Ordinal Encoding visually explained using Excel

Published: 14 May 2021
on channel: Kunaal Naik | Data Science Masterminds
1,599
19

In sequential encoding, an integer is assigned to each unique category value.

For example, "High" is 1, "Medium" is 2, and "Low" is 3.

This is called sequential or integer encoding and can be easily reversed. Usually, we use integers starting at zero.

Sequential coding may be sufficient for some variables. Integer values naturally have an ordered relationship with each other, and machine learning algorithms can understand and use this relationship.

It is a natural coding for sequential variables. For categorical variables, it imposes a sequence relationship in which such a relationship cannot exist. This can cause problems and effective encryption can be used instead.

This sequential scripting transformation is available in the scikit-learn Python machine learning library via the OrdinalEncoder class.

By default, it assigns integers to the tags in the order observed in the data. If a specific order is desired, it is also possible, is specified via the "categories" argument as a collation list of all expected tags.

#ordinalencoding #sklearn #machinelearning