StandardScalerTransform¶
- class StandardScalerTransform(in_column: Optional[Union[str, List[str]]] = None, inplace: bool = True, out_column: Optional[str] = None, with_mean: bool = True, with_std: bool = True, mode: Union[etna.transforms.math.sklearn.TransformMode, str] = 'per-segment')[source]¶
Bases:
etna.transforms.math.sklearn.SklearnTransform
Standardize features by removing the mean and scaling to unit variance.
Uses
sklearn.preprocessing.StandardScaler
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 StandardScalerPreprocess.
- 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.with_mean (bool) – if True, center the data before scaling.
with_std (bool) – if True, scale the data to unit standard deviation.
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.