mojolearn.LabelEncoder#
- class mojolearn.LabelEncoder#
Encode 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]))
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)- fit_transform(y)#
Fit to
X, then transformX.- Returns:
array – The transformed data.
- get_params(deep=True)#
Return the constructor parameters as a dict.
- Parameters:
deep (bool, default True) – Accepted for scikit-learn compatibility.
- Returns:
dict – Parameter names mapped to their values.
- set_params(**params)#
Set constructor parameters.
An unknown parameter name raises
ValueError.- Returns:
self