Skip to content

fix: support per-sample variogram exponents - #183

Draft
ayushibaidya wants to merge 1 commit into
frazane:mainfrom
ayushibaidya:fix/variogram-per-sample-p
Draft

ayushibaidya wants to merge 1 commit into
frazane:mainfrom
ayushibaidya:fix/variogram-per-sample-p

Conversation

@ayushibaidya

Copy link
Copy Markdown

Summary

Fixes #174.

This PR adds support for per-sample exponent arrays in variogram ensemble scoring.

Previously, passing an array-valued p caused broadcasting errors because the exponent was applied directly to the pairwise difference arrays.

Changes

  • Align exponent dimensions with observation and forecast pairwise differences.
  • Support per-sample exponents for both weighted and unweighted variogram scores.
  • Validate exponent broadcasting against the observation batch shape to prevent unintended output dimensions.
  • Preserve forecast dtype when converting exponent values.
  • Add regression tests for both nrg and fair estimators, including multidimensional batches and NumPy/PyTorch backends.

Testing

  • 74 passed, 450 skipped using uv run pytest -q --backend=numpy,torch tests/test_variogram.py tests/test_wvariogram.py.
  • Confirmed that incompatible exponent shapes raise ValueError.
  • Numba-specific tests remain to be verified.

Checklist

  • Tests pass across all supported backends (Numba/JAX not yet verified).
  • Array-API and Numba paths reviewed where applicable.
  • Documentation updated for the expanded p parameter behavior.
  • Release-note label applied.

@github-actions github-actions Bot added the core Core scoring API / numerics label Nov 17, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Core scoring API / numerics

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Variogram scores fail on the array path with a per-sample p

1 participant