|
3686 | 3686 | ">\n",
|
3687 | 3687 | "> Generally, the more CPU cores you have, the faster your models will train on CPU. And similar for GPUs.\n",
|
3688 | 3688 | "> \n",
|
3689 |
| - "> Newer hardware (in terms of age) will also often train models faster due to incorporating technology advances.\n", |
| 3689 | + "> Newer hardware (in terms of age) will also often train models faster due to incorporating technological advances.\n", |
3690 | 3690 | "\n",
|
3691 | 3691 | "How about we get visual?"
|
3692 | 3692 | ]
|
|
4041 | 4041 | "\n",
|
4042 | 4042 | "One of the most visual is a [confusion matrix](https://www.dataschool.io/simple-guide-to-confusion-matrix-terminology/).\n",
|
4043 | 4043 | "\n",
|
4044 |
| - "A confusion matrix shows you where your classification model got confused between predicitons and true labels.\n", |
| 4044 | + "A confusion matrix shows you where your classification model got confused between predictions and true labels.\n", |
4045 | 4045 | "\n",
|
4046 | 4046 | "To make a confusion matrix, we'll go through three steps:\n",
|
4047 | 4047 | "1. Make predictions with our trained model, `model_2` (a confusion matrix compares predictions to true labels).\n",
|
|
4126 | 4126 | "2. Make a confusion matrix using [`torchmetrics.ConfusionMatrix`](https://torchmetrics.readthedocs.io/en/latest/references/modules.html?highlight=confusion#confusionmatrix).\n",
|
4127 | 4127 | "3. Plot the confusion matrix using [`mlxtend.plotting.plot_confusion_matrix()`](http://rasbt.github.io/mlxtend/user_guide/plotting/plot_confusion_matrix/).\n",
|
4128 | 4128 | "\n",
|
4129 |
| - "First we'll need to make sure we've got `torchmetrics` and `mlxtend` installed (these two libraries will help us make and visual a confusion matrix).\n", |
| 4129 | + "First we'll need to make sure we've got `torchmetrics` and `mlxtend` installed (these two libraries will help us make and visualize a confusion matrix).\n", |
4130 | 4130 | "\n",
|
4131 | 4131 | "> **Note:** If you're using Google Colab, the default version of `mlxtend` installed is 0.14.0 (as of March 2022), however, for the parameters of the `plot_confusion_matrix()` function we'd like use, we need 0.19.0 or higher. "
|
4132 | 4132 | ]
|
|
4215 | 4215 | "\n",
|
4216 | 4216 | "Then we'll create a confusion matrix (in tensor format) by passing our instance our model's predictions (`preds=y_pred_tensor`) and targets (`target=test_data.targets`).\n",
|
4217 | 4217 | "\n",
|
4218 |
| - "Finally we can plot our confision matrix using the `plot_confusion_matrix()` function from `mlxtend.plotting`." |
| 4218 | + "Finally we can plot our confusion matrix using the `plot_confusion_matrix()` function from `mlxtend.plotting`." |
4219 | 4219 | ]
|
4220 | 4220 | },
|
4221 | 4221 | {
|
|
4539 | 4539 | "7. Turn the MNIST train and test datasets into dataloaders using `torch.utils.data.DataLoader`, set the `batch_size=32`.\n",
|
4540 | 4540 | "8. Recreate `model_2` used in this notebook (the same model from the [CNN Explainer website](https://poloclub.github.io/cnn-explainer/), also known as TinyVGG) capable of fitting on the MNIST dataset.\n",
|
4541 | 4541 | "9. Train the model you built in exercise 8. on CPU and GPU and see how long it takes on each.\n",
|
4542 |
| - "10. Make predictions using your trained model and visualize at least 5 of them comparing the prediciton to the target label.\n", |
| 4542 | + "10. Make predictions using your trained model and visualize at least 5 of them comparing the prediction to the target label.\n", |
4543 | 4543 | "11. Plot a confusion matrix comparing your model's predictions to the truth labels.\n",
|
4544 | 4544 | "12. Create a random tensor of shape `[1, 3, 64, 64]` and pass it through a `nn.Conv2d()` layer with various hyperparameter settings (these can be any settings you choose), what do you notice if the `kernel_size` parameter goes up and down?\n",
|
4545 | 4545 | "13. Use a model similar to the trained `model_2` from this notebook to make predictions on the test [`torchvision.datasets.FashionMNIST`](https://pytorch.org/vision/main/generated/torchvision.datasets.FashionMNIST.html) dataset. \n",
|
|
4549 | 4549 | "\n",
|
4550 | 4550 | "## Extra-curriculum\n",
|
4551 | 4551 | "* **Watch:** [MIT's Introduction to Deep Computer Vision](https://www.youtube.com/watch?v=iaSUYvmCekI&list=PLtBw6njQRU-rwp5__7C0oIVt26ZgjG9NI&index=3) lecture. This will give you a great intuition behind convolutional neural networks.\n",
|
4552 |
| - "* Spend 10-minutes clicking thorugh the different options of the [PyTorch vision library](https://pytorch.org/vision/stable/index.html), what different modules are available?\n", |
| 4552 | + "* Spend 10-minutes clicking through the different options of the [PyTorch vision library](https://pytorch.org/vision/stable/index.html), what different modules are available?\n", |
4553 | 4553 | "* Lookup \"most common convolutional neural networks\", what architectures do you find? Are any of them contained within the [`torchvision.models`](https://pytorch.org/vision/stable/models.html) library? What do you think you could do with these?\n",
|
4554 | 4554 | "* For a large number of pretrained PyTorch computer vision models as well as many different extensions to PyTorch's computer vision functionalities check out the [PyTorch Image Models library `timm`](https://github.com/rwightman/pytorch-image-models/) (Torch Image Models) by Ross Wightman."
|
4555 | 4555 | ]
|
4556 |
| - }, |
4557 |
| - { |
4558 |
| - "cell_type": "markdown", |
4559 |
| - "id": "3690b822", |
4560 |
| - "metadata": {}, |
4561 |
| - "source": [] |
4562 | 4556 | }
|
4563 | 4557 | ],
|
4564 | 4558 | "metadata": {
|
|
0 commit comments