Skip to content

Commit c0451c3

Browse files
author
Lucas Zimmer
committed
Clarifications in the tutorial
1 parent a1ea8a4 commit c0451c3

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

examples/basics/Auto-PyTorch Tutorial.ipynb

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"cell_type": "markdown",
5151
"metadata": {},
5252
"source": [
53-
"Upon initialization of a class, you can specify its configuration. The *config_preset* allows to constrain the search space to one of *tiny_cs, medium_cs* or *full_cs*. These presets can be seen in *core/presets/*."
53+
"Upon initialization of a class, you can specify its configuration. Later, you can override its configuration in each fit call. The *config_preset* allows to constrain the search space to one of *tiny_cs, medium_cs* or *full_cs*. These presets can be seen in *core/presets/*."
5454
]
5555
},
5656
{
@@ -93,7 +93,7 @@
9393
"source": [
9494
"The most important methods for using Auto-PyTorch are **fit**, **refit**, **score** and **predict**.\n",
9595
"\n",
96-
"**fit** is used to search for a configuration:"
96+
"**fit** is used to search for a good configuration by fitting different parameter configurations. The incumbent configuration is then returned and stored in the class:"
9797
]
9898
},
9999
{
@@ -151,21 +151,19 @@
151151
"cell_type": "markdown",
152152
"metadata": {},
153153
"source": [
154-
"**refit** allows you to fit a configuration of your choice for a defined time:"
154+
"**refit** allows you to fit a configuration of your choice for a defined time. You can specify a hyperparameter configuration to fit (if you do not specify a configuration the incumbent configuration from the last fit call will be used):"
155155
]
156156
},
157157
{
158158
"cell_type": "code",
159159
"execution_count": null,
160-
"metadata": {
161-
"scrolled": true
162-
},
160+
"metadata": {},
163161
"outputs": [],
164162
"source": [
165163
"# Create an autonet, use tensorboard during fitting\n",
166164
"autonet_config = {\n",
167165
" \"result_logger_dir\" : \"logs/\",\n",
168-
" \"budget_type\" : \"epochs\",\n",
166+
" \"budget_type\" : \"time\",\n",
169167
" \"log_level\" : \"info\", \n",
170168
" \"use_tensorboard_logger\" : True\n",
171169
" }\n",
@@ -174,14 +172,14 @@
174172
"# This samples a random hyperparameter configuration as an example\n",
175173
"hyperparameter_config = autonet.get_hyperparameter_search_space().sample_configuration().get_dictionary()\n",
176174
"\n",
177-
"# Refit with sampled hyperparameter config for 10 epochs. This time on the full dataset.\n",
175+
"# Refit with sampled hyperparameter config for 120 s. This time on the full dataset.\n",
178176
"results_refit = autonet.refit(X_train=X_train,\n",
179177
" Y_train=Y_train,\n",
180178
" X_valid=None,\n",
181179
" Y_valid=None,\n",
182180
" hyperparameter_config=hyperparameter_config,\n",
183181
" autonet_config=autonet.get_current_autonet_config(),\n",
184-
" budget=10)\n",
182+
" budget=120)\n",
185183
"\n",
186184
"# Save json\n",
187185
"with open(\"logs/results_refit.json\", \"w\") as file:\n",
@@ -201,18 +199,19 @@
201199
"metadata": {},
202200
"outputs": [],
203201
"source": [
202+
"# Print score of found configuration\n",
204203
"score = autonet.score(X_test=X_test, Y_test=Y_test)\n",
205204
"pred = autonet.predict(X=X_test)\n",
206205
"\n",
207-
"print(\"Model prediction:\", pred)\n",
206+
"print(\"Model prediction:\", pred[0:10])\n",
208207
"print(\"Accuracy score\", score)"
209208
]
210209
},
211210
{
212211
"cell_type": "markdown",
213212
"metadata": {},
214213
"source": [
215-
"Finall, you can also get the incumbent model as PyTorch Sequential model via"
214+
"Finally, you can also get the incumbent model as PyTorch Sequential model via"
216215
]
217216
},
218217
{
@@ -321,9 +320,9 @@
321320
"autonet_image_classification.fit(X_train=X_train,\n",
322321
" Y_train=Y_train,\n",
323322
" images_shape=[3,32,32],\n",
324-
" min_budget=100,\n",
325-
" max_budget=200,\n",
326-
" max_runtime=400,\n",
323+
" min_budget=900,\n",
324+
" max_budget=1200,\n",
325+
" max_runtime=3000,\n",
327326
" save_checkpoints=True,\n",
328327
" images_root_folders=[os.path.abspath(\"../../datasets/example_images\")])"
329328
]

0 commit comments

Comments
 (0)