Aggregators

Module of aggregators.

An aggregator combines multiple lists of anomalies into one.

adtk.aggregator.print_all_models()[source]

Print description of every model in this module.

class adtk.aggregator.OrAggregator[source]

Aggregator that identifies a time point as anomalous as long as it is included in one of the input anomaly lists.

aggregate(lists)

Aggregate multiple lists of anomalies into one.

Parameters:lists (pandas.DataFrame, a dict of Series/DataFrame, or a dict of lists) –

Anomaly lists to be aggregated.

  • If a pandas DataFrame, every column is a binary Series representing a list of anomalies;
  • If a dict of Series/DataFrame, every value of the dict is a binary Series/DataFrame representing a list / a set of lists of anomalies;
  • If a dict of list, every value of the dict is a list of pandas Timestamps representing anomalous time points.
Returns:Aggregated list of anomalies.
  • If input is a pandas DataFrame or a dict of Series/DataFrame, return a binary Series;
  • If input is a dict of list, return a list.
Return type:list of pandas TimeStamps, or a binary pandas Series
fit_predict(lists, *args, **kwargs)

Alias of aggregate.

get_params()

Get parameters of this model.

Returns:Model parameters.
Return type:dict
predict(lists, *args, **kwargs)

Alias of aggregate.

set_params(**kwargs)

Set parameters of this model.

Parameters:**kwargs – Model parameters to set. If empty, then all parameters will be reset to default values.
class adtk.aggregator.AndAggregator[source]

Aggregator that identifies a time point as anomalous only if it is included in all the input anomaly lists.

aggregate(lists)

Aggregate multiple lists of anomalies into one.

Parameters:lists (pandas.DataFrame, a dict of Series/DataFrame, or a dict of lists) –

Anomaly lists to be aggregated.

  • If a pandas DataFrame, every column is a binary Series representing a list of anomalies;
  • If a dict of Series/DataFrame, every value of the dict is a binary Series/DataFrame representing a list / a set of lists of anomalies;
  • If a dict of list, every value of the dict is a list of pandas Timestamps representing anomalous time points.
Returns:Aggregated list of anomalies.
  • If input is a pandas DataFrame or a dict of Series/DataFrame, return a binary Series;
  • If input is a dict of list, return a list.
Return type:list of pandas TimeStamps, or a binary pandas Series
fit_predict(lists, *args, **kwargs)

Alias of aggregate.

get_params()

Get parameters of this model.

Returns:Model parameters.
Return type:dict
predict(lists, *args, **kwargs)

Alias of aggregate.

set_params(**kwargs)

Set parameters of this model.

Parameters:**kwargs – Model parameters to set. If empty, then all parameters will be reset to default values.
class adtk.aggregator.CustomizedAggregator(aggregate_func=<function CustomizedAggregator.<lambda>>, aggregate_func_params=None)[source]

Aggregator derived from a user-given function and parameters.

Parameters:
  • aggregate_func (function) – A function aggregating multiple lists of anomalies. The first input argument must be a dict, optional input argument allows (through parameter aggregate_func_params). The output must be a list of pandas Timestamps.
  • aggregate_func_params (dict, optional) – Parameters of aggregate_func. Default: None.
aggregate(lists)

Aggregate multiple lists of anomalies into one.

Parameters:lists (pandas.DataFrame, a dict of Series/DataFrame, or a dict of lists) –

Anomaly lists to be aggregated.

  • If a pandas DataFrame, every column is a binary Series representing a list of anomalies;
  • If a dict of Series/DataFrame, every value of the dict is a binary Series/DataFrame representing a list / a set of lists of anomalies;
  • If a dict of list, every value of the dict is a list of pandas Timestamps representing anomalous time points.
Returns:Aggregated list of anomalies.
  • If input is a pandas DataFrame or a dict of Series/DataFrame, return a binary Series;
  • If input is a dict of list, return a list.
Return type:list of pandas TimeStamps, or a binary pandas Series
fit_predict(lists, *args, **kwargs)

Alias of aggregate.

get_params()

Get parameters of this model.

Returns:Model parameters.
Return type:dict
predict(lists, *args, **kwargs)

Alias of aggregate.

set_params(**kwargs)

Set parameters of this model.

Parameters:**kwargs – Model parameters to set. If empty, then all parameters will be reset to default values.