Skip to content

Override is_available_while_running on DerivedMetric (#5028)#5028

Closed
ItsMrLin wants to merge 2 commits into
facebook:mainfrom
ItsMrLin:export-D96558279
Closed

Override is_available_while_running on DerivedMetric (#5028)#5028
ItsMrLin wants to merge 2 commits into
facebook:mainfrom
ItsMrLin:export-D96558279

Conversation

@ItsMrLin
Copy link
Copy Markdown
Contributor

@ItsMrLin ItsMrLin commented Mar 14, 2026

Summary:

DerivedMetric.is_available_while_running() currently inherits the base
Metric default of False. This causes fetch_data_prefer_lookup to
skip derived metrics for running trials -- it returns cached data (which
is empty) instead of computing from freshly-fetched base data.

Override the classmethod to return True so derived metrics always
attempt to compute. If base data isn't available, fetch_trial_data
returns empty data which is handled gracefully downstream.

Differential Revision: D96558279

@meta-cla meta-cla Bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Mar 14, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented Mar 14, 2026

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

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.84%. Comparing base (f3fd499) to head (17540a0).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5028      +/-   ##
==========================================
- Coverage   96.84%   96.84%   -0.01%     
==========================================
  Files         605      605              
  Lines       65292    65316      +24     
==========================================
+ Hits        63233    63254      +21     
- Misses       2059     2062       +3     

☔ View full report in Codecov by Sentry.
📢 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.

Summary:
When `relativize_inputs=True`, the status quo arm was previously excluded
from the output because its relativized values are trivially zero.  This
is incorrect for non-linear expressions: `exp(0) = 1`, not 0.

Instead of skipping the SQ arm, construct a DataFrame with zero-valued
inputs for all input metrics and let `_compute_derived_values` evaluate
the expression on them.  This produces correct SQ output for any
expression (e.g., `a + b = 0`, `exp(a) = 1`).

Differential Revision: D96558255
@meta-codesync meta-codesync Bot changed the title Override is_available_while_running on DerivedMetric Override is_available_while_running on DerivedMetric (#5028) Mar 15, 2026
ItsMrLin added a commit to ItsMrLin/Ax that referenced this pull request Mar 15, 2026
Summary:

`DerivedMetric.is_available_while_running()` currently inherits the base
`Metric` default of `False`.  This causes `fetch_data_prefer_lookup` to
skip derived metrics for running trials -- it returns cached data (which
is empty) instead of computing from freshly-fetched base data.

Override the classmethod to return `True` so derived metrics always
attempt to compute.  If base data isn't available, `fetch_trial_data`
returns empty data which is handled gracefully downstream.

Differential Revision: D96558279
Summary:
Pull Request resolved: facebook#5028

`DerivedMetric.is_available_while_running()` currently inherits the base
`Metric` default of `False`.  This causes `fetch_data_prefer_lookup` to
skip derived metrics for running trials -- it returns cached data (which
is empty) instead of computing from freshly-fetched base data.

Override the classmethod to return `True` so derived metrics always
attempt to compute.  If base data isn't available, `fetch_trial_data`
returns empty data which is handled gracefully downstream.

Differential Revision: D96558279
ItsMrLin added a commit to ItsMrLin/Ax that referenced this pull request Mar 16, 2026
Summary:

`DerivedMetric.is_available_while_running()` currently inherits the base
`Metric` default of `False`.  This causes `fetch_data_prefer_lookup` to
skip derived metrics for running trials -- it returns cached data (which
is empty) instead of computing from freshly-fetched base data.

Override the classmethod to return `True` so derived metrics always
attempt to compute.  If base data isn't available, `fetch_trial_data`
returns empty data which is handled gracefully downstream.

Reviewed By: lena-kashtelyan

Differential Revision: D96558279
@meta-codesync meta-codesync Bot closed this in 77dd69f Mar 16, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented Mar 16, 2026

This pull request has been merged in 77dd69f.

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. fb-exported Merged meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants