Skip to content

How to use non-linear multi-class SVM to predict class for new data? #149

@AlexHMJ

Description

@AlexHMJ

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))

  1. How do I use this trained SVM model to predict the new data (no label)?
  2. 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?
  3. How can those three lines of code get correct prediction result?

Hope someone can help me to figure out what's going on.

Metadata

Metadata

Assignees

Labels

ch4Chapter 4

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions