pysad.transform.ensemble.AverageOfMaximumScoreEnsembler

class pysad.transform.ensemble.AverageOfMaximumScoreEnsembler(n_buckets=5, method='static', bootstrap_estimators=False)[source]

Maximum of average scores ensembler that outputs the maximum of average. For more details, see [BAS15] and PyOD documentation. The ensembler firt divides the scores into buckets and takes the maximum for each bucket. Then, the ensembler outputs the average of all these maximum scores of buckets.

Parameters:
  • n_buckets (int) – The number of subgroups to build (Default=5).

  • method (str) – {‘static’, ‘dynamic’}, if ‘dynamic’, build subgroups randomly with dynamic bucket size (Default=’static’).

  • bootstrap_estimators (bool) Whether estimators are drawn with replacement (Default=False) –

Methods

__init__([n_buckets, method, ...])

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:

object

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:

object

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.

Parameters:

score (float) – Input score.

Returns:

Processed score.

Return type:

float

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,)

transform_partial(scores)

Combines anomaly scores from multiple anomaly detectors for a particular timestep.

Parameters:

scores – np.float64 array of shape (num_anomaly_detectors, ) List of scores from multiple anomaly detectors.

Returns:

Resulting anomaly score.

Return type:

float