Skip to content

Record accuracy sweep results for mahalanobis#1404

Merged
brendancol merged 1 commit into
mainfrom
accuracy-sweep-mahalanobis
May 2, 2026
Merged

Record accuracy sweep results for mahalanobis#1404
brendancol merged 1 commit into
mainfrom
accuracy-sweep-mahalanobis

Conversation

@brendancol
Copy link
Copy Markdown
Contributor

Summary

  • Audited xrspatial/mahalanobis.py against the five accuracy categories (precision loss, NaN/Inf, off-by-one, projection, backend parity).
  • No critical or high issues. All four backends cast to float64, filter NaN/Inf via isfinite, clamp dist_sq non-negative before sqrt, and raise ValueError on exactly singular covariance.
  • Recorded one LOW note: np.linalg.inv has no pseudo-inverse fallback so a near-singular (but not exactly singular) covariance can return garbage without raising; the two-pass mean/cov can also lose precision for inputs with very large mean and small variance. Both are documented but not fixed.

Test plan

  • csv updated via csv.DictReader/Writer
  • no source files touched

No critical or high accuracy issues. All four backends use float64
throughout, NaN/Inf are filtered via isfinite, dist_sq is clamped
non-negative before sqrt, and singular covariance raises ValueError.
@github-actions github-actions Bot added the performance PR touches performance-sensitive code label May 2, 2026
@brendancol brendancol merged commit afbf1f7 into main May 2, 2026
11 checks passed
@brendancol brendancol deleted the accuracy-sweep-mahalanobis branch May 4, 2026 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance PR touches performance-sensitive code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant