_OneSegmentSpecialDaysTransform¶
- class _OneSegmentSpecialDaysTransform(find_special_weekday: bool = True, find_special_month_day: bool = True)[source]¶
Bases:
etna.transforms.base.OneSegmentTransform
Search for anomalies in values, marked this days as 1 (and return new column with 1 in corresponding places).
Notes
You can read more about other anomalies detection methods in: Time Series of Price Anomaly Detection
Create instance of _OneSegmentSpecialDaysTransform.
- Parameters
find_special_weekday (bool) – flag, if True, find special weekdays in transform
find_special_month_day (bool) – flag, if True, find special monthdays in transform
- Raises
ValueError: – if all the modes are False
- Inherited-members
Methods
fit
(df)Fit _OneSegmentSpecialDaysTransform with data from df.
fit_transform
(df)Fit and transform Dataframe.
Inverse transform Dataframe.
set_params
(**params)Return new object instance with modified parameters.
to_dict
()Collect all information about etna object in dict.
transform
(df)Transform data from df with _OneSegmentSpecialDaysTransform and generate a column of special day flags.
- fit(df: pandas.core.frame.DataFrame) etna.transforms.timestamp.special_days._OneSegmentSpecialDaysTransform [source]¶
Fit _OneSegmentSpecialDaysTransform with data from df.
- Parameters
df (pd.DataFrame) – value series with index column in timestamp format
- Return type
etna.transforms.timestamp.special_days._OneSegmentSpecialDaysTransform
- inverse_transform(df: pandas.core.frame.DataFrame) pandas.core.frame.DataFrame [source]¶
Inverse transform Dataframe.
- Parameters
df (pandas.core.frame.DataFrame) –
- Return type
pandas.core.frame.DataFrame
- transform(df: pandas.core.frame.DataFrame) pandas.core.frame.DataFrame [source]¶
Transform data from df with _OneSegmentSpecialDaysTransform and generate a column of special day flags.
- Parameters
df (pd.DataFrame) – value series with index column in timestamp format
- Returns
pd.DataFrame with ‘anomaly_weekday’, ‘anomaly_monthday’ or both of them columns no-timestamp indexed that contains 1 at i-th position if i-th day is a special day
- Return type
pandas.core.frame.DataFrame