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 matrix based on an SVM model created with svmtrain.
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.
| 0 | return decision values. (default) | |
| 1 | return 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 is the number of classes in training data, for decision values, each row includes results of predicting binary-class SVMs. For classification, is a special case. Decision value +1 is returned for each testing instance, instead of an empty vector. For probabilities, each row contains 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.
: This implementation is based on LIBSVM 3.36 (2025) and now supports probability estimates for One-Class SVM (-s 2) when combined with the probability flag (-b 1). For One-Class SVM, the prob_estimates output is a single column vector containing the probability of the instance being an inlier.
Source Code: svmpredict