pysad.transform.preprocessing.ModifiedSTLResidualTransformer
- class pysad.transform.preprocessing.ModifiedSTLResidualTransformer(period, window_size=None, robust=True, **stl_kwargs)[source]
Modified STL residual transformer used by S-ESD and S-H-ESD.
The transformer follows the residual construction in [BHVK17]: estimate the seasonal component with STL, replace STL’s trend component with the median of the raw series, and return
X - seasonal - median(X). It owns only the paper’s residual step; usepysad.models.SeasonalESDorpysad.models.SeasonalHybridESDfor the full detector.- Parameters:
Methods
__init__(period[, window_size, robust])fit(X)Shortcut method that iteratively applies fit_partial to all instances in order.
fit_partial(X)Fits the next timestep by adding it to the residual window.
Shortcut method that iteratively applies fit_transform_partial to all instances in order.
Adds and transforms the next timestep without adding it twice.
transform(X)Shortcut method that iteratively applies transform_partial to all instances in order.
Returns the latest residual for the next candidate window.
Transforms a full window into modified STL residuals.
- 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_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)
- 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)