Skip to content

Commit

Permalink
[tune] fix hebo_example. (ray-project#26439)
Browse files Browse the repository at this point in the history
Fixes a bug in the the ipython notebook.
  • Loading branch information
xwjiang2010 authored Jul 11, 2022
1 parent b01e11d commit c97d65e
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 14 deletions.
1 change: 0 additions & 1 deletion doc/source/tune/examples/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ py_test_run_all_notebooks(
"nyc_taxi_basic_processing.ipynb", # REGRESSION
"ocr_example.ipynb", # REGRESSION
"bohb_example.ipynb", # REGRESSION
"hebo_example.ipynb", # REGRESSION
"horovod_simple.ipynb", # REGRESSION
"hyperopt_example.ipynb", # REGRESSION
"sigopt_example.ipynb", # REGRESSION
Expand Down
69 changes: 56 additions & 13 deletions doc/source/tune/examples/hebo_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
"metadata": {
"tags": [
"remove-cell"
]
],
"vscode": {
"languageId": "python"
}
},
"outputs": [],
"source": [
Expand All @@ -46,7 +49,10 @@
"metadata": {
"tags": [
"hide-input"
]
],
"vscode": {
"languageId": "python"
}
},
"outputs": [],
"source": [
Expand All @@ -73,7 +79,11 @@
"cell_type": "code",
"execution_count": null,
"id": "d654948a",
"metadata": {},
"metadata": {
"vscode": {
"languageId": "python"
}
},
"outputs": [],
"source": [
"def evaluate(step, width, height, activation):\n",
Expand All @@ -95,7 +105,11 @@
"cell_type": "code",
"execution_count": null,
"id": "b7e5f38b",
"metadata": {},
"metadata": {
"vscode": {
"languageId": "python"
}
},
"outputs": [],
"source": [
"def objective(config):\n",
Expand All @@ -111,7 +125,10 @@
"metadata": {
"tags": [
"remove-cell"
]
],
"vscode": {
"languageId": "python"
}
},
"outputs": [],
"source": [
Expand All @@ -133,7 +150,11 @@
"cell_type": "code",
"execution_count": null,
"id": "9aaf222e",
"metadata": {},
"metadata": {
"vscode": {
"languageId": "python"
}
},
"outputs": [],
"source": [
"\n",
Expand Down Expand Up @@ -169,7 +190,11 @@
"cell_type": "code",
"execution_count": null,
"id": "ea2a405c",
"metadata": {},
"metadata": {
"vscode": {
"languageId": "python"
}
},
"outputs": [],
"source": [
"num_samples = 1000"
Expand All @@ -182,7 +207,10 @@
"metadata": {
"tags": [
"remove-cell"
]
],
"vscode": {
"languageId": "python"
}
},
"outputs": [],
"source": [
Expand All @@ -203,14 +231,18 @@
"cell_type": "code",
"execution_count": null,
"id": "0a530e21",
"metadata": {},
"metadata": {
"vscode": {
"languageId": "python"
}
},
"outputs": [],
"source": [
"search_config = {\n",
" \"steps\": 100,\n",
" \"width\": tune.uniform(0, 20),\n",
" \"height\": tune.uniform(-100, 100),\n",
" \"activation\": tune.choice([\"relu, tanh\"])\n",
" \"activation\": tune.choice([\"relu\", \"tanh\"])\n",
"}"
]
},
Expand All @@ -226,7 +258,11 @@
"cell_type": "code",
"execution_count": null,
"id": "3fb63ef3",
"metadata": {},
"metadata": {
"vscode": {
"languageId": "python"
}
},
"outputs": [],
"source": [
"analysis = tune.run(\n",
Expand All @@ -252,7 +288,11 @@
"cell_type": "code",
"execution_count": null,
"id": "8b8a23e4",
"metadata": {},
"metadata": {
"vscode": {
"languageId": "python"
}
},
"outputs": [],
"source": [
"print(\"Best hyperparameters found were: \", analysis.best_config)"
Expand All @@ -265,7 +305,10 @@
"metadata": {
"tags": [
"remove-cell"
]
],
"vscode": {
"languageId": "python"
}
},
"outputs": [],
"source": [
Expand Down

0 comments on commit c97d65e

Please sign in to comment.