2022-01-04 11:44:35 +01:00
|
|
|
from sklearn.preprocessing import MinMaxScaler, Normalizer, StandardScaler
|
2022-01-12 14:42:16 +01:00
|
|
|
from typing import Union
|
2022-01-04 11:44:35 +01:00
|
|
|
from utils.types import ScalerTypes
|
|
|
|
|
|
2022-01-12 14:42:16 +01:00
|
|
|
def get_scaler(type: ScalerTypes) -> Union[MinMaxScaler, Normalizer, StandardScaler]:
|
2022-01-04 11:44:35 +01:00
|
|
|
if type == 'normalize':
|
|
|
|
|
return Normalizer()
|
|
|
|
|
elif type == 'minmax':
|
|
|
|
|
return MinMaxScaler(feature_range= (-1, 1))
|
|
|
|
|
elif type == 'standardize':
|
|
|
|
|
return StandardScaler()
|
|
|
|
|
else:
|
2022-01-12 14:42:16 +01:00
|
|
|
raise Exception("Scaler type not supported")
|