Skip to content

refactor(aggregation): Rename simplex projection helper - #804

Closed
ValerianRey wants to merge 1 commit into
mainfrom
refactor/simplex-projection-name
Closed

ValerianRey wants to merge 1 commit into
mainfrom
refactor/simplex-projection-name

Conversation

@ValerianRey

Copy link
Copy Markdown
Member

_projection2simplex (in the private aggregation/_utils package) is imported by MoDoWeighting, SDMGradWeighting and the tests, while its sibling helper pref_vector_to_weighting has no leading underscore and spells out "to". It's renamed to project_onto_simplex, and its last line uses (y - tmax_f).clamp(min=0.0) instead of torch.max(y - tmax_f, y.new_zeros(m)).

Outputs are bit-identical before and after on 6004 random projections (float32/float64, including a NaN input) and on 20 MoDo and 20 SDMGrad calls. The simplex, MoDo and SDMGrad tests pass.

🤖 Generated with Claude Code

`_projection2simplex` is imported by MoDo, SDMGrad and the tests, and its
sibling helper in `aggregation/_utils` (`pref_vector_to_weighting`) has no
leading underscore and spells out "to". Also use `clamp` instead of taking
the maximum with a new tensor of zeros. Outputs are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ValerianRey ValerianRey added package: aggregation cc: refactor Conventional commit type for any refactoring, not user-facing, and not typing or perf improvements labels Oct 7, 2026
@github-actions github-actions Bot changed the title Rename simplex projection helper refactor(aggregation): Rename simplex projection helper Oct 7, 2026
@ValerianRey

ValerianRey commented Oct 7, 2026 •

Copy link
Copy Markdown
Member Author

Superseded by #814 (rename _projection2simplex to project_onto_simplex) and #815 (use clamp in the projection), which split this PR in two.

@ValerianRey ValerianRey closed this Oct 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cc: refactor Conventional commit type for any refactoring, not user-facing, and not typing or perf improvements package: aggregation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant