Use compute_metric_availability in AxClient.fit_model#5111
Closed
sdaulton wants to merge 1 commit into
Closed
Conversation
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
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
|
This pull request has been merged in 8ec8faa. |
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:
The previous data check in
fit_modelonly verified that the DataFramewas non-empty (
lookup_data().df.empty), which would pass even when dataexisted 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()fromax.core.utils, which inspects per-trial metric coverage against theoptimization config's required metrics.
fit_modelnow raisesDataRequiredErrorunless at least one completed trial has data forall required metrics (
MetricAvailability.COMPLETE).Reviewed By: saitcakmak
Differential Revision: D98208718