-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1cb18e8
commit 9a2914d
Showing
93 changed files
with
220,512 additions
and
1,069 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,383 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"deletable": true, | ||
"editable": true, | ||
"slideshow": { | ||
"slide_type": "slide" | ||
} | ||
}, | ||
"source": [ | ||
"# ConvNet HandsOn with Keras" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"deletable": true, | ||
"editable": true, | ||
"slideshow": { | ||
"slide_type": "subslide" | ||
} | ||
}, | ||
"source": [ | ||
"## Problem Definition\n", | ||
"\n", | ||
"*Recognize handwritten digits*" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"deletable": true, | ||
"editable": true, | ||
"slideshow": { | ||
"slide_type": "subslide" | ||
} | ||
}, | ||
"source": [ | ||
"## Data\n", | ||
"\n", | ||
"The MNIST database ([link](http://yann.lecun.com/exdb/mnist)) has a database of handwritten digits. \n", | ||
"\n", | ||
"The training set has $60,000$ samples. \n", | ||
"The test set has $10,000$ samples.\n", | ||
"\n", | ||
"The digits are size-normalized and centered in a fixed-size image. \n", | ||
"\n", | ||
"The data page has description on how the data was collected. It also has reports the benchmark of various algorithms on the test dataset. " | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"deletable": true, | ||
"editable": true, | ||
"slideshow": { | ||
"slide_type": "subslide" | ||
} | ||
}, | ||
"source": [ | ||
"### Load the data\n", | ||
"\n", | ||
"The data is available in the repo's `data` folder. Let's load that using the `keras` library. \n", | ||
"\n", | ||
"For now, let's load the data and see how it looks." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false, | ||
"deletable": true, | ||
"editable": true, | ||
"slideshow": { | ||
"slide_type": "subslide" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"import numpy as np\n", | ||
"import keras\n", | ||
"from keras.datasets import mnist" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"code_folding": [], | ||
"collapsed": false, | ||
"deletable": true, | ||
"editable": true, | ||
"slideshow": { | ||
"slide_type": "fragment" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"# Load the datasets\n", | ||
"(X_train, y_train), (X_test, y_test) = mnist.load_data()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"deletable": true, | ||
"editable": true, | ||
"slideshow": { | ||
"slide_type": "slide" | ||
} | ||
}, | ||
"source": [ | ||
"# Basic data analysis on the dataset" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false, | ||
"deletable": true, | ||
"editable": true, | ||
"slideshow": { | ||
"slide_type": "subslide" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"# What is the type of X_train?\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false, | ||
"deletable": true, | ||
"editable": true, | ||
"slideshow": { | ||
"slide_type": "subslide" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"# What is the type of y_train?\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false, | ||
"deletable": true, | ||
"editable": true, | ||
"slideshow": { | ||
"slide_type": "subslide" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"# Find number of observations in training data\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false, | ||
"deletable": true, | ||
"editable": true, | ||
"slideshow": { | ||
"slide_type": "subslide" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"# Find number of observations in test data\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false, | ||
"deletable": true, | ||
"editable": true, | ||
"slideshow": { | ||
"slide_type": "subslide" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"# Display first 2 records of X_train\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false, | ||
"deletable": true, | ||
"editable": true, | ||
"slideshow": { | ||
"slide_type": "subslide" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"# Display the first 10 records of y_train\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false, | ||
"deletable": true, | ||
"editable": true, | ||
"slideshow": { | ||
"slide_type": "subslide" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"# Find the number of observations for each digit in the y_train dataset \n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false, | ||
"deletable": true, | ||
"editable": true, | ||
"slideshow": { | ||
"slide_type": "subslide" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"# Find the number of observations for each digit in the y_test dataset \n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false, | ||
"deletable": true, | ||
"editable": true, | ||
"slideshow": { | ||
"slide_type": "subslide" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"# What is the dimension of X_train?. What does that mean?\n", | ||
"\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"deletable": true, | ||
"editable": true, | ||
"slideshow": { | ||
"slide_type": "slide" | ||
} | ||
}, | ||
"source": [ | ||
"### Display Images\n", | ||
"\n", | ||
"Let's now display some of the images and see how they look\n", | ||
"\n", | ||
"We will be using `matplotlib` library for displaying the image" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": true, | ||
"deletable": true, | ||
"editable": true, | ||
"slideshow": { | ||
"slide_type": "subslide" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"from matplotlib import pyplot\n", | ||
"import matplotlib as mpl\n", | ||
"%matplotlib inline" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": true, | ||
"deletable": true, | ||
"editable": true, | ||
"slideshow": { | ||
"slide_type": "subslide" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"# Displaying the first training data" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false, | ||
"deletable": true, | ||
"editable": true | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"fig = pyplot.figure()\n", | ||
"ax = fig.add_subplot(1,1,1)\n", | ||
"imgplot = ax.imshow(X_train[0], cmap=mpl.cm.Greys)\n", | ||
"imgplot.set_interpolation('nearest')\n", | ||
"ax.xaxis.set_ticks_position('top')\n", | ||
"ax.yaxis.set_ticks_position('left')\n", | ||
"pyplot.show()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": true, | ||
"deletable": true, | ||
"editable": true, | ||
"slideshow": { | ||
"slide_type": "subslide" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"# Let's now display the 11th record" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false, | ||
"deletable": true, | ||
"editable": true | ||
}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.5.2" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 0 | ||
} |
Oops, something went wrong.