updating book

This commit is contained in:
Morten Hjorth-Jensen
2023-09-18 12:44:58 +02:00
parent 409e8ba58e
commit 83ef9e4213
18 changed files with 866 additions and 856 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -281,7 +281,7 @@ const thebe_selector_output = ".output, .cell_output"
</li>
<li class="toctree-l1">
<a class="reference internal" href="week37.html">
Week 37: Statitsitcal interpretations and Resampling Methods
Week 37: Statistical interpretations and Resampling Methods
</a>
</li>
<li class="toctree-l1">
@@ -291,7 +291,7 @@ const thebe_selector_output = ".output, .cell_output"
</li>
<li class="toctree-l1">
<a class="reference internal" href="week38.html">
Data Analysis and Machine Learning: Logistic Regression and Optimization
Week38: Logistic Regression and Optimization
</a>
</li>
</ul>
+2 -2
View File
@@ -282,7 +282,7 @@ const thebe_selector_output = ".output, .cell_output"
</li>
<li class="toctree-l1">
<a class="reference internal" href="week37.html">
Week 37: Statitsitcal interpretations and Resampling Methods
Week 37: Statistical interpretations and Resampling Methods
</a>
</li>
<li class="toctree-l1">
@@ -292,7 +292,7 @@ const thebe_selector_output = ".output, .cell_output"
</li>
<li class="toctree-l1">
<a class="reference internal" href="week38.html">
Data Analysis and Machine Learning: Logistic Regression and Optimization
Week38: Logistic Regression and Optimization
</a>
</li>
</ul>
Binary file not shown.
+2 -2
View File
@@ -287,7 +287,7 @@ const thebe_selector_output = ".output, .cell_output"
</li>
<li class="toctree-l1">
<a class="reference internal" href="week37.html">
Week 37: Statitsitcal interpretations and Resampling Methods
Week 37: Statistical interpretations and Resampling Methods
</a>
</li>
<li class="toctree-l1">
@@ -297,7 +297,7 @@ const thebe_selector_output = ".output, .cell_output"
</li>
<li class="toctree-l1">
<a class="reference internal" href="week38.html">
Data Analysis and Machine Learning: Logistic Regression and Optimization
Week38: Logistic Regression and Optimization
</a>
</li>
</ul>
File diff suppressed because one or more lines are too long
+39 -29
View File
@@ -5,7 +5,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Week 37: Statitsitcal interpretations and Resampling Methods &#8212; Applied Data Analysis and Machine Learning</title>
<title>Week 37: Statistical interpretations and Resampling Methods &#8212; Applied Data Analysis and Machine Learning</title>
<link href="_static/css/theme.css" rel="stylesheet">
<link href="_static/css/index.ff1ffe594081f20da1ef19478df9384b.css" rel="stylesheet">
@@ -55,7 +55,7 @@ const thebe_selector_output = ".output, .cell_output"
<script defer="defer" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Project 1 on Machine Learning, deadline October 9 (midnight), 2023" href="project1.html" />
<link rel="next" title="Exercises week 38" href="exercisesweek38.html" />
<link rel="prev" title="Exercises week 37" href="exercisesweek37.html" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="docsearch:language" content="None">
@@ -285,7 +285,17 @@ const thebe_selector_output = ".output, .cell_output"
</li>
<li class="toctree-l1 current active">
<a class="current reference internal" href="#">
Week 37: Statitsitcal interpretations and Resampling Methods
Week 37: Statistical interpretations and Resampling Methods
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="exercisesweek38.html">
Exercises week 38
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="week38.html">
Week38: Logistic Regression and Optimization
</a>
</li>
</ul>
@@ -657,7 +667,7 @@ const thebe_selector_output = ".output, .cell_output"
<div class="col-12 col-md-9 pl-md-3 pr-md-0">
<!-- Table of contents that is only displayed when printing the page -->
<div id="jb-print-docs-body" class="onlyprint">
<h1>Week 37: Statitsitcal interpretations and Resampling Methods</h1>
<h1>Week 37: Statistical interpretations and Resampling Methods</h1>
<!-- Table of contents -->
<div id="print-main-content">
<div id="jb-print-toc">
@@ -954,10 +964,10 @@ const thebe_selector_output = ".output, .cell_output"
<!-- HTML file automatically generated from DocOnce source (https://github.com/doconce/doconce/)
doconce format html week37.do.txt --no_mako -->
<!-- dom:TITLE: Week 37: Statitsitcal interpretations and Resampling Methods --><div class="tex2jax_ignore mathjax_ignore section" id="week-37-statitsitcal-interpretations-and-resampling-methods">
<h1>Week 37: Statitsitcal interpretations and Resampling Methods<a class="headerlink" href="#week-37-statitsitcal-interpretations-and-resampling-methods" title="Permalink to this headline"></a></h1>
<!-- dom:TITLE: Week 37: Statistical interpretations and Resampling Methods --><div class="tex2jax_ignore mathjax_ignore section" id="week-37-statistical-interpretations-and-resampling-methods">
<h1>Week 37: Statistical interpretations and Resampling Methods<a class="headerlink" href="#week-37-statistical-interpretations-and-resampling-methods" title="Permalink to this headline"></a></h1>
<p><strong>Morten Hjorth-Jensen</strong>, Department of Physics, University of Oslo and Department of Physics and Astronomy and Facility for Rare Isotope Beams, Michigan State University</p>
<p>Date: <strong>Sep 14, 2023</strong></p>
<p>Date: <strong>Sep 18, 2023</strong></p>
<p>Copyright 1999-2023, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license</p>
<!-- todo add link to videos and add link to Van Wieringens notes --><div class="section" id="plans-for-week-37">
<h2>Plans for week 37<a class="headerlink" href="#plans-for-week-37" title="Permalink to this headline"></a></h2>
@@ -1767,7 +1777,7 @@ theorem.</p>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Bootstrap Statistics :
original bias std. error
99.9713 14.943 99.972 0.149583
99.971 15.2789 99.9715 0.152907
</pre></div>
</div>
</div>
@@ -2002,14 +2012,14 @@ Error: 0.06844519414009445
Bias^2: 0.06453579006728322
Var: 0.003909404072811221
0.06844519414009445 &gt;= 0.06453579006728322 + 0.003909404072811221 = 0.06844519414009444
</pre></div>
</div>
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Polynomial degree: 5
Polynomial degree: 5
Error: 0.05227921801205679
Bias^2: 0.04818727730430286
Var: 0.004091940707753925
0.05227921801205679 &gt;= 0.04818727730430286 + 0.004091940707753925 = 0.05227921801205679
Polynomial degree: 6
</pre></div>
</div>
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Polynomial degree: 6
Error: 0.03781367141738902
Bias^2: 0.03365768507152769
Var: 0.0041559863458613296
@@ -2029,14 +2039,14 @@ Error: 0.026605727637184558
Bias^2: 0.010018312644139219
Var: 0.016587414993045335
0.026605727637184558 &gt;= 0.010018312644139219 + 0.016587414993045335 = 0.026605727637184554
Polynomial degree: 10
</pre></div>
</div>
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Polynomial degree: 10
Error: 0.021592704588021178
Bias^2: 0.010516485576646504
Var: 0.01107621901137467
0.021592704588021178 &gt;= 0.010516485576646504 + 0.01107621901137467 = 0.021592704588021174
</pre></div>
</div>
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Polynomial degree: 11
Polynomial degree: 11
Error: 0.07160048164232538
Bias^2: 0.014436800088896381
Var: 0.05716368155342902
@@ -2473,12 +2483,12 @@ Mean squared error on test data: 238.16356503
Degree of polynomial: 20
Mean squared error on training data: 0.00140849
Mean squared error on test data: 1345.68592431
</pre></div>
</div>
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 21
Degree of polynomial: 21
Mean squared error on training data: 0.00119699
Mean squared error on test data: 1836.21110005
Degree of polynomial: 22
</pre></div>
</div>
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 22
Mean squared error on training data: 0.00092904
Mean squared error on test data: 1182.64316482
Degree of polynomial: 23
@@ -2493,12 +2503,12 @@ Mean squared error on test data: 7697.35412147
Degree of polynomial: 26
Mean squared error on training data: 0.00075597
Mean squared error on test data: 1078.81597834
</pre></div>
</div>
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 27
Degree of polynomial: 27
Mean squared error on training data: 0.00068088
Mean squared error on test data: 3189.20355156
Degree of polynomial: 28
</pre></div>
</div>
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Degree of polynomial: 28
Mean squared error on training data: 0.00063364
Mean squared error on test data: 692.24085321
Degree of polynomial: 29
@@ -2506,9 +2516,9 @@ Mean squared error on training data: 0.00063862
Mean squared error on test data: 3073.63180447
</pre></div>
</div>
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_31560/626635268.py:73: RuntimeWarning: divide by zero encountered in log10
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_10727/626635268.py:73: RuntimeWarning: divide by zero encountered in log10
plt.plot(polynomial, np.log10(trainingerror), label=&#39;Training Error&#39;)
/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_31560/626635268.py:74: RuntimeWarning: divide by zero encountered in log10
/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_10727/626635268.py:74: RuntimeWarning: divide by zero encountered in log10
plt.plot(polynomial, np.log10(testerror), label=&#39;Test Error&#39;)
</pre></div>
</div>
@@ -2593,7 +2603,7 @@ Mean squared error on test data: 3073.63180447
</div>
</div>
<div class="cell_output docutils container">
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_31560/3817475779.py:63: RuntimeWarning: divide by zero encountered in log10
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/var/folders/td/3yk470mj5p931p9dtkk0y6jw0000gn/T/ipykernel_10727/3817475779.py:63: RuntimeWarning: divide by zero encountered in log10
plt.plot(polynomial, np.log10(estimated_mse_sklearn), label=&#39;Test Error&#39;)
</pre></div>
</div>
@@ -2990,10 +3000,10 @@ using the <strong>standardscaler</strong> functionality of the library
<p class="prev-next-title">Exercises week 37</p>
</div>
</a>
<a class='right-next' id="next-link" href="project1.html" title="next page">
<a class='right-next' id="next-link" href="exercisesweek38.html" title="next page">
<div class="prev-next-info">
<p class="prev-next-subtitle">next</p>
<p class="prev-next-title">Project 1 on Machine Learning, deadline October 9 (midnight), 2023</p>
<p class="prev-next-title">Exercises week 38</p>
</div>
<i class="fas fa-angle-right"></i>
</a>
+7 -7
View File
@@ -5,7 +5,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Data Analysis and Machine Learning: Logistic Regression and Optimization &#8212; Applied Data Analysis and Machine Learning</title>
<title>Week38: Logistic Regression and Optimization &#8212; Applied Data Analysis and Machine Learning</title>
<link href="_static/css/theme.css" rel="stylesheet">
<link href="_static/css/index.ff1ffe594081f20da1ef19478df9384b.css" rel="stylesheet">
@@ -285,7 +285,7 @@ const thebe_selector_output = ".output, .cell_output"
</li>
<li class="toctree-l1">
<a class="reference internal" href="week37.html">
Week 37: Statitsitcal interpretations and Resampling Methods
Week 37: Statistical interpretations and Resampling Methods
</a>
</li>
<li class="toctree-l1">
@@ -295,7 +295,7 @@ const thebe_selector_output = ".output, .cell_output"
</li>
<li class="toctree-l1 current active">
<a class="current reference internal" href="#">
Data Analysis and Machine Learning: Logistic Regression and Optimization
Week38: Logistic Regression and Optimization
</a>
</li>
</ul>
@@ -711,7 +711,7 @@ const thebe_selector_output = ".output, .cell_output"
<div class="col-12 col-md-9 pl-md-3 pr-md-0">
<!-- Table of contents that is only displayed when printing the page -->
<div id="jb-print-docs-body" class="onlyprint">
<h1>Data Analysis and Machine Learning: Logistic Regression and Optimization</h1>
<h1>Week38: Logistic Regression and Optimization</h1>
<!-- Table of contents -->
<div id="print-main-content">
<div id="jb-print-toc">
@@ -1052,8 +1052,8 @@ const thebe_selector_output = ".output, .cell_output"
<!-- HTML file automatically generated from DocOnce source (https://github.com/doconce/doconce/)
doconce format html week38.do.txt --no_mako -->
<!-- dom:TITLE: Data Analysis and Machine Learning: Logistic Regression and Optimization --><div class="tex2jax_ignore mathjax_ignore section" id="data-analysis-and-machine-learning-logistic-regression-and-optimization">
<h1>Data Analysis and Machine Learning: Logistic Regression and Optimization<a class="headerlink" href="#data-analysis-and-machine-learning-logistic-regression-and-optimization" title="Permalink to this headline"></a></h1>
<!-- dom:TITLE: Week38: Logistic Regression and Optimization --><div class="tex2jax_ignore mathjax_ignore section" id="week38-logistic-regression-and-optimization">
<h1>Week38: Logistic Regression and Optimization<a class="headerlink" href="#week38-logistic-regression-and-optimization" title="Permalink to this headline"></a></h1>
<p><strong>Morten Hjorth-Jensen</strong>, Department of Physics and Center for Computing in Science Education, University of Oslo and Department of Physics and Astronomy and Facility for Rare Isotope Beams, Michigan State University</p>
<p>Date: <strong>September 18-22</strong></p>
<div class="section" id="plans-for-week-38">
@@ -1994,7 +1994,7 @@ case under study.</p>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>RandomizedSearchCV(estimator=Ridge(), n_iter=100,
param_distributions={&#39;alpha&#39;: &lt;scipy.stats._distn_infrastructure.rv_frozen object at 0x130057e80&gt;})
param_distributions={&#39;alpha&#39;: &lt;scipy.stats._distn_infrastructure.rv_frozen object at 0x128a2b580&gt;})
Best estimated lambda-value: 0.9849967686928113
MSE score: 1.0853136633465326
R2 score: -0.0002382102844775691
File diff suppressed because one or more lines are too long
@@ -3,12 +3,12 @@
# <!-- HTML file automatically generated from DocOnce source (https://github.com/doconce/doconce/)
# doconce format html week37.do.txt --no_mako -->
# <!-- dom:TITLE: Week 37: Statitsitcal interpretations and Resampling Methods -->
# <!-- dom:TITLE: Week 37: Statistical interpretations and Resampling Methods -->
# # Week 37: Statitsitcal interpretations and Resampling Methods
# # Week 37: Statistical interpretations and Resampling Methods
# **Morten Hjorth-Jensen**, Department of Physics, University of Oslo and Department of Physics and Astronomy and Facility for Rare Isotope Beams, Michigan State University
#
# Date: **Sep 14, 2023**
# Date: **Sep 18, 2023**
#
# Copyright 1999-2023, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license
#
Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

File diff suppressed because it is too large Load Diff
@@ -3,9 +3,9 @@
# <!-- HTML file automatically generated from DocOnce source (https://github.com/doconce/doconce/)
# doconce format html week38.do.txt --no_mako -->
# <!-- dom:TITLE: Data Analysis and Machine Learning: Logistic Regression and Optimization -->
# <!-- dom:TITLE: Week38: Logistic Regression and Optimization -->
# # Data Analysis and Machine Learning: Logistic Regression and Optimization
# # Week38: Logistic Regression and Optimization
# **Morten Hjorth-Jensen**, Department of Physics and Center for Computing in Science Education, University of Oslo and Department of Physics and Astronomy and Facility for Rare Isotope Beams, Michigan State University
#
# Date: **September 18-22**