labelencoder

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

Attention: Available only with Activate commercial edition.

Syntax

parameters = labelencoder(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 labelencoderTransform function.
Type: struct

Example

Usage of labelencoder

y = [1, 2, 2, 6];
parameters = labelencoder(y)
encoded_y = labelencodertransform(parameters, [1, 1, 2, 6]);
> parameters
parameters = struct [
  label_to_idx: struct [
    1: 0
    2: 1
    6: 2
  ]
  labels: [Matrix] 3 x 1
  1
  2
  6
]

Comments

Output 'parameters' can be used by labelencodertransform function.