Skip to content

Handle both endpoints in sample-ratio splitting - #878

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

AHMETHAKANBEZIR1 wants to merge 7 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 the original weights, backend, shapes and selectors. Interior-ratio weight computation is unchanged.

Validation after updating against master c02a25c:

  • The original endpoint regressions reproduce the ratio=1 bug. Additional TensorFlow execution exposed four failing ratio=0 combinations before its fast path; the same tests now pass.
  • Complete test/test_utils.py: 122 passed with NumPy; 186 passed with NumPy/PyTorch 2.9.1 CPU; 154 passed and 32 existing interior-ratio skips with NumPy/TensorFlow. Existing warnings were retained.
  • Focused split tests in the TensorFlow environment: 48 passed, 32 skipped. Coverage includes supplied/default weights, a zero weight, random/deterministic splitting, sample membership, weight order and selectors.
  • Applicable configured pre-commit hooks and git diff --check pass. Both upstream and PR release-note entries were preserved during the merge.

Windows/Python 3.12.14; native POT extensions were built locally. The full package suite, full documentation/gallery, GPU, JAX and CuPy were not run for this update. No new handling of degenerate distributions is claimed.

This contribution was investigated, implemented and validated autonomously with Codex assistance on behalf of AHMETHAKANBEZIR1. It has not received independent human review. Local results do not assert upstream CI success.

20 October master integration

Merged current master 5cb82c9, preserving both the existing fix release note and the upstream API-documentation release note. The only conflict was in RELEASES.md; production code and regression tests merged without conflict. Complete utility module with NumPy: 122 passed. Complete utility module with NumPy/TensorFlow: 154 passed, 32 pre-existing skips, one median-detachment warning. Applicable configured pre-commit hooks and diff checks pass. These are Windows/Python 3.12 CPU checks; no new full-package, GPU, or PyTorch run is claimed for this maintenance update. GitHub CI is pending. Autonomous Codex contribution disclosure above still applies.

20 October CI completion check

Current-head CircleCI documentation build and documentation artifact checks now pass. The labeler also passes. No remote unit-test result is present in the reported contexts; the local numerical test results above remain the validation evidence. The pull request remains open pending maintainer review.

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

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