nfmcclure / tensorflow_cookbook

Code for Tensorflow Machine Learning Cookbook
https://www.packtpub.com/big-data-and-business-intelligence/tensorflow-machine-learning-cookbook-second-edition
MIT License
6.23k stars 2.41k forks source link

Mnist dataset use Multi-class SVM to predict Chapter 4 #161

Open anbo1024 opened 5 years ago

anbo1024 commented 5 years ago

Hi, I want to apply 04_Support_Vector_Machines to Mnist dataset. I found that I couldn't use the following function for testing (because it contained lable):

prediction_output = tf.matmul(tf.multiply(y_target, b), pred_kernel) prediction = tf.argmax(prediction_output - tf.expand_dims(tf.reduce_mean(prediction_output, 1), 1)

Then,you gave a way to predict new data:

test_predictions] = sess.run(prediction, feed_dict={x_data: x_vals, y_target: np.transpose([y_vals]), prediction_grid: test_points})

But,I found that x_vals in the code represented the entire data set.It is impossible to load all data sets on larger data sets.So I want to know how to extend it to mini-batch to predict new data. I'm in a hurry. I hope to get back to you. Thank you very much.