Skip to content

Commit

Permalink
New Materials for PyDataIt
Browse files Browse the repository at this point in the history
  • Loading branch information
leriomaggio committed Apr 8, 2017
1 parent 1cb18e8 commit 9a2914d
Show file tree
Hide file tree
Showing 93 changed files with 220,512 additions and 1,069 deletions.
599 changes: 155 additions & 444 deletions 0. Preamble.ipynb

Large diffs are not rendered by default.

481 changes: 457 additions & 24 deletions 1.1 Introduction - Deep Learning and ANN.ipynb

Large diffs are not rendered by default.

976 changes: 976 additions & 0 deletions 1.1.1 Perceptron and Adaline.ipynb

Large diffs are not rendered by default.

1,503 changes: 1,503 additions & 0 deletions 1.1.2 MLP and MNIST.ipynb

Large diffs are not rendered by default.

1,768 changes: 1,768 additions & 0 deletions 1.2 Introduction - Tensorflow.ipynb

Large diffs are not rendered by default.

468 changes: 372 additions & 96 deletions 1.3 Introduction - Keras.ipynb

Large diffs are not rendered by default.

1,075 changes: 1,075 additions & 0 deletions 1.4 Keras Backend.ipynb

Large diffs are not rendered by default.

1,011 changes: 1,011 additions & 0 deletions 1.5.1 (Extra) Introduction - Theano.ipynb

Large diffs are not rendered by default.

334 changes: 294 additions & 40 deletions 2.1 Supervised Learning - ConvNets.ipynb

Large diffs are not rendered by default.

383 changes: 383 additions & 0 deletions 2.2.1 ConvNet HandsOn Part I.ipynb
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
}
Loading

0 comments on commit 9a2914d

Please sign in to comment.