Evaluation
The tsseg.metrics namespace provides classes implementing common
segmentation quality measures. Every metric inherits from
tsseg.metrics.BaseMetric and shares the same compute(y_true, y_pred)
contract (with an update / compute variant for streaming use).
Change-point metrics
These metrics compare two sets of sparse change-point indices.
Computes the F1-score for change point detection. |
|
Computes the Covering score for a segmentation. |
|
Computes the Hausdorff distance between two sets of change points. |
|
Gaussian-weighted alternative to the classic F1 score. |
|
Bidirectional extension of the classical Covering metric. |
State-labelling metrics
These metrics compare two dense label arrays of equal length, aligning predicted to ground-truth states when needed (e.g. Hungarian matching).
Computes the Adjusted Rand Index (ARI). |
|
Computes the Adjusted Mutual Information (AMI). |
|
Computes the Normalized Mutual Information (NMI). |
|
Computes the Weighted Adjusted Rand Index (WARI). |
|
Computes the Weighted Normalized Mutual Information (WNMI). |
|
Computes the State Matching Score (SMS). |
Base protocol
Usage
from tsseg.metrics import F1Score, StateMatchingScore
# Change-point evaluation
f1 = F1Score(margin=5)
result = f1.compute(y_true_cps, y_pred_cps)
print(result["f1"])
# State-labelling evaluation
sms = StateMatchingScore()
result = sms.compute(y_true_labels, y_pred_labels)
print(result["score"])
See Getting started for end-to-end examples that combine detectors and metrics.