MinMaxScalerTransform

class MinMaxScalerTransform(in_column: Optional[Union[str, List[str]]] = None, inplace: bool = True, out_column: Optional[str] = None, feature_range: Tuple[float, float] = (0, 1), clip: bool = True, mode: Union[etna.transforms.math.sklearn.TransformMode, str] = 'per-segment')[source]

Bases: etna.transforms.math.sklearn.SklearnTransform

Transform features by scaling each feature to a given range.

Uses sklearn.preprocessing.MinMaxScaler inside.

Warning

This transform can suffer from look-ahead bias. For transforming data at some timestamp it uses information from the whole train part.

Init MinMaxScalerPreprocess.

Parameters
  • in_column (Optional[Union[str, List[str]]]) – columns to be scaled, if None - all columns will be scaled.

  • inplace (bool) – features are changed by scaled.

  • out_column (Optional[str]) – base for the names of generated columns, uses self.__repr__() if not given.

  • feature_range (Tuple[float, float]) – desired range of transformed data.

  • clip (bool) – set to True to clip transformed values of held-out data to provided feature range.

  • mode (Union[etna.transforms.math.sklearn.TransformMode, str]) –

    “macro” or “per-segment”, way to transform features over segments.

    • If “macro”, transforms features globally, gluing the corresponding ones for all segments.

    • If “per-segment”, transforms features for each segment separately.

Raises

ValueError: – if incorrect mode given

Inherited-members

Methods

fit(df)

Fit transformer with data from df.

fit_transform(df)

May be reimplemented.

inverse_transform(df)

Apply inverse transformation to DataFrame.

transform(df)

Transform given data with fitted transformer.