From f1a5d87bb72ff3fb4263c7a82f2c7d65f2a19af0 Mon Sep 17 00:00:00 2001 From: Miles Olson Date: Thu, 3 Nov 2022 12:05:10 -0700 Subject: [PATCH] Fix tutorials after introduction of MetricFetchResult Summary: A few tutorials were not compatible with the new way we fetch data. In this diff we change custom metrics to return Ok(data) instead of data, and change `trial.fetch_data()` => `Metric._unwrap_trial_data_multi(results=trial.fetch_data())`. In the future we may want to add some copy in the tutorials discussing Result, but we should land this for now to get things working again ASAP Differential Revision: D40994060 fbshipit-source-id: 0246818e55659090fdd12cd1082bc8d807c93b27 --- tutorials/custom_botorch_model_in_ax.ipynb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tutorials/custom_botorch_model_in_ax.ipynb b/tutorials/custom_botorch_model_in_ax.ipynb index 3d79c4163a..1387864666 100644 --- a/tutorials/custom_botorch_model_in_ax.ipynb +++ b/tutorials/custom_botorch_model_in_ax.ipynb @@ -1085,6 +1085,7 @@ " Runner,\n", " SearchSpace,\n", ")\n", + "from ax.utils.common.result import Ok\n", "from botorch.test_functions import Branin\n", "\n", "\n", @@ -1106,7 +1107,7 @@ " \"sem\": float(\"nan\"), # SEM (observation noise) - NaN indicates unknown\n", " }\n", " )\n", - " return Data(df=pd.DataFrame.from_records(records))\n", + " return Ok(value=Data(df=pd.DataFrame.from_records(records)))\n", "\n", "\n", "# Search space defines the parameters, their types, and acceptable values.\n",