Skip to content

Normalize legacy scalarized constraints at construction - #5336

Open
saitcakmak wants to merge 2 commits into
meta:mainfrom
saitcakmak:export-D134595196
Open

saitcakmak wants to merge 2 commits into
meta:mainfrom
saitcakmak:export-D134595196

Conversation

@saitcakmak

Copy link
Copy Markdown
Contributor

Summary:

What Changed

Make the deprecated ScalarizedOutcomeConstraint(...) constructor a factory returning a plain, expression-backed OutcomeConstraint, now that JSON serialization (D135145413, landed), SQL storage (D134526278, landed), and all Ax callers (D135150118..D136125784) handle multi-metric OutcomeConstraints natively.

  • Raise UserInputError when metrics is empty (with unit test coverage).
  • Remove ScalarizedOutcomeConstraint from CORE_ENCODER_REGISTRY and SQL encoder/decoder, while keeping legacy JSON tags and legacy SQL rows readable as OutcomeConstraint.
  • Update remaining unit tests and stubs expecting the deprecated subclass.

This intentionally stops exposing ScalarizedOutcomeConstraint as a class. Callers using isinstance, subclassing, or .weights must use OutcomeConstraint, is_scalarized, and metric_weights. No SQL schema change.

Differential Revision: D134595196

…, and stopping (meta#5335)

Summary:

## What Changed
- `service/utils/best_point.py` (`is_row_feasible`): evaluate multi-metric constraints per arm/trial using combined weighted mean and independent-metric SEM, and check missingness across all `oc.metric_names`.
- `global_stopping/strategies/improvement.py`: evaluate weighted sum across all constraint components in `constraint_is_satisfied`.
- `api/utils/instantiation/from_string.py` and `plot/pareto_utils.py`: check all `metric_names` in an `OutcomeConstraint` against objective metrics.
- `core/experiment.py` (`metric_config_summary_df`) and `orchestration/orchestrator.py`: collect and format all component metrics for scalarized constraints.

___

landed-with-radar-review

Differential Revision: D136125781
Summary:
## What Changed
Make the deprecated `ScalarizedOutcomeConstraint(...)` constructor a factory returning a plain, expression-backed `OutcomeConstraint`, now that JSON serialization (D135145413, landed), SQL storage (D134526278, landed), and all Ax callers (D135150118..D136125784) handle multi-metric `OutcomeConstraint`s natively.

- Raise `UserInputError` when `metrics` is empty (with unit test coverage).
- Remove `ScalarizedOutcomeConstraint` from `CORE_ENCODER_REGISTRY` and SQL encoder/decoder, while keeping legacy JSON tags and legacy SQL rows readable as `OutcomeConstraint`.
- Update remaining unit tests and stubs expecting the deprecated subclass.

This intentionally stops exposing `ScalarizedOutcomeConstraint` as a class. Callers using `isinstance`, subclassing, or `.weights` must use `OutcomeConstraint`, `is_scalarized`, and `metric_weights`. No SQL schema change.

Differential Revision: D134595196
@meta-cla meta-cla Bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Dec 4, 2026
@meta-codesync

meta-codesync Bot commented Dec 4, 2026

Copy link
Copy Markdown

@saitcakmak has exported this pull request. If you are a Meta employee, you can view the originating Diff in D134595196.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.00000% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.62%. Comparing base (181c4f7) to head (f2d3b08).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
ax/plot/pareto_utils.py 0.00% 3 Missing ⚠️
ax/global_stopping/strategies/improvement.py 85.71% 1 Missing ⚠️
ax/service/utils/best_point.py 96.87% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5336      +/-   ##
==========================================
- Coverage   96.62%   96.62%   -0.01%     
==========================================
  Files         621      621              
  Lines       71460    71518      +58     
==========================================
+ Hits        69048    69104      +56     
- Misses       2412     2414       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Do not delete this pull request or issue due to inactivity. meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants