labelbinarizer

Binarize labels in one vs all fashion.

Syntax

parameters = labelbinarizer(y)

Inputs

y
Labels to be encoded. Cell can be used to encode string labels.
Type: integer
Dimension: cell | vector

Outputs

parameters
Parameters to be used by labelbinarizerTransform function.
Type: struct

Example

Usage of labelbinarizer

y = [1, 2, 2, 1];
parameters = labelbinarizer(y);
> parameters
parameters = struct [
label_to_idx: struct [
1: 0
2: 1
]
labels: [Matrix] 2 x 1
1
2
num_labels: 2
]

Comments

Output 'parameters' can be used by labelbinarizertransform function.