Skip to content

Commit 43cf3a3

Browse files
Update 14_spot_ray_hpt_torch_cifar10.ipynb
criterion -> loss_function
1 parent afbc395 commit 43cf3a3

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

notebooks/14_spot_ray_hpt_torch_cifar10.ipynb

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -857,6 +857,7 @@
857857
]
858858
},
859859
{
860+
"attachments": {},
860861
"cell_type": "markdown",
861862
"metadata": {},
862863
"source": [
@@ -905,7 +906,12 @@
905906
"\n",
906907
"### Loss Functions and Metrics\n",
907908
"\n",
908-
"The key `\"criterion\"` specifies the loss function which is used during the optimization. There are several different loss functions under `PyTorch`'s nn package. For example, a simple loss is `MSELoss`, which computes the mean-squared error between the output and the target. In this tutorial we will use `CrossEntropyLoss`, because it is also used in the `PyTorch` tutorial."
909+
"::: {.callout-warning}\n",
910+
"#### Use of the Key `\"criterion\"` is deprecated as of `v.0.1.5`\n",
911+
"Starting with version `v.0.1.5` `spotPython` uses the key `\"loss_function\"` for loss functions instead of `\"criterion\"`.\n",
912+
":::\n",
913+
"\n",
914+
"The key `\"loss_function\"` specifies the loss function which is used during the optimization. There are several different loss functions under `PyTorch`'s nn package. For example, a simple loss is `MSELoss`, which computes the mean-squared error between the output and the target. In this tutorial we will use `CrossEntropyLoss`, because it is also used in the `PyTorch` tutorial."
909915
]
910916
},
911917
{
@@ -914,7 +920,7 @@
914920
"metadata": {},
915921
"outputs": [],
916922
"source": [
917-
"fun_control = modify_hyper_parameter_levels(fun_control, \"criterion\", [\"CrossEntropyLoss\"])"
923+
"fun_control = modify_hyper_parameter_levels(fun_control, \"loss_function\", [\"CrossEntropyLoss\"])"
918924
]
919925
},
920926
{
@@ -933,7 +939,7 @@
933939
"source": [
934940
"#| echo: true\n",
935941
"weights = 1.0\n",
936-
"criterion = CrossEntropyLoss\n",
942+
"loss_function = CrossEntropyLoss\n",
937943
"shuffle = True\n",
938944
"eval = \"train_hold_out\"\n",
939945
"device = DEVICE\n",
@@ -952,7 +958,7 @@
952958
" \"weight_coeff\": None,\n",
953959
" \"metric\": None,\n",
954960
" \"metric_sklearn\": None,\n",
955-
" \"criterion\": criterion,\n",
961+
" \"loss_function\": loss_function,\n",
956962
" \"shuffle\": shuffle,\n",
957963
" \"eval\": eval,\n",
958964
" \"device\": device,\n",
@@ -2265,6 +2271,7 @@
22652271
]
22662272
},
22672273
{
2274+
"attachments": {},
22682275
"cell_type": "markdown",
22692276
"metadata": {},
22702277
"source": [
@@ -2273,7 +2280,7 @@
22732280
"```{raw}\n",
22742281
"config: {'l1': 64, 'l2': 32, 'lr': 0.008391430243550081, \n",
22752282
" 'batch_size': 4, 'epochs': 16, 'k_folds': 0, 'patience': 3,\n",
2276-
" 'optimizer': 'Adam', 'criterion': CrossEntropyLoss()}\n",
2283+
" 'optimizer': 'Adam', 'loss_function': CrossEntropyLoss()}\n",
22772284
"Epoch: 9\n",
22782285
"Batch: 1000. Batch Size: 4. Training Loss (running): 2.308\n",
22792286
"Batch: 2000. Batch Size: 4. Training Loss (running): 1.153\n",

0 commit comments

Comments
 (0)