directed_hausdorff_distance¶
- kooplearn.metrics.directed_hausdorff_distance(pred: ndarray, reference: ndarray)[source]¶
One-sided directed Hausdorff distance between two 1D sets. Useful for computing distances between estimated eigenvalues
Calculates the directed Hausdorff distance \(\vec{H}(A, B) = \max_{a \in A} \min_{b \in B} \|a - b\|_p\) where \(A\) is the set of points in
predand \(B\) is the set of points inreference. The current implementation uses the \(L_1\) norm: \(\|a - b\|_1 = |a - b|\).- Parameters:
pred (
numpy.ndarray) – The set of predicted points \(A\). Must be a 1D array.reference (
numpy.ndarray) – The set of reference points \(B\). Must be a 1D array.
- Returns:
The directed Hausdorff distance between
pred``and ``reference.- Return type:
float- Raises:
AssertionError – If
predorreferenceare not 1-dimensional arrays.
Examples
import numpy as np from kooplearn.metrics import directed_hausdorff_distance pred = np.array([1, 5, 6]) reference = np.array([2, 4, 7]) directed_hausdorff_distance(pred, reference) # Will print np.float64(1.0)