Skip to content

Commit 736e054

Browse files
Added activation functions to MLP models (and minor formatting). (#45)
* 📝 Added activation functions to model * 🎨 Applied black * 📝 Demo updates * 🎨 Applied black * ➕ Added black * 🎨 Applied black * revert black to being an optional linting dependency. * revert explicit specification of learning rate in exercise 1 (discussed in exercise 2.) * Apply black unrelated to the rest of this PR -_-. --------- Co-authored-by: Jack Atkinson <[email protected]>
1 parent 7eccfe3 commit 736e054

File tree

6 files changed

+118
-131
lines changed

6 files changed

+118
-131
lines changed

exercises/01_penguin_classification.ipynb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,11 @@
143143
"outputs": [],
144144
"source": [
145145
"from torchvision.transforms import Compose\n",
146+
"\n",
146147
"# import some useful functions here, see https://pytorch.org/docs/stable/torch.html\n",
147148
"# where `tensor` and `eye` are used for constructing tensors,\n",
148149
"# and using a lower-precision float32 is advised for performance\n",
149-
"from torch import tensor, eye, float32 \n",
150+
"from torch import tensor, eye, float32\n",
150151
"\n",
151152
"# Apply the transforms we need to the PenguinDataset to get out input\n",
152153
"# targets as Tensors."
@@ -396,7 +397,7 @@
396397
"\n",
397398
"# Print the raw output from the net\n",
398399
"\n",
399-
"# Transform the raw output back to human-readable format\n"
400+
"# Transform the raw output back to human-readable format"
400401
]
401402
}
402403
],

exercises/03_mnist_classification.ipynb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@
101101
"from torchvision.transforms import ToTensor, Compose\n",
102102
"from torch import Tensor, tensor\n",
103103
"\n",
104+
"\n",
104105
"def get_img_tfms(training: bool) -> Compose:\n",
105106
" \"\"\"Return a composition of image transforms.\n",
106107
"\n",
@@ -141,7 +142,7 @@
141142
" The target as a one-hot-encoded vector.\n",
142143
"\n",
143144
" \"\"\"\n",
144-
" return #???\n",
145+
" return # ???\n",
145146
"\n",
146147
"\n",
147148
"train_set = MNIST(\n",

src/ml_workshop/_ellipse.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Ellipse-drawing dataset."""
2+
23
from typing import Tuple, Optional, Any
34

45
from numpy.random import default_rng

worked-solutions/01_penguin_classification_solutions.ipynb

Lines changed: 51 additions & 57 deletions
Large diffs are not rendered by default.

worked-solutions/02_penguin_regression_solutions.ipynb

Lines changed: 60 additions & 70 deletions
Large diffs are not rendered by default.

worked-solutions/03_mnist_classification_solutions.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,7 @@
829829
" Notes\n",
830830
" -----\n",
831831
" - This function assumes the ``preds`` have had the softmax applied to them\n",
832-
" along dimension 1, and that the predicted class is therefore \n",
832+
" along dimension 1, and that the predicted class is therefore\n",
833833
" ``preds.argmax(dim=1)``.\n",
834834
"\n",
835835
" \"\"\"\n",

0 commit comments

Comments
 (0)