Skip to content

Commit d88d7a7

Browse files
author
github-actions
committed
Auto-generate Jupyter notebooks from Markdown
1 parent eb470a6 commit d88d7a7

9 files changed

Lines changed: 56 additions & 56 deletions

notebooks/01-introduction.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "markdown",
5-
"id": "50eec27f",
5+
"id": "5950f81b",
66
"metadata": {},
77
"source": [
88
"---\n",
@@ -44,7 +44,7 @@
4444
"\n",
4545
"The image below shows the relationships between artificial intelligence, machine learning and deep learning.\n",
4646
"\n",
47-
"![An infographic showing some of the relationships between AI, ML, and DL](fig/introduction/AI_ML_DL_differences.png)\n",
47+
"![An infographic showing some of the relationships between AI, ML, and DL](https://github.com/UW-Madison-DataScience/machine-learning-novice-sklearn/raw/gh-pages/episodes/fig/introduction/AI_ML_DL_differences.png)\n",
4848
"The image above is by Tukijaaliwa, CC BY-SA 4.0, via Wikimedia Commons, original source\n",
4949
"\n",
5050
"\n",
@@ -126,7 +126,7 @@
126126
"\n",
127127
"If we want our ML models to make predictions or classifications, we also provide \"labels\" as our expected \"answers/results\". The model will then be trained on the input features to try and match our provided labels. This is done by providing a \"Target Array\" (usually referred to as the code variable `y`) which contains the \"labels or values\" that we wish to predict using the features data.\n",
128128
"\n",
129-
"![Types of Machine Learning](fig/introduction/sklearn_input.png)\n",
129+
"![Types of Machine Learning](https://github.com/UW-Madison-DataScience/machine-learning-novice-sklearn/raw/gh-pages/episodes/fig/introduction/sklearn_input.png)\n",
130130
"Figure from the [Python Data Science Handbook](https://github.com/jakevdp/PythonDataScienceHandbook)\n",
131131
"\n",
132132
"# What will we cover today?\n",
@@ -135,7 +135,7 @@
135135
"\n",
136136
"The figure below provides a nice overview of some of the sub-domains of ML and the techniques used within each sub-domain. We recommend checking out the Scikit-Learn [webpage](https://scikit-learn.org/stable/index.html) for additional examples of the topics we will cover in this lesson. We will cover topics highlighted in blue: classical learning techniques such as regression, classification, clustering, and dimension reduction, as well as ensemble methods and a brief introduction to neural networks using perceptrons.\n",
137137
"\n",
138-
"![Types of Machine Learning](fig/introduction/ML_summary.png)\n",
138+
"![Types of Machine Learning](https://github.com/UW-Madison-DataScience/machine-learning-novice-sklearn/raw/gh-pages/episodes/fig/introduction/ML_summary.png)\n",
139139
"[Image from Vasily Zubarev via their blog](https://vas3k.com/blog/machine_learning/) with modifications in blue to denote lesson content.\n",
140140
"\n",
141141
"{% include links.md %}\n",

notebooks/02-regression.ipynb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "markdown",
5-
"id": "53247487",
5+
"id": "c26c7a74",
66
"metadata": {},
77
"source": [
88
"---\n",
@@ -48,7 +48,7 @@
4848
"\n",
4949
"Regression can be as simple as drawing a \"line of best fit\" through data points, known as linear regression, or more complex models such as polynomial regression, and is used routinely around the world in both industry and research. You may have already used regression in the past without knowing that it is also considered a machine learning technique!\n",
5050
"\n",
51-
"![Example of linear and polynomial regressions](fig/regression_example.png)\n",
51+
"![Example of linear and polynomial regressions](https://github.com/UW-Madison-DataScience/machine-learning-novice-sklearn/raw/gh-pages/episodes/fig/regression_example.png)\n",
5252
"\n",
5353
"## Linear regression using Scikit-Learn\n",
5454
"\n",
@@ -95,7 +95,7 @@
9595
"~~~\n",
9696
"{: .language-python}\n",
9797
"\n",
98-
"![Comparison of the regressions of our dataset](fig/penguin_regression.png)\n",
98+
"![Comparison of the regressions of our dataset](https://github.com/UW-Madison-DataScience/machine-learning-novice-sklearn/raw/gh-pages/episodes/fig/penguin_regression.png)\n",
9999
"\n",
100100
"In this regression example we will create a Linear Regression model that will try to predict `y` values based upon `x` values.\n",
101101
"\n",
@@ -180,7 +180,7 @@
180180
"~~~\n",
181181
"{: .language-python}\n",
182182
"\n",
183-
"![Comparison of the regressions of our dataset](fig/regress_penguin_lin.png)\n",
183+
"![Comparison of the regressions of our dataset](https://github.com/UW-Madison-DataScience/machine-learning-novice-sklearn/raw/gh-pages/episodes/fig/regress_penguin_lin.png)\n",
184184
"\n",
185185
"\n",
186186
"\n",
@@ -222,7 +222,7 @@
222222
"~~~\n",
223223
"{: .language-python}\n",
224224
"\n",
225-
"![Comparison of the regressions of our dataset](fig/penguin_regression_all.png)\n",
225+
"![Comparison of the regressions of our dataset](https://github.com/UW-Madison-DataScience/machine-learning-novice-sklearn/raw/gh-pages/episodes/fig/penguin_regression_all.png)\n",
226226
"\n",
227227
"Oh dear. It looks like our linear regression fits okay for our subset of the penguin data, and a few additional samples, but there appears to be a cluster of points that are poorly predicted by our model. Even if we re-trained our model using all samples it looks unlikely that our model would perform much better due to the two-cluster nature of our dataset.\n",
228228
"\n",
@@ -378,7 +378,7 @@
378378
"{: .language-python}\n",
379379
"\n",
380380
"\n",
381-
"![Comparison of the regressions of our dataset](fig/penguin_regression_poly.png)\n",
381+
"![Comparison of the regressions of our dataset](https://github.com/UW-Madison-DataScience/machine-learning-novice-sklearn/raw/gh-pages/episodes/fig/penguin_regression_poly.png)\n",
382382
"\n",
383383
"::::::::::::::::::::::::::::::::::::: challenge\n",
384384
"\n",

notebooks/03-classification.ipynb

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "markdown",
5-
"id": "7c7f9ca5",
5+
"id": "2433c099",
66
"metadata": {},
77
"source": [
88
"---\n",
@@ -34,10 +34,10 @@
3434
"## The penguins dataset\n",
3535
"We're going to be using the penguins dataset of Allison Horst, published [here](https://github.com/allisonhorst/palmerpenguins), The dataset contains 344 size measurements for three penguin species (Chinstrap, Gentoo and Adélie) observed on three islands in the Palmer Archipelago, Antarctica.\n",
3636
"\n",
37-
"![*Artwork by @allison_horst*](fig/palmer_penguins.png)\n",
37+
"![*Artwork by @allison_horst*](https://github.com/UW-Madison-DataScience/machine-learning-novice-sklearn/raw/gh-pages/episodes/fig/palmer_penguins.png)\n",
3838
"\n",
3939
"The physical attributes measured are flipper length, beak length, beak width, body mass, and sex.\n",
40-
"![*Artwork by @allison_horst*](fig/culmen_depth.png)\n",
40+
"![*Artwork by @allison_horst*](https://github.com/UW-Madison-DataScience/machine-learning-novice-sklearn/raw/gh-pages/episodes/fig/culmen_depth.png)\n",
4141
"\n",
4242
"In other words, the dataset contains 344 rows with 7 features i.e. 5 physical attributes, species and the island where the observations were made.\n",
4343
"\n",
@@ -126,7 +126,7 @@
126126
"~~~\n",
127127
"{: .language-python}\n",
128128
"\n",
129-
"![Visualising the penguins dataset](fig/e3_penguins_vis.png)\n",
129+
"![Visualising the penguins dataset](https://github.com/UW-Madison-DataScience/machine-learning-novice-sklearn/raw/gh-pages/episodes/fig/e3_penguins_vis.png)\n",
130130
"\n",
131131
"As there are four measurements for each penguin, we need quite a few plots to visualise all four dimensions against each other. Here is a handy Seaborn function to do so:\n",
132132
"\n",
@@ -136,15 +136,15 @@
136136
"~~~\n",
137137
"{: .language-python}\n",
138138
"\n",
139-
"![Visualising the penguins dataset](fig/pairplot.png)\n",
139+
"![Visualising the penguins dataset](https://github.com/UW-Madison-DataScience/machine-learning-novice-sklearn/raw/gh-pages/episodes/fig/pairplot.png)\n",
140140
"\n",
141141
"We can see that penguins from each species form fairly distinct spatial clusters in these plots, so that you could draw lines between those clusters to delineate each species. This is effectively what many classification algorithms do. They use the training data to delineate the observation space, in this case the 4 measurement dimensions, into classes. When given a new observation, the model finds which of those class areas the new observation falls in to.\n",
142142
"\n",
143143
"\n",
144144
"## Classification using a decision tree\n",
145145
"We'll first apply a decision tree classifier to the data. Decisions trees are conceptually similar to flow diagrams (or more precisely for the biologists: dichotomous keys). They split the classification problem into a binary tree of comparisons, at each step comparing a measurement to a value, and moving left or right down the tree until a classification is reached.\n",
146146
"\n",
147-
"![Decision tree for classifying penguins](fig/decision_tree_example.png)\n",
147+
"![Decision tree for classifying penguins](https://github.com/UW-Madison-DataScience/machine-learning-novice-sklearn/raw/gh-pages/episodes/fig/decision_tree_example.png)\n",
148148
"\n",
149149
"\n",
150150
"Training and using a decision tree in Scikit-Learn is straightforward:\n",
@@ -183,7 +183,7 @@
183183
"~~~\n",
184184
"{: .language-python}\n",
185185
"\n",
186-
"![Decision tree for classifying penguins](fig/e3_dt_2.png)\n",
186+
"![Decision tree for classifying penguins](https://github.com/UW-Madison-DataScience/machine-learning-novice-sklearn/raw/gh-pages/episodes/fig/e3_dt_2.png)\n",
187187
"\n",
188188
"The first first question (`depth=1`) splits the training data into \"Adelie\" and \"Gentoo\" categories using the criteria `flipper_length_mm <= 206.5`, and the next two questions (`depth=2`) split the \"Adelie\" and \"Gentoo\" categories into \"Adelie & Chinstrap\" and \"Gentoo & Chinstrap\" predictions. \n",
189189
"\n",
@@ -214,7 +214,7 @@
214214
"~~~\n",
215215
"{: .language-python}\n",
216216
"\n",
217-
"![Classification space for our decision tree](fig/e3_dt_space_2.png)\n",
217+
"![Classification space for our decision tree](https://github.com/UW-Madison-DataScience/machine-learning-novice-sklearn/raw/gh-pages/episodes/fig/e3_dt_space_2.png)\n",
218218
"\n",
219219
"## Tuning the `max_depth` hyperparameter\n",
220220
"\n",
@@ -244,7 +244,7 @@
244244
"~~~\n",
245245
"{: .language-python}\n",
246246
"\n",
247-
"![Performance of decision trees of various depths](fig/e3_dt_overfit.png)\n",
247+
"![Performance of decision trees of various depths](https://github.com/UW-Madison-DataScience/machine-learning-novice-sklearn/raw/gh-pages/episodes/fig/e3_dt_overfit.png)\n",
248248
"\n",
249249
"Here we can see that a `max_depth=2` performs slightly better on the test data than those with `max_depth > 2`. This can seem counter intuitive, as surely more questions should be able to better split up our categories and thus give better predictions?\n",
250250
"\n",
@@ -260,7 +260,7 @@
260260
"~~~\n",
261261
"{: .language-python}\n",
262262
"\n",
263-
"![Simplified decision tree](fig/e3_dt_6.png)\n",
263+
"![Simplified decision tree](https://github.com/UW-Madison-DataScience/machine-learning-novice-sklearn/raw/gh-pages/episodes/fig/e3_dt_6.png)\n",
264264
"\n",
265265
"It looks like our decision tree has split up the training data into the correct penguin categories and more accurately than the `max_depth=2` model did, however it used some very specific questions to split up the penguins into the correct categories. Let's try visualising the classification space for a more intuitive understanding:\n",
266266
"~~~\n",
@@ -277,7 +277,7 @@
277277
"~~~\n",
278278
"{: .language-python}\n",
279279
"\n",
280-
"![Classification space of the simplified decision tree](fig/e3_dt_space_6.png)\n",
280+
"![Classification space of the simplified decision tree](https://github.com/UW-Madison-DataScience/machine-learning-novice-sklearn/raw/gh-pages/episodes/fig/e3_dt_space_6.png)\n",
281281
"\n",
282282
"Earlier we saw that the `max_depth=2` model split the data into 3 simple bounding boxes, whereas for `max_depth=5` we see the model has created some very specific classification boundaries to correctly classify every point in the training data.\n",
283283
"\n",
@@ -454,7 +454,7 @@
454454
"- **`C`**: Balances smoothness of the decision boundary and misclassifications; start with `C=1`, increase for tighter boundaries, decrease to prevent overfitting.\n",
455455
"\n",
456456
"\n",
457-
"![Classification space generated by the SVM model](fig/e3_svc_space.png)\n",
457+
"![Classification space generated by the SVM model](https://github.com/UW-Madison-DataScience/machine-learning-novice-sklearn/raw/gh-pages/episodes/fig/e3_svc_space.png)\n",
458458
"\n",
459459
"While this SVM model performs slightly worse than our decision tree (95.6% vs. 98.5%), it's likely that the non-linear boundaries will perform better when exposed to more and more real data, as decision trees are prone to overfitting and requires complex linear models to reproduce simple non-linear boundaries. It's important to pick a model that is appropriate for your problem and data trends!\n",
460460
"\n",

notebooks/04-ensemble-methods.ipynb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "markdown",
5-
"id": "f32a0da4",
5+
"id": "d442dc97",
66
"metadata": {},
77
"source": [
88
"---\n",
@@ -47,7 +47,7 @@
4747
"\n",
4848
"If we trained the same model multiple times on the same data we would expect very similar answers, and so the emphasis with stacking is to choose different models that can be used to build up a reliable concensus. Regression is then typically a good choice for the final decision-making model.\n",
4949
"\n",
50-
"![Stacking](fig/stacking.jpeg)\n",
50+
"![Stacking](https://github.com/UW-Madison-DataScience/machine-learning-novice-sklearn/raw/gh-pages/episodes/fig/stacking.jpeg)\n",
5151
"\n",
5252
"[Image from Vasily Zubarev via their blog](https://vas3k.com/blog/machine_learning/)\n",
5353
"\n",
@@ -59,7 +59,7 @@
5959
"\n",
6060
"The most common example is known as the Random Forest algorithm, which we'll take a look at later on. Random Forests are typically used as a faster, computationally cheaper alternative to Neural Networks, which is ideal for real-time applications like camera face detection prompts.\n",
6161
"\n",
62-
"![Stacking](fig/bagging.jpeg)\n",
62+
"![Stacking](https://github.com/UW-Madison-DataScience/machine-learning-novice-sklearn/raw/gh-pages/episodes/fig/bagging.jpeg)\n",
6363
"\n",
6464
"[Image from Vasily Zubarev via their blog](https://vas3k.com/blog/machine_learning/)\n",
6565
"\n",
@@ -69,7 +69,7 @@
6969
"\n",
7070
"Just like for bagging, boosting is trained mostly on subsets, however in this case these subsets are not randomly generated but are instead built using poorly estimated predictions. Boosting can produce some very high accuracies by learning from it's mistakes, but due to the iterative nature of these improvements it doesn't parallelize well unlike the other ensemble methods. Despite this it can still be a faster, and computationally cheaper alternative to Neural Networks.\n",
7171
"\n",
72-
"![Stacking](fig/boosting.jpeg)\n",
72+
"![Stacking](https://github.com/UW-Madison-DataScience/machine-learning-novice-sklearn/raw/gh-pages/episodes/fig/boosting.jpeg)\n",
7373
"\n",
7474
"[Image from Vasily Zubarev via their blog](https://vas3k.com/blog/machine_learning/)\n",
7575
"\n",
@@ -125,7 +125,7 @@
125125
"\n",
126126
"Random forests are built on decision trees and can provide another way to address over-fitting. Rather than classifying based on one single decision tree (which could overfit the data), an average of results of many trees can be derived for more robust/accurate estimates compared against single trees used in the ensemble.\n",
127127
"\n",
128-
"![Random Forests](fig/randomforest.png) \n",
128+
"![Random Forests](https://github.com/UW-Madison-DataScience/machine-learning-novice-sklearn/raw/gh-pages/episodes/fig/randomforest.png) \n",
129129
"\n",
130130
"[Image from Venkatak Jagannath](https://commons.wikimedia.org/wiki/File:Random_forest_diagram_complete.png)\n",
131131
"\n",
@@ -169,7 +169,7 @@
169169
"~~~\n",
170170
"{: .language-python}\n",
171171
"\n",
172-
"![random forest trees](fig/rf_5_trees.png)\n",
172+
"![random forest trees](https://github.com/UW-Madison-DataScience/machine-learning-novice-sklearn/raw/gh-pages/episodes/fig/rf_5_trees.png)\n",
173173
"\n",
174174
"We can see the first 5 (of 100) trees that were fitted as part of the forest. \n",
175175
"\n",
@@ -193,7 +193,7 @@
193193
"~~~\n",
194194
"{: .language-python}\n",
195195
"\n",
196-
"![random forest clf space](fig/EM_rf_clf_space.png)\n",
196+
"![random forest clf space](https://github.com/UW-Madison-DataScience/machine-learning-novice-sklearn/raw/gh-pages/episodes/fig/EM_rf_clf_space.png)\n",
197197
"\n",
198198
"There is still some overfitting indicated by the regions that contain only single points but using the same hyper-parameter settings used to fit the decision tree classifier, we can see that overfitting is reduced.\n",
199199
"\n",
@@ -329,7 +329,7 @@
329329
"~~~\n",
330330
"{: .language-python}\n",
331331
"\n",
332-
"![Regressor predictions and average from stack](fig/house_price_voting_regressor.svg)\n",
332+
"![Regressor predictions and average from stack](https://github.com/UW-Madison-DataScience/machine-learning-novice-sklearn/raw/gh-pages/episodes/fig/house_price_voting_regressor.svg)\n",
333333
"\n",
334334
"Finally, lets see how the average compares against each single estimator in the stack? \n",
335335
"\n",

0 commit comments

Comments
 (0)