"## Adding Regularization to Prevent Overfitting\n",
"\n",
"Regularization is a technique used to avoid **overfitting**. Overfitting happens\n",
"when your model does well on the data it is trained on, but worse on test data\n",
"that the model has not seen before, such as live traffic. Overfitting generally\n",
"occurs when a model is excessively complex, such as having too many parameters\n",
"relative to the number of observed training data. Regularization allows for you\n",
"to control your model's complexity and makes the model more generalizable to\n",
"unseen data.\n",
"Regularization is a technique used to avoid overfitting. Overfitting happens when a model performs well on the data it is trained on, but worse on test data that the model has not seen before. Overfitting can occur when a model is excessively complex, such as having too many parameters relative to the number of observed training data. Regularization allows you to control the model's complexity and make the model more generalizable to unseen data.\n",
"\n",
"You can add L1 and L2 regularizations to the model with the following code:"
]
...
...
@@ -1446,12 +1243,7 @@
"metadata": {
"id": "lzMUSBQ03hHx",
"colab_type": "code",
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
}
}
"colab": {}
},
"cell_type": "code",
"source": [
...
...
@@ -1476,12 +1268,7 @@
"metadata": {
"id": "ofmPL212JIy2",
"colab_type": "code",
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
}
}
"colab": {}
},
"cell_type": "code",
"source": [
...
...
@@ -1509,19 +1296,14 @@
},
"cell_type": "markdown",
"source": [
"These regularized models don't perform very differently base model. Let look ar the models' weight distributions to better see the effect of the regularization:"
"These regularized models don't perform very differently than the base model. Let's look ar the models' weight distributions to better see the effect of the regularization:"