pysad.transform.preprocessing.SeasonalTrendDecomposer
- class pysad.transform.preprocessing.SeasonalTrendDecomposer(season_length, trend_window=None)[source]
Streaming seasonal and trend decomposition preprocessor.
The transformer subtracts a rolling mean trend estimate and a running average seasonal estimate for each position in the season. This is an online approximation intended for preprocessing before univariate anomaly scoring; it is not an STL implementation and does not reproduce the modified STL residual used by Seasonal ESD in [BHVK17].
- Parameters:
Methods
__init__(season_length[, trend_window])fit(X)Shortcut method that iteratively applies fit_partial to all instances in order.
fit_partial(X)Fits the next timestep's values to train the decomposer.
Shortcut method that iteratively applies fit_transform_partial to all instances in order.
Fits and transforms the next timestep.
transform(X)Shortcut method that iteratively applies transform_partial to all instances in order.
Transforms the next timestep by removing trend and seasonality.
- fit(X)
Shortcut method that iteratively applies fit_partial to all instances in order.
- Parameters:
X (np.float64 array of shape (num_instances, num_features)) – Input feature vectors.
- Returns:
The fitted transformer
- Return type:
- fit_partial(X)[source]
Fits the next timestep’s values to train the decomposer.
- Parameters:
X (np.float64 array of shape (num_features,)) – Input feature vector.
- Returns:
self.
- Return type:
- fit_transform(X)
Shortcut method that iteratively applies fit_transform_partial to all instances in order.
- Parameters:
X (np.float64 array of shape (num_instances, num_components)) – Input feature vectors.
- Returns:
Projected feature vectors.
- Return type:
np.float64 array of shape (num_instances, num_components)
- fit_transform_partial(X)[source]
Fits and transforms the next timestep.
- Parameters:
X (np.float64 array of shape (num_features,)) – Input feature vector.
- Returns:
Residual feature vector.
- Return type:
residual_X (np.float64 array of shape (num_features,))
- transform(X)
Shortcut method that iteratively applies transform_partial to all instances in order.
- Parameters:
X (np.float64 array of shape (num_instances, num_features)) – Input feature vectors.
- Returns:
Projected feature vectors.
- Return type:
np.float64 array of shape (num_instances, num_components)