Skip to content

Use compute_metric_availability in AxClient.fit_model#5111

Closed
sdaulton wants to merge 1 commit into
facebook:mainfrom
sdaulton:export-D98208718
Closed

Use compute_metric_availability in AxClient.fit_model#5111
sdaulton wants to merge 1 commit into
facebook:mainfrom
sdaulton:export-D98208718

Conversation

@sdaulton
Copy link
Copy Markdown
Contributor

Summary:
The previous data check in fit_model only verified that the DataFrame
was non-empty (lookup_data().df.empty), which would pass even when data
existed for only a subset of required metrics. This could allow model
fitting to proceed with incomplete data, leading to downstream errors.

Replace the manual check with compute_metric_availability() from
ax.core.utils, which inspects per-trial metric coverage against the
optimization config's required metrics. fit_model now raises
DataRequiredError unless at least one completed trial has data for
all required metrics (MetricAvailability.COMPLETE).

Reviewed By: saitcakmak

Differential Revision: D98208718

Summary:
The previous data check in `fit_model` only verified that the DataFrame
was non-empty (`lookup_data().df.empty`), which would pass even when data
existed for only a subset of required metrics. This could allow model
fitting to proceed with incomplete data, leading to downstream errors.

Replace the manual check with `compute_metric_availability()` from
`ax.core.utils`, which inspects per-trial metric coverage against the
optimization config's required metrics. `fit_model` now raises
`DataRequiredError` unless at least one completed trial has data for
**all** required metrics (`MetricAvailability.COMPLETE`).

Reviewed By: saitcakmak

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

meta-codesync Bot commented Mar 30, 2026

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

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.42%. Comparing base (218bf55) to head (649197f).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5111      +/-   ##
==========================================
+ Coverage   96.41%   96.42%   +0.01%     
==========================================
  Files         613      613              
  Lines       68131    68142      +11     
==========================================
+ Hits        65687    65705      +18     
+ Misses       2444     2437       -7     

☔ 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.

@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented Mar 30, 2026

This pull request has been merged in 8ec8faa.

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