mirror of
https://github.com/webclinic017/drift.git
synced 2026-08-01 13:17:47 +00:00
8dd2d88740
* chore(Linter): reformatted code with black * Create black.yaml
17 lines
598 B
Python
17 lines
598 B
Python
from sklearn.preprocessing import MinMaxScaler, Normalizer, StandardScaler
|
|
from .sklearn import SKLearnTransformation
|
|
from typing import Literal
|
|
|
|
ScalerTypes = Literal["normalize", "minmax", "standardize"]
|
|
|
|
|
|
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")
|