Anomaly aggregators base classes

class darts.ad.aggregators.aggregators.Aggregator[source]

Bases: ABC

Base class for Aggregators.

Methods

eval_metric(anomalies, series[, window, metric])

Aggregates the (sequence of) multivariate series given as input into one (sequence of) series and evaluates the results against the ground truth anomaly labels.

predict(series[, name])

Aggregates the (sequence of) multivariate binary series given as input into a (sequence of) univariate binary series.

eval_metric(anomalies, series, window=1, metric='recall')[source]

Aggregates the (sequence of) multivariate series given as input into one (sequence of) series and evaluates the results against the ground truth anomaly labels.

Parameters
  • anomalies (Union[TimeSeries, Sequence[TimeSeries]]) – The (sequence of) binary ground truth anomaly labels (1 if it is an anomaly and 0 if not).

  • series (Union[TimeSeries, Sequence[TimeSeries]]) – The (sequence of) predicted multivariate binary series to aggregate.

  • window (int) – (Sequence of) integer value indicating the number of past samples each point represents in the (sequence of) series. The parameter will be used by the function _window_adjustment_anomalies() in darts.ad.utils to transform anomalies.

  • metric (Literal[‘recall’, ‘precision’, ‘f1’, ‘accuracy’]) – The name of the metric function to use. Must be one of “recall”, “precision”, “f1”, and “accuracy”. Default: “recall”.

Returns

(Sequence of) score for the (sequence of) series.

Return type

Union[float, Sequence[float]]

predict(series, name='series')[source]

Aggregates the (sequence of) multivariate binary series given as input into a (sequence of) univariate binary series.

Parameters
  • series (Union[TimeSeries, Sequence[TimeSeries]]) – The (sequence of) multivariate binary series to aggregate.

  • name (str) – The name of series.

Returns

(Sequence of) aggregated results.

Return type

TimeSeries

class darts.ad.aggregators.aggregators.FittableAggregator[source]

Bases: Aggregator

Base class for Aggregators that require training.

Methods

eval_metric(anomalies, series[, window, metric])

Aggregates the (sequence of) multivariate series given as input into one (sequence of) series and evaluates the results against the ground truth anomaly labels.

fit(anomalies, series)

Fit the aggregators on the (sequence of) multivariate binary anomaly series.

predict(series[, name])

Aggregates the (sequence of) multivariate binary series given as input into a (sequence of) univariate binary series.

eval_metric(anomalies, series, window=1, metric='recall')

Aggregates the (sequence of) multivariate series given as input into one (sequence of) series and evaluates the results against the ground truth anomaly labels.

Parameters
  • anomalies (Union[TimeSeries, Sequence[TimeSeries]]) – The (sequence of) binary ground truth anomaly labels (1 if it is an anomaly and 0 if not).

  • series (Union[TimeSeries, Sequence[TimeSeries]]) – The (sequence of) predicted multivariate binary series to aggregate.

  • window (int) – (Sequence of) integer value indicating the number of past samples each point represents in the (sequence of) series. The parameter will be used by the function _window_adjustment_anomalies() in darts.ad.utils to transform anomalies.

  • metric (Literal[‘recall’, ‘precision’, ‘f1’, ‘accuracy’]) – The name of the metric function to use. Must be one of “recall”, “precision”, “f1”, and “accuracy”. Default: “recall”.

Returns

(Sequence of) score for the (sequence of) series.

Return type

Union[float, Sequence[float]]

fit(anomalies, series)[source]

Fit the aggregators on the (sequence of) multivariate binary anomaly series.

If a list of series is given, they must have the same number of components.

Parameters
  • anomalies (Union[TimeSeries, Sequence[TimeSeries]]) – The (sequence of) binary ground truth anomaly labels (1 if it is an anomaly and 0 if not).

  • series (Union[TimeSeries, Sequence[TimeSeries]]) – The (sequence of) multivariate binary series (predicted labels) to aggregate.

Return type

Self

predict(series, name='series')[source]

Aggregates the (sequence of) multivariate binary series given as input into a (sequence of) univariate binary series.

Parameters
  • series (Union[TimeSeries, Sequence[TimeSeries]]) – The (sequence of) multivariate binary series to aggregate.

  • name (str) – The name of series.

Returns

(Sequence of) aggregated results.

Return type

TimeSeries