Skip to content

Commit 6cebfb4

Browse files
Merge pull request #305 from sof202/main
Intro to Machine Learning proof read
2 parents 7afef3d + 8a60c2d commit 6cebfb4

File tree

4 files changed

+110
-98
lines changed

4 files changed

+110
-98
lines changed

individual_modules/introduction_to_machine_learning/1_linear_regression.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -838,8 +838,8 @@
838838
"plt.plot(x, y_pred, color=\"orange\", label=\"Closed form predictions\")\n",
839839
"\n",
840840
"# Draw vertical lines from each point to the line\n",
841-
"for i in range(len(x)):\n",
842-
" plt.plot([x[i], x[i]], [y[i], y_pred[i]], color='black', linestyle='dashed')\n",
841+
"for i, x_i in enumerate(x):\n",
842+
" plt.plot([x_i, x_i], [y[i], y_pred[i]], color='black', linestyle='dashed')\n",
843843
"\n",
844844
"plt.title(\"Linear Regression with closed-form predictions\")\n",
845845
"plt.legend()\n",
@@ -1495,7 +1495,7 @@
14951495
"source": [
14961496
"## Multiple regression with synthetic data\n",
14971497
"\n",
1498-
"As before, we can generate some random data, but this time, for two dependent variables. We will need to combine the feature variables to create a single vector for the model training stage."
1498+
"As before, we can generate some random data, but this time, for two independent variables. We will need to combine the feature variables to create a single vector for the model training stage."
14991499
]
15001500
},
15011501
{

individual_modules/introduction_to_machine_learning/2_model_selection.ipynb

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@
152152
}
153153
],
154154
"source": [
155-
"plt.scatter(X_train[:, 0], X_train[:, 1], label=\"X_train\")\n",
156-
"plt.scatter(X_test[:, 0], X_test[:, 1], label=\"X_test\")\n",
155+
"plt.scatter(X_train[:, 0], X_train[:, 1], label=\"X_train\", edgecolors='k')\n",
156+
"plt.scatter(X_test[:, 0], X_test[:, 1], label=\"X_test\", edgecolors='k')\n",
157157
"plt.xlabel('Feature 1')\n",
158158
"plt.ylabel('Feature 2')\n",
159159
"plt.title('Dataset split into train (80%) and test (20%)')\n",
@@ -666,7 +666,7 @@
666666
}
667667
],
668668
"source": [
669-
"plt.scatter(X_test[:, 0], X_test[:, 1], label=\"X_test\")\n",
669+
"plt.scatter(X_test[:, 0], X_test[:, 1], label=\"X_test\", edgecolors='k')\n",
670670
"plt.xlabel('Feature 1')\n",
671671
"plt.ylabel('Feature 2')\n",
672672
"plt.title('Test dataset')\n",
@@ -703,15 +703,14 @@
703703
"plt.xlabel('Feature 1')\n",
704704
"plt.ylabel('Feature 2')\n",
705705
"plt.title('Test dataset coloured by model prediction')\n",
706-
"plt.legend()\n",
707706
"plt.show()"
708707
]
709708
},
710709
{
711710
"cell_type": "markdown",
712711
"metadata": {},
713712
"source": [
714-
"* Which points were incorrectly classified? We know that ~5% of 1000 were."
713+
"* Which points were incorrectly classified? We know that ~5% of 200 were."
715714
]
716715
},
717716
{

0 commit comments

Comments
 (0)