SklearnTransform¶
- class SklearnTransform(in_column: Optional[Union[str, List[str]]], out_column: Optional[str], transformer: sklearn.base.TransformerMixin, inplace: bool = True, mode: Union[etna.transforms.math.sklearn.TransformMode, str] = 'per-segment')[source]¶
Bases:
etna.transforms.base.Transform
Base class for different sklearn transforms.
Init SklearnTransform.
- Parameters
in_column (Optional[Union[str, List[str]]]) – columns to be transformed, if None - all columns will be transformed.
transformer (sklearn.base.TransformerMixin) –
sklearn.base.TransformerMixin
instance.inplace (bool) – features are changed by transformed.
out_column (Optional[str]) – base for the names of generated columns, uses
self.__repr__()
if not given.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.
Apply inverse transformation to DataFrame.
transform
(df)Transform given data with fitted transformer.
- fit(df: pandas.core.frame.DataFrame) etna.transforms.math.sklearn.SklearnTransform [source]¶
Fit transformer with data from df.
- Parameters
df (pandas.core.frame.DataFrame) – DataFrame to fit transformer.
- Return type