|
2163 | 2163 | "\n",
|
2164 | 2164 | "Overfitting means our model is learning the training data well but those patterns aren't generalizing to the testing data.\n",
|
2165 | 2165 | "\n",
|
2166 |
| - "Two of the main to fix overfitting include:\n", |
| 2166 | + "Two of the main ways to fix overfitting include:\n", |
2167 | 2167 | "1. Using a smaller or different model (some models fit certain kinds of data better than others).\n",
|
2168 | 2168 | "2. Using a larger dataset (the more data, the more chance a model has to learn generalizable patterns).\n",
|
2169 | 2169 | "\n",
|
|
2306 | 2306 | " self.classifier = nn.Sequential(\n",
|
2307 | 2307 | " nn.Flatten(),\n",
|
2308 | 2308 | " # Where did this in_features shape come from? \n",
|
2309 |
| - " # It's because each layer of our network compresses and changes the shape of our inputs data.\n", |
| 2309 | + " # It's because each layer of our network compresses and changes the shape of our input data.\n", |
2310 | 2310 | " nn.Linear(in_features=hidden_units*7*7, \n",
|
2311 | 2311 | " out_features=output_shape)\n",
|
2312 | 2312 | " )\n",
|
|
3014 | 3014 | "source": [
|
3015 | 3015 | "Notice the change in the shapes of what's happening in and out of a `nn.MaxPool2d()` layer.\n",
|
3016 | 3016 | "\n",
|
3017 |
| - "The `kernel_size` of the `nn.MaxPool2d()` layer will effects the size of the output shape.\n", |
| 3017 | + "The `kernel_size` of the `nn.MaxPool2d()` layer will affect the size of the output shape.\n", |
3018 | 3018 | "\n",
|
3019 | 3019 | "In our case, the shape halves from a `62x62` image to `31x31` image.\n",
|
3020 | 3020 | "\n",
|
|
3050 | 3050 | ],
|
3051 | 3051 | "source": [
|
3052 | 3052 | "torch.manual_seed(42)\n",
|
3053 |
| - "# Create a random tensor with a similiar number of dimensions to our images\n", |
| 3053 | + "# Create a random tensor with a similar number of dimensions to our images\n", |
3054 | 3054 | "random_tensor = torch.randn(size=(1, 1, 2, 2))\n",
|
3055 | 3055 | "print(f\"Random tensor:\\n{random_tensor}\")\n",
|
3056 | 3056 | "print(f\"Random tensor shape: {random_tensor.shape}\")\n",
|
|
0 commit comments