qolmat.imputations.preprocessing.BinTransformer

class qolmat.imputations.preprocessing.BinTransformer(cols: Optional[List] = None)[source]

BinTransformer class.

Learn the possible values of the provided numerical feature, allowing to transform new values to the closest existing one.

__init__(cols: Optional[List] = None)[source]
fit(X: ndarray[tuple[int, ...], dtype[_ScalarType_co]], y: Optional[ndarray[tuple[int, ...], dtype[_ScalarType_co]]] = None) BinTransformer[source]

Fit the BinTransformer to X.

Parameters
Xarray-like of shape (n_samples, n_features)

The data to determine the unique values.

yNone

Ignored. This parameter exists only for compatibility with Pipeline.

Returns
selfobject

Fitted transformer.

inverse_transform(X: ndarray[tuple[int, ...], dtype[_ScalarType_co]]) ndarray[tuple[int, ...], dtype[_ScalarType_co]][source]

Transform X to existing values learned during fit.

Parameters
Xarray-like of shape (n_samples, n_features)

The data to transform.

Returns
X_outndarray of shape (n_samples,)

Transformed input.

transform(X: ndarray[tuple[int, ...], dtype[_ScalarType_co]]) ndarray[tuple[int, ...], dtype[_ScalarType_co]][source]

Transform X to existing values learned during fit.

Parameters
Xarray-like of shape (n_samples,)

The data to transform.

Returns
X_outndarray of shape (n_samples,)

Transformed input.

Examples using qolmat.imputations.preprocessing.BinTransformer

Benchmark for categorical data

Benchmark for categorical data