Skip to content

Commit

Permalink
Created using Colaboratory
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-mushtaq committed May 25, 2021
1 parent b20c1ba commit 78058d6
Showing 1 changed file with 78 additions and 1 deletion.
79 changes: 78 additions & 1 deletion Deep_Learning_with_Keras.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"name": "Deep Learning with Keras.ipynb",
"provenance": [],
"toc_visible": true,
"authorship_tag": "ABX9TyNMTvNCHSQwzWnINdbmjdoX",
"authorship_tag": "ABX9TyMsjIHo/nxUPEQkKV/Owj0f",
"include_colab_link": true
},
"kernelspec": {
Expand Down Expand Up @@ -1849,6 +1849,83 @@
"### **1.5 Keras callbacks**\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "K8YZexVh8xbm"
},
"source": [
"**1. Keras callbacks**\n",
"\n",
"By now you've trained a lot of models. It's time to learn more about how to better control and supervise model training by using callbacks.\n",
"\n",
"**2. What is a callback?**\n",
"\n",
"A callback is a function that is executed after some other function, event, or task has finished. For instance, when you touch your phone screen, a block of code that identifies the type of gesture will be triggered. Since this block of code has been called after the touching event occurred, it's a callback."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "i9aWbrGx-Q3s"
},
"source": [
"![](https://drive.google.com/uc?export=view&id=10Qq4jNXDAYNfqvvQe_EB_fLGH4exiCLL\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "R72vo8f9-WJT"
},
"source": [
"**3. Callbacks in Keras**\n",
"\n",
"In the same way, a keras callback is a block of code that gets executed after each epoch during training or after the training is finished. They are useful to store metrics as the model trains and to make decisions as the training goes by"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "73ILMgFT-5SL"
},
"source": [
"![](https://drive.google.com/uc?export=view&id=1fSWIRWa9McKbWfT9pZlUwq03p7kuBEYv)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "yC3XNKVV_ruj"
},
"source": [
"**4. A callback you've been missing**\n",
"\n",
"Every time you call the fit method on a keras model there's a callback object that gets returned after the model finishes training. This is the history object. Accessing the history attribute, which is a python dictionary,we can check the saved metrics of the model at each epoch during training as an array of numbers."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "NvjLVL4yAM8C"
},
"source": [
"![](\n",
"https://drive.google.com/uc?export=view&id=18Ld8VcDVPyDmE4ilWWDf-xUu_3hU8ENy)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "53--fzeeAkX6"
},
"source": [
"**5. A callback you've been missing**\n",
"\n",
"To get the most out of the history object we should use the validation_data parameter in our fit method, passing X_test and y_test as a tuple. The validation_split parameter can be used instead, specifying a percentage of the training data that will be left out for testing purposes. That way we not only have the training metrics but also the validation metrics."
]
},
{
"cell_type": "markdown",
"metadata": {
Expand Down

0 comments on commit 78058d6

Please sign in to comment.