From af0c959d07ddbb64fe92a29b67e455fe76db9232 Mon Sep 17 00:00:00 2001 From: Ian Beauregard Date: Mon, 14 Sep 2020 07:52:07 -0400 Subject: [PATCH 1/8] Remove soon-to-be-deprecated method Warning: THIS FUNCTION IS DEPRECATED. It will be removed after 2021-01-01. Instructions for updating: Please use instead: np.argmax(model.predict(x), axis=-1), if your model does multi-class classification (e.g. if it uses a softmax last-layer activation). --- 10_neural_nets_with_keras.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/10_neural_nets_with_keras.ipynb b/10_neural_nets_with_keras.ipynb index caeac36..8c1ca66 100644 --- a/10_neural_nets_with_keras.ipynb +++ b/10_neural_nets_with_keras.ipynb @@ -741,7 +741,7 @@ "metadata": {}, "outputs": [], "source": [ - "y_pred = model.predict_classes(X_new)\n", + "y_pred = np.argmax(model.predict(X_new), axis=-1)\n", "y_pred" ] }, From 30d160f8be9fa959ca507a6ca53bc891b98ade08 Mon Sep 17 00:00:00 2001 From: Ian Beauregard Date: Mon, 14 Sep 2020 09:35:42 -0400 Subject: [PATCH 2/8] Remove useless code cell --- 10_neural_nets_with_keras.ipynb | 9 --------- 1 file changed, 9 deletions(-) diff --git a/10_neural_nets_with_keras.ipynb b/10_neural_nets_with_keras.ipynb index 8c1ca66..4bd30d9 100644 --- a/10_neural_nets_with_keras.ipynb +++ b/10_neural_nets_with_keras.ipynb @@ -1085,15 +1085,6 @@ "y_pred_main, y_pred_aux = model.predict((X_new_A, X_new_B))" ] }, - { - "cell_type": "code", - "execution_count": 67, - "metadata": {}, - "outputs": [], - "source": [ - "model = WideAndDeepModel(30, activation=\"relu\")" - ] - }, { "cell_type": "markdown", "metadata": {}, From 5d53b561ad7ef314bbc22de379d600165640e961 Mon Sep 17 00:00:00 2001 From: Akshit Gupta Date: Mon, 5 Oct 2020 23:40:19 +0530 Subject: [PATCH 3/8] updated the import --- 02_end_to_end_machine_learning_project.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/02_end_to_end_machine_learning_project.ipynb b/02_end_to_end_machine_learning_project.ipynb index 06b7747..a277f39 100644 --- a/02_end_to_end_machine_learning_project.ipynb +++ b/02_end_to_end_machine_learning_project.ipynb @@ -95,7 +95,7 @@ "source": [ "import os\n", "import tarfile\n", - "import urllib\n", + "import urllib.request\n", "\n", "DOWNLOAD_ROOT = \"https://raw.githubusercontent.com/ageron/handson-ml2/master/\"\n", "HOUSING_PATH = os.path.join(\"datasets\", \"housing\")\n", From cbfefe7a97ba07e836ffb5224bcca8af560b292d Mon Sep 17 00:00:00 2001 From: Ian Beauregard Date: Tue, 6 Oct 2020 17:02:03 -0400 Subject: [PATCH 4/8] Change function argument In Exercise 9, function `mnist_dataset` was called with the wrong argument. --- 13_loading_and_preprocessing_data.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/13_loading_and_preprocessing_data.ipynb b/13_loading_and_preprocessing_data.ipynb index 144b216..8561f33 100644 --- a/13_loading_and_preprocessing_data.ipynb +++ b/13_loading_and_preprocessing_data.ipynb @@ -2040,8 +2040,8 @@ "outputs": [], "source": [ "train_set = mnist_dataset(train_filepaths, shuffle_buffer_size=60000)\n", - "valid_set = mnist_dataset(train_filepaths)\n", - "test_set = mnist_dataset(train_filepaths)" + "valid_set = mnist_dataset(valid_filepaths)\n", + "test_set = mnist_dataset(test_filepaths)" ] }, { From c3cbfd04d5e80ec88e95cd5b1e3c0829bb760d3f Mon Sep 17 00:00:00 2001 From: Ian Beauregard Date: Tue, 6 Oct 2020 17:51:42 -0400 Subject: [PATCH 5/8] Adding two missing words --- 13_loading_and_preprocessing_data.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/13_loading_and_preprocessing_data.ipynb b/13_loading_and_preprocessing_data.ipynb index 8561f33..4e9a935 100644 --- a/13_loading_and_preprocessing_data.ipynb +++ b/13_loading_and_preprocessing_data.ipynb @@ -2274,7 +2274,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "But let's pretend the dataset does not fit in memory, just to make things more interesting. Luckily, each review fits on just one line (they use `
` to indicate line breaks), so we can read the reviews using a `TextLineDataset`. If they didn't we would have to preprocess the input files (e.g., converting them to TFRecords). For very large datasets, it would make sense a tool like Apache Beam for that." + "But let's pretend the dataset does not fit in memory, just to make things more interesting. Luckily, each review fits on just one line (they use `
` to indicate line breaks), so we can read the reviews using a `TextLineDataset`. If they didn't we would have to preprocess the input files (e.g., converting them to TFRecords). For very large datasets, it would make sense to use a tool like Apache Beam for that." ] }, { From a83d4885dce9bd247bbe384f92f3e22df03e9b27 Mon Sep 17 00:00:00 2001 From: Ian Beauregard Date: Tue, 6 Oct 2020 18:51:06 -0400 Subject: [PATCH 6/8] Correct a small typo One missing word. --- 13_loading_and_preprocessing_data.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/13_loading_and_preprocessing_data.ipynb b/13_loading_and_preprocessing_data.ipynb index 4e9a935..c258b82 100644 --- a/13_loading_and_preprocessing_data.ipynb +++ b/13_loading_and_preprocessing_data.ipynb @@ -2473,7 +2473,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Let's run it on the same `X_example`, just to make sure the word IDs are larger now, since the vocabulary bigger:" + "Let's run it on the same `X_example`, just to make sure the word IDs are larger now, since the vocabulary is bigger:" ] }, { From 08e387005399bba46e5b1aa605e467f47ef50272 Mon Sep 17 00:00:00 2001 From: Ian Beauregard Date: Tue, 6 Oct 2020 19:20:18 -0400 Subject: [PATCH 7/8] Correct small "code typo" --- 13_loading_and_preprocessing_data.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/13_loading_and_preprocessing_data.ipynb b/13_loading_and_preprocessing_data.ipynb index c258b82..7d7ff12 100644 --- a/13_loading_and_preprocessing_data.ipynb +++ b/13_loading_and_preprocessing_data.ipynb @@ -2540,7 +2540,7 @@ "source": [ "class BagOfWords(keras.layers.Layer):\n", " def __init__(self, n_tokens, dtype=tf.int32, **kwargs):\n", - " super().__init__(dtype=tf.int32, **kwargs)\n", + " super().__init__(dtype=dtype, **kwargs)\n", " self.n_tokens = n_tokens\n", " def call(self, inputs):\n", " one_hot = tf.one_hot(inputs, self.n_tokens)\n", From 80f6cb27c080282e75a6036991c99736f6b13bba Mon Sep 17 00:00:00 2001 From: 8bitmp3 <19637339+8bitmp3@users.noreply.github.com> Date: Sat, 17 Oct 2020 15:04:51 +0100 Subject: [PATCH 8/8] Update (small) the reinforcement learning chapter --- 18_reinforcement_learning.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/18_reinforcement_learning.ipynb b/18_reinforcement_learning.ipynb index e6d3717..726a137 100644 --- a/18_reinforcement_learning.ipynb +++ b/18_reinforcement_learning.ipynb @@ -565,7 +565,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Let's create a neural network that will take observations as inputs, and output the action to take for each observation. To choose an action, the network will estimate a probability for each action, then we will select an action randomly according to the estimated probabilities. In the case of the Cart-Pole environment, there are just two possible actions (left or right), so we only need one output neuron: it will output the probability `p` of the action 0 (left), and of course the probability of action 1 (right) will be `1 - p`." + "Let's create a neural network that will take observations as inputs, and output the probabilities of actions to take for each observation. To choose an action, the network will estimate a probability for each action, then we will select an action randomly according to the estimated probabilities. In the case of the Cart-Pole environment, there are just two possible actions (left or right), so we only need one output neuron: it will output the probability `p` of the action 0 (left), and of course the probability of action 1 (right) will be `1 - p`." ] }, {