mirror of
https://github.com/webclinic017/drift.git
synced 2026-07-28 03:08:01 +00:00
c611481eb6
* 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()`
13 lines
484 B
Python
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") |