mirror of
https://github.com/webclinic017/drift.git
synced 2026-07-28 03:08:01 +00:00
1856fcad22
* feat(Transformations): added Transformations abstraction & handling in walk_forward_train() & inference() * fix(WalkForward): use Dataframes to call Transformation.fit_transform() * feat(WalkForward): restored option for models to recieve unscaled data * fix(Transformations): output DataFrame as expected * fix(Tests): missing new property
13 lines
560 B
Python
13 lines
560 B
Python
from sklearn.preprocessing import MinMaxScaler, Normalizer, StandardScaler
|
|
from transformations.sklearn import SKLearnTransformation
|
|
from utils.types import ScalerTypes
|
|
|
|
def get_scaler(type: ScalerTypes) -> SKLearnTransformation:
|
|
if type == 'normalize':
|
|
return SKLearnTransformation(Normalizer())
|
|
elif type == 'minmax':
|
|
return SKLearnTransformation(MinMaxScaler(feature_range= (-1, 1)))
|
|
elif type == 'standardize':
|
|
return SKLearnTransformation(StandardScaler())
|
|
else:
|
|
raise Exception("Scaler type not supported") |