You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/pub/week48/html/week48-reveal.html
+180-3Lines changed: 180 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -209,7 +209,7 @@ <h2 id="plan-for-week-47">Plan for week 47 </h2>
209
209
210
210
<p><li> Lab sessions at usual times.</li>
211
211
212
-
<p><li> For the week of December 2-6, lab sessions atart at 10am and end 4pm, room FØ434, Tuesday and Wednesday</li>
212
+
<p><li> For the week of December 2-6, lab sessions start at 10am and end at 4pm, room FØ434, Tuesday and Wednesday</li>
213
213
</ul>
214
214
</div>
215
215
@@ -222,8 +222,8 @@ <h2 id="plan-for-week-47">Plan for week 47 </h2>
222
222
<p><li> Summary of course</li>
223
223
<p><li> Readings and Videos:
224
224
<oltype="a"></li>
225
-
<p><li> These lecture notes at <ahref="https://github.com/CompPhysics/MachineLearning/blob/master/doc/pub/week47/ipynb/week48.ipynb" target="_blank"><tt>https://github.com/CompPhysics/MachineLearning/blob/master/doc/pub/week47/ipynb/week48.ipynb</tt></a></li>
226
-
<p><li> See also lecture notes from week 47 at <ahref="https://github.com/CompPhysics/MachineLearning/blob/master/doc/pub/week46/ipynb/week47.ipynb" target="_blank"><tt>https://github.com/CompPhysics/MachineLearning/blob/master/doc/pub/week46/ipynb/week47.ipynb</tt></a>. The lecture on Monday starts with a repetition on AdaBoost before we move over to gradient boosting with examples
225
+
<p><li> These lecture notes at <ahref="https://github.com/CompPhysics/MachineLearning/blob/master/doc/pub/week48/ipynb/week48.ipynb" target="_blank"><tt>https://github.com/CompPhysics/MachineLearning/blob/master/doc/pub/week48/ipynb/week48.ipynb</tt></a></li>
226
+
<p><li> See also lecture notes from week 47 at <ahref="https://github.com/CompPhysics/MachineLearning/blob/master/doc/pub/week47/ipynb/week47.ipynb" target="_blank"><tt>https://github.com/CompPhysics/MachineLearning/blob/master/doc/pub/week47/ipynb/week47.ipynb</tt></a>. The lecture on Monday starts with a repetition on AdaBoost before we move over to gradient boosting with examples
227
227
<!-- o Video of lecture at <a href="https://youtu.be/RIHzmLv05DA" target="_blank"><tt>https://youtu.be/RIHzmLv05DA</tt></a> -->
228
228
<!-- o Whiteboard notes at <a href="https://github.com/CompPhysics/MachineLearning/blob/master/doc/HandWrittenNotes/2024/NotesNovember25.pdf" target="_blank"><tt>https://github.com/CompPhysics/MachineLearning/blob/master/doc/HandWrittenNotes/2024/NotesNovember25.pdf</tt></a> --></li>
229
229
<p><li> Video on Decision trees <ahref="https://www.youtube.com/watch?v=RmajweUFKvM&ab_channel=Simplilearn" target="_blank"><tt>https://www.youtube.com/watch?v=RmajweUFKvM&ab_channel=Simplilearn</tt></a></li>
@@ -237,6 +237,183 @@ <h2 id="plan-for-week-47">Plan for week 47 </h2>
237
237
</div>
238
238
</section>
239
239
240
+
<section>
241
+
<h2id="random-forest-algorithm-reminder-from-last-week">Random Forest Algorithm, reminder from last week </h2>
242
+
243
+
<p>The algorithm described here can be applied to both classification and regression problems.</p>
244
+
245
+
<p>We will grow of forest of say \( B \) trees.</p>
246
+
<ol>
247
+
<p><li> For \( b=1:B \)
248
+
<oltype="a"></li>
249
+
<p><li> Draw a bootstrap sample from the training data organized in our \( \boldsymbol{X} \) matrix.</li>
250
+
<p><li> We grow then a random forest tree \( T_b \) based on the bootstrapped data by repeating the steps outlined till we reach the maximum node size is reached</li>
251
+
<ol>
252
+
253
+
<p><li> we select \( m \le p \) variables at random from the \( p \) predictors/features</li>
254
+
255
+
<p><li> pick the best split point among the \( m \) features using for example the CART algorithm and create a new node</li>
256
+
257
+
<p><li> split the node into daughter nodes</li>
258
+
</ol>
259
+
<p>
260
+
</ol>
261
+
<p>
262
+
<p><li> Output then the ensemble of trees \( \{T_b\}_1^{B} \) and make predictions for either a regression type of problem or a classification type of problem.</li>
263
+
</ol>
264
+
</section>
265
+
266
+
<section>
267
+
<h2id="random-forests-compared-with-other-methods-on-the-cancer-data">Random Forests Compared with other Methods on the Cancer Data </h2>
268
+
269
+
270
+
<!-- code=python (!bc pycod) typeset with pygments style "perldoc" -->
<spanstyle="color: #658b00">print</span>(<spanstyle="color: #CD5555">"Test set accuracy Logistic Regression with scaled data: {:.2f}"</span>.format(logreg.score(X_test_scaled,y_test)))
307
+
<spanstyle="color: #228B22"># Support Vector Machine</span>
308
+
svm.fit(X_train_scaled, y_train)
309
+
<spanstyle="color: #658b00">print</span>(<spanstyle="color: #CD5555">"Test set accuracy SVM with scaled data: {:.2f}"</span>.format(logreg.score(X_test_scaled,y_test)))
<spanstyle="color: #658b00">print</span>(<spanstyle="color: #CD5555">"Test set accuracy with Decision Trees and scaled data: {:.2f}"</span>.format(deep_tree_clf.score(X_test_scaled,y_test)))
<spanstyle="color: #658b00">print</span>(<spanstyle="color: #CD5555">"Test set accuracy with Random Forests and scaled data: {:.2f}"</span>.format(Random_Forest_model.score(X_test_scaled,y_test)))
0 commit comments