Repository navigation
fix(aggregation): Keep significant zeros in CAGrad string - #817
Merged
Merged
Conversation
str(self.c).rstrip("0") also stripped significant zeros, so CAGrad(c=10)
and CAGrad(c=100) were both named CAGrad1. Only the trailing ".0" of whole
floats is now removed.
Fixes SimplexLab#809
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SausageMan99
requested review from
a team,
KhusPatel4450,
PierreQuinton and
ValerianRey
as code owners
October 7, 2026 16:20
ValerianRey
approved these changes
Oct 7, 2026
ValerianRey
left a comment
Member
There was a problem hiding this comment.
LGTM, thanks! This is very minor so no need for changelog entry IMO.
ValerianRey
enabled auto-merge (squash)
October 7, 2026 16:25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #809.
CAGrad.__str__usedstr(self.c).rstrip("0"), which also removed significant zeros (CAGrad(c=10)andCAGrad(c=100)were bothCAGrad1, andCAGrad(c=1.0)wasCAGrad1.). It now only removes the trailing.0of whole floats, soc=10→CAGrad10,c=1.0→CAGrad1,c=0→CAGrad0,c=0.5→CAGrad0.5(unchanged).Note:
c=0used to giveCAGradand now givesCAGrad0. Happy to keep the old behaviour for 0 if you prefer.Tested with a new parametrized test in
tests/unit/aggregation/test_cagrad.py.This change was prepared with the help of an AI agent (Claude) and reviewed by me before opening.