Skip to content

Commit

Permalink
Replace usage of exp_to_df with Experiment.to_df (#3279)
Browse files Browse the repository at this point in the history
Summary:

Updates some use cases of `exp_to_df` to utilize `Experiment.to_df`. This diff handles most usage that doesn't rely on the kwargs exposed on `exp_to_df`. The remaining usage will be updated after adding the necessary options to `Experiment.to_df`.

Differential Revision: D68774600
  • Loading branch information
saitcakmak authored and facebook-github-bot committed Jan 28, 2025
1 parent 73d4dab commit d66aaeb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
5 changes: 2 additions & 3 deletions ax/modelbridge/tests/test_torch_moo_modelbridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
infer_objective_thresholds,
pareto_frontier_evaluator,
)
from ax.service.utils.report_utils import exp_to_df
from ax.utils.common.random import set_rng_seed
from ax.utils.common.testutils import TestCase
from ax.utils.testing.core_stubs import (
Expand Down Expand Up @@ -546,7 +545,7 @@ def test_infer_objective_thresholds(self, _, cuda: bool = False) -> None:
self.assertEqual(obj_thresholds[1].op, ComparisonOp.LEQ)
self.assertFalse(obj_thresholds[0].relative)
self.assertFalse(obj_thresholds[1].relative)
df = exp_to_df(exp)
df = exp.to_df()
Y = np.stack([df.branin_a.values, df.branin_b.values]).T
Y = torch.from_numpy(Y)
Y[:, 0] *= -1
Expand Down Expand Up @@ -616,7 +615,7 @@ def test_infer_objective_thresholds(self, _, cuda: bool = False) -> None:
self.assertEqual(obj_thresholds[1].op, ComparisonOp.LEQ)
self.assertFalse(obj_thresholds[0].relative)
self.assertFalse(obj_thresholds[1].relative)
df = exp_to_df(exp)
df = exp.to_df()
trial_mask = df.trial_index == 1
Y = np.stack([df.branin_a.values[trial_mask], df.branin_b.values[trial_mask]]).T
Y = torch.from_numpy(Y)
Expand Down
3 changes: 1 addition & 2 deletions ax/service/ax_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@
InstantiationBase,
ObjectiveProperties,
)
from ax.service.utils.report_utils import exp_to_df
from ax.service.utils.with_db_settings_base import DBSettings
from ax.storage.json_store.decoder import (
generation_strategy_from_json,
Expand Down Expand Up @@ -920,7 +919,7 @@ def get_trials_data_frame(self) -> pd.DataFrame:
one-arm trials, which is the case in base ``AxClient``; will correspond
to arms in trials in the batch-trial case).
"""
return exp_to_df(exp=self.experiment)
return self.experiment.to_df()

def get_max_parallelism(self) -> list[tuple[int, int]]:
"""Retrieves maximum number of trials that can be scheduled in parallel
Expand Down

0 comments on commit d66aaeb

Please sign in to comment.