Created using Colab
This commit is contained in:
@@ -293,9 +293,11 @@
|
|||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"source": [
|
"source": [
|
||||||
"# Plot the noise, bias and variance as a function of capacity\n",
|
"# 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",
|
"bias = np.zeros((len(hidden_variables),1)) ;\n",
|
||||||
"variance = 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",
|
||||||
"n_datasets = 100\n",
|
"n_datasets = 100\n",
|
||||||
"n_data = 15\n",
|
"n_data = 15\n",
|
||||||
@@ -321,7 +323,7 @@
|
|||||||
"ax.plot(hidden_variables, variance, 'k-')\n",
|
"ax.plot(hidden_variables, variance, 'k-')\n",
|
||||||
"ax.plot(hidden_variables, bias, 'r-')\n",
|
"ax.plot(hidden_variables, bias, 'r-')\n",
|
||||||
"ax.plot(hidden_variables, variance+bias, 'g-')\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_ylim(0,0.5)\n",
|
||||||
"ax.set_xlabel(\"Model capacity\")\n",
|
"ax.set_xlabel(\"Model capacity\")\n",
|
||||||
"ax.set_ylabel(\"Variance\")\n",
|
"ax.set_ylabel(\"Variance\")\n",
|
||||||
@@ -333,15 +335,6 @@
|
|||||||
},
|
},
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"outputs": []
|
"outputs": []
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"source": [],
|
|
||||||
"metadata": {
|
|
||||||
"id": "WKUyOAywL_b2"
|
|
||||||
},
|
|
||||||
"execution_count": null,
|
|
||||||
"outputs": []
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user