Skip to content

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

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

AHMETHAKANBEZIR1 wants to merge 11 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 validation

Current head f0386a1 includes master f48a63a. Only RELEASES.md conflicted; both release entries are retained. The PR production and regression files are byte-for-byte unchanged from its previous head.

  • Complete utility module and doctests: NumPy 125 passed, 1 skipped; NumPy/PyTorch 2.9.1 CPU 189 passed, 1 skipped; NumPy/TensorFlow 157 passed, 33 skipped. Each process asserts the actual backend list and source checkout. Torch and TensorFlow run in separate environments. Skips are reported, not counted as passes.

  • The updated master's native extensions were rebuilt locally with the existing MSVC/Cython toolchain; the results above were repeated against that build. No native solver correctness or performance claim follows from the utility tests.

  • All applicable configured pre-commit hooks for the PR files and diff checks pass.

  • A private integration of [MRG] Fix sparse simplex projection with oversized budgets #876, [MRG] Handle both endpoints in sample-ratio splitting #878 and [MRG] Stabilize simplex projection against large common offsets #880 on the same master passes the utility module/doctests: NumPy 145 passed, 1 skipped; NumPy/PyTorch 229 passed, 1 skipped; NumPy/TensorFlow 197 passed, 33 skipped. That local integration branch is not published and is not part of this PR.

Windows/Python 3.12.14, CPU only. The full package suite, current full documentation/gallery, GPU, JAX and CuPy were not run locally. Current-head CircleCI documentation build 4316 completed successfully, with its commit verified against this PR head; all three reported checks now pass. This is an upstream full documentation build, not a local gallery run.

AI assistance disclosure

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
@codecov

codecov Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.07%. Comparing base (3367480) to head (f09a297).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #878   +/-   ##
=======================================
  Coverage   97.07%   97.07%           
=======================================
  Files         130      130           
  Lines       27095    27122   +27     
=======================================
+ Hits        26302    26329   +27     
  Misses        793      793           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

2 participants