Skip to content

Commit d14abed

Browse files
Richa Gadgilmeta-codesync[bot]
authored andcommitted
Fix ValueError in FillMissingParameters with empty experiment data (#4973)
Summary: Pull Request resolved: #4973 `FillMissingParameters.transform_experiment_data` crashes with `ValueError: Columns must be same length as key` when `arm_data` has zero rows (e.g., during initial Sobol trial generation before any trials have completed). This happens because `DataFrame.apply(func, axis=1)` on an empty DataFrame returns an empty DataFrame rather than an empty Series. Assigning that DataFrame to a single column then fails. Replace `arm_data.apply(...)` with a list comprehension over `arm_data.iterrows()`, which correctly produces an empty list for empty DataFrames. Failing run: https://www.internalfb.com/mlhub/flow/1044918711/overview Reviewed By: yuhuishi-convect, saitcakmak Differential Revision: D95266027
1 parent f973cb4 commit d14abed

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

ax/adapter/transforms/fill_missing_parameters.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,7 @@ def transform_experiment_data(
101101
if c != "metadata" and c not in self._derived_parameters
102102
]
103103
for p_name, p in self._derived_parameters.items():
104-
arm_data[p_name] = arm_data.apply(
105-
lambda row, p=p: p.compute({col: row[col] for col in tunable_cols}),
106-
axis=1,
107-
)
104+
arm_data[p_name] = p.compute_array(arm_data)
108105
return ExperimentData(
109106
arm_data=arm_data,
110107
observation_data=experiment_data.observation_data,

0 commit comments

Comments
 (0)