Created using Colab

This commit is contained in:
udlbook
2025-08-26 07:47:09 -04:00
parent a644267053
commit 44a3e5f678

View File

@@ -293,9 +293,11 @@
"cell_type": "code",
"source": [
"# Plot the noise, bias and variance as a function of capacity\n",
"hidden_variables = [1,2,3,4,5,6,7,8,9,10,11,12]\n",
"n_hidden = 12\n",
"hidden_variables = list(range(1, n_hidden + 1))\n",
"bias = np.zeros((len(hidden_variables),1)) ;\n",
"variance = np.zeros((len(hidden_variables),1)) ;\n",
"# Plot the noise, bias and variance as a function of capacity\n",
"\n",
"n_datasets = 100\n",
"n_data = 15\n",
@@ -321,7 +323,7 @@
"ax.plot(hidden_variables, variance, 'k-')\n",
"ax.plot(hidden_variables, bias, 'r-')\n",
"ax.plot(hidden_variables, variance+bias, 'g-')\n",
"ax.set_xlim(0,12)\n",
"ax.set_xlim(0,n_hidden)\n",
"ax.set_ylim(0,0.5)\n",
"ax.set_xlabel(\"Model capacity\")\n",
"ax.set_ylabel(\"Variance\")\n",
@@ -333,15 +335,6 @@
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [],
"metadata": {
"id": "WKUyOAywL_b2"
},
"execution_count": null,
"outputs": []
}
]
}