MedianOutliersTransform

class MedianOutliersTransform(in_column: str, window_size: int = 10, alpha: float = 3)[source]

Bases: etna.transforms.outliers.base.OutliersTransform

Transform that uses get_anomalies_median() to find anomalies in data.

Warning

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

Create instance of MedianOutliersTransform.

Parameters
  • in_column (str) – name of processed column

  • window_size (int) – number of points in the window

  • alpha (float) – coefficient for determining the threshold

Inherited-members

Methods

detect_outliers(ts)

Call get_anomalies_median() function with self parameters.

fit(ts)

Fit the transform.

fit_transform(ts)

Fit and transform TSDataset.

get_regressors_info()

Return the list with regressors created by the transform.

inverse_transform(ts)

Inverse transform TSDataset.

load(path)

Load an object.

params_to_tune()

Get default grid for tuning hyperparameters.

save(path)

Save the object.

set_params(**params)

Return new object instance with modified parameters.

to_dict()

Collect all information about etna object in dict.

transform(ts)

Transform TSDataset inplace.

detect_outliers(ts: etna.datasets.tsdataset.TSDataset) Dict[str, List[pandas._libs.tslibs.timestamps.Timestamp]][source]

Call get_anomalies_median() function with self parameters.

Parameters

ts (etna.datasets.tsdataset.TSDataset) – dataset to process

Returns

dict of outliers in format {segment: [outliers_timestamps]}

Return type

Dict[str, List[pandas._libs.tslibs.timestamps.Timestamp]]

params_to_tune() Dict[str, etna.distributions.distributions.BaseDistribution][source]

Get default grid for tuning hyperparameters.

This grid tunes parameters: window_size, alpha. Other parameters are expected to be set by the user.

Returns

Grid to tune.

Return type

Dict[str, etna.distributions.distributions.BaseDistribution]