From b0b98e3564c86c741619db296ece7ddd43564610 Mon Sep 17 00:00:00 2001 From: Lena Kashtelyan Date: Thu, 16 May 2019 14:12:39 -0700 Subject: [PATCH] Service API tutorial formatting fix Summary: There was some JSON formatting issue in the tutorial, which prevented it from rendering in Bento. Reuploaded and fixed here Reviewed By: ldworkin Differential Revision: D15377991 fbshipit-source-id: 26ee32f261a71768c016d4d6905666efb00128d1 --- tutorials/gpei_hartmann_service.ipynb | 95 +++++++++++---------------- 1 file changed, 38 insertions(+), 57 deletions(-) diff --git a/tutorials/gpei_hartmann_service.ipynb b/tutorials/gpei_hartmann_service.ipynb index b3f18c6c4af..d876b5e36c5 100644 --- a/tutorials/gpei_hartmann_service.ipynb +++ b/tutorials/gpei_hartmann_service.ipynb @@ -102,7 +102,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "[INFO 05-07 12:48:02] ipy_plotting: Injecting Plotly library into cell. Do not overwrite or delete cell.\n" + "[INFO 05-16 11:12:00] ipy_plotting: Injecting Plotly library into cell. Do not overwrite or delete cell.\n" ] } ], @@ -136,7 +136,7 @@ }, "outputs": [], "source": [ - "ax_client = AxClient()" + "ax = AxClient()" ] }, { @@ -161,12 +161,12 @@ "name": "stderr", "output_type": "stream", "text": [ - "[INFO 05-07 12:48:02] ax.service.utils.dispatch: Using Bayesian Optimization generation strategy. Iterations after 6 will take longer to generate due to model-fitting.\n" + "[INFO 05-16 11:12:00] ax.service.utils.dispatch: Using Bayesian Optimization generation strategy. Iterations after 6 will take longer to generate due to model-fitting.\n" ] } ], "source": [ - "ax_client.create_experiment(\n", + "ax.create_experiment(\n", " name=\"hartmann_test_experiment\",\n", " parameters=[\n", " {\n", @@ -287,23 +287,7 @@ "Running trial 26/30...\n", "Running trial 27/30...\n", "Running trial 28/30...\n", - "Running trial 29/30...\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/mnt/xarfuse/uid-132168/dd4aa69e-ns-4026531840/botorch/optim/optimize.py:241: BadInitialCandidatesWarning:\n", - "\n", - "Unable to find non-zero acquistion function values - initial conditions are being selected randomly.\n", - "\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ + "Running trial 29/30...\n", "Running trial 30/30...\n" ] } @@ -311,9 +295,9 @@ "source": [ "for i in range(30):\n", " print(f\"Running trial {i+1}/30...\")\n", - " parameters, trial_index = ax_client.get_next_trial()\n", + " parameters, trial_index = ax.get_next_trial()\n", " # Local evaluation here can be replaced with deployment to external system.\n", - " ax_client.complete_trial(trial_index=trial_index, raw_data=evaluate(parameters))" + " ax.complete_trial(trial_index=trial_index, raw_data=evaluate(parameters))" ] }, { @@ -333,23 +317,23 @@ { "data": { "text/plain": [ - "{'x1': 0.39840772006583164,\n", - " 'x2': 0.8456785922105853,\n", - " 'x3': 0.5456340573033964,\n", - " 'x4': 0.5441807097161516,\n", - " 'x5': 0.282668984460409,\n", - " 'x6': 0.03372333172147051}" + "{'x1': 0.21127060890423158,\n", + " 'x2': 0.12958624276430736,\n", + " 'x3': 0.46672446090247494,\n", + " 'x4': 0.29155022697999494,\n", + " 'x5': 0.29405611196836107,\n", + " 'x6': 0.6731283134175391}" ] }, "execution_count": 6, "metadata": { - "bento_obj_id": "139631101307424" + "bento_obj_id": "139775054299496" }, "output_type": "execute_result" } ], "source": [ - "best_parameters, values = ax_client.get_best_parameters()\n", + "best_parameters, values = ax.get_best_parameters()\n", "best_parameters" ] }, @@ -361,12 +345,12 @@ { "data": { "text/plain": [ - "{'hartmann6': -3.1195206874557275, 'l2norm': 1.244503603746641}" + "{'hartmann6': -3.2882678801628886, 'l2norm': 0.9507007106922534}" ] }, "execution_count": 7, "metadata": { - "bento_obj_id": "139631048357784" + "bento_obj_id": "139775021640584" }, "output_type": "execute_result" } @@ -396,7 +380,7 @@ }, "execution_count": 8, "metadata": { - "bento_obj_id": "139631113579328" + "bento_obj_id": "139775055114696" }, "output_type": "execute_result" } @@ -410,7 +394,7 @@ "metadata": {}, "source": [ "## 6. Plot the response surface and optimization trace\n", - "Here we arbitrarily select \"x1\" and \"x2\" as the two parameters to plot for \"hartmann6\". The remainder of the parameters will be fixed at the middle of their range, 0.5." + "Here we arbitrarily select \"x1\" and \"x2\" as the two parameters to plot for both metrics, \"hartmann6\" and \"l2norm\"." ] }, { @@ -421,7 +405,7 @@ { "data": { "text/html": [ - "
" ] }, @@ -726,7 +710,7 @@ "source": [ "render(\n", " plot_contour(\n", - " model=ax_client.generation_strategy.model, param_x='x1', param_y='x2', metric_name='hartmann6'\n", + " model=ax.generation_strategy.model, param_x='x1', param_y='x2', metric_name='hartmann6'\n", " )\n", ")" ] @@ -746,7 +730,7 @@ { "data": { "text/html": [ - "