mojolearn.LabelEncoder#
- class mojolearn.LabelEncoder[source]#
Bases:
_PrepBaseEncode target labels as integers
0ton_classes - 1.Follows scikit-learn’s
LabelEncoder.classes_are the sorted distinct labels andtransformreturns each label’s index as int32. Numeric and string labels are supported. A label not seen in fit raisesValueErrorintransformandinverse_transform.- Variables:
Examples
>>> import numpy as np, mojolearn >>> enc = mojolearn.LabelEncoder().fit(np.array([10, 30, 20, 10])) >>> enc.transform(np.array([30, 10])) >>> enc.inverse_transform(np.array([0, 2]))
- __init__()#
Methods
fit(y)Fit to
X, then transformX.get_params([deep])Return the constructor parameters as a dict.
inverse_transform(y)set_params(**params)Set constructor parameters.
transform(y)