Function Reference: svmpredict

statistics: predicted_label = svmpredict (labels, data, model)
statistics: predicted_label = svmpredict (labels, data, model, libsvm_options)
statistics: [predicted_label, accuracy, decision_values] = svmpredict (labels, data, model, libsvm_options)
statistics: [predicted_label, accuracy, prob_estimates] = svmpredict (labels, data, model, libsvm_options)

This function predicts new labels from a testing instance matrtix based on an SVM model created with svmtrain.

  • labels : An m by 1 vector of prediction labels. If labels of test data are unknown, simply use any random values. (type must be double)
  • data : An m by n matrix of m testing instances with n features. It can be dense or sparse. (type must be double)
  • model : The output of svmtrain function.
  • libsvm_options : A string of testing options in the same format as that of LIBSVM.

libsvm_options :

  • -b : probability_estimates; whether to predict probability estimates. For one-class SVM only 0 is supported.
0return decision values. (default)
1return probability estimates.
  • -q : quiet mode. (no outputs)

The svmpredict function has three outputs. The first one, predicted_label, is a vector of predicted labels. The second output, accuracy, is a vector including accuracy (for classification), mean squared error, and squared correlation coefficient (for regression). The third is a matrix containing decision values or probability estimates (if -b 1’ is specified). If k is the number of classes in training data, for decision values, each row includes results of predicting k(k-1)/2 binary-class SVMs. For classification, k = 1 is a special case. Decision value +1 is returned for each testing instance, instead of an empty vector. For probabilities, each row contains k values indicating the probability that the testing instance is in each class. Note that the order of classes here is the same as Label field in the model structure.

Source Code: svmpredict