Skip to content

feat(aggregation): Add getters and setters to UPGrad parameters#658

Merged
ValerianRey merged 5 commits intomainfrom
feat/upgrad-properties
Apr 20, 2026
Merged

feat(aggregation): Add getters and setters to UPGrad parameters#658
ValerianRey merged 5 commits intomainfrom
feat/upgrad-properties

Conversation

@mattbuot
Copy link
Copy Markdown
Contributor

@mattbuot mattbuot commented Apr 19, 2026

Summary

  • Expose pref_vector, norm_eps, and reg_eps as properties (getter + setter) on both UPGrad and UPGradWeighting so users can read and update them after instantiation.
  • The pref_vector setter also rebuilds the internal weighting via pref_vector_to_weighting to keep state consistent.
  • The norm_eps and reg_eps setters validate that the new value is non-negative.
  • UPGrad.__init__ no longer stores redundant _pref_vector / _norm_eps / _reg_eps fields; __repr__ / __str__ read them through the new properties.
  • Changelog entry added under [Unreleased].

Test plan

  • uv run pytest tests/unit/aggregation/test_upgrad.py (144 passed)
  • uv run ty check src/torchjd/aggregation/_upgrad.py
  • CI passes

Expose pref_vector, norm_eps, and reg_eps as properties on UPGrad and
UPGradWeighting so users can read and update them after instantiation.
The norm_eps and reg_eps setters validate that the new value is
non-negative.
@mattbuot mattbuot added cc: feat Conventional commit type for new features. package: aggregation labels Apr 19, 2026
Add tests for pref_vector, norm_eps, and reg_eps setters on UPGrad and
UPGradWeighting, including validation errors on negative norm_eps and
reg_eps. Addresses the codecov/patch coverage gap.
@mattbuot mattbuot marked this pull request as ready for review April 19, 2026 20:56
@mattbuot mattbuot requested review from a team, PierreQuinton and ValerianRey as code owners April 19, 2026 20:56
Comment thread src/torchjd/aggregation/_upgrad.py Outdated
Comment thread src/torchjd/aggregation/_upgrad.py
Comment thread tests/unit/aggregation/test_upgrad.py
Copy link
Copy Markdown
Contributor

@ValerianRey ValerianRey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few minor issues, then we can merge. I'll make the fixes.

@ValerianRey ValerianRey merged commit 30b65a0 into main Apr 20, 2026
15 checks passed
@ValerianRey ValerianRey deleted the feat/upgrad-properties branch April 20, 2026 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cc: feat Conventional commit type for new features. package: aggregation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants