mojolearn.Binarizer#
- class mojolearn.Binarizer(*, threshold=0.0, copy=True)[source]#
Bases:
_PrepBaseSet feature values to 0 or 1 by a threshold.
Follows scikit-learn’s
Binarizer: values greater thanthresholdbecome 1, the others 0; NaN is kept. The transformer is stateless: fit only records the number of columns. Input and output are float32.- Parameters:
threshold (float, default 0.0) – Values above this become 1.
copy (bool, default True) – Accepted for scikit-learn compatibility; transform always returns a new array.
- Variables:
Examples
>>> import numpy as np, mojolearn >>> X = np.array([[-1.0, 0.5], [2.0, 0.0]], dtype=np.float32) >>> mojolearn.Binarizer(threshold=0.25).fit_transform(X)
Methods
fit(X[, y])fit_transform(X[, y])Fit to
X, then transformX.get_params([deep])Return the constructor parameters as a dict.
set_params(**params)Set constructor parameters.
transform(X[, copy])