Files
drift/utils/scaler.py
T
Mark Aron Szulyovszky c611481eb6 refactor(WalkForward): separate train / test functions to help with inference later (#158)
* refactor(WalkForward): separate train / test functions (draft) to potentially help with inference later

* fix(Training): use the new separate train / test functions

* feat(Training): return and pass in scalers that are necessary for inference

* fix(Project): runtime errors

* fix(WalkForward): use the correct `train_from` value

* fix(Tests): for new walk_forward functions()

* refactor(WalkForward): rename `walk_forward_test()` to `walk_forward_inference()`
2022-01-12 14:42:16 +01:00

13 lines
484 B
Python

from sklearn.preprocessing import MinMaxScaler, Normalizer, StandardScaler
from typing import Union
from utils.types import ScalerTypes
def get_scaler(type: ScalerTypes) -> Union[MinMaxScaler, Normalizer, StandardScaler]:
if type == 'normalize':
return Normalizer()
elif type == 'minmax':
return MinMaxScaler(feature_range= (-1, 1))
elif type == 'standardize':
return StandardScaler()
else:
raise Exception("Scaler type not supported")