Main Content

Discard support vectors for linear support vector machine (SVM) classifier

returns the trained, linear support vector machine (SVM) model
`Mdl`

= discardSupportVectors(`MdlSV`

)`Mdl`

. Both `Mdl`

and the trained, linear SVM
model `MdlSV`

are the same type of object. That is, they both are
either `ClassificationSVM`

objects or `CompactClassificationSVM`

objects. However, `Mdl`

and
`MdlSV`

differ in the following ways:

The

`Alpha`

,`SupportVectors`

, and`SupportVectorLabels`

properties are empty (`[]`

) in`Mdl`

.If you display

`Mdl`

, the software lists the`Beta`

property instead of`Alpha`

.

For a trained, linear SVM model, the

`SupportVectors`

property is an*n*-by-_{sv}*p*matrix.*n*is the number of support vectors (at most the training sample size) and_{sv}*p*is the number of predictors, or features. The`Alpha`

and`SupportVectorLabels`

properties are vectors with*n*elements. These properties can be large for complex data sets containing many observations or examples. The_{sv}`Beta`

property is a vector with*p*elements.If the trained SVM model has many support vectors, use

`discardSupportVectors`

to reduce the amount of space consumed by the trained, linear SVM model. You can display the size of the support vector matrix by entering`size(MdlSV.SupportVectors)`

.

`predict`

and `resubPredict`

estimate SVM scores
*f*(*x*), and subsequently label and estimate
posterior probabilities using

$$f(x)=x\prime \beta +b.$$

*β* is `Mdl.Beta`

and
*b* is `Mdl.Bias`

, that is, the
`Beta`

and `Bias`

properties of
`Mdl`

, respectively. For more details, see Support Vector Machines for Binary Classification.

`ClassificationECOC`

| `ClassificationSVM`

| `CompactClassificationSVM`

| `discardSupportVectors`

| `fitcsvm`

| `templateSVM`