Main Content

Discard support vectors of linear SVM binary learners in ECOC model

returns a trained multiclass error-correcting output codes (ECOC) model
(`Mdl`

= discardSupportVectors(`MdlSV`

)`Mdl`

) from the trained multiclass ECOC model
(`MdlSV`

), which contains at least one linear
`CompactClassificationSVM`

binary learner. Both
`Mdl`

and `MdlSV`

are objects of the same
type, either `ClassificationECOC`

objects or `CompactClassificationECOC`

objects.

`Mdl`

has these characteristics:

The

`Alpha`

,`SupportVectors`

, and`SupportVectorLabels`

properties of all the linear SVM binary learners are empty (`[]`

).If you display any linear SVM binary learners stored in the cell array of trained models

`Mdl.BinaryLearners`

, the software lists the`Beta`

property instead of`Alpha`

.

By default and for efficiency,

`fitcecoc`

empties the`Alpha`

,`SupportVectorLabels`

, and`SupportVectors`

properties for all linear SVM binary learners.`fitcecoc`

lists`Beta`

, rather than`Alpha`

, in the model display.To store

`Alpha`

,`SupportVectorLabels`

, and`SupportVectors`

, pass a linear SVM template that specifies storing support vectors to`fitcecoc`

. For example, enter:t = templateSVM('SaveSupportVectors',true) Mdl = fitcecoc(X,Y,'Learners',t);

You can remove the support vectors and related values by passing the resulting

`ClassificationECOC`

model to`discardSupportVectors`

.

`predict`

and `resubPredict`

estimate SVM scores
*f*(*x*) for each linear SVM binary learner in an
ECOC model using

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

*β* is the `Beta`

property and
*b* is the `Bias`

property of the binary
learners. You can access these properties for each linear SVM binary learner in the cell
array `Mdl.BinaryLearners`

. For more details on the SVM score
calculation, see Support Vector Machines for Binary Classification.

`ClassificationECOC`

| `ClassificationSVM`

| `CompactClassificationECOC`

| `discardSupportVectors`

| `fitcecoc`

| `fitcsvm`

| `templateSVM`