Skip to content

fix(reorder): keep equal-score samples stable in descending order - #70

Open
BSAIPF wants to merge 1 commit into
OpenDCAI:mainfrom
BSAIPF:fix/stable-descending-score-order
Open

BSAIPF wants to merge 1 commit into
OpenDCAI:mainfrom
BSAIPF:fix/stable-descending-score-order

Conversation

@BSAIPF

@BSAIPF BSAIPF commented Oct 20, 2026

Copy link
Copy Markdown

sort_positions() reverses the ascending stable permutation for descending order, which also reverses equal-score samples. For scores [1, 2, 2, 1, 3], it returns row indices [4, 2, 1, 3, 0] instead of [4, 1, 2, 0, 3]. With all scores equal, it reverses the entire input. This reaches both static and dynamic reordering.

Sort negated scores with the stable sorter for descending order so ties retain their incoming order, as documented.

Validation:

  • 17 regression/control cases pass on both Python 3.11 and 3.12, including static raw-row ordering and static/dynamic index batches; 8 failed before the fix.
  • Ruff lint and format checks pass for both changed files.
  • Source distribution and wheel build; twine check --strict passes.

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