Metrics#

Functions for evaluating detector outputs against ground truth, and helpers for building scorers that operate on a fitted detector and a dataset.

Metrics follow the signature (y_true, y_pred) -> float. Scorers follow the sklearn-compatible signature (detector, X, y=None) -> float.

Changepoint metrics#

Compare predicted and true sets of changepoints.

changepoint_f1_score(changepoints_true, ...)

Compute the F1 score for changepoint detection with a tolerance window.

changepoint_precision(changepoints_true, ...)

Compute detection precision for changepoints with a tolerance window.

changepoint_recall(changepoints_true, ...[, ...])

Compute detection recall for changepoints with a tolerance window.

hausdorff_metric(changepoints_true, ...[, ...])

Compute the Hausdorff distance between two changepoint sets.

Segment anomaly metrics#

Compare predicted and true sets of anomalous segments.

segment_anomaly_f1_score(intervals_true, ...)

Compute the F1 score for segment anomaly detection.

segment_anomaly_precision(intervals_true, ...)

Compute detection precision for segment anomalies.

segment_anomaly_recall(intervals_true, ...)

Compute detection recall for segment anomalies.

Segment label metrics#

Compare predicted and true dense per-sample segment labels.

rand_index(y_true, y_pred)

Compute the Rand index for two segmentations.

adjusted_rand_index(y_true, y_pred)

Compute the adjusted Rand index for two segmentations.

Scorers#

Build and resolve sklearn-compatible scorers from metrics.

make_detector_scorer(metric, *[, ...])

Wrap a (y_true, y_pred) -> float metric as a detector scorer.

resolve_scoring(scoring)

Normalise scoring into a callable (detector, X, y) -> float.

n_changepoints(detector, X[, y])

n_segment_anomalies(detector, X[, y])

n_segments(detector, X[, y])