|
50 | 50 | "cell_type": "markdown", |
51 | 51 | "metadata": {}, |
52 | 52 | "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/*." |
54 | 54 | ] |
55 | 55 | }, |
56 | 56 | { |
|
93 | 93 | "source": [ |
94 | 94 | "The most important methods for using Auto-PyTorch are **fit**, **refit**, **score** and **predict**.\n", |
95 | 95 | "\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:" |
97 | 97 | ] |
98 | 98 | }, |
99 | 99 | { |
|
151 | 151 | "cell_type": "markdown", |
152 | 152 | "metadata": {}, |
153 | 153 | "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):" |
155 | 155 | ] |
156 | 156 | }, |
157 | 157 | { |
158 | 158 | "cell_type": "code", |
159 | 159 | "execution_count": null, |
160 | | - "metadata": { |
161 | | - "scrolled": true |
162 | | - }, |
| 160 | + "metadata": {}, |
163 | 161 | "outputs": [], |
164 | 162 | "source": [ |
165 | 163 | "# Create an autonet, use tensorboard during fitting\n", |
166 | 164 | "autonet_config = {\n", |
167 | 165 | " \"result_logger_dir\" : \"logs/\",\n", |
168 | | - " \"budget_type\" : \"epochs\",\n", |
| 166 | + " \"budget_type\" : \"time\",\n", |
169 | 167 | " \"log_level\" : \"info\", \n", |
170 | 168 | " \"use_tensorboard_logger\" : True\n", |
171 | 169 | " }\n", |
|
174 | 172 | "# This samples a random hyperparameter configuration as an example\n", |
175 | 173 | "hyperparameter_config = autonet.get_hyperparameter_search_space().sample_configuration().get_dictionary()\n", |
176 | 174 | "\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", |
178 | 176 | "results_refit = autonet.refit(X_train=X_train,\n", |
179 | 177 | " Y_train=Y_train,\n", |
180 | 178 | " X_valid=None,\n", |
181 | 179 | " Y_valid=None,\n", |
182 | 180 | " hyperparameter_config=hyperparameter_config,\n", |
183 | 181 | " autonet_config=autonet.get_current_autonet_config(),\n", |
184 | | - " budget=10)\n", |
| 182 | + " budget=120)\n", |
185 | 183 | "\n", |
186 | 184 | "# Save json\n", |
187 | 185 | "with open(\"logs/results_refit.json\", \"w\") as file:\n", |
|
201 | 199 | "metadata": {}, |
202 | 200 | "outputs": [], |
203 | 201 | "source": [ |
| 202 | + "# Print score of found configuration\n", |
204 | 203 | "score = autonet.score(X_test=X_test, Y_test=Y_test)\n", |
205 | 204 | "pred = autonet.predict(X=X_test)\n", |
206 | 205 | "\n", |
207 | | - "print(\"Model prediction:\", pred)\n", |
| 206 | + "print(\"Model prediction:\", pred[0:10])\n", |
208 | 207 | "print(\"Accuracy score\", score)" |
209 | 208 | ] |
210 | 209 | }, |
211 | 210 | { |
212 | 211 | "cell_type": "markdown", |
213 | 212 | "metadata": {}, |
214 | 213 | "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" |
216 | 215 | ] |
217 | 216 | }, |
218 | 217 | { |
|
321 | 320 | "autonet_image_classification.fit(X_train=X_train,\n", |
322 | 321 | " Y_train=Y_train,\n", |
323 | 322 | " 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", |
327 | 326 | " save_checkpoints=True,\n", |
328 | 327 | " images_root_folders=[os.path.abspath(\"../../datasets/example_images\")])" |
329 | 328 | ] |
|
0 commit comments