Sparse test - #1167
Conversation
expecting errors
* fixing fixture expecting errors * fixing prism * trying another approach * some fixes * more fixes * more fixes * fix for learning * more learning fix * restoring test still fails
* further improving prism_convert * capecod & mack fixes * fixing test_utilities and removing sparse.testing * more fixes * implementing nanquantile and nanmedian * improving comment, adding tests, fixing bugbot * fixing test * removing empty check
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit ac9e1b5. Configure here.
|
|
||
| for start, end in zip(starts, ends): | ||
| gid = group_ids[start] | ||
| out[gid] = np.nanquantile(values[start:end], q) |
There was a problem hiding this comment.
Empty sparse quantile crashes
Medium Severity
When a multi-dimensional COO has no stored values (nnz == 0), group_ids is empty but the loop still runs with starts=[0], so group_ids[start] raises IndexError. An all-missing reduction should return NaNs, matching np.nanquantile.
Reviewed by Cursor Bugbot for commit ac9e1b5. Configure here.
Pyright Type CompletenessView the full Project (full
Other symbols referenced but not exported by
Symbols without documentation:
Patch (exported symbols added or changed by this PR): 28.6% fully typed (2 / 7); 2 no longer exported
Patch symbol details
|


Summary of Changes
Related GitHub Issue(s)
Additional Context for Reviewers
uv run pytest) and documentation changes (uv run jb build docs --builder=custom --custom-builder=doctest)Note
Medium Risk
Changes Mack standard-error recursion and sparse reduction helpers used in production paths, not only tests; incorrect backend alignment could affect numerical results on sparse triangles.
Overview
Improves sparse-array test coverage and fixes backend mismatches when triangles mix numpy and sparse after
auto_sparseor reductions.Test harness: Sample fixtures now set backend per triangle via
set_backend()instead of toggling globalARRAY_BACKEND. The fullprismfixture runs sparse-only; a smallerprism_convertslice backs the auto-sparse test.Sparse utilities:
nan_to_numaccepts a configurable NaN fill value. Newnanquantile/nanmedianon COO arrays support median/quantile on sparse-backed triangles.Runtime fixes: Mack recursion and
summary_force matching backends before sums and concatenation (e.g. aftersumtriggers auto-sparse).DevelopmentML._prep_w_mldensifies weights for scikit-learn. Several tests assert Triangle equality or numpy arrays instead of backend-specificxp.testing.Test tweaks: Cape Cod zero-triangle uses
.at; Mack malformed test uses theraafixture.Reviewed by Cursor Bugbot for commit ac9e1b5. Bugbot is set up for automated code reviews on this repo. Configure here.