labelencodertransform
Encodes labels such that all lies between 0 and n -1 classes.
Syntax
labels = labelencodertransform(parameters,y)
Inputs
- parameters
- Parameters returned by labelEncoder method.
- y
- Labels to be encoded. Cell can be used to encode string labels.
Outputs
- labels
- Encoded labels.
Example
Usage ofy = [1, 2, 2, 6];
parameters = labelencoder(y);
encoded_y = labelencodertransform(parameters, [1, 1, 2, 6])
> encoded_y
encoded_y = [Matrix] 4 x 1
0
0
1
2
Comments
If unknown labels (not seen during fitting) are found during transformation, it throws error and halts execution.