tsseg.metrics.GaussianF1Score
- class tsseg.metrics.GaussianF1Score(*, sigma_fraction=0.01, min_sigma=1.0, adaptive_sigma=False, convert_labels_to_segments=False)[source]
Gaussian-weighted alternative to the classic F1 score.
The metric operates in three conceptual steps:
- Preparation – convert optional label sequences into change point
lists, remove boundary markers, and infer the series length.
- Gaussian matching – every true change point is associated with a
Gaussian of width
sigma_fraction * n(clamped below bymin_sigma). Predictions are rewarded according to that shared kernel and a greedy assignment keeps the best non-overlapping pairs.
- Soft precision & recall – derive precision and recall from the sum of
Gaussian rewards, yielding a fuzzy F1 in \([0, 1]\).
Special cases are handled explicitly:
- No ground-truth change point – if the data really is stationary and no
change points are predicted either, we return the perfect score 1.0. Conversely, predicting spurious changes yields a zero score.
- Single change point – the Gaussian spread still follows the global
fraction, ensuring a consistent reward scale across all events.
- __init__(*, sigma_fraction=0.01, min_sigma=1.0, adaptive_sigma=False, convert_labels_to_segments=False)[source]
Initializes the metric with optional parameters.
Methods
__init__(*[, sigma_fraction, min_sigma, ...])Initializes the metric with optional parameters.
compute(y_true, y_pred)Return the Gaussian-weighted precision, recall, and F1 score.