classify observations using support vector machine (svm) classifier -凯发k8网页登录
classify observations using support vector machine (svm) classifier
description
[
also returns a matrix of scores (label
,score
]
= predict(svmmodel
,x
)score
) indicating the
likelihood that a label comes from a particular class. for svm, likelihood measures
are either classification scores or
class posterior probabilities.
for each observation in x
, the predicted class label corresponds
to the maximum score among all classes.
examples
input arguments
output arguments
more about
tips
if you are using a linear svm model for classification and the model has many support vectors, then using
predict
for the prediction method can be slow. to efficiently classify observations based on a linear svm model, remove the support vectors from the model object by using .
algorithms
by default and irrespective of the model kernel function, matlab® uses the dual representation of the score function to classify observations based on trained svm models, specifically
this prediction method requires the trained support vectors and α coefficients (see the
supportvectors
andalpha
properties of the svm model).by default, the software computes optimal posterior probabilities using platt’s method [1]:
perform 10-fold cross-validation.
fit the sigmoid function parameters to the scores returned from the cross-validation.
estimate the posterior probabilities by entering the cross-validation scores into the fitted sigmoid function.
the software incorporates prior probabilities in the svm objective function during training.
for svm,
predict
andresubpredict
classify observations into the class yielding the largest score (the largest posterior probability). the software accounts for misclassification costs by applying the average-cost correction before training the classifier. that is, given the class prior vector p, misclassification cost matrix c, and observation weight vector w, the software defines a new vector of observation weights (w) such that
alternative functionality
simulink block
to integrate the prediction of an svm classification model into simulink®, you can use the classificationsvm
predict block in the statistics and machine learning toolbox™ library or a matlab function block with the predict
function. for
examples, see predict class labels using classificationsvm predict block and predict class labels using matlab function block.
when deciding which approach to use, consider the following:
if you use the statistics and machine learning toolbox library block, you can use the (fixed-point designer) to convert a floating-point model to fixed point.
support for variable-size arrays must be enabled for a matlab function block with the
predict
function.if you use a matlab function block, you can use matlab functions for preprocessing or post-processing before or after predictions in the same matlab function block.
references
[1] platt, j. “probabilistic outputs for support vector machines and comparisons to regularized likelihood methods.” advances in large margin classifiers. mit press, 1999, pages 61–74.
extended capabilities
version history
introduced in r2014a