hausdorff_metric#
- hausdorff_metric(changepoints_true: ArrayLike, changepoints_pred: ArrayLike, *, max_distance: float | None = None) float[source][source]#
Compute the Hausdorff distance between two changepoint sets.
Measures the maximum distance from any true changepoint to its nearest predicted changepoint, and vice versa. Lower is better.
- Parameters:
- changepoints_truearray-like of shape (n_changepoints_true,)
True changepoint indices, as returned by
predict_changepoints().- changepoints_predarray-like of shape (n_changepoints_pred,)
Predicted changepoint indices, as returned by
predict_changepoints().- max_distancefloat | None, default=None
Cap on the returned distance. If None, no cap is applied.
- Returns:
- float
Hausdorff distance. Returns 0.0 if both have no changepoints, inf (or max_distance) if exactly one has no changepoints.
Examples
>>> hausdorff_metric([10, 20], [12, 20]) 2.0