labelbinarizertransform
Binarize labels in one vs all fashion.
Syntax
labels = labelbinarizertransform(parameters,y)
Inputs
- parameters
- Parameters returned by labelBinarizer method.
- y
- Labels to be encoded. Cell can be used to encode string labels.
Outputs
- labels
- Binarized labels.
Example
Usage of
y = [1, 2, 2, 1];
parameters = labelbinarizer(y);
label_matrix = labelbinarizertransform(parameters, [1, 2, 3, 4]);
> label_matrix
label_matrix = [Matrix] 4 x 2
1 0
0 1
0 0
0 0
Comments
If unknown labels are found during transformation, it is represented by row of zeros.