Spaces:
Runtime error
Runtime error
Kyle Dampier
commited on
Commit
•
4789c9d
1
Parent(s):
89e16b4
retrained model and got it ready for a demo of over fitting
Browse files- Week1.ipynb +34 -25
- mnist.h5 +1 -1
Week1.ipynb
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
},
|
21 |
{
|
22 |
"cell_type": "code",
|
23 |
-
"execution_count":
|
24 |
"metadata": {},
|
25 |
"outputs": [],
|
26 |
"source": [
|
@@ -38,7 +38,7 @@
|
|
38 |
},
|
39 |
{
|
40 |
"cell_type": "code",
|
41 |
-
"execution_count":
|
42 |
"metadata": {},
|
43 |
"outputs": [
|
44 |
{
|
@@ -85,7 +85,7 @@
|
|
85 |
},
|
86 |
{
|
87 |
"cell_type": "code",
|
88 |
-
"execution_count":
|
89 |
"metadata": {},
|
90 |
"outputs": [
|
91 |
{
|
@@ -144,6 +144,18 @@
|
|
144 |
"## Train the Model"
|
145 |
]
|
146 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
{
|
148 |
"cell_type": "code",
|
149 |
"execution_count": 5,
|
@@ -154,41 +166,41 @@
|
|
154 |
"output_type": "stream",
|
155 |
"text": [
|
156 |
"Epoch 1/15\n",
|
157 |
-
"422/422 [==============================] -
|
158 |
"Epoch 2/15\n",
|
159 |
-
"422/422 [==============================] - 1s 3ms/step - loss: 0.
|
160 |
"Epoch 3/15\n",
|
161 |
-
"422/422 [==============================] - 1s
|
162 |
"Epoch 4/15\n",
|
163 |
-
"422/422 [==============================] - 1s
|
164 |
"Epoch 5/15\n",
|
165 |
-
"422/422 [==============================] - 1s 3ms/step - loss: 0.
|
166 |
"Epoch 6/15\n",
|
167 |
-
"422/422 [==============================] - 1s 2ms/step - loss: 0.
|
168 |
"Epoch 7/15\n",
|
169 |
-
"422/422 [==============================] - 1s
|
170 |
"Epoch 8/15\n",
|
171 |
-
"422/422 [==============================] - 1s
|
172 |
"Epoch 9/15\n",
|
173 |
-
"422/422 [==============================] - 1s 2ms/step - loss: 0.
|
174 |
"Epoch 10/15\n",
|
175 |
-
"422/422 [==============================] - 1s 2ms/step - loss: 0.
|
176 |
"Epoch 11/15\n",
|
177 |
-
"422/422 [==============================] - 1s 2ms/step - loss: 0.
|
178 |
"Epoch 12/15\n",
|
179 |
-
"422/422 [==============================] - 1s
|
180 |
"Epoch 13/15\n",
|
181 |
-
"422/422 [==============================] - 1s
|
182 |
"Epoch 14/15\n",
|
183 |
-
"422/422 [==============================] - 1s 2ms/step - loss: 0.
|
184 |
"Epoch 15/15\n",
|
185 |
-
"422/422 [==============================] - 1s
|
186 |
]
|
187 |
},
|
188 |
{
|
189 |
"data": {
|
190 |
"text/plain": [
|
191 |
-
"<keras.callbacks.History at
|
192 |
]
|
193 |
},
|
194 |
"execution_count": 5,
|
@@ -197,10 +209,7 @@
|
|
197 |
}
|
198 |
],
|
199 |
"source": [
|
200 |
-
"
|
201 |
-
"epochs = 15\n",
|
202 |
-
"\n",
|
203 |
-
"model.compile(loss=\"categorical_crossentropy\", optimizer=\"adam\", metrics=[\"accuracy\"])\n",
|
204 |
"\n",
|
205 |
"model.fit(x_train, y_train, batch_size=batch_size, epochs=epochs, validation_split=0.1)"
|
206 |
]
|
@@ -221,8 +230,8 @@
|
|
221 |
"name": "stdout",
|
222 |
"output_type": "stream",
|
223 |
"text": [
|
224 |
-
"Test loss: 0.
|
225 |
-
"Test accuracy: 0.
|
226 |
]
|
227 |
}
|
228 |
],
|
|
|
20 |
},
|
21 |
{
|
22 |
"cell_type": "code",
|
23 |
+
"execution_count": 1,
|
24 |
"metadata": {},
|
25 |
"outputs": [],
|
26 |
"source": [
|
|
|
38 |
},
|
39 |
{
|
40 |
"cell_type": "code",
|
41 |
+
"execution_count": 2,
|
42 |
"metadata": {},
|
43 |
"outputs": [
|
44 |
{
|
|
|
85 |
},
|
86 |
{
|
87 |
"cell_type": "code",
|
88 |
+
"execution_count": 3,
|
89 |
"metadata": {},
|
90 |
"outputs": [
|
91 |
{
|
|
|
144 |
"## Train the Model"
|
145 |
]
|
146 |
},
|
147 |
+
{
|
148 |
+
"cell_type": "code",
|
149 |
+
"execution_count": 4,
|
150 |
+
"metadata": {},
|
151 |
+
"outputs": [],
|
152 |
+
"source": [
|
153 |
+
"batch_size = 128\n",
|
154 |
+
"epochs = 15\n",
|
155 |
+
"\n",
|
156 |
+
"model.compile(loss=\"categorical_crossentropy\", optimizer=\"adam\", metrics=[\"accuracy\"])"
|
157 |
+
]
|
158 |
+
},
|
159 |
{
|
160 |
"cell_type": "code",
|
161 |
"execution_count": 5,
|
|
|
166 |
"output_type": "stream",
|
167 |
"text": [
|
168 |
"Epoch 1/15\n",
|
169 |
+
"422/422 [==============================] - 4s 3ms/step - loss: 0.3724 - accuracy: 0.8837 - val_loss: 0.0810 - val_accuracy: 0.9785\n",
|
170 |
"Epoch 2/15\n",
|
171 |
+
"422/422 [==============================] - 1s 3ms/step - loss: 0.1118 - accuracy: 0.9671 - val_loss: 0.0562 - val_accuracy: 0.9852\n",
|
172 |
"Epoch 3/15\n",
|
173 |
+
"422/422 [==============================] - 1s 2ms/step - loss: 0.0835 - accuracy: 0.9739 - val_loss: 0.0481 - val_accuracy: 0.9872\n",
|
174 |
"Epoch 4/15\n",
|
175 |
+
"422/422 [==============================] - 1s 2ms/step - loss: 0.0700 - accuracy: 0.9787 - val_loss: 0.0404 - val_accuracy: 0.9898\n",
|
176 |
"Epoch 5/15\n",
|
177 |
+
"422/422 [==============================] - 1s 3ms/step - loss: 0.0604 - accuracy: 0.9815 - val_loss: 0.0381 - val_accuracy: 0.9910\n",
|
178 |
"Epoch 6/15\n",
|
179 |
+
"422/422 [==============================] - 1s 2ms/step - loss: 0.0559 - accuracy: 0.9826 - val_loss: 0.0354 - val_accuracy: 0.9903\n",
|
180 |
"Epoch 7/15\n",
|
181 |
+
"422/422 [==============================] - 1s 2ms/step - loss: 0.0505 - accuracy: 0.9829 - val_loss: 0.0338 - val_accuracy: 0.9903\n",
|
182 |
"Epoch 8/15\n",
|
183 |
+
"422/422 [==============================] - 1s 2ms/step - loss: 0.0484 - accuracy: 0.9847 - val_loss: 0.0296 - val_accuracy: 0.9923\n",
|
184 |
"Epoch 9/15\n",
|
185 |
+
"422/422 [==============================] - 1s 2ms/step - loss: 0.0443 - accuracy: 0.9860 - val_loss: 0.0333 - val_accuracy: 0.9912\n",
|
186 |
"Epoch 10/15\n",
|
187 |
+
"422/422 [==============================] - 1s 2ms/step - loss: 0.0422 - accuracy: 0.9869 - val_loss: 0.0308 - val_accuracy: 0.9927\n",
|
188 |
"Epoch 11/15\n",
|
189 |
+
"422/422 [==============================] - 1s 2ms/step - loss: 0.0397 - accuracy: 0.9874 - val_loss: 0.0321 - val_accuracy: 0.9922\n",
|
190 |
"Epoch 12/15\n",
|
191 |
+
"422/422 [==============================] - 1s 2ms/step - loss: 0.0375 - accuracy: 0.9875 - val_loss: 0.0269 - val_accuracy: 0.9928\n",
|
192 |
"Epoch 13/15\n",
|
193 |
+
"422/422 [==============================] - 1s 2ms/step - loss: 0.0355 - accuracy: 0.9886 - val_loss: 0.0296 - val_accuracy: 0.9925\n",
|
194 |
"Epoch 14/15\n",
|
195 |
+
"422/422 [==============================] - 1s 2ms/step - loss: 0.0340 - accuracy: 0.9888 - val_loss: 0.0291 - val_accuracy: 0.9928\n",
|
196 |
"Epoch 15/15\n",
|
197 |
+
"422/422 [==============================] - 1s 3ms/step - loss: 0.0321 - accuracy: 0.9894 - val_loss: 0.0277 - val_accuracy: 0.9927\n"
|
198 |
]
|
199 |
},
|
200 |
{
|
201 |
"data": {
|
202 |
"text/plain": [
|
203 |
+
"<keras.callbacks.History at 0x14a08dfc3d0>"
|
204 |
]
|
205 |
},
|
206 |
"execution_count": 5,
|
|
|
209 |
}
|
210 |
],
|
211 |
"source": [
|
212 |
+
"# This line can be run multiple times, but keep in mind that the model will probably be over fitting\n",
|
|
|
|
|
|
|
213 |
"\n",
|
214 |
"model.fit(x_train, y_train, batch_size=batch_size, epochs=epochs, validation_split=0.1)"
|
215 |
]
|
|
|
230 |
"name": "stdout",
|
231 |
"output_type": "stream",
|
232 |
"text": [
|
233 |
+
"Test loss: 0.02324853651225567\n",
|
234 |
+
"Test accuracy: 0.9922000169754028\n"
|
235 |
]
|
236 |
}
|
237 |
],
|
mnist.h5
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
size 455304
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6b9d7830249bb932ad3715ba3d277c9415cd8a8a4c6d100eb6a1f8568f58fa8f
|
3 |
size 455304
|