|
1 | 1 | {
|
2 |
| - "nbformat": 4, |
3 |
| - "nbformat_minor": 0, |
4 |
| - "metadata": { |
5 |
| - "colab": { |
6 |
| - "version": "0.3.2", |
7 |
| - "views": {}, |
8 |
| - "default_view": {}, |
9 |
| - "name": "3_regularization.ipynb", |
10 |
| - "provenance": [], |
11 |
| - "toc_visible": true |
12 |
| - } |
13 |
| - }, |
14 | 2 | "cells": [
|
15 | 3 | {
|
16 | 4 | "cell_type": "markdown",
|
17 | 5 | "metadata": {
|
18 |
| - "id": "kR-4eNdK6lYS", |
19 |
| - "colab_type": "text" |
| 6 | + "id": "kR-4eNdK6lYS" |
20 | 7 | },
|
21 | 8 | "source": [
|
22 | 9 | "Deep Learning\n",
|
|
32 | 19 | },
|
33 | 20 | {
|
34 | 21 | "cell_type": "code",
|
| 22 | + "execution_count": null, |
35 | 23 | "metadata": {
|
36 |
| - "id": "JLpLa8Jt7Vu4", |
37 |
| - "colab_type": "code", |
38 |
| - "colab": { |
39 |
| - "autoexec": { |
40 |
| - "startup": false, |
41 |
| - "wait_interval": 0 |
42 |
| - } |
43 |
| - }, |
44 |
| - "cellView": "both" |
| 24 | + "cellView": "both", |
| 25 | + "id": "JLpLa8Jt7Vu4" |
45 | 26 | },
|
| 27 | + "outputs": [], |
46 | 28 | "source": [
|
47 | 29 | "# These are all the modules we'll be using later. Make sure you can import them\n",
|
48 | 30 | "# before proceeding further.\n",
|
49 | 31 | "from __future__ import print_function\n",
|
50 | 32 | "import numpy as np\n",
|
51 | 33 | "import tensorflow as tf\n",
|
52 | 34 | "from six.moves import cPickle as pickle"
|
53 |
| - ], |
54 |
| - "outputs": [], |
55 |
| - "execution_count": 0 |
| 35 | + ] |
56 | 36 | },
|
57 | 37 | {
|
58 | 38 | "cell_type": "markdown",
|
59 | 39 | "metadata": {
|
60 |
| - "id": "1HrCK6e17WzV", |
61 |
| - "colab_type": "text" |
| 40 | + "id": "1HrCK6e17WzV" |
62 | 41 | },
|
63 | 42 | "source": [
|
64 | 43 | "First reload the data we generated in `1_notmnist.ipynb`."
|
65 | 44 | ]
|
66 | 45 | },
|
67 | 46 | {
|
68 | 47 | "cell_type": "code",
|
| 48 | + "execution_count": null, |
69 | 49 | "metadata": {
|
70 |
| - "id": "y3-cj1bpmuxc", |
71 |
| - "colab_type": "code", |
72 |
| - "colab": { |
73 |
| - "autoexec": { |
74 |
| - "startup": false, |
75 |
| - "wait_interval": 0 |
76 |
| - }, |
77 |
| - "output_extras": [ |
78 |
| - { |
79 |
| - "item_id": 1 |
80 |
| - } |
81 |
| - ] |
82 |
| - }, |
83 | 50 | "cellView": "both",
|
84 |
| - "executionInfo": { |
85 |
| - "elapsed": 11777, |
86 |
| - "status": "ok", |
87 |
| - "timestamp": 1449849322348, |
88 |
| - "user": { |
89 |
| - "color": "", |
90 |
| - "displayName": "", |
91 |
| - "isAnonymous": false, |
92 |
| - "isMe": true, |
93 |
| - "permissionId": "", |
94 |
| - "photoUrl": "", |
95 |
| - "sessionId": "0", |
96 |
| - "userId": "" |
97 |
| - }, |
98 |
| - "user_tz": 480 |
99 |
| - }, |
100 |
| - "outputId": "e03576f1-ebbe-4838-c388-f1777bcc9873" |
| 51 | + "id": "y3-cj1bpmuxc" |
101 | 52 | },
|
| 53 | + "outputs": [ |
| 54 | + { |
| 55 | + "name": "stdout", |
| 56 | + "output_type": "stream", |
| 57 | + "text": [ |
| 58 | + "Training set (200000, 28, 28) (200000,)\n", |
| 59 | + "Validation set (10000, 28, 28) (10000,)\n", |
| 60 | + "Test set (18724, 28, 28) (18724,)\n" |
| 61 | + ] |
| 62 | + } |
| 63 | + ], |
102 | 64 | "source": [
|
103 | 65 | "pickle_file = 'notMNIST.pickle'\n",
|
104 | 66 | "\n",
|
|
114 | 76 | " print('Training set', train_dataset.shape, train_labels.shape)\n",
|
115 | 77 | " print('Validation set', valid_dataset.shape, valid_labels.shape)\n",
|
116 | 78 | " print('Test set', test_dataset.shape, test_labels.shape)"
|
117 |
| - ], |
118 |
| - "outputs": [ |
119 |
| - { |
120 |
| - "output_type": "stream", |
121 |
| - "text": [ |
122 |
| - "Training set (200000, 28, 28) (200000,)\n", |
123 |
| - "Validation set (10000, 28, 28) (10000,)\n", |
124 |
| - "Test set (18724, 28, 28) (18724,)\n" |
125 |
| - ], |
126 |
| - "name": "stdout" |
127 |
| - } |
128 |
| - ], |
129 |
| - "execution_count": 0 |
| 79 | + ] |
130 | 80 | },
|
131 | 81 | {
|
132 | 82 | "cell_type": "markdown",
|
133 | 83 | "metadata": {
|
134 |
| - "id": "L7aHrm6nGDMB", |
135 |
| - "colab_type": "text" |
| 84 | + "id": "L7aHrm6nGDMB" |
136 | 85 | },
|
137 | 86 | "source": [
|
138 | 87 | "Reformat into a shape that's more adapted to the models we're going to train:\n",
|
|
142 | 91 | },
|
143 | 92 | {
|
144 | 93 | "cell_type": "code",
|
| 94 | + "execution_count": null, |
145 | 95 | "metadata": {
|
146 |
| - "id": "IRSyYiIIGIzS", |
147 |
| - "colab_type": "code", |
148 |
| - "colab": { |
149 |
| - "autoexec": { |
150 |
| - "startup": false, |
151 |
| - "wait_interval": 0 |
152 |
| - }, |
153 |
| - "output_extras": [ |
154 |
| - { |
155 |
| - "item_id": 1 |
156 |
| - } |
157 |
| - ] |
158 |
| - }, |
159 | 96 | "cellView": "both",
|
160 |
| - "executionInfo": { |
161 |
| - "elapsed": 11728, |
162 |
| - "status": "ok", |
163 |
| - "timestamp": 1449849322356, |
164 |
| - "user": { |
165 |
| - "color": "", |
166 |
| - "displayName": "", |
167 |
| - "isAnonymous": false, |
168 |
| - "isMe": true, |
169 |
| - "permissionId": "", |
170 |
| - "photoUrl": "", |
171 |
| - "sessionId": "0", |
172 |
| - "userId": "" |
173 |
| - }, |
174 |
| - "user_tz": 480 |
175 |
| - }, |
176 |
| - "outputId": "3f8996ee-3574-4f44-c953-5c8a04636582" |
| 97 | + "id": "IRSyYiIIGIzS" |
177 | 98 | },
|
| 99 | + "outputs": [ |
| 100 | + { |
| 101 | + "name": "stdout", |
| 102 | + "output_type": "stream", |
| 103 | + "text": [ |
| 104 | + "Training set (200000, 784) (200000, 10)\n", |
| 105 | + "Validation set (10000, 784) (10000, 10)\n", |
| 106 | + "Test set (18724, 784) (18724, 10)\n" |
| 107 | + ] |
| 108 | + } |
| 109 | + ], |
178 | 110 | "source": [
|
179 | 111 | "image_size = 28\n",
|
180 | 112 | "num_labels = 10\n",
|
|
190 | 122 | "print('Training set', train_dataset.shape, train_labels.shape)\n",
|
191 | 123 | "print('Validation set', valid_dataset.shape, valid_labels.shape)\n",
|
192 | 124 | "print('Test set', test_dataset.shape, test_labels.shape)"
|
193 |
| - ], |
194 |
| - "outputs": [ |
195 |
| - { |
196 |
| - "output_type": "stream", |
197 |
| - "text": [ |
198 |
| - "Training set (200000, 784) (200000, 10)\n", |
199 |
| - "Validation set (10000, 784) (10000, 10)\n", |
200 |
| - "Test set (18724, 784) (18724, 10)\n" |
201 |
| - ], |
202 |
| - "name": "stdout" |
203 |
| - } |
204 |
| - ], |
205 |
| - "execution_count": 0 |
| 125 | + ] |
206 | 126 | },
|
207 | 127 | {
|
208 | 128 | "cell_type": "code",
|
| 129 | + "execution_count": null, |
209 | 130 | "metadata": {
|
210 |
| - "id": "RajPLaL_ZW6w", |
211 |
| - "colab_type": "code", |
212 |
| - "colab": { |
213 |
| - "autoexec": { |
214 |
| - "startup": false, |
215 |
| - "wait_interval": 0 |
216 |
| - } |
217 |
| - }, |
218 |
| - "cellView": "both" |
| 131 | + "cellView": "both", |
| 132 | + "id": "RajPLaL_ZW6w" |
219 | 133 | },
|
| 134 | + "outputs": [], |
220 | 135 | "source": [
|
221 | 136 | "def accuracy(predictions, labels):\n",
|
222 | 137 | " return (100.0 * np.sum(np.argmax(predictions, 1) == np.argmax(labels, 1))\n",
|
223 | 138 | " / predictions.shape[0])"
|
224 |
| - ], |
225 |
| - "outputs": [], |
226 |
| - "execution_count": 0 |
| 139 | + ] |
227 | 140 | },
|
228 | 141 | {
|
229 | 142 | "cell_type": "markdown",
|
230 | 143 | "metadata": {
|
231 |
| - "id": "sgLbUAQ1CW-1", |
232 |
| - "colab_type": "text" |
| 144 | + "id": "sgLbUAQ1CW-1" |
233 | 145 | },
|
234 | 146 | "source": [
|
235 | 147 | "---\n",
|
|
244 | 156 | {
|
245 | 157 | "cell_type": "markdown",
|
246 | 158 | "metadata": {
|
247 |
| - "id": "na8xX2yHZzNF", |
248 |
| - "colab_type": "text" |
| 159 | + "id": "na8xX2yHZzNF" |
249 | 160 | },
|
250 | 161 | "source": [
|
251 | 162 | "---\n",
|
|
259 | 170 | {
|
260 | 171 | "cell_type": "markdown",
|
261 | 172 | "metadata": {
|
262 |
| - "id": "ww3SCBUdlkRc", |
263 |
| - "colab_type": "text" |
| 173 | + "id": "ww3SCBUdlkRc" |
264 | 174 | },
|
265 | 175 | "source": [
|
266 | 176 | "---\n",
|
|
276 | 186 | {
|
277 | 187 | "cell_type": "markdown",
|
278 | 188 | "metadata": {
|
279 |
| - "id": "-b1hTz3VWZjw", |
280 |
| - "colab_type": "text" |
| 189 | + "id": "-b1hTz3VWZjw" |
281 | 190 | },
|
282 | 191 | "source": [
|
283 | 192 | "---\n",
|
|
297 | 206 | " ---\n"
|
298 | 207 | ]
|
299 | 208 | }
|
300 |
| - ] |
| 209 | + ], |
| 210 | + "metadata": { |
| 211 | + "colab": { |
| 212 | + "name": "3_regularization.ipynb", |
| 213 | + "toc_visible": true |
| 214 | + }, |
| 215 | + "kernelspec": { |
| 216 | + "display_name": "Python 3", |
| 217 | + "name": "python3" |
| 218 | + } |
| 219 | + }, |
| 220 | + "nbformat": 4, |
| 221 | + "nbformat_minor": 0 |
301 | 222 | }
|
0 commit comments