LabelEncoder
Compatibility: categorical
data (nominal and ordinal)
The LabelEncoder
transforms data that represents categorical values into integers 0
, 1
, 2
, etc. corresponding to each category.
Parameters
order_by
: Apply a prescribed ordering scheme to the values before assigning the labels
(default) | Do not apply a particular order. The first unique value will be assigned label |
| If the data is represented by integers or floats, order by those values before assigning the labels. That is: label |
| If the data is represented by strings, order them alphabetically before assigning the labels. That is: label |
add_noise
: Add noise to the label values
(default) | Do not not add noise. Each time a category appears, it will always be transformed to the same label value. |
| Add noise. A category will be transformed to the same label with some noise added. For example instead of the label |
Examples
FAQs
Last updated