Skip to content

Commit 707708e

Browse files
committed
updated week 48
1 parent e7a9d99 commit 707708e

17 files changed

Lines changed: 560 additions & 554 deletions
866 Bytes
Binary file not shown.
446 Bytes
Binary file not shown.
38.8 KB
Loading
11.6 KB
Loading
16.8 KB
Loading
44 KB
Loading
43.7 KB
Loading

doc/LectureNotes/_build/html/_sources/week48.ipynb

Lines changed: 163 additions & 161 deletions
Large diffs are not rendered by default.

doc/LectureNotes/_build/html/searchindex.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

doc/LectureNotes/_build/html/week48.html

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ <h2> Contents </h2>
527527
<!-- dom:TITLE: Week 48: Gradient boosting and summary of course --><section class="tex2jax_ignore mathjax_ignore" id="week-48-gradient-boosting-and-summary-of-course">
528528
<h1>Week 48: Gradient boosting and summary of course<a class="headerlink" href="#week-48-gradient-boosting-and-summary-of-course" title="Link to this heading">#</a></h1>
529529
<p><strong>Morten Hjorth-Jensen</strong>, Department of Physics and Center for Computing in Science Education, University of Oslo, Norway</p>
530-
<p>Date: <strong>Nov 24, 2024</strong></p>
530+
<p>Date: <strong>Nov 25, 2024</strong></p>
531531
<p>Copyright 1999-2024, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license</p>
532532
<section id="overview-of-week-48">
533533
<h2>Overview of week 48<a class="headerlink" href="#overview-of-week-48" title="Link to this heading">#</a></h2>
@@ -542,13 +542,13 @@ <h2>Lecture Monday, November 25<a class="headerlink" href="#lecture-monday-novem
542542
</ol>
543543
<p>a. These lecture notes at <a class="github reference external" href="https://github.com/CompPhysics/MachineLearning/blob/master/doc/pub/week48/ipynb/week48.ipynb">CompPhysics/MachineLearning</a></p>
544544
<p>b. See also lecture notes from week 47 at <a class="github reference external" href="https://github.com/CompPhysics/MachineLearning/blob/master/doc/pub/week47/ipynb/week47.ipynb">CompPhysics/MachineLearning</a>. The lecture on Monday starts with a repetition on AdaBoost before we move over to gradient boosting with examples</p>
545-
<!-- o Video of lecture at <https://youtu.be/RIHzmLv05DA> -->
546-
<!-- o Whiteboard notes at <https://github.com/CompPhysics/MachineLearning/blob/master/doc/HandWrittenNotes/2024/NotesNovember25.pdf> -->
547-
<p>c. Video on Decision trees <a class="reference external" href="https://www.youtube.com/watch?v=RmajweUFKvM&amp;amp;ab_channel=Simplilearn">https://www.youtube.com/watch?v=RmajweUFKvM&amp;ab_channel=Simplilearn</a></p>
548-
<p>d. Video on boosting methods <a class="reference external" href="https://www.youtube.com/watch?v=wPqtzj5VZus&amp;amp;ab_channel=H2O.ai">https://www.youtube.com/watch?v=wPqtzj5VZus&amp;ab_channel=H2O.ai</a></p>
549-
<p>e. Video on AdaBoost <a class="reference external" href="https://www.youtube.com/watch?v=LsK-xG1cLYA">https://www.youtube.com/watch?v=LsK-xG1cLYA</a></p>
550-
<p>f. Video on Gradient boost, part 1, parts 2-4 follow thereafter <a class="reference external" href="https://www.youtube.com/watch?v=3CC4N4z3GJc">https://www.youtube.com/watch?v=3CC4N4z3GJc</a></p>
551-
<p>g. Decision Trees: Rashcka et al chapter 3 pages 86-98, and chapter 7 on Ensemble methods, Voting and Bagging and Gradient Boosting. See also lecture from STK-IN4300, lecture 7 at <a class="reference external" href="https://www.uio.no/studier/emner/matnat/math/STK-IN4300/h20/slides/lecture_7.pdf">https://www.uio.no/studier/emner/matnat/math/STK-IN4300/h20/slides/lecture_7.pdf</a>.</p>
545+
<p>c. Video of lecture at <a class="reference external" href="https://youtu.be/iTaRdAPQnDA">https://youtu.be/iTaRdAPQnDA</a></p>
546+
<p>d. Whiteboard notes at <a class="github reference external" href="https://github.com/CompPhysics/MachineLearning/blob/master/doc/HandWrittenNotes/2024/NotesNovember25.pdf">CompPhysics/MachineLearning</a></p>
547+
<p>e. Video on Decision trees <a class="reference external" href="https://www.youtube.com/watch?v=RmajweUFKvM&amp;amp;ab_channel=Simplilearn">https://www.youtube.com/watch?v=RmajweUFKvM&amp;ab_channel=Simplilearn</a></p>
548+
<p>f. Video on boosting methods <a class="reference external" href="https://www.youtube.com/watch?v=wPqtzj5VZus&amp;amp;ab_channel=H2O.ai">https://www.youtube.com/watch?v=wPqtzj5VZus&amp;ab_channel=H2O.ai</a></p>
549+
<p>g. Video on AdaBoost <a class="reference external" href="https://www.youtube.com/watch?v=LsK-xG1cLYA">https://www.youtube.com/watch?v=LsK-xG1cLYA</a></p>
550+
<p>h. Video on Gradient boost, part 1, parts 2-4 follow thereafter <a class="reference external" href="https://www.youtube.com/watch?v=3CC4N4z3GJc">https://www.youtube.com/watch?v=3CC4N4z3GJc</a></p>
551+
<p>i. Decision Trees: Rashcka et al chapter 3 pages 86-98, and chapter 7 on Ensemble methods, Voting and Bagging and Gradient Boosting. See also lecture from STK-IN4300, lecture 7 at <a class="reference external" href="https://www.uio.no/studier/emner/matnat/math/STK-IN4300/h20/slides/lecture_7.pdf">https://www.uio.no/studier/emner/matnat/math/STK-IN4300/h20/slides/lecture_7.pdf</a>.</p>
552552
</section>
553553
<section id="lab-sessions">
554554
<h2>Lab sessions<a class="headerlink" href="#lab-sessions" title="Link to this heading">#</a></h2>
@@ -651,17 +651,17 @@ <h2>Random Forests Compared with other Methods on the Cancer Data<a class="heade
651651
(143, 30)
652652
Test set accuracy Logistic Regression with scaled data: 0.96
653653
Test set accuracy SVM with scaled data: 0.96
654-
Test set accuracy with Decision Trees and scaled data: 0.91
654+
Test set accuracy with Decision Trees and scaled data: 0.92
655655
</pre></div>
656656
</div>
657-
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[1. 0.8 0.93333333 1. 1. 0.92857143
657+
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[1. 0.73333333 0.93333333 1. 1. 0.92857143
658658
1. 0.92857143 0.92857143 0.92857143]
659-
Test set accuracy with Random Forests and scaled data: 0.98
659+
Test set accuracy with Random Forests and scaled data: 0.97
660660
</pre></div>
661661
</div>
662-
<img alt="_images/936367d3bdcae10aafd2cc903d30ce54287b55ddddaa7af46f455a620a3745cd.png" src="_images/936367d3bdcae10aafd2cc903d30ce54287b55ddddaa7af46f455a620a3745cd.png" />
663-
<img alt="_images/be8d5df8bb940da757ef8fd6eac65ebe0352641500f781f4284c949ce274e1ee.png" src="_images/be8d5df8bb940da757ef8fd6eac65ebe0352641500f781f4284c949ce274e1ee.png" />
664-
<img alt="_images/8f696a60652d0003039dd9a563eb80367f1d574ca15b61c7a3f9757b19083d26.png" src="_images/8f696a60652d0003039dd9a563eb80367f1d574ca15b61c7a3f9757b19083d26.png" />
662+
<img alt="_images/90075505602c3f17740e87e303ddff0ae0ff2ec0245679468ad8fb7cb2ba3b3a.png" src="_images/90075505602c3f17740e87e303ddff0ae0ff2ec0245679468ad8fb7cb2ba3b3a.png" />
663+
<img alt="_images/a318a67ffc1f6a60c2418c7f612568dd9b06752eb57ba2c4643dcc6e7d1a01dc.png" src="_images/a318a67ffc1f6a60c2418c7f612568dd9b06752eb57ba2c4643dcc6e7d1a01dc.png" />
664+
<img alt="_images/1d150add40cbaa91d293348b988a5fbd2e04c68c41f11a70ebf78ac5686e7e4a.png" src="_images/1d150add40cbaa91d293348b988a5fbd2e04c68c41f11a70ebf78ac5686e7e4a.png" />
665665
</div>
666666
</div>
667667
<p>Recall that the cumulative gains curve shows the percentage of the
@@ -1173,30 +1173,30 @@ <h2>Gradient Boosting, Examples of Regression<a class="headerlink" href="#gradie
11731173
</div>
11741174
<div class="cell_output docutils container">
11751175
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Max depth: 1
1176-
Error: 0.4203129333425336
1177-
Bias^2: 0.21226966048908316
1178-
Var: 0.20804327285345042
1179-
0.4203129333425336 &gt;= 0.21226966048908316 + 0.20804327285345042 = 0.4203129333425336
1176+
Error: 0.4010613825254484
1177+
Bias^2: 0.2079593417034804
1178+
Var: 0.19310204082196794
1179+
0.4010613825254484 &gt;= 0.2079593417034804 + 0.19310204082196794 = 0.4010613825254483
11801180
Max depth: 2
1181-
Error: 0.40767639731018696
1182-
Bias^2: 0.21200998139721822
1183-
Var: 0.19566641591296877
1184-
0.40767639731018696 &gt;= 0.21200998139721822 + 0.19566641591296877 = 0.407676397310187
1181+
Error: 0.4250776117755916
1182+
Bias^2: 0.2080984218270197
1183+
Var: 0.21697918994857185
1184+
0.4250776117755916 &gt;= 0.2080984218270197 + 0.21697918994857185 = 0.42507761177559156
11851185
Max depth: 3
1186-
Error: 0.4076774836661818
1187-
Bias^2: 0.2120099429256955
1188-
Var: 0.19566754074048626
1189-
0.4076774836661818 &gt;= 0.2120099429256955 + 0.19566754074048626 = 0.40767748366618173
1186+
Error: 0.4250796355306808
1187+
Bias^2: 0.2080985447081304
1188+
Var: 0.21698109082255032
1189+
0.4250796355306808 &gt;= 0.2080985447081304 + 0.21698109082255032 = 0.42507963553068073
11901190
Max depth: 4
1191-
Error: 0.4076774836661818
1192-
Bias^2: 0.2120099429256955
1193-
Var: 0.19566754074048626
1194-
0.4076774836661818 &gt;= 0.2120099429256955 + 0.19566754074048626 = 0.40767748366618173
1191+
Error: 0.4250796355306808
1192+
Bias^2: 0.2080985447081304
1193+
Var: 0.21698109082255038
1194+
0.4250796355306808 &gt;= 0.2080985447081304 + 0.21698109082255038 = 0.4250796355306808
11951195
Max depth: 5
1196-
Error: 0.4076774836661816
1197-
Bias^2: 0.2120099429256955
1198-
Var: 0.1956675407404862
1199-
0.4076774836661816 &gt;= 0.2120099429256955 + 0.1956675407404862 = 0.40767748366618173
1196+
Error: 0.42507963553068073
1197+
Bias^2: 0.2080985447081304
1198+
Var: 0.21698109082255032
1199+
0.42507963553068073 &gt;= 0.2080985447081304 + 0.21698109082255032 = 0.42507963553068073
12001200
</pre></div>
12011201
</div>
12021202
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/Users/mhjensen/miniforge3/envs/myenv/lib/python3.9/site-packages/sklearn/ensemble/_gb.py:424: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().
@@ -1211,7 +1211,7 @@ <h2>Gradient Boosting, Examples of Regression<a class="headerlink" href="#gradie
12111211
y = column_or_1d(y, warn=True)
12121212
</pre></div>
12131213
</div>
1214-
<img alt="_images/82abcfe355d89bb3d7dd4eb6e9ffe48d1f3f3511015d80687fbe0db1b8fd5999.png" src="_images/82abcfe355d89bb3d7dd4eb6e9ffe48d1f3f3511015d80687fbe0db1b8fd5999.png" />
1214+
<img alt="_images/801d16873af4f485d9c398ac11811a7d9c4f25dd40c995cf7565bd81af8071c5.png" src="_images/801d16873af4f485d9c398ac11811a7d9c4f25dd40c995cf7565bd81af8071c5.png" />
12151215
</div>
12161216
</div>
12171217
</section>
@@ -1264,13 +1264,13 @@ <h2>Gradient Boosting, Classification Example<a class="headerlink" href="#gradie
12641264
(143, 30)
12651265
</pre></div>
12661266
</div>
1267-
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[0.93333333 0.93333333 0.93333333 0.92857143 1. 0.92857143
1267+
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[0.93333333 0.93333333 0.86666667 1. 1. 0.92857143
12681268
1. 0.92857143 0.85714286 0.92857143]
1269-
Test set accuracy with Gradient boosting and scaled data: 0.99
1269+
Test set accuracy with Gradient boosting and scaled data: 0.97
12701270
</pre></div>
12711271
</div>
1272-
<img alt="_images/e0c9e5cfc32bfe482c04b2091d5d98aa80212c0eef5e22892d16f73e93be8afc.png" src="_images/e0c9e5cfc32bfe482c04b2091d5d98aa80212c0eef5e22892d16f73e93be8afc.png" />
1273-
<img alt="_images/796ded1719cb864b630c37e7692028ee18f0df7fb5a0ed2de15817b0c2f36c0c.png" src="_images/796ded1719cb864b630c37e7692028ee18f0df7fb5a0ed2de15817b0c2f36c0c.png" />
1272+
<img alt="_images/90075505602c3f17740e87e303ddff0ae0ff2ec0245679468ad8fb7cb2ba3b3a.png" src="_images/90075505602c3f17740e87e303ddff0ae0ff2ec0245679468ad8fb7cb2ba3b3a.png" />
1273+
<img alt="_images/de0019c6a0f8206c4c2b0f29eedfececf3b0ad5a07a733217a9ed5b8e4cae808.png" src="_images/de0019c6a0f8206c4c2b0f29eedfececf3b0ad5a07a733217a9ed5b8e4cae808.png" />
12741274
<img alt="_images/45972a93ed8e1f6ed66fe9c322a65b549b39dd2c80e16d5081151b2bc713b669.png" src="_images/45972a93ed8e1f6ed66fe9c322a65b549b39dd2c80e16d5081151b2bc713b669.png" />
12751275
</div>
12761276
</div>

0 commit comments

Comments
 (0)