Skip to content

Commit

Permalink
Adding updated custom encode_dim loss decorator
Browse files Browse the repository at this point in the history
  • Loading branch information
DiogenesAnalytics committed Jan 23, 2024
1 parent 1abce70 commit 58cdea1
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions notebooks/tuning/minndae.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,11 @@
" # create model\n",
" autoencoder = MinNDAE(config)\n",
" \n",
" # get custom loss func\n",
" loss_function = build_encode_dim_loss_function(encode_dim, regularization_factor=REG_FACTOR)\n",
" # get custom loss func using decorator factory\n",
" custom_loss = build_encode_dim_loss_function(encode_dim, regularization_factor=REG_FACTOR)()\n",
" \n",
" # select loss function\n",
" autoencoder.compile(optimizer=\"adam\", loss=loss_function)\n",
" autoencoder.compile(optimizer=\"adam\", loss=custom_loss)\n",
"\n",
" # now return keras model\n",
" return autoencoder.model"
Expand All @@ -143,15 +143,15 @@
"source": [
"# get hyperparam tools\n",
"from keras.callbacks import EarlyStopping\n",
"from keras_tuner import GridSearch\n",
"from keras_tuner import RandomSearch\n",
"\n",
"# setup tuner\n",
"tuner = GridSearch(\n",
"tuner = RandomSearch(\n",
" build_autoencoder,\n",
" objective=\"val_loss\",\n",
" max_trials=50,\n",
" max_trials=100,\n",
" directory=\"autoencoder_tuning/minndae\",\n",
" project_name=f\"grid_search_encode_dim_{REG_FACTOR}_reg\",\n",
" project_name=f\"random_search_encode_dim_{REG_FACTOR}_reg\",\n",
" seed=42,\n",
")\n",
"\n",
Expand All @@ -162,7 +162,7 @@
"tuner.search_space_summary()\n",
"\n",
"# run the hyperparameter search\n",
"tuner.search(train_ds, epochs=10, validation_data=test_ds, callbacks=[stop_early])"
"tuner.search(train_ds, epochs=3, validation_data=test_ds, callbacks=[stop_early])"
]
},
{
Expand Down

0 comments on commit 58cdea1

Please sign in to comment.