From 4e33f5bdf4d322e46038523e322f4834a92654d6 Mon Sep 17 00:00:00 2001 From: Mustapha Abdullahi <37770012+mustious@users.noreply.github.com> Date: Fri, 27 Jan 2023 22:50:32 +0000 Subject: [PATCH 1/8] spelling correction --- 00_pytorch_fundamentals.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/00_pytorch_fundamentals.ipynb b/00_pytorch_fundamentals.ipynb index cc7927f..c1dd6d7 100644 --- a/00_pytorch_fundamentals.ipynb +++ b/00_pytorch_fundamentals.ipynb @@ -697,7 +697,7 @@ "\n", "And machine learning models such as neural networks manipulate and seek patterns within tensors.\n", "\n", - "But when building machine learning models with PyTorch, it's rare you'll create tenors by hand (like what we've being doing).\n", + "But when building machine learning models with PyTorch, it's rare you'll create tensors by hand (like what we've being doing).\n", "\n", "Instead, a machine learning model often starts out with large random tensors of numbers and adjusts these random numbers as it works through data to better represent it.\n", "\n", From b714f816c2d44ddbac2f36de31d35a0a16affa58 Mon Sep 17 00:00:00 2001 From: Mustapha Abdullahi <37770012+mustious@users.noreply.github.com> Date: Fri, 27 Jan 2023 23:38:18 +0000 Subject: [PATCH 2/8] small spelling change --- 00_pytorch_fundamentals.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/00_pytorch_fundamentals.ipynb b/00_pytorch_fundamentals.ipynb index cc7927f..e494a6c 100644 --- a/00_pytorch_fundamentals.ipynb +++ b/00_pytorch_fundamentals.ipynb @@ -1044,7 +1044,7 @@ "float_32_tensor = torch.tensor([3.0, 6.0, 9.0],\n", " dtype=None, # defaults to None, which is torch.float32 or whatever datatype is passed\n", " device=None, # defaults to None, which uses the default tensor type\n", - " requires_grad=False) # if True, operations perfromed on the tensor are recorded \n", + " requires_grad=False) # if True, operations performed on the tensor are recorded \n", "\n", "float_32_tensor.shape, float_32_tensor.dtype, float_32_tensor.device" ] From c70de44635f98c562c0d77f270b9f7adbb84f58e Mon Sep 17 00:00:00 2001 From: Stefano Fiorucci <44616784+anakin87@users.noreply.github.com> Date: Mon, 13 Feb 2023 14:25:18 +0100 Subject: [PATCH 3/8] Fix typos in 02 notebook --- 02_pytorch_classification.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/02_pytorch_classification.ipynb b/02_pytorch_classification.ipynb index ee7ea92..abe3df0 100644 --- a/02_pytorch_classification.ipynb +++ b/02_pytorch_classification.ipynb @@ -956,7 +956,7 @@ "| Stochastic Gradient Descent (SGD) optimizer | Classification, regression, many others. | [`torch.optim.SGD()`](https://pytorch.org/docs/stable/generated/torch.optim.SGD.html) |\n", "| Adam Optimizer | Classification, regression, many others. | [`torch.optim.Adam()`](https://pytorch.org/docs/stable/generated/torch.optim.Adam.html) |\n", "| Binary cross entropy loss | Binary classification | [`torch.nn.BCELossWithLogits`](https://pytorch.org/docs/stable/generated/torch.nn.BCEWithLogitsLoss.html) or [`torch.nn.BCELoss`](https://pytorch.org/docs/stable/generated/torch.nn.BCELoss.html) |\n", - "| Cross entropy loss | Mutli-class classification | [`torch.nn.CrossEntropyLoss`](https://pytorch.org/docs/stable/generated/torch.nn.CrossEntropyLoss.html) |\n", + "| Cross entropy loss | Multi-class classification | [`torch.nn.CrossEntropyLoss`](https://pytorch.org/docs/stable/generated/torch.nn.CrossEntropyLoss.html) |\n", "| Mean absolute error (MAE) or L1 Loss | Regression | [`torch.nn.L1Loss`](https://pytorch.org/docs/stable/generated/torch.nn.L1Loss.html) | \n", "| Mean squared error (MSE) or L2 Loss | Regression | [`torch.nn.MSELoss`](https://pytorch.org/docs/stable/generated/torch.nn.MSELoss.html#torch.nn.MSELoss) | \n", "\n", @@ -2913,7 +2913,7 @@ "id": "f5Ephtx6f1jB" }, "source": [ - "### 8.1 Creating mutli-class classification data\n", + "### 8.1 Creating multi-class classification data\n", "\n", "To begin a multi-class classification problem, let's create some multi-class data.\n", "\n", From 453a94a2ba8b3cc69a6864cb2e25c2f22d97efc7 Mon Sep 17 00:00:00 2001 From: Stefano Fiorucci <44616784+anakin87@users.noreply.github.com> Date: Mon, 13 Feb 2023 15:31:32 +0100 Subject: [PATCH 4/8] Update 02_pytorch_classification_exercises.ipynb --- extras/exercises/02_pytorch_classification_exercises.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/exercises/02_pytorch_classification_exercises.ipynb b/extras/exercises/02_pytorch_classification_exercises.ipynb index b792b44..8592b6a 100644 --- a/extras/exercises/02_pytorch_classification_exercises.ipynb +++ b/extras/exercises/02_pytorch_classification_exercises.ipynb @@ -212,7 +212,7 @@ "print(\"Pred probs:\")\n", "## Your code here ##\n", "\n", - "# Prediction probabilities\n", + "# Prediction labels\n", "print(\"Pred labels:\")\n", "## Your code here ##" ], From 9b0ddfc120b991788b799f4b018b8ccca4087347 Mon Sep 17 00:00:00 2001 From: Stefano Fiorucci <44616784+anakin87@users.noreply.github.com> Date: Wed, 1 Mar 2023 16:28:15 +0100 Subject: [PATCH 5/8] change Accuracy for recent versions of torchmetrics --- .../02_pytorch_classification_exercise_solutions.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/solutions/02_pytorch_classification_exercise_solutions.ipynb b/extras/solutions/02_pytorch_classification_exercise_solutions.ipynb index 3f79724..b6940ae 100644 --- a/extras/solutions/02_pytorch_classification_exercise_solutions.ipynb +++ b/extras/solutions/02_pytorch_classification_exercise_solutions.ipynb @@ -633,7 +633,7 @@ "# Let's calculuate the accuracy\n", "!pip -q install torchmetrics # colab doesn't come with torchmetrics\n", "from torchmetrics import Accuracy\n", - "acc_fn = Accuracy().to(device) # send accuracy function to device\n", + "acc_fn = Accuracy(task="multiclass", num_classes=2).to(device) # send accuracy function to device\n", "acc_fn" ], "metadata": { From 649d59a1da78f275f9cc4f0829b0a7e893599684 Mon Sep 17 00:00:00 2001 From: Stefano Fiorucci <44616784+anakin87@users.noreply.github.com> Date: Wed, 1 Mar 2023 16:55:37 +0100 Subject: [PATCH 6/8] improvements --- .../02_pytorch_classification_exercise_solutions.ipynb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/extras/solutions/02_pytorch_classification_exercise_solutions.ipynb b/extras/solutions/02_pytorch_classification_exercise_solutions.ipynb index b6940ae..eda2b10 100644 --- a/extras/solutions/02_pytorch_classification_exercise_solutions.ipynb +++ b/extras/solutions/02_pytorch_classification_exercise_solutions.ipynb @@ -630,7 +630,7 @@ { "cell_type": "code", "source": [ - "# Let's calculuate the accuracy\n", + "# Let's calculate the accuracy\n", "!pip -q install torchmetrics # colab doesn't come with torchmetrics\n", "from torchmetrics import Accuracy\n", "acc_fn = Accuracy(task="multiclass", num_classes=2).to(device) # send accuracy function to device\n", @@ -649,7 +649,7 @@ "output_type": "execute_result", "data": { "text/plain": [ - "Accuracy()" + "MulticlassAccuracy()" ] }, "metadata": {}, @@ -1054,10 +1054,10 @@ { "cell_type": "code", "source": [ - "# Let's calculuate the accuracy for when we fit our model\n", + "# Let's calculate the accuracy for when we fit our model\n", "!pip -q install torchmetrics # colab doesn't come with torchmetrics\n", "from torchmetrics import Accuracy\n", - "acc_fn = Accuracy().to(device)\n", + "acc_fn = Accuracy(task=\"multiclass\", num_classes=4).to(device) # send accuracy function to device\n", "acc_fn" ], "metadata": { @@ -1073,7 +1073,7 @@ "output_type": "execute_result", "data": { "text/plain": [ - "Accuracy()" + "MulticlassAccuracy()" ] }, "metadata": {}, From f1f307d1c78e4e7efb7664ed8d76e65a5642a63a Mon Sep 17 00:00:00 2001 From: Stefano Fiorucci <44616784+anakin87@users.noreply.github.com> Date: Wed, 1 Mar 2023 17:00:00 +0100 Subject: [PATCH 7/8] fix error --- .../02_pytorch_classification_exercise_solutions.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/solutions/02_pytorch_classification_exercise_solutions.ipynb b/extras/solutions/02_pytorch_classification_exercise_solutions.ipynb index eda2b10..1c8a460 100644 --- a/extras/solutions/02_pytorch_classification_exercise_solutions.ipynb +++ b/extras/solutions/02_pytorch_classification_exercise_solutions.ipynb @@ -633,7 +633,7 @@ "# Let's calculate the accuracy\n", "!pip -q install torchmetrics # colab doesn't come with torchmetrics\n", "from torchmetrics import Accuracy\n", - "acc_fn = Accuracy(task="multiclass", num_classes=2).to(device) # send accuracy function to device\n", + "acc_fn = Accuracy(task=\"multiclass\", num_classes=2).to(device) # send accuracy function to device\n", "acc_fn" ], "metadata": { From 85a99bc78ee36bd94b76f0b4d59fe60d8c74fb71 Mon Sep 17 00:00:00 2001 From: Stefano Fiorucci <44616784+anakin87@users.noreply.github.com> Date: Wed, 1 Mar 2023 17:02:01 +0100 Subject: [PATCH 8/8] fix number of classes --- .../02_pytorch_classification_exercise_solutions.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/solutions/02_pytorch_classification_exercise_solutions.ipynb b/extras/solutions/02_pytorch_classification_exercise_solutions.ipynb index 1c8a460..a16fe1f 100644 --- a/extras/solutions/02_pytorch_classification_exercise_solutions.ipynb +++ b/extras/solutions/02_pytorch_classification_exercise_solutions.ipynb @@ -1057,7 +1057,7 @@ "# Let's calculate the accuracy for when we fit our model\n", "!pip -q install torchmetrics # colab doesn't come with torchmetrics\n", "from torchmetrics import Accuracy\n", - "acc_fn = Accuracy(task=\"multiclass\", num_classes=4).to(device) # send accuracy function to device\n", + "acc_fn = Accuracy(task=\"multiclass\", num_classes=3).to(device) # send accuracy function to device\n", "acc_fn" ], "metadata": {