Skip to content

Migrate the brier, quantile, interval and error spread scores to the array API - #156

Merged
frazane merged 12 commits into
mainfrom
array-api/p2-small-families
Nov 7, 2026
Merged

frazane merged 12 commits into
mainfrom
array-api/p2-small-families

Conversation

@frazane

@frazane frazane commented Nov 7, 2026

Copy link
Copy Markdown
Owner

Part of the array API phase 2 stack (#132). Moves the four smallest families to the inferred xp namespace, following the CRPS template. Values are unchanged.

What changed

  • Brier, RPS, log and RLS scores, the quantile score, the interval and weighted interval scores, and the error spread score infer the array framework from the inputs.
  • The weighted interval and error spread scores pick numba with the same rule as CRPS, and both paths share the input checks.
  • The binary and categorical input checks run on any array framework without a Python loop over values. The quantile score body moves to core/quantile.py.
  • Python-float parameters (such as alpha or w_median) take the dtype and device of the array inputs, so float32 inputs stay float32 and torch float64 inputs keep full precision.
  • Tests run on native arrays of each framework, with numba vs array parity, float32 and gradient checks, and the interval and error spread scores join the jit smoke test.

Notes

A few shapes and dtypes now follow the gufunc. Error spread, the weighted interval score and interval_score with a scalar alpha return shape (1,) for a single observation instead of (). rps_score, rls_score and quantile_score return floats for integer inputs, and log_score with scalar inputs returns a numpy scalar like CRPS. With backend="numba" and jax or torch inputs, the weighted interval and error spread scores raise as CRPS does, while the scores without a gufunc use the input's framework. The weighted interval score parity test still skips the median term, pending #141.


This change was developed in tandem with AI coding agents.

@frazane
frazane requested a balanced review from Copilot November 7, 2026 12:16
@github-actions github-actions Bot added the core Core scoring API / numerics label Nov 7, 2026
@frazane
frazane added this pull request to stack #157 November 7, 2026 12:16

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Base automatically changed from array-api/p2-parity-fixes to main November 7, 2026 14:43
@frazane
frazane force-pushed the array-api/p2-small-families branch from 3358dde to 7308d55 Compare November 7, 2026 14:44
@frazane
frazane merged commit 7a75339 into main Nov 7, 2026
27 checks passed
@frazane
frazane deleted the array-api/p2-small-families branch November 7, 2026 14:53
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.

2 participants