SFI.inference.sparse.metrics module¶
SFI.inference.sparse.metrics — Benchmark helpers¶
Standalone functions for comparing inferred supports / coefficients against ground truth. Useful for benchmarking and papers but not required for normal inference.
- SFI.inference.sparse.metrics.overlap_metrics(true_support, pred_support)[source]¶
Compare predicted support to the ground truth.
- Parameters:
true_support (list[int]) – Indices of the true and predicted active basis functions.
pred_support (list[int]) – Indices of the true and predicted active basis functions.
- Returns:
Keys:
TP,FP,FN,prec,rec,exact.- Return type:
dict
- SFI.inference.sparse.metrics.predictive_nmse(Phi_test, true_support, true_coeffs, inferred_support, inferred_coeffs)[source]¶
Normalised mean-squared error on a held-out design matrix.
- Parameters:
Phi_test ((n_test, p) Array) – Design matrix evaluated on test data.
true_support (list[int]) – Ground-truth active indices.
true_coeffs (array-like) – Ground-truth coefficient vector (length
len(true_support)).inferred_support (list[int]) – Inferred active indices.
inferred_coeffs (array-like) – Inferred coefficient vector (length
len(inferred_support)).
- Returns:
\(\|\hat y - y\|^2 / \|y\|^2\).
- Return type:
float