orion.evaluation.contextual_confusion_matrix

orion.evaluation.contextual_confusion_matrix(expected, observed, data=None, start=None, end=None, weighted=True)[source]

Compute the confusion matrix between the ground truth and the detected anomalies.

Parameters
  • expected (DataFrame or list of tuples) – Ground truth passed as a pandas.DataFrame or list containing two columns: start and stop.

  • observed (DataFrame or list of tuples) – Detected anomalies passed as a pandas.DataFrame or list containing two columns: start and stop.

  • data (DataFrame) – Original data, passed as a pandas.DataFrame containing timestamp. Used to extract start and end.

  • start (int) – Minimum timestamp of the original data.

  • end (int) – Maximum timestamp of the original data.

  • weighted (boolean) – Flag to represent which algorithm to use. If true use weighted segment algorithm, else use overlap segment.

Returns

number of true negative, false positive, false negative, true positive.

Return type

tuple