You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have modified "ch4 - Implementing Multiclass SVMs" code to use my own data set to train the classifier. The training process is good and so for the testing result. But I got some problems when I want to predict the new data that are without the labels.
I see three lines of code in "ch4 - Implementing Multiclass SVMs" which use those lines below to estimate the training acc :
How do I use this trained SVM model to predict the new data (no label)?
It seems that I need the label for the data to run the prediction, but I think it is very weird why I need the y_target (label) to calculate the prediction result?
How can those three lines of code get correct prediction result?
Hope someone can help me to figure out what's going on.
The text was updated successfully, but these errors were encountered:
Thanks for bringing this up. I'm quite busy in the next month, but I can check this out and see if I can extend it to the MNIST data in a few weeks. Let me know if you make any progress in the mean time.
# Predict one new samplenew_sample=np.array([6.5, 1.0]).reshape(-1,2)
pred=sess.run(prediction, feed_dict={x_data: rand_x, y_target: rand_y, prediction_grid: new_sample})
print("predicted: {}".format(pred[0]))
In my humble opinion, the naming 'y_target' in the prediction part is a little confusing, because its meanings in 'prediction_output' and 'accuracy' may be different: the former represents the target of training data, but the latter may represent the target of training data or that of test data.
I have modified "ch4 - Implementing Multiclass SVMs" code to use my own data set to train the classifier. The training process is good and so for the testing result. But I got some problems when I want to predict the new data that are without the labels.
I see three lines of code in "ch4 - Implementing Multiclass SVMs" which use those lines below to estimate the training acc :
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), 0)
accuracy = tf.reduce_mean(tf.cast(tf.equal(prediction, tf.argmax(y_target, 0)), tf.float32))
Hope someone can help me to figure out what's going on.
The text was updated successfully, but these errors were encountered: