Skip to content

fix: pass flattened points to multidimensional approximate PDFs - #1232

Open
AryanRG wants to merge 1 commit into
scikit-hep:developfrom
AryanRG:fix/multidimensional-pdf-midpoints
Open

AryanRG wants to merge 1 commit into
scikit-hep:developfrom
AryanRG:fix/multidimensional-pdf-midpoints

Conversation

@AryanRG

@AryanRG AryanRG commented Nov 13, 2026

Copy link
Copy Markdown

Multidimensional BinnedNLL and ExtendedBinnedNLL with use_pdf="approximate" pass a grid-shaped array to the model instead of the documented (D, N) points. A scipy-style PDF using pdf(xy.T) can fail on rectangular histograms or silently swap fitted means on square ones.

Flatten the bin midpoints like the CDF path, then reshape the PDF values back to the histogram. The multidimensional PDF output is now shape-checked like the CDF output. The 1D path is unchanged.

Added regression cases for both costs using a non-square histogram. They fail on the base and pass with the fix. Locally: 633 tests passed, 109 skipped (optional dependencies and one platform skip); pinned Ruff and pre-commit-style mypy checks pass. Also checked uneven 3D bins, masks, weighted histograms and a fitted 2D Gaussian against the CDF result.

The native core was reused from the 2.33.0 wheel; C++/CMake sources and the ROOT pin match the base. No fresh native build or additional platform matrix was run.

Prepared with AI assistance.

@henryiii
henryiii force-pushed the fix/multidimensional-pdf-midpoints branch from c620cb5 to 7c749b2 Compare November 13, 2026 22:48

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant