tsseg.metrics.BidirectionalCovering
- class tsseg.metrics.BidirectionalCovering(*, convert_labels_to_segments=False, aggregation='harmonic', **kwargs)[source]
Bidirectional extension of the classical Covering metric.
The classical Covering score only evaluates how well predicted segments cover the ground-truth segmentation. However, this directionality means that long predicted segments that cover the truth sparsely may still obtain a high score, even when the prediction introduces substantial over-segmentation.
The bidirectional variant evaluates coverage in both directions:
ground_truth_coveringmirrors the traditional definition where each ground-truth interval is weighted by its duration and matched to the best overlapping predicted interval via Intersection over Union (IoU).prediction_coveringswaps the roles. Each predicted segment is weighted by its duration and matched to the best ground-truth overlap.
The two directional scores are then aggregated using an F1-style harmonic mean by default. Alternative aggregation strategies (
geometric,arithmeticormin) can be selected via theaggregationargument. The resulting metric rewards segmentations that both cover the truth and avoid excessive over-segmentation.- Parameters:
convert_labels_to_segments (
bool) – WhenTrue, the inputs are interpreted as label sequences and will be converted to change-points viatsseg.metrics.change_point_detection.labels_to_change_points().aggregation (
str) – Name of the aggregation strategy used to combine the two directional covering scores. Supported values are"harmonic"(default),"geometric","arithmetic"and"min".kwargs – Forwarded to
tsseg.metrics.base.BaseMetric.
- __init__(*, convert_labels_to_segments=False, aggregation='harmonic', **kwargs)[source]
Initializes the metric with optional parameters.
Methods
__init__(*[, convert_labels_to_segments, ...])Initializes the metric with optional parameters.
compute(y_true, y_pred)Computes the value of the metric.