Coding matrix for reducing error-correcting output code to binary

returns
the coding matrix `M`

= designecoc(`K`

,`name`

)`M`

that reduces the error-correcting
output code (ECOC) design specified by `name`

and `K`

classes
to a binary problem. `M`

has `K`

rows
and *L* columns, with each row corresponding to a
class and each column corresponding to a binary learner. `name`

and `K`

determine
the value of *L*.

You can view or customize `M`

, and then specify
it as the coding matrix for training an ECOC multiclass classifier
using `fitcecoc`

.

returns
the coding matrix with additional options specified by one or more `M`

= designecoc(`K`

,`name`

,`Name,Value`

)`Name,Value`

pair
arguments.

For example, you can specify the number of trials when generating a dense or sparse, random coding matrix.

The number of binary learners grows with the number of classes. For a problem with many classes, the

`binarycomplete`

and`ternarycomplete`

coding designs are not efficient. However:If

*K*≤ 4, then use`ternarycomplete`

coding design rather than`sparserandom`

.If

*K*≤ 5, then use`binarycomplete`

coding design rather than`denserandom`

.

You can display the coding design matrix of a trained ECOC classifier by entering

`Mdl.CodingMatrix`

into the Command Window.You should form a coding matrix using intimate knowledge of the application, and taking into account computational constraints. If you have sufficient computational power and time, then try several coding matrices and choose the one with the best performance (e.g., check the confusion matrices for each model using

`confusionchart`

).Leave-one-out cross-validation (

`Leaveout`

) is inefficient for data sets with many observations. Instead, use*k*-fold cross-validation (`KFold`

).

[1] Fürnkranz, Johannes. “Round
Robin Classification.” *J. Mach. Learn. Res.*,
Vol. 2, 2002, pp. 721–747.

[2] Escalera, S., O. Pujol, and P. Radeva.
“Separability of ternary codes for sparse designs of error-correcting
output codes.” *Pattern Recog. Lett.*,
Vol. 30, Issue 3, 2009, pp. 285–297.