From 1c5b6d5130ce8f3e7f5b2960ff1ae793c15c1aa9 Mon Sep 17 00:00:00 2001 From: Morten Hjorth-Jensen Date: Fri, 28 Oct 2022 08:14:43 +0200 Subject: [PATCH] update --- doc/pub/week43/html/week43-bs.html | 12 +- doc/pub/week43/html/week43-reveal.html | 12 +- doc/pub/week43/html/week43-solarized.html | 12 +- doc/pub/week43/html/week43.html | 12 +- doc/pub/week43/ipynb/ipynb-week43-src.tar.gz | Bin 88085 -> 88085 bytes doc/pub/week43/ipynb/week43.ipynb | 334 +++++++++---------- doc/src/week43/week43.do.txt | 13 +- 7 files changed, 173 insertions(+), 222 deletions(-) diff --git a/doc/pub/week43/html/week43-bs.html b/doc/pub/week43/html/week43-bs.html index 3035e24df..e5f8d9fd6 100644 --- a/doc/pub/week43/html/week43-bs.html +++ b/doc/pub/week43/html/week43-bs.html @@ -1186,7 +1186,6 @@ train_images, test_images = train_images
class_names = ['airplane', 'automobile', 'bird', 'cat', 'deer',
                'dog', 'frog', 'horse', 'ship', 'truck']
-​
 plt.figure(figsize=(10,10))
 for i in range(25):
     plt.subplot(5,5,i+1)
@@ -1277,8 +1276,7 @@ layer with 10 outputs and a softmax activation.
   
model.add(layers.Flatten())
 model.add(layers.Dense(64, activation='relu'))
 model.add(layers.Dense(10))
-Here's the complete architecture of our model.
-
+#Here's the complete architecture of our model.
 model.summary()
 
@@ -1295,7 +1293,7 @@ model.summary() -

As you can see, our (4, 4, 64) outputs were flattened into vectors of shape (1024) before going through two Dense layers.

+

As you can see, our (4, 4, 64) outputs were flattened into vectors of shape (1024) before going through two dense layers.

Compile and train the model

@@ -1310,7 +1308,6 @@ model.summary()
model.compile(optimizer='adam',
               loss=tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True),
               metrics=['accuracy'])
-​
 history = model.fit(train_images, train_labels, epochs=10, 
                     validation_data=(test_images, test_labels))
 
@@ -1345,9 +1342,7 @@ plt.xlabel(' plt.ylabel('Accuracy') plt.ylim([0.5, 1]) plt.legend(loc='lower right') - test_loss, test_acc = model.evaluate(test_images, test_labels, verbose=2) - print(test_acc)
@@ -1416,8 +1411,6 @@ systems such as automatic translation and speech-to-text. from tensorflow.keras import regularizers from tensorflow.keras.utils import to_categorical - - # convert into dataset matrix def convertToMatrix(data, step): X, Y =[], [] @@ -1457,7 +1450,6 @@ model.add(Dense(.add(Dense(1)) model.compile(loss='mean_squared_error', optimizer='rmsprop') model.summary() - model.fit(trainX,trainY, epochs=100, batch_size=16, verbose=2) trainPredict = model.predict(trainX) testPredict= model.predict(testX) diff --git a/doc/pub/week43/html/week43-reveal.html b/doc/pub/week43/html/week43-reveal.html index aacb5cbe2..f91554b01 100644 --- a/doc/pub/week43/html/week43-reveal.html +++ b/doc/pub/week43/html/week43-reveal.html @@ -1141,7 +1141,6 @@ train_images, test_images = train_images / 255.0
class_names = ['airplane', 'automobile', 'bird', 'cat', 'deer',
                'dog', 'frog', 'horse', 'ship', 'truck']
-
 plt.figure(figsize=(10,10))
 for i in range(25):
     plt.subplot(5,5,i+1)
@@ -1233,8 +1232,7 @@ layer with 10 outputs and a softmax activation.
   
model.add(layers.Flatten())
 model.add(layers.Dense(64, activation='relu'))
 model.add(layers.Dense(10))
-Here's the complete architecture of our model.
-
+#Here's the complete architecture of our model.
 model.summary()
 
@@ -1251,7 +1249,7 @@ model.summary() -

As you can see, our (4, 4, 64) outputs were flattened into vectors of shape (1024) before going through two Dense layers.

+

As you can see, our (4, 4, 64) outputs were flattened into vectors of shape (1024) before going through two dense layers.

@@ -1267,7 +1265,6 @@ model.summary()
model.compile(optimizer='adam',
               loss=tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True),
               metrics=['accuracy'])
-
 history = model.fit(train_images, train_labels, epochs=10, 
                     validation_data=(test_images, test_labels))
 
@@ -1302,9 +1299,7 @@ plt.xlabel('Epoch') plt.ylabel('Accuracy') plt.ylim([0.5, 1]) plt.legend(loc='lower right') - test_loss, test_acc = model.evaluate(test_images, test_labels, verbose=2) - print(test_acc)
@@ -1375,8 +1370,6 @@ systems such as automatic translation and speech-to-text. from tensorflow.keras import regularizers from tensorflow.keras.utils import to_categorical - - # convert into dataset matrix def convertToMatrix(data, step): X, Y =[], [] @@ -1416,7 +1409,6 @@ model.add(Dense(8, activation=1)) model.compile(loss='mean_squared_error', optimizer='rmsprop') model.summary() - model.fit(trainX,trainY, epochs=100, batch_size=16, verbose=2) trainPredict = model.predict(trainX) testPredict= model.predict(testX) diff --git a/doc/pub/week43/html/week43-solarized.html b/doc/pub/week43/html/week43-solarized.html index d6e97b7db..c6440f2f5 100644 --- a/doc/pub/week43/html/week43-solarized.html +++ b/doc/pub/week43/html/week43-solarized.html @@ -1121,7 +1121,6 @@ train_images, test_images = train_images / 255.0
class_names = ['airplane', 'automobile', 'bird', 'cat', 'deer',
                'dog', 'frog', 'horse', 'ship', 'truck']
-
 plt.figure(figsize=(10,10))
 for i in range(25):
     plt.subplot(5,5,i+1)
@@ -1212,8 +1211,7 @@ layer with 10 outputs and a softmax activation.
   
model.add(layers.Flatten())
 model.add(layers.Dense(64, activation='relu'))
 model.add(layers.Dense(10))
-Here's the complete architecture of our model.
-
+#Here's the complete architecture of our model.
 model.summary()
 
@@ -1230,7 +1228,7 @@ model.summary() -

As you can see, our (4, 4, 64) outputs were flattened into vectors of shape (1024) before going through two Dense layers.

+

As you can see, our (4, 4, 64) outputs were flattened into vectors of shape (1024) before going through two dense layers.











Compile and train the model

@@ -1245,7 +1243,6 @@ model.summary()
model.compile(optimizer='adam',
               loss=tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True),
               metrics=['accuracy'])
-
 history = model.fit(train_images, train_labels, epochs=10, 
                     validation_data=(test_images, test_labels))
 
@@ -1280,9 +1277,7 @@ plt.xlabel('Epoch') plt.ylabel('Accuracy') plt.ylim([0.5, 1]) plt.legend(loc='lower right') - test_loss, test_acc = model.evaluate(test_images, test_labels, verbose=2) - print(test_acc)
@@ -1351,8 +1346,6 @@ systems such as automatic translation and speech-to-text. from tensorflow.keras import regularizers from tensorflow.keras.utils import to_categorical - - # convert into dataset matrix def convertToMatrix(data, step): X, Y =[], [] @@ -1392,7 +1385,6 @@ model.add(Dense(8, activation=1)) model.compile(loss='mean_squared_error', optimizer='rmsprop') model.summary() - model.fit(trainX,trainY, epochs=100, batch_size=16, verbose=2) trainPredict = model.predict(trainX) testPredict= model.predict(testX) diff --git a/doc/pub/week43/html/week43.html b/doc/pub/week43/html/week43.html index f8717f5d2..4efcd90a5 100644 --- a/doc/pub/week43/html/week43.html +++ b/doc/pub/week43/html/week43.html @@ -1198,7 +1198,6 @@ train_images, test_images = train_images
class_names = ['airplane', 'automobile', 'bird', 'cat', 'deer',
                'dog', 'frog', 'horse', 'ship', 'truck']
-​
 plt.figure(figsize=(10,10))
 for i in range(25):
     plt.subplot(5,5,i+1)
@@ -1289,8 +1288,7 @@ layer with 10 outputs and a softmax activation.
   
model.add(layers.Flatten())
 model.add(layers.Dense(64, activation='relu'))
 model.add(layers.Dense(10))
-Here's the complete architecture of our model.
-
+#Here's the complete architecture of our model.
 model.summary()
 
@@ -1307,7 +1305,7 @@ model.summary() -

As you can see, our (4, 4, 64) outputs were flattened into vectors of shape (1024) before going through two Dense layers.

+

As you can see, our (4, 4, 64) outputs were flattened into vectors of shape (1024) before going through two dense layers.











Compile and train the model

@@ -1322,7 +1320,6 @@ model.summary()
model.compile(optimizer='adam',
               loss=tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True),
               metrics=['accuracy'])
-​
 history = model.fit(train_images, train_labels, epochs=10, 
                     validation_data=(test_images, test_labels))
 
@@ -1357,9 +1354,7 @@ plt.xlabel(' plt.ylabel('Accuracy') plt.ylim([0.5, 1]) plt.legend(loc='lower right') - test_loss, test_acc = model.evaluate(test_images, test_labels, verbose=2) - print(test_acc)
@@ -1428,8 +1423,6 @@ systems such as automatic translation and speech-to-text. from tensorflow.keras import regularizers from tensorflow.keras.utils import to_categorical - - # convert into dataset matrix def convertToMatrix(data, step): X, Y =[], [] @@ -1469,7 +1462,6 @@ model.add(Dense(.add(Dense(1)) model.compile(loss='mean_squared_error', optimizer='rmsprop') model.summary() - model.fit(trainX,trainY, epochs=100, batch_size=16, verbose=2) trainPredict = model.predict(trainX) testPredict= model.predict(testX) diff --git a/doc/pub/week43/ipynb/ipynb-week43-src.tar.gz b/doc/pub/week43/ipynb/ipynb-week43-src.tar.gz index 322104dc24998d162f7a5e6e56559f1dbf18f9dd..38921dd10f5edef269154e080fbbfe1b2dc6f9ca 100644 GIT binary patch delta 20 bcmbQbfpzKzRyO%=4hDnbMz*bNjQkM*L?Q*6 delta 20 bcmbQbfpzKzRyO%=4u%Vbjci-l82KXrNwNkw diff --git a/doc/pub/week43/ipynb/week43.ipynb b/doc/pub/week43/ipynb/week43.ipynb index 8403f4c6c..d8df74187 100644 --- a/doc/pub/week43/ipynb/week43.ipynb +++ b/doc/pub/week43/ipynb/week43.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "64f0fb95", + "id": "c5d39e0b", "metadata": { "editable": true }, @@ -14,7 +14,7 @@ }, { "cell_type": "markdown", - "id": "ec4435d5", + "id": "6459c579", "metadata": { "editable": true }, @@ -29,7 +29,7 @@ }, { "cell_type": "markdown", - "id": "d36232f9", + "id": "70ebd784", "metadata": { "editable": true }, @@ -59,7 +59,7 @@ }, { "cell_type": "markdown", - "id": "73938052", + "id": "ad740247", "metadata": { "editable": true }, @@ -85,7 +85,7 @@ }, { "cell_type": "markdown", - "id": "230b9055", + "id": "9293049f", "metadata": { "editable": true }, @@ -112,7 +112,7 @@ }, { "cell_type": "markdown", - "id": "d15c3dc6", + "id": "67a1fb47", "metadata": { "editable": true }, @@ -134,7 +134,7 @@ }, { "cell_type": "markdown", - "id": "cf6057f4", + "id": "5e4646d6", "metadata": { "editable": true }, @@ -152,7 +152,7 @@ }, { "cell_type": "markdown", - "id": "13df44dc", + "id": "9a829df6", "metadata": { "editable": true }, @@ -182,7 +182,7 @@ }, { "cell_type": "markdown", - "id": "d4317855", + "id": "3e53ba7c", "metadata": { "editable": true }, @@ -212,7 +212,7 @@ }, { "cell_type": "markdown", - "id": "edb251e1", + "id": "09e08f91", "metadata": { "editable": true }, @@ -252,7 +252,7 @@ }, { "cell_type": "markdown", - "id": "8e0d0bb5", + "id": "7c8a5acf", "metadata": { "editable": true }, @@ -281,7 +281,7 @@ }, { "cell_type": "markdown", - "id": "1045f868", + "id": "12071d8a", "metadata": { "editable": true }, @@ -303,7 +303,7 @@ }, { "cell_type": "markdown", - "id": "989ee7f3", + "id": "c1faf1e4", "metadata": { "editable": true }, @@ -332,7 +332,7 @@ }, { "cell_type": "markdown", - "id": "c9db3ad1", + "id": "39016bcb", "metadata": { "editable": true }, @@ -349,7 +349,7 @@ }, { "cell_type": "markdown", - "id": "0d6f1fa0", + "id": "945544d3", "metadata": { "editable": true }, @@ -369,7 +369,7 @@ }, { "cell_type": "markdown", - "id": "93186e95", + "id": "48a2b80c", "metadata": { "editable": true }, @@ -381,7 +381,7 @@ }, { "cell_type": "markdown", - "id": "3d7ea176", + "id": "cfd14636", "metadata": { "editable": true }, @@ -393,7 +393,7 @@ }, { "cell_type": "markdown", - "id": "96afecaf", + "id": "66afa266", "metadata": { "editable": true }, @@ -405,7 +405,7 @@ }, { "cell_type": "markdown", - "id": "2fca2b28", + "id": "96f87f9a", "metadata": { "editable": true }, @@ -415,7 +415,7 @@ }, { "cell_type": "markdown", - "id": "be464e2e", + "id": "f070283e", "metadata": { "editable": true }, @@ -427,7 +427,7 @@ }, { "cell_type": "markdown", - "id": "b65a0439", + "id": "9d3db171", "metadata": { "editable": true }, @@ -439,7 +439,7 @@ }, { "cell_type": "markdown", - "id": "2df4dfd9", + "id": "33f6af14", "metadata": { "editable": true }, @@ -454,7 +454,7 @@ }, { "cell_type": "markdown", - "id": "4a9ba5c1", + "id": "02a99cff", "metadata": { "editable": true }, @@ -466,7 +466,7 @@ }, { "cell_type": "markdown", - "id": "809dc4d2", + "id": "2c6a4e0c", "metadata": { "editable": true }, @@ -476,7 +476,7 @@ }, { "cell_type": "markdown", - "id": "5c0ee27d", + "id": "08df12bf", "metadata": { "editable": true }, @@ -488,7 +488,7 @@ }, { "cell_type": "markdown", - "id": "1b05fc18", + "id": "2d082fe8", "metadata": { "editable": true }, @@ -498,7 +498,7 @@ }, { "cell_type": "markdown", - "id": "c65cb2b7", + "id": "19f66253", "metadata": { "editable": true }, @@ -510,7 +510,7 @@ }, { "cell_type": "markdown", - "id": "99c7c3dc", + "id": "06e842d7", "metadata": { "editable": true }, @@ -523,7 +523,7 @@ }, { "cell_type": "markdown", - "id": "53d53bbc", + "id": "60a4a134", "metadata": { "editable": true }, @@ -542,7 +542,7 @@ }, { "cell_type": "markdown", - "id": "94ac0ef9", + "id": "17cb3b7c", "metadata": { "editable": true }, @@ -554,7 +554,7 @@ }, { "cell_type": "markdown", - "id": "c4f33864", + "id": "5c318d22", "metadata": { "editable": true }, @@ -566,7 +566,7 @@ }, { "cell_type": "markdown", - "id": "92652c28", + "id": "35ec45df", "metadata": { "editable": true }, @@ -576,7 +576,7 @@ }, { "cell_type": "markdown", - "id": "56a16a6a", + "id": "2b9c44d7", "metadata": { "editable": true }, @@ -588,7 +588,7 @@ }, { "cell_type": "markdown", - "id": "92636cff", + "id": "70a7d1dc", "metadata": { "editable": true }, @@ -598,7 +598,7 @@ }, { "cell_type": "markdown", - "id": "560ed487", + "id": "a29e240c", "metadata": { "editable": true }, @@ -612,7 +612,7 @@ }, { "cell_type": "markdown", - "id": "2be56ff2", + "id": "bf4a8589", "metadata": { "editable": true }, @@ -630,7 +630,7 @@ }, { "cell_type": "markdown", - "id": "e277d2e6", + "id": "325858c8", "metadata": { "editable": true }, @@ -641,7 +641,7 @@ }, { "cell_type": "markdown", - "id": "44fd182f", + "id": "dad45e98", "metadata": { "editable": true }, @@ -659,7 +659,7 @@ }, { "cell_type": "markdown", - "id": "3e977804", + "id": "633095c0", "metadata": { "editable": true }, @@ -673,7 +673,7 @@ }, { "cell_type": "markdown", - "id": "48348573", + "id": "0499b303", "metadata": { "editable": true }, @@ -687,7 +687,7 @@ }, { "cell_type": "markdown", - "id": "bd57bb0b", + "id": "9f7145ad", "metadata": { "editable": true }, @@ -699,7 +699,7 @@ }, { "cell_type": "markdown", - "id": "a03db30b", + "id": "c8f1867e", "metadata": { "editable": true }, @@ -709,7 +709,7 @@ }, { "cell_type": "markdown", - "id": "621656e3", + "id": "c86dd048", "metadata": { "editable": true }, @@ -721,7 +721,7 @@ }, { "cell_type": "markdown", - "id": "2a5d79f2", + "id": "428656bc", "metadata": { "editable": true }, @@ -731,7 +731,7 @@ }, { "cell_type": "markdown", - "id": "ced1dd7d", + "id": "c70e9d1e", "metadata": { "editable": true }, @@ -743,7 +743,7 @@ }, { "cell_type": "markdown", - "id": "58154535", + "id": "7b9b0f19", "metadata": { "editable": true }, @@ -755,7 +755,7 @@ }, { "cell_type": "markdown", - "id": "cb5e7c3b", + "id": "ddc85d9b", "metadata": { "editable": true }, @@ -782,7 +782,7 @@ }, { "cell_type": "markdown", - "id": "2c679c06", + "id": "004f94f5", "metadata": { "editable": true }, @@ -794,7 +794,7 @@ }, { "cell_type": "markdown", - "id": "1b6db8ba", + "id": "ecbfa56d", "metadata": { "editable": true }, @@ -804,7 +804,7 @@ }, { "cell_type": "markdown", - "id": "fb8f30dc", + "id": "ac1647b2", "metadata": { "editable": true }, @@ -830,7 +830,7 @@ }, { "cell_type": "markdown", - "id": "a06b6155", + "id": "d43e606a", "metadata": { "editable": true }, @@ -842,7 +842,7 @@ }, { "cell_type": "markdown", - "id": "f6e9bbbe", + "id": "8cce1a2a", "metadata": { "editable": true }, @@ -861,7 +861,7 @@ }, { "cell_type": "markdown", - "id": "ff616494", + "id": "c44045c5", "metadata": { "editable": true }, @@ -874,7 +874,7 @@ }, { "cell_type": "markdown", - "id": "97b7bd6b", + "id": "59a365da", "metadata": { "editable": true }, @@ -886,7 +886,7 @@ }, { "cell_type": "markdown", - "id": "40c08862", + "id": "34ae8a74", "metadata": { "editable": true }, @@ -907,7 +907,7 @@ }, { "cell_type": "markdown", - "id": "f356a8f2", + "id": "c67263a9", "metadata": { "editable": true }, @@ -928,7 +928,7 @@ }, { "cell_type": "markdown", - "id": "2e3e8fab", + "id": "795378a9", "metadata": { "editable": true }, @@ -953,7 +953,7 @@ }, { "cell_type": "markdown", - "id": "0d321e12", + "id": "65b4ac52", "metadata": { "editable": true }, @@ -972,7 +972,7 @@ }, { "cell_type": "markdown", - "id": "5c33ad7b", + "id": "caf13811", "metadata": { "editable": true }, @@ -983,7 +983,7 @@ { "cell_type": "code", "execution_count": 1, - "id": "f92b952c", + "id": "f8a921f2", "metadata": { "collapsed": false, "editable": true @@ -1036,7 +1036,7 @@ }, { "cell_type": "markdown", - "id": "bc853b74", + "id": "642845d2", "metadata": { "editable": true }, @@ -1047,7 +1047,7 @@ { "cell_type": "code", "execution_count": 2, - "id": "968f01ec", + "id": "615d9546", "metadata": { "collapsed": false, "editable": true @@ -1080,7 +1080,7 @@ }, { "cell_type": "markdown", - "id": "4f12bd24", + "id": "878a352e", "metadata": { "editable": true }, @@ -1091,7 +1091,7 @@ { "cell_type": "code", "execution_count": 3, - "id": "0e81b3b9", + "id": "05878dc8", "metadata": { "collapsed": false, "editable": true @@ -1128,7 +1128,7 @@ }, { "cell_type": "markdown", - "id": "a180bb4f", + "id": "538e069f", "metadata": { "editable": true }, @@ -1139,7 +1139,7 @@ { "cell_type": "code", "execution_count": 4, - "id": "c32d897b", + "id": "4c91e0c7", "metadata": { "collapsed": false, "editable": true @@ -1166,7 +1166,7 @@ }, { "cell_type": "markdown", - "id": "4d53cf65", + "id": "4708fdf8", "metadata": { "editable": true }, @@ -1177,7 +1177,7 @@ { "cell_type": "code", "execution_count": 5, - "id": "0f1e5f83", + "id": "dc871d8f", "metadata": { "collapsed": false, "editable": true @@ -1218,7 +1218,7 @@ }, { "cell_type": "markdown", - "id": "e6468862", + "id": "4cc87ad5", "metadata": { "editable": true }, @@ -1234,7 +1234,7 @@ { "cell_type": "code", "execution_count": 6, - "id": "58aaf533", + "id": "6a075034", "metadata": { "collapsed": false, "editable": true @@ -1255,7 +1255,7 @@ }, { "cell_type": "markdown", - "id": "d8f52e33", + "id": "b48d3436", "metadata": { "editable": true }, @@ -1268,7 +1268,7 @@ { "cell_type": "code", "execution_count": 7, - "id": "afd58fba", + "id": "82256673", "metadata": { "collapsed": false, "editable": true @@ -1277,7 +1277,6 @@ "source": [ "class_names = ['airplane', 'automobile', 'bird', 'cat', 'deer',\n", " 'dog', 'frog', 'horse', 'ship', 'truck']\n", - "​\n", "plt.figure(figsize=(10,10))\n", "for i in range(25):\n", " plt.subplot(5,5,i+1)\n", @@ -1293,7 +1292,7 @@ }, { "cell_type": "markdown", - "id": "26008a78", + "id": "2de5f864", "metadata": { "editable": true }, @@ -1308,7 +1307,7 @@ { "cell_type": "code", "execution_count": 8, - "id": "fdf773da", + "id": "34cd91dc", "metadata": { "collapsed": false, "editable": true @@ -1329,7 +1328,7 @@ }, { "cell_type": "markdown", - "id": "9ebc2edb", + "id": "c51270ac", "metadata": { "editable": true }, @@ -1339,7 +1338,7 @@ }, { "cell_type": "markdown", - "id": "3b98a7e4", + "id": "f7680dfc", "metadata": { "editable": true }, @@ -1358,7 +1357,7 @@ { "cell_type": "code", "execution_count": 9, - "id": "3bfb8db3", + "id": "b923f7c4", "metadata": { "collapsed": false, "editable": true @@ -1368,24 +1367,23 @@ "model.add(layers.Flatten())\n", "model.add(layers.Dense(64, activation='relu'))\n", "model.add(layers.Dense(10))\n", - "Here's the complete architecture of our model.\n", - "\n", + "#Here's the complete architecture of our model.\n", "model.summary()" ] }, { "cell_type": "markdown", - "id": "ceb8c2c4", + "id": "8107d910", "metadata": { "editable": true }, "source": [ - "As you can see, our (4, 4, 64) outputs were flattened into vectors of shape (1024) before going through two Dense layers." + "As you can see, our (4, 4, 64) outputs were flattened into vectors of shape (1024) before going through two dense layers." ] }, { "cell_type": "markdown", - "id": "f762fe86", + "id": "d6436c68", "metadata": { "editable": true }, @@ -1396,7 +1394,7 @@ { "cell_type": "code", "execution_count": 10, - "id": "c088fa80", + "id": "6b1d461a", "metadata": { "collapsed": false, "editable": true @@ -1406,14 +1404,13 @@ "model.compile(optimizer='adam',\n", " loss=tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True),\n", " metrics=['accuracy'])\n", - "​\n", "history = model.fit(train_images, train_labels, epochs=10, \n", " validation_data=(test_images, test_labels))" ] }, { "cell_type": "markdown", - "id": "6a58f2f9", + "id": "a9853275", "metadata": { "editable": true }, @@ -1424,7 +1421,7 @@ { "cell_type": "code", "execution_count": 11, - "id": "970b93c1", + "id": "3641ff80", "metadata": { "collapsed": false, "editable": true @@ -1437,15 +1434,13 @@ "plt.ylabel('Accuracy')\n", "plt.ylim([0.5, 1])\n", "plt.legend(loc='lower right')\n", - "\n", "test_loss, test_acc = model.evaluate(test_images, test_labels, verbose=2)\n", - "\n", "print(test_acc)" ] }, { "cell_type": "markdown", - "id": "595bbe49", + "id": "4e8bb911", "metadata": { "editable": true }, @@ -1472,7 +1467,7 @@ }, { "cell_type": "markdown", - "id": "a6a3ceed", + "id": "d10dd84c", "metadata": { "editable": true }, @@ -1484,7 +1479,7 @@ }, { "cell_type": "markdown", - "id": "1c11cfe0", + "id": "6791aa19", "metadata": { "editable": true }, @@ -1495,7 +1490,7 @@ { "cell_type": "code", "execution_count": 12, - "id": "3c9c960e", + "id": "1a9bea34", "metadata": { "collapsed": false, "editable": true @@ -1515,8 +1510,6 @@ "from tensorflow.keras import regularizers \n", "from tensorflow.keras.utils import to_categorical \n", "\n", - "\n", - "\n", "# convert into dataset matrix\n", "def convertToMatrix(data, step):\n", " X, Y =[], []\n", @@ -1556,7 +1549,6 @@ "model.add(Dense(1))\n", "model.compile(loss='mean_squared_error', optimizer='rmsprop')\n", "model.summary()\n", - "\n", "model.fit(trainX,trainY, epochs=100, batch_size=16, verbose=2)\n", "trainPredict = model.predict(trainX)\n", "testPredict= model.predict(testX)\n", @@ -1574,7 +1566,7 @@ }, { "cell_type": "markdown", - "id": "3ead3155", + "id": "7e222e09", "metadata": { "editable": true }, @@ -1590,7 +1582,7 @@ { "cell_type": "code", "execution_count": 13, - "id": "ccae4f21", + "id": "fa1b4b28", "metadata": { "collapsed": false, "editable": true @@ -1629,7 +1621,7 @@ }, { "cell_type": "markdown", - "id": "7d6b63a0", + "id": "c6237960", "metadata": { "editable": true }, @@ -1673,7 +1665,7 @@ { "cell_type": "code", "execution_count": 14, - "id": "671b8076", + "id": "777176d4", "metadata": { "collapsed": false, "editable": true @@ -1756,7 +1748,7 @@ }, { "cell_type": "markdown", - "id": "9b7b896b", + "id": "e5b3cd18", "metadata": { "editable": true }, @@ -1767,7 +1759,7 @@ { "cell_type": "code", "execution_count": 15, - "id": "33bb81ea", + "id": "8bd0ef49", "metadata": { "collapsed": false, "editable": true @@ -1869,7 +1861,7 @@ }, { "cell_type": "markdown", - "id": "421951bd", + "id": "ca50ecee", "metadata": { "editable": true }, @@ -1891,7 +1883,7 @@ { "cell_type": "code", "execution_count": 16, - "id": "cce1b4fc", + "id": "0f56a065", "metadata": { "collapsed": false, "editable": true @@ -1988,7 +1980,7 @@ }, { "cell_type": "markdown", - "id": "b1eac503", + "id": "231486ad", "metadata": { "editable": true }, @@ -2014,7 +2006,7 @@ { "cell_type": "code", "execution_count": 17, - "id": "54144082", + "id": "346c01ec", "metadata": { "collapsed": false, "editable": true @@ -2215,7 +2207,7 @@ }, { "cell_type": "markdown", - "id": "102d34c5", + "id": "1e855715", "metadata": { "editable": true }, @@ -2239,7 +2231,7 @@ }, { "cell_type": "markdown", - "id": "850021bc", + "id": "74c691f8", "metadata": { "editable": true }, @@ -2259,7 +2251,7 @@ }, { "cell_type": "markdown", - "id": "17b9ceac", + "id": "20b0f4e4", "metadata": { "editable": true }, @@ -2277,7 +2269,7 @@ }, { "cell_type": "markdown", - "id": "356c6b8d", + "id": "60295fd3", "metadata": { "editable": true }, @@ -2292,7 +2284,7 @@ }, { "cell_type": "markdown", - "id": "3ac797c4", + "id": "06f276d9", "metadata": { "editable": true }, @@ -2310,7 +2302,7 @@ }, { "cell_type": "markdown", - "id": "234ecc59", + "id": "ac42c4db", "metadata": { "editable": true }, @@ -2323,7 +2315,7 @@ }, { "cell_type": "markdown", - "id": "aa46be2b", + "id": "04c1b0fe", "metadata": { "editable": true }, @@ -2341,7 +2333,7 @@ }, { "cell_type": "markdown", - "id": "916b05b5", + "id": "91abaad4", "metadata": { "editable": true }, @@ -2352,7 +2344,7 @@ }, { "cell_type": "markdown", - "id": "f1596b0b", + "id": "18714b71", "metadata": { "editable": true }, @@ -2370,7 +2362,7 @@ }, { "cell_type": "markdown", - "id": "29c9cda8", + "id": "6b83109a", "metadata": { "editable": true }, @@ -2397,7 +2389,7 @@ }, { "cell_type": "markdown", - "id": "0d0f4f2a", + "id": "f4623825", "metadata": { "editable": true }, @@ -2409,7 +2401,7 @@ }, { "cell_type": "markdown", - "id": "26ad50df", + "id": "97e20104", "metadata": { "editable": true }, @@ -2428,7 +2420,7 @@ }, { "cell_type": "markdown", - "id": "28576f76", + "id": "a11dc809", "metadata": { "editable": true }, @@ -2438,7 +2430,7 @@ }, { "cell_type": "markdown", - "id": "69f18cef", + "id": "4e1c6fc8", "metadata": { "editable": true }, @@ -2458,7 +2450,7 @@ }, { "cell_type": "markdown", - "id": "e98fe7bd", + "id": "6f811ebb", "metadata": { "editable": true }, @@ -2470,7 +2462,7 @@ }, { "cell_type": "markdown", - "id": "33625620", + "id": "609dbebf", "metadata": { "editable": true }, @@ -2488,7 +2480,7 @@ }, { "cell_type": "markdown", - "id": "03ade079", + "id": "b8e9dc97", "metadata": { "editable": true }, @@ -2500,7 +2492,7 @@ }, { "cell_type": "markdown", - "id": "41f30d1c", + "id": "50adaf2b", "metadata": { "editable": true }, @@ -2521,7 +2513,7 @@ }, { "cell_type": "markdown", - "id": "e62959d8", + "id": "f7f89a95", "metadata": { "editable": true }, @@ -2538,7 +2530,7 @@ { "cell_type": "code", "execution_count": 18, - "id": "1c0fe176", + "id": "e9dae945", "metadata": { "collapsed": false, "editable": true @@ -2556,7 +2548,7 @@ }, { "cell_type": "markdown", - "id": "e059945f", + "id": "8469c1ae", "metadata": { "editable": true }, @@ -2567,7 +2559,7 @@ { "cell_type": "code", "execution_count": 19, - "id": "b46c3171", + "id": "4f06f394", "metadata": { "collapsed": false, "editable": true @@ -2593,7 +2585,7 @@ }, { "cell_type": "markdown", - "id": "eda283cb", + "id": "9c5cd3cf", "metadata": { "editable": true }, @@ -2606,7 +2598,7 @@ { "cell_type": "code", "execution_count": 20, - "id": "e7be1c2e", + "id": "db7ee861", "metadata": { "collapsed": false, "editable": true @@ -2619,7 +2611,7 @@ }, { "cell_type": "markdown", - "id": "6a3e4f06", + "id": "290ed024", "metadata": { "editable": true }, @@ -2638,7 +2630,7 @@ { "cell_type": "code", "execution_count": 21, - "id": "aaf9a85c", + "id": "86f144d3", "metadata": { "collapsed": false, "editable": true @@ -2706,7 +2698,7 @@ }, { "cell_type": "markdown", - "id": "05051929", + "id": "8bf7ab88", "metadata": { "editable": true }, @@ -2719,7 +2711,7 @@ { "cell_type": "code", "execution_count": 22, - "id": "47dfdf75", + "id": "ee8291f7", "metadata": { "collapsed": false, "editable": true @@ -2759,7 +2751,7 @@ }, { "cell_type": "markdown", - "id": "4e4c9b20", + "id": "fffb3d71", "metadata": { "editable": true }, @@ -2771,7 +2763,7 @@ { "cell_type": "code", "execution_count": 23, - "id": "1c73bbbb", + "id": "a78aeff3", "metadata": { "collapsed": false, "editable": true @@ -2785,7 +2777,7 @@ { "cell_type": "code", "execution_count": 24, - "id": "cb263f7b", + "id": "b6841971", "metadata": { "collapsed": false, "editable": true @@ -2798,7 +2790,7 @@ }, { "cell_type": "markdown", - "id": "594a6faa", + "id": "7a0e935e", "metadata": { "editable": true }, @@ -2809,7 +2801,7 @@ { "cell_type": "code", "execution_count": 25, - "id": "b4bf2541", + "id": "4d955ef1", "metadata": { "collapsed": false, "editable": true @@ -2823,7 +2815,7 @@ }, { "cell_type": "markdown", - "id": "30f5f988", + "id": "1f02c4d5", "metadata": { "editable": true }, @@ -2838,7 +2830,7 @@ { "cell_type": "code", "execution_count": 26, - "id": "0057bc45", + "id": "4f2c7e3b", "metadata": { "collapsed": false, "editable": true @@ -2854,7 +2846,7 @@ { "cell_type": "code", "execution_count": 27, - "id": "b7d13cf5", + "id": "3e283626", "metadata": { "collapsed": false, "editable": true @@ -2871,7 +2863,7 @@ }, { "cell_type": "markdown", - "id": "b66ef096", + "id": "f24a66e8", "metadata": { "editable": true }, @@ -2883,7 +2875,7 @@ { "cell_type": "code", "execution_count": 28, - "id": "265edec4", + "id": "fe431bbc", "metadata": { "collapsed": false, "editable": true @@ -2897,7 +2889,7 @@ }, { "cell_type": "markdown", - "id": "d8b925a9", + "id": "08bedbc8", "metadata": { "editable": true }, @@ -2913,7 +2905,7 @@ { "cell_type": "code", "execution_count": 29, - "id": "4c24e07c", + "id": "dcbbfe02", "metadata": { "collapsed": false, "editable": true @@ -2947,7 +2939,7 @@ }, { "cell_type": "markdown", - "id": "226e11aa", + "id": "642f178c", "metadata": { "editable": true }, @@ -2960,7 +2952,7 @@ { "cell_type": "code", "execution_count": 30, - "id": "12665849", + "id": "8eb8f078", "metadata": { "collapsed": false, "editable": true @@ -2985,7 +2977,7 @@ }, { "cell_type": "markdown", - "id": "6dbda3fc", + "id": "185100ba", "metadata": { "editable": true }, @@ -2999,7 +2991,7 @@ { "cell_type": "code", "execution_count": 31, - "id": "f8e512f6", + "id": "6a256e74", "metadata": { "collapsed": false, "editable": true @@ -3017,7 +3009,7 @@ }, { "cell_type": "markdown", - "id": "22d5f913", + "id": "bd97b51d", "metadata": { "editable": true }, @@ -3028,7 +3020,7 @@ { "cell_type": "code", "execution_count": 32, - "id": "820c1dc6", + "id": "42ddd910", "metadata": { "collapsed": false, "editable": true @@ -3068,7 +3060,7 @@ }, { "cell_type": "markdown", - "id": "364f2202", + "id": "cab3288a", "metadata": { "editable": true }, @@ -3080,7 +3072,7 @@ { "cell_type": "code", "execution_count": 33, - "id": "edcb5cf6", + "id": "e3e4e46b", "metadata": { "collapsed": false, "editable": true @@ -3092,7 +3084,7 @@ }, { "cell_type": "markdown", - "id": "0a69b6db", + "id": "fa628eb4", "metadata": { "editable": true }, @@ -3106,7 +3098,7 @@ { "cell_type": "code", "execution_count": 34, - "id": "e62ec4b9", + "id": "a29d7a36", "metadata": { "collapsed": false, "editable": true @@ -3123,7 +3115,7 @@ }, { "cell_type": "markdown", - "id": "30719441", + "id": "c97bb950", "metadata": { "editable": true }, @@ -3137,7 +3129,7 @@ { "cell_type": "code", "execution_count": 35, - "id": "fdd86d94", + "id": "75c02c4f", "metadata": { "collapsed": false, "editable": true @@ -3154,7 +3146,7 @@ }, { "cell_type": "markdown", - "id": "e650dcb0", + "id": "7002de8e", "metadata": { "editable": true }, @@ -3170,7 +3162,7 @@ { "cell_type": "code", "execution_count": 36, - "id": "c10ede25", + "id": "7fafeb29", "metadata": { "collapsed": false, "editable": true @@ -3198,7 +3190,7 @@ { "cell_type": "code", "execution_count": 37, - "id": "007f5c1c", + "id": "965eee54", "metadata": { "collapsed": false, "editable": true @@ -3221,7 +3213,7 @@ { "cell_type": "code", "execution_count": 38, - "id": "2e4e23bf", + "id": "08a29dab", "metadata": { "collapsed": false, "editable": true @@ -3234,7 +3226,7 @@ }, { "cell_type": "markdown", - "id": "0d6229f1", + "id": "889fcecb", "metadata": { "editable": true }, @@ -3250,7 +3242,7 @@ { "cell_type": "code", "execution_count": 39, - "id": "331eb2c0", + "id": "437bc288", "metadata": { "collapsed": false, "editable": true @@ -3277,7 +3269,7 @@ }, { "cell_type": "markdown", - "id": "f40a0233", + "id": "ccbd2be7", "metadata": { "editable": true }, @@ -3292,7 +3284,7 @@ { "cell_type": "code", "execution_count": 40, - "id": "e7532cee", + "id": "61d645f2", "metadata": { "collapsed": false, "editable": true @@ -3308,7 +3300,7 @@ }, { "cell_type": "markdown", - "id": "50d2c1af", + "id": "e098db36", "metadata": { "editable": true }, @@ -3319,7 +3311,7 @@ }, { "cell_type": "markdown", - "id": "1bb36160", + "id": "94429655", "metadata": { "editable": true }, @@ -3337,7 +3329,7 @@ { "cell_type": "code", "execution_count": 41, - "id": "94ff439b", + "id": "2af9e60d", "metadata": { "collapsed": false, "editable": true @@ -3355,7 +3347,7 @@ }, { "cell_type": "markdown", - "id": "9ea83687", + "id": "26be8697", "metadata": { "editable": true }, @@ -3366,7 +3358,7 @@ { "cell_type": "code", "execution_count": 42, - "id": "8a4ae113", + "id": "b6534afb", "metadata": { "collapsed": false, "editable": true diff --git a/doc/src/week43/week43.do.txt b/doc/src/week43/week43.do.txt index a5574a954..1d68fa871 100644 --- a/doc/src/week43/week43.do.txt +++ b/doc/src/week43/week43.do.txt @@ -745,7 +745,6 @@ To verify that the dataset looks correct, let's plot the first 25 images from th !bc pycod class_names = ['airplane', 'automobile', 'bird', 'cat', 'deer', 'dog', 'frog', 'horse', 'ship', 'truck'] -​ plt.figure(figsize=(10,10)) for i in range(25): plt.subplot(5,5,i+1) @@ -799,11 +798,10 @@ layer with 10 outputs and a softmax activation. model.add(layers.Flatten()) model.add(layers.Dense(64, activation='relu')) model.add(layers.Dense(10)) -Here's the complete architecture of our model. - +#Here's the complete architecture of our model. model.summary() !ec -As you can see, our (4, 4, 64) outputs were flattened into vectors of shape (1024) before going through two Dense layers. +As you can see, our (4, 4, 64) outputs were flattened into vectors of shape (1024) before going through two dense layers. !split ===== Compile and train the model ===== @@ -812,7 +810,6 @@ As you can see, our (4, 4, 64) outputs were flattened into vectors of shape (102 model.compile(optimizer='adam', loss=tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True), metrics=['accuracy']) -​ history = model.fit(train_images, train_labels, epochs=10, validation_data=(test_images, test_labels)) @@ -829,11 +826,8 @@ plt.xlabel('Epoch') plt.ylabel('Accuracy') plt.ylim([0.5, 1]) plt.legend(loc='lower right') - test_loss, test_acc = model.evaluate(test_images, test_labels, verbose=2) - print(test_acc) - !ec @@ -880,8 +874,6 @@ from tensorflow.keras import optimizers from tensorflow.keras import regularizers from tensorflow.keras.utils import to_categorical - - # convert into dataset matrix def convertToMatrix(data, step): X, Y =[], [] @@ -921,7 +913,6 @@ model.add(Dense(8, activation="relu")) model.add(Dense(1)) model.compile(loss='mean_squared_error', optimizer='rmsprop') model.summary() - model.fit(trainX,trainY, epochs=100, batch_size=16, verbose=2) trainPredict = model.predict(trainX) testPredict= model.predict(testX)