feat(Transformations): added Transformations abstraction & handling in walk_forward_train() & inference() (#161)

* 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
This commit is contained in:
Mark Aron Szulyovszky
2022-01-12 23:22:55 +01:00
committed by GitHub
parent 3084f5e271
commit 1856fcad22
16 changed files with 144 additions and 85 deletions
+5 -5
View File
@@ -1,13 +1,13 @@
from sklearn.preprocessing import MinMaxScaler, Normalizer, StandardScaler
from typing import Union
from transformations.sklearn import SKLearnTransformation
from utils.types import ScalerTypes
def get_scaler(type: ScalerTypes) -> Union[MinMaxScaler, Normalizer, StandardScaler]:
def get_scaler(type: ScalerTypes) -> SKLearnTransformation:
if type == 'normalize':
return Normalizer()
return SKLearnTransformation(Normalizer())
elif type == 'minmax':
return MinMaxScaler(feature_range= (-1, 1))
return SKLearnTransformation(MinMaxScaler(feature_range= (-1, 1)))
elif type == 'standardize':
return StandardScaler()
return SKLearnTransformation(StandardScaler())
else:
raise Exception("Scaler type not supported")