from typing import Iterable, Union
import pandas as pd
from sklearn.preprocessing import (Binarizer, FunctionTransformer,
KBinsDiscretizer, KernelCenterer,
LabelBinarizer, LabelEncoder, MaxAbsScaler,
MinMaxScaler, MultiLabelBinarizer,
Normalizer, OneHotEncoder, OrdinalEncoder,
PolynomialFeatures, PowerTransformer,
QuantileTransformer, RobustScaler,
StandardScaler)
from conmo.conf import Index
from conmo.preprocesses.preprocess import ExtendedPreprocess
[docs]class SklearnPreprocess(ExtendedPreprocess):
"""
Class used to wrap existing preprocess in the Scikit-Learn library.
It also allows this preprocess to be applied to certain columns of the dataset.
"""
[docs] def __init__(self, to_data: Union[bool, Iterable[str]], to_labels: Union[bool, Iterable[str]], test_set: bool, preprocess: Union[Binarizer, FunctionTransformer, KBinsDiscretizer, KernelCenterer, LabelBinarizer, LabelEncoder, MultiLabelBinarizer, MaxAbsScaler, MinMaxScaler, Normalizer, OneHotEncoder, OrdinalEncoder, PolynomialFeatures, PowerTransformer, QuantileTransformer, RobustScaler, StandardScaler]) -> None:
super().__init__(to_data, to_labels, test_set)
self.preprocess = preprocess