Learn R Programming

FluxPoint (version 0.1.2)

get_metrics: Evaluate change point detection accuracy metrics

Description

Computes standard evaluation metrics — bias, precision, recall, and F1-score — for change point detection results by comparing estimated change points against true ones within a specified tolerance (acceptance radius).

Usage

get_metrics(n, num_cps, est_cps, accept_radius)

Value

A list containing:

  • `bias` — Absolute difference between true and estimated number of change points.

  • `precision` — Proportion of correctly detected change points among all detections.

  • `recall` — Proportion of true change points correctly detected.

  • `F1` — Harmonic mean of precision and recall.

Arguments

n

Integer; total series length.

num_cps

Integer; true number of change points.

est_cps

Numeric vector of estimated change point locations.

accept_radius

Numeric; tolerance radius within which an estimated change point is considered correctly detected (a true positive).

Details

True change points are assumed to occur at evenly spaced positions. An estimated change point is counted as a true positive if it lies within accept_radius of any true change point location. Estimated points that do not match any true change point are classified as false positives, while true change points that are not detected are counted as false negatives. Bias is defined as the absolute difference between the true and estimated numbers of change points.

The metrics are defined as: $$ \text{Precision} = \frac{TP}{TP + FP}, \quad \text{Recall} = \frac{TP}{TP + FN}, \quad F_1 = \frac{2 \cdot \text{Precision} \cdot \text{Recall}}{\text{Precision} + \text{Recall}}. $$