Skip to content

[MRG] Handle both endpoints in sample-ratio splitting - #878

Open
AHMETHAKANBEZIR1 wants to merge 8 commits into
PythonOT:masterfrom
AHMETHAKANBEZIR1:fix/sample-split-endpoint
Open

AHMETHAKANBEZIR1 wants to merge 8 commits into
PythonOT:masterfrom
AHMETHAKANBEZIR1:fix/sample-split-endpoint

Conversation

@AHMETHAKANBEZIR1

@AHMETHAKANBEZIR1 AHMETHAKANBEZIR1 commented Oct 2, 2026 •

Copy link
Copy Markdown

Fixes #877. At ratio=1, split_sample_ratio searches past the final weight and raises an indexing error. At ratio=0, TensorFlow's scalar searchsorted path also raises before returning the empty/full split.

Return the full and empty distributions directly at both supported endpoints, after the existing optional permutation. Preserve weights, backend, shapes and selectors; interior-ratio weight computation is unchanged. The endpoint regressions cover supplied/default weights, zero weights, randomized/deterministic splits, membership, weight order and selectors.

Current branch 328f4db includes master 0b6f8d5. Its only merge conflict was RELEASES.md, where both entries were retained. The PR's production and regression files are unchanged from the previous head.

Validation on this merged head (Windows/Python 3.12.14):

  • Complete utility module and doctests: NumPy 122 passed; NumPy/PyTorch 2.9.1 CPU 186 passed; NumPy/TensorFlow 154 passed, 32 existing skips, one median-detachment warning. The supported backends actually loaded in each profile were verified; Torch and TensorFlow ran in separate processes/environments.
  • All applicable configured pre-commit hooks for the PR files and diff checks pass.

Existing native POT extensions were reused; the new master changes no native extension source. The full package suite, local full documentation/gallery, GPU, JAX and CuPy were not tested for this update. No handling of degenerate distributions is claimed. Current-head upstream CircleCI documentation build 4269 completed successfully. GitHub status propagation may still be pending; this is not a local full-gallery run.

Prepared, investigated and tested autonomously by OpenAI Codex on behalf of AHMETHAKANBEZIR1. No independent human review has been performed.

Return both endpoint distributions and matching selectors before
accessing a boundary weight beyond the end of the array.

Co-authored-by: Codex <noreply@openai.com>
@AHMETHAKANBEZIR1 AHMETHAKANBEZIR1 changed the title [MRG] Handle ratio=1 in sample distribution splitting Handle both endpoints in sample-ratio splitting Oct 13, 2026
@AHMETHAKANBEZIR1 AHMETHAKANBEZIR1 changed the title Handle both endpoints in sample-ratio splitting [MRG] Handle both endpoints in sample-ratio splitting Oct 28, 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

split_sample_ratio raises IndexError for the supported ratio=1 endpoint

1 participant