Skip to content

Commit 58cdea1

Browse files
Adding updated custom encode_dim loss decorator
1 parent 1abce70 commit 58cdea1

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

notebooks/tuning/minndae.ipynb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,11 @@
113113
" # create model\n",
114114
" autoencoder = MinNDAE(config)\n",
115115
" \n",
116-
" # get custom loss func\n",
117-
" loss_function = build_encode_dim_loss_function(encode_dim, regularization_factor=REG_FACTOR)\n",
116+
" # get custom loss func using decorator factory\n",
117+
" custom_loss = build_encode_dim_loss_function(encode_dim, regularization_factor=REG_FACTOR)()\n",
118118
" \n",
119119
" # select loss function\n",
120-
" autoencoder.compile(optimizer=\"adam\", loss=loss_function)\n",
120+
" autoencoder.compile(optimizer=\"adam\", loss=custom_loss)\n",
121121
"\n",
122122
" # now return keras model\n",
123123
" return autoencoder.model"
@@ -143,15 +143,15 @@
143143
"source": [
144144
"# get hyperparam tools\n",
145145
"from keras.callbacks import EarlyStopping\n",
146-
"from keras_tuner import GridSearch\n",
146+
"from keras_tuner import RandomSearch\n",
147147
"\n",
148148
"# setup tuner\n",
149-
"tuner = GridSearch(\n",
149+
"tuner = RandomSearch(\n",
150150
" build_autoencoder,\n",
151151
" objective=\"val_loss\",\n",
152-
" max_trials=50,\n",
152+
" max_trials=100,\n",
153153
" directory=\"autoencoder_tuning/minndae\",\n",
154-
" project_name=f\"grid_search_encode_dim_{REG_FACTOR}_reg\",\n",
154+
" project_name=f\"random_search_encode_dim_{REG_FACTOR}_reg\",\n",
155155
" seed=42,\n",
156156
")\n",
157157
"\n",
@@ -162,7 +162,7 @@
162162
"tuner.search_space_summary()\n",
163163
"\n",
164164
"# run the hyperparameter search\n",
165-
"tuner.search(train_ds, epochs=10, validation_data=test_ds, callbacks=[stop_early])"
165+
"tuner.search(train_ds, epochs=3, validation_data=test_ds, callbacks=[stop_early])"
166166
]
167167
},
168168
{

0 commit comments

Comments
 (0)