pysad.transform.ensemble.AverageScoreEnsembler¶
- class pysad.transform.ensemble.AverageScoreEnsembler(estimator_weights=None)[source]¶
An wrapper class that results in the weighted average of the anomaly scores from multiple anomaly detectors. For more details, see PyOD documentation.
- Parameters:
estimator_weights (np array of shape (1, num_anomaly_detectors)) – The weights for detectors. If None, uniform weights are assigned.
Methods
__init__
([estimator_weights])fit
(scores)Shortcut method that iteratively applies fit_partial to all instances in order.
fit_partial
(scores)Fits particular (next) timestep's score to train the ensembler.
fit_transform
(scores)Shortcut method that iteratively applies fit_transform_partial to all instances in order.
fit_transform_partial
(score)Shortcut method that iteratively applies fit_partial and transform_partial, respectively.
transform
(scores)Shortcut method that iteratively applies transform_partial to all instances in order.
transform_partial
(scores)Combines anomaly scores from multiple anomaly detectors for a particular timestep.
- fit(scores)¶
Shortcut method that iteratively applies fit_partial to all instances in order.
- Parameters:
shape (np.float64 array of) – Input scores.
- Returns:
self.
- Return type:
- fit_partial(scores)¶
Fits particular (next) timestep’s score to train the ensembler. For PYOD based ensemblers, this method does not affect anything and returns self directly.
- Parameters:
scores – np.float64 array of shape (num_anomaly_detectors, ) List of scores from multiple anomaly detectors.
- Returns:
The fitted ensembler.
- Return type:
- fit_transform(scores)¶
Shortcut method that iteratively applies fit_transform_partial to all instances in order.
- Parameters:
shape (np.float64 array of) – Input scores.
- Returns:
Processed scores.
- Return type:
np.float64 array of shape (num_instances,)
- fit_transform_partial(score)¶
Shortcut method that iteratively applies fit_partial and transform_partial, respectively.
- transform(scores)¶
Shortcut method that iteratively applies transform_partial to all instances in order.
- Parameters:
shape (np.float64 array of) – Input scores.
- Returns:
Processed scores.
- Return type:
np.float64 array of shape (num_instances,)