feat(perturbations): rename sigma→scale, default num_samples=1 (#1342)#1662
Open
yurekami wants to merge 2 commits into
Open
feat(perturbations): rename sigma→scale, default num_samples=1 (#1342)#1662yurekami wants to merge 2 commits into
yurekami wants to merge 2 commits into
Conversation
… to 1 Implements the two refinements proposed in google-deepmind#1342: - Rename `make_perturbed_fun`'s `sigma` parameter to `scale`, the more generic name suggested in the issue. The old `sigma` kwarg is kept as a keyword-only deprecated alias that emits a `DeprecationWarning`; positional callers are unaffected. - Change the default value of `num_samples` from 1000 to 1, matching the convention common in stochastic optimization. Updates tests (adds test_sigma_deprecation and test_default_num_samples), the perturbations example notebook, and the docstring.
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.
Closes #1342.
Implements the two refinements maintainers pre-approved on the issue:
sigma→scaleinoptax.perturbations.make_perturbed_fun.scaleis the more generic/self-explanatory name suggested in the issue. The oldsigmakwarg is preserved as a keyword-only deprecated alias that emits aDeprecationWarning— existing positional callers are unaffected.num_samples1000 → 1, matching the convention common in stochastic optimization (where the objective is itself stochastic).Changes
optax/perturbations/_make_pert.py— signature, docstring, deprecation shimoptax/perturbations/_make_pert_test.py— update kwarg calls; addtest_sigma_deprecationandtest_default_num_samplesexamples/perturbations.ipynb— update 3 call sites fromsigma=SIGMAtoscale=SIGMATest plan
pytest optax/perturbations/_make_pert_test.py— 19/19 pass locallyruff check— clean