Add intro paragraph, tx to Daniel and minor formatting fixes

main
Aurélien Geron 2018-09-17 11:51:05 +02:00
parent de6678beb1
commit dc16446c5f
1 changed files with 28 additions and 7 deletions

View File

@ -1,5 +1,19 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Comparison of Batch, Mini-Batch and Stochastic Gradient Descent"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This notebook displays an animation comparing Batch, Mini-Batch and Stochastic Gradient Descent (introduced in Chapter 4). Thanks to [Daniel Ingram](https://github.com/daniel-s-ingram) who contributed this notebook."
]
},
{
"cell_type": "code",
"execution_count": 1,
@ -159,7 +173,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
@ -174,7 +188,7 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 12,
"metadata": {},
"outputs": [],
"source": [
@ -202,23 +216,30 @@
" cost_ax.set_ylim([0, 5])\n",
"\n",
" data_ax.set_xlabel(r'$x_1$')\n",
" data_ax.set_ylabel(r'$y$')\n",
" data_ax.set_ylabel(r'$y$', rotation=0)\n",
" cost_ax.set_xlabel(r'$\\theta_0$')\n",
" cost_ax.set_ylabel(r'$\\theta_1$')\n",
"\n",
" data_ax.legend(('Data', 'BGD', 'SGD', 'MBGD'))\n",
" cost_ax.legend(('Normal Equation', 'BGD', 'SGD', 'MBGD'))"
" data_ax.legend(('Data', 'BGD', 'SGD', 'MBGD'), loc=\"upper left\")\n",
" cost_ax.legend(('Normal Equation', 'BGD', 'SGD', 'MBGD'), loc=\"upper left\")"
]
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 13,
"metadata": {},
"outputs": [],
"source": [
"animation = FuncAnimation(fig, animate, frames=n_iter)\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
@ -237,7 +258,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.2"
"version": "3.6.6"
}
},
"nbformat": 4,