Skip to content

Commit

Permalink
Upgrade notebooks to TensorFlow 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ageron committed Feb 17, 2017
1 parent 248fe59 commit d526403
Show file tree
Hide file tree
Showing 43 changed files with 6,144 additions and 10,029 deletions.
692 changes: 449 additions & 243 deletions 02_end_to_end_machine_learning_project.ipynb

Large diffs are not rendered by default.

447 changes: 323 additions & 124 deletions 03_classification.ipynb

Large diffs are not rendered by default.

350 changes: 245 additions & 105 deletions 04_training_linear_models.ipynb

Large diffs are not rendered by default.

347 changes: 236 additions & 111 deletions 05_support_vector_machines.ipynb

Large diffs are not rendered by default.

155 changes: 109 additions & 46 deletions 06_decision_trees.ipynb

Large diffs are not rendered by default.

253 changes: 180 additions & 73 deletions 07_ensemble_learning_and_random_forests.ipynb

Large diffs are not rendered by default.

477 changes: 327 additions & 150 deletions 08_dimensionality_reduction.ipynb

Large diffs are not rendered by default.

577 changes: 404 additions & 173 deletions 09_up_and_running_with_tensorflow.ipynb

Large diffs are not rendered by default.

1,215 changes: 1,106 additions & 109 deletions 10_introduction_to_artificial_neural_networks.ipynb

Large diffs are not rendered by default.

533 changes: 276 additions & 257 deletions 11_deep_learning.ipynb

Large diffs are not rendered by default.

155 changes: 110 additions & 45 deletions 12_distributed_tensorflow.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,40 @@
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"**Chapter 12 – Distributed TensorFlow**"
]
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"_This notebook contains all the sample code and solutions to the exercices in chapter 12._"
]
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"# Setup"
]
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"First, let's make sure this notebook works well in both python 2 and 3, import a few common modules, ensure MatplotLib plots figures inline and prepare a function to save the figures:"
]
Expand All @@ -32,7 +44,9 @@
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
"collapsed": true,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
Expand Down Expand Up @@ -69,7 +83,10 @@
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"# Local server"
]
Expand All @@ -78,7 +95,9 @@
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": true
"collapsed": true,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
Expand All @@ -89,7 +108,9 @@
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": true
"collapsed": true,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
Expand All @@ -101,7 +122,9 @@
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
Expand All @@ -119,7 +142,10 @@
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"# Cluster"
]
Expand All @@ -128,7 +154,9 @@
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": true
"collapsed": true,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
Expand All @@ -148,7 +176,9 @@
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
Expand All @@ -161,7 +191,10 @@
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"# Pinning operations across devices and servers"
]
Expand All @@ -170,7 +203,9 @@
"cell_type": "code",
"execution_count": 7,
"metadata": {
"collapsed": true
"collapsed": true,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
Expand All @@ -190,7 +225,9 @@
"cell_type": "code",
"execution_count": 8,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
Expand All @@ -211,7 +248,9 @@
"cell_type": "code",
"execution_count": 9,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
Expand Down Expand Up @@ -239,26 +278,31 @@
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"# Readers"
]
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 10,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"No more files to read\n",
"[array([[ 7., 8.],\n",
" [ 4., 5.]], dtype=float32), array([0, 1], dtype=int32)]\n",
"[array([[ 1., 1.]], dtype=float32), array([0], dtype=int32)]\n",
"[array([[ 4. , 5. ],\n",
" [ 1. , -508.17480469]], dtype=float32), array([1, 0], dtype=int32)]\n",
"[array([[ 7., 8.]], dtype=float32), array([0], dtype=int32)]\n",
"No more training instances\n"
]
}
Expand All @@ -282,7 +326,7 @@
"key, value = reader.read(filename_queue)\n",
"\n",
"x1, x2, target = tf.decode_csv(value, record_defaults=[[-1.], [-1.], [-1]])\n",
"features = tf.pack([x1, x2])\n",
"features = tf.stack([x1, x2])\n",
"\n",
"instance_queue = tf.RandomShuffleQueue(\n",
" capacity=10, min_after_dequeue=2,\n",
Expand Down Expand Up @@ -311,9 +355,11 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 11,
"metadata": {
"collapsed": true
"collapsed": true,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
Expand All @@ -326,25 +372,30 @@
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"# Queue runners and coordinators"
]
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 12,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[array([[ 7., 8.],\n",
" [ 4., 5.]], dtype=float32), array([0, 1], dtype=int32)]\n",
"[array([[ 1., 1.]], dtype=float32), array([0], dtype=int32)]\n",
"[array([[ 1. , -508.17480469],\n",
" [ 7. , 8. ]], dtype=float32), array([0, 0], dtype=int32)]\n",
"[array([[ 4., 5.]], dtype=float32), array([1], dtype=int32)]\n",
"No more training instances\n"
]
}
Expand All @@ -361,7 +412,7 @@
"key, value = reader.read(filename_queue)\n",
"\n",
"x1, x2, target = tf.decode_csv(value, record_defaults=[[-1.], [-1.], [-1]])\n",
"features = tf.pack([x1, x2])\n",
"features = tf.stack([x1, x2])\n",
"\n",
"instance_queue = tf.RandomShuffleQueue(\n",
" capacity=10, min_after_dequeue=2,\n",
Expand Down Expand Up @@ -389,18 +440,20 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 13,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[array([[ 7., 8.],\n",
" [ 4., 5.]], dtype=float32), array([0, 1], dtype=int32)]\n",
"[array([[ 1., 1.]], dtype=float32), array([0], dtype=int32)]\n",
"[array([[ 1. , -508.17480469],\n",
" [ 4. , 5. ]], dtype=float32), array([0, 1], dtype=int32)]\n",
"[array([[ 7., 8.]], dtype=float32), array([0], dtype=int32)]\n",
"No more training instances\n"
]
}
Expand All @@ -412,7 +465,7 @@
" reader = tf.TextLineReader(skip_header_lines=1)\n",
" key, value = reader.read(filename_queue)\n",
" x1, x2, target = tf.decode_csv(value, record_defaults=[[-1.], [-1.], [-1]])\n",
" features = tf.pack([x1, x2])\n",
" features = tf.stack([x1, x2])\n",
" enqueue_instance = instance_queue.enqueue([features, target])\n",
" return enqueue_instance\n",
"\n",
Expand Down Expand Up @@ -446,16 +499,21 @@
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"# Setting a timeout"
]
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 14,
"metadata": {
"collapsed": false
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
Expand Down Expand Up @@ -499,15 +557,20 @@
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
"collapsed": true,
"deletable": true,
"editable": true
},
"source": [
"# Exercise solutions"
]
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"**Coming soon**"
]
Expand All @@ -516,7 +579,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
"collapsed": true,
"deletable": true,
"editable": true
},
"outputs": [],
"source": []
Expand All @@ -538,7 +603,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.1"
"version": "3.5.2+"
},
"nav_menu": {},
"toc": {
Expand Down
Loading

0 comments on commit d526403

Please sign in to comment.