Skip to content

Update text in exercises and solutions #102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions exercises/01_penguin_classification.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### Task 1: Look at the data\n",
"### Task 1 -- Part (a): Look at the data\n",
"In the following code block, we import the ``load_penguins`` function from the ``palmerpenguins`` package.\n",
"\n",
"- Call this function, which returns a single object, and assign it to the variable ``data``.\n",
Expand Down Expand Up @@ -62,7 +62,18 @@
"outputs": [],
"source": [
"# import seaborn as sns\n",
"# sns.pairplot(data.drop(\"year\", axis=1), hue='species')"
"\n",
"# species_palette = {\n",
"# \"Adelie\": sns.color_palette()[0], # Blue\n",
"# \"Chinstrap\": sns.color_palette()[1], # Orange\n",
"# \"Gentoo\": sns.color_palette()[2], # Green\n",
"# }\n",
"\n",
"# sns.pairplot(\n",
"# data.drop(\"year\", axis=1),\n",
"# hue=\"species\",\n",
"# palette=species_palette,\n",
"# hue_order=[\"Adelie\", \"Chinstrap\", \"Gentoo\"], "
]
},
{
Expand Down Expand Up @@ -105,14 +116,12 @@
"reducer = umap.UMAP(random_state=42)\n",
"embedding = reducer.fit_transform(scaled_penguin_data)\n",
"\n",
"colors = sns.color_palette()\n",
"\n",
"for i, (species, group) in enumerate(data.groupby(\"species\")):\n",
" plt.scatter(\n",
" embedding[data.species == species, 0],\n",
" embedding[data.species == species, 1],\n",
" label=species,\n",
" color=colors[i],\n",
" color=species_palette[species],\n",
" )\n",
"\n",
"plt.gca().set_aspect(\"equal\", \"datalim\")\n",
Expand Down Expand Up @@ -357,7 +366,7 @@
"metadata": {},
"outputs": [],
"source": [
"# Complete __len__() and __getitem__() functions\n",
"# Complete the __getitem__() function\n",
"# See Task 4 ``TODOs`` in PenguinDataset class.\n",
"\n",
"# Create train_set\n",
Expand Down Expand Up @@ -540,7 +549,7 @@
"# Print the model architecture.\n",
"# print(res_model)\n",
"\n",
"list(res_model.parameters())"
"# list(res_model.parameters())"
]
},
{
Expand Down Expand Up @@ -778,14 +787,14 @@
"\n",
" # zero the gradients (otherwise gradients accumulate)\n",
"\n",
" # run forward model and compute proxy probabilities over dimension 1 (columns of tensor).\n",
" # run forward model to make predictions\n",
"\n",
" # compute loss\n",
" # e.g. pred : Tensor([3]) and target : int\n",
"\n",
" # compute gradients\n",
"\n",
" # nudge parameters in direction of steepest descent c\n",
" # nudge parameters in direction of steepest descent\n",
"\n",
" # append metrics\n",
"\n",
Expand Down
66 changes: 46 additions & 20 deletions worked-solutions/01_penguin_classification_solutions.ipynb

Large diffs are not rendered by default.