Migrate core/adapter test callers from objective= to objectives=[]#5155
Open
saitcakmak wants to merge 5 commits intofacebook:mainfrom
Open
Migrate core/adapter test callers from objective= to objectives=[]#5155saitcakmak wants to merge 5 commits intofacebook:mainfrom
saitcakmak wants to merge 5 commits intofacebook:mainfrom
Conversation
…zationConfig Summary: Implementation plan for Option 3 from the design doc: https://docs.google.com/document/d/1EGQYmBjiNGtYapXu1RLHEBdA5Yz2c7q17acX3es0yV8/edit This restricts Objective to represent a single (possibly scalarized) objective, moves multi-objective representation to OptimizationConfig(objectives=list[Objective]), adds threshold/relative_threshold fields to Objective, and deprecates MultiObjectiveOptimizationConfig, MultiObjective, ScalarizedObjective, and ObjectiveThreshold. The plan is a 6-diff stack, each backward-compatible: 1. Add objectives: list[Objective] to OptimizationConfig 2. Update MOOC & PreferenceOptimizationConfig to use objectives list 3. Restrict Objective to single/scalarized (reject commas) 4. Migrate isinstance(_, MOOC) checks to is_moo_problem 5. Add threshold/relative_threshold to Objective + storage 6. Remove all internal usage of deprecated classes Differential Revision: D99386109
Summary: Part of the Restrict Objective to Single/Scalarized & Simplify OptimizationConfig design (see design doc: https://docs.google.com/document/d/1EGQYmBjiNGtYapXu1RLHEBdA5Yz2c7q17acX3es0yV8/edit). This is Diff 1 of the stack: enables the new `OptimizationConfig(objectives=[...])` construction path without breaking any existing code. Changes: - `OptimizationConfig.__init__` and `clone_with_args` are now keyword-only across `OptimizationConfig`, `MOOC`, and `PreferenceOptimizationConfig`. All positional callers updated. - New kwarg `objectives: list[Objective] | None = None`, mutually exclusive with `objective`, on `__init__` and `clone_with_args` of all three classes (`OptimizationConfig`, `MOOC`, and `PreferenceOptimizationConfig`). - Internally stores `self._objectives: list[Objective]` (both paths). - New `objectives` property returns the list. - `objective` property raises `UnsupportedError` if `len > 1`. - `is_moo_problem` property: True when multiple objectives or legacy multi-objective expression. - `metric_names`, `metric_name_to_signature`, `metric_signatures` aggregate across all objectives + constraints. - `__repr__` always uses `objectives=`. - JSON storage: encoder uses `objectives` key; decoder has backward compat to convert old `objective` key to `objectives` list. - SQA storage: encoder iterates `objectives` to encode each one; decoder collects multiple OBJECTIVE rows and reconstructs `OptimizationConfig(objectives=...)` when `len > 1`. - Validation ensures no duplicate metrics across objectives and no multi-objective expressions in individual list elements. Differential Revision: D99387020
…one_with_args(objective=) Summary: Goal: We added `objectives` input, we're now migrating all usage to `objectives` and eliminating the `objective` input. This will make it easier to eliminate `MultiObjective` and `MultiObjectiveOptimizationConfig`. Phase 1 of the OptimizationConfig simplification migration: - Add DeprecationWarning when passing objective= to OptimizationConfig.__init__ - Remove the objective setter on OptimizationConfig (MOOC keeps its own) - Remove objective= param from OptimizationConfig.clone_with_args (MOOC/PreferenceOC keep theirs) - Migrate all callers of the removed setter and clone_with_args(objective=) Differential Revision: D99491494
Summary: Migrate all production (non-test, non-stubs) callers of OptimizationConfig(objective=...) to use the new objectives=[...] parameter. This is part of the phased deprecation of the objective= keyword argument. Mechanical migration of all base OptimizationConfig callers in core_stubs.py from the deprecated objective= kwarg to objectives=[...]. MultiObjectiveOptimizationConfig callers are not changed. This is part of a phased deprecation of the objective= parameter from OptimizationConfig.__init__. Differential Revision: D99504973 [Easy][Ax] Migrate core_stubs.py from objective= to objectives=[] D99506123
Summary: Mechanical migration of base OptimizationConfig callers in test files under ax/core/tests/ and ax/adapter/transforms/tests/ from the deprecated objective= kwarg to objectives=[...]. MultiObjectiveOptimizationConfig callers are not changed. Files changed: - ax/core/tests/test_optimization_config.py - ax/core/tests/test_derived_metric.py - ax/core/tests/test_experiment.py - ax/core/tests/test_multi_type_experiment.py - ax/core/tests/test_utils.py - ax/adapter/transforms/tests/test_log_y_transform.py - ax/adapter/transforms/tests/test_power_y_transform.py - ax/adapter/transforms/tests/test_standardize_y_transform.py - ax/adapter/transforms/tests/test_stratified_standardize_y_transform.py Differential Revision: D99506710
|
@saitcakmak has exported this pull request. If you are a Meta employee, you can view the originating Diff in D99506710. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5155 +/- ##
==========================================
+ Coverage 96.39% 96.40% +0.01%
==========================================
Files 613 613
Lines 68385 68493 +108
==========================================
+ Hits 65919 66031 +112
+ Misses 2466 2462 -4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Summary:
Mechanical migration of base OptimizationConfig callers in test files under
ax/core/tests/ and ax/adapter/transforms/tests/ from the deprecated
objective= kwarg to objectives=[...].
MultiObjectiveOptimizationConfig callers are not changed.
Files changed:
Differential Revision: D99506710