labelencodertransform

Encodes labels such that all lies between 0 and n -1 classes.

Attention: Available only with Activate commercial edition.

Syntax

labels = labelencodertransform(parameters,y)

Inputs

parameters
Parameters returned by labelEncoder method.
Type: struct
y
Labels to be encoded. Cell can be used to encode string labels.
Type: integer
Dimension: cell | vector

Outputs

labels
Encoded labels.
Type: integer
Dimension: vector | matrix

Example

Usage of
y = [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.