This commit is contained in:
Morten Hjorth-Jensen
2022-08-23 10:41:54 +02:00
parent 3b8fc53c1c
commit a64e06d984
57 changed files with 3260 additions and 3441 deletions
+21 -40
View File
@@ -1,6 +1,7 @@
<!--
Automatically generated HTML file from DocOnce source
HTML file automatically generated from DocOnce source
(https://github.com/doconce/doconce/)
doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako
-->
<html>
<head>
@@ -8,24 +9,20 @@ Automatically generated HTML file from DocOnce source
<meta name="generator" content="DocOnce: https://github.com/doconce/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Week 37: Summary of Ridge and Lasso Regression and Resampling Methods">
<title>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</title>
<!-- Bootstrap style: bootstrap -->
<!-- doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
@@ -35,18 +32,16 @@ Automatically generated HTML file from DocOnce source
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Plans for week 37', 2, None, 'plans-for-week-37'),
('Thursday September 16, Summary of Ridge and Lasso Regression '
('Thursday September 15, Summary of Ridge and Lasso Regression '
'and start Resampling methods',
2,
None,
'thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
'thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
('Deriving OLS from a probability distribution',
2,
None,
@@ -197,8 +192,6 @@ MathJax.Hub.Config({
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
@@ -209,14 +202,13 @@ MathJax.Hub.Config({
</button>
<a class="navbar-brand" href="week37-bs.html">Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week37-bs001.html#plans-for-week-37" style="font-size: 80%;">Plans for week 37</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs003.html#deriving-ols-from-a-probability-distribution" style="font-size: 80%;">Deriving OLS from a probability distribution</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs004.html#independent-and-identically-distrubuted-iid" style="font-size: 80%;">Independent and Identically Distrubuted (iid)</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs005.html#maximum-likelihood-estimation-mle" style="font-size: 80%;">Maximum Likelihood Estimation (MLE)</a></li>
@@ -270,36 +262,32 @@ MathJax.Hub.Config({
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0000"></a>
<!-- ------------------- main content ---------------------- -->
<div class="jumbotron">
<center><h1>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</h1></center> <!-- document title -->
<center>
<h1>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</h1>
</center> <!-- document title -->
<p>
<!-- author(s): Morten Hjorth-Jensen -->
<center>
<b>Morten Hjorth-Jensen</b> [1, 2]
</center>
<p>
<!-- institution(s) -->
<center>
[1] <b>Department of Physics, University of Oslo</b>
</center>
<center>
[2] <b>Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory, Michigan State University</b>
</center>
<br>
<center>
<h4>Aug 23, 2022</h4>
</center> <!-- date -->
<br>
<center>[1] <b>Department of Physics, University of Oslo</b></center>
<center>[2] <b>Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory, Michigan State University</b></center>
<br>
<p>
<center><h4>Sep 28, 2021</h4></center> <!-- date -->
<br>
<p>
<p><a href="._week37-bs001.html" class="btn btn-primary btn-lg">Read &raquo;</a></p>
@@ -325,25 +313,18 @@ MathJax.Hub.Config({
<li><a href="._week37-bs001.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="https://..."><img width="250" align=right src="https://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright --> &copy; 1999-2021, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license
<!-- copyright --> &copy; 1999-2022, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license
</center>
</body>
</html>
+9 -42
View File
@@ -1,6 +1,7 @@
<!--
Automatically generated HTML file from DocOnce source
HTML file automatically generated from DocOnce source
(https://github.com/doconce/doconce/)
doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako
-->
<html>
<head>
@@ -8,24 +9,20 @@ Automatically generated HTML file from DocOnce source
<meta name="generator" content="DocOnce: https://github.com/doconce/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Week 37: Summary of Ridge and Lasso Regression and Resampling Methods">
<title>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</title>
<!-- Bootstrap style: bootstrap -->
<!-- doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
@@ -35,18 +32,16 @@ Automatically generated HTML file from DocOnce source
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Plans for week 37', 2, None, 'plans-for-week-37'),
('Thursday September 16, Summary of Ridge and Lasso Regression '
('Thursday September 15, Summary of Ridge and Lasso Regression '
'and start Resampling methods',
2,
None,
'thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
'thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
('Deriving OLS from a probability distribution',
2,
None,
@@ -197,8 +192,6 @@ MathJax.Hub.Config({
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
@@ -209,14 +202,13 @@ MathJax.Hub.Config({
</button>
<a class="navbar-brand" href="week37-bs.html">Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="#plans-for-week-37" style="font-size: 80%;">Plans for week 37</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs003.html#deriving-ols-from-a-probability-distribution" style="font-size: 80%;">Deriving OLS from a probability distribution</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs004.html#independent-and-identically-distrubuted-iid" style="font-size: 80%;">Independent and Identically Distrubuted (iid)</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs005.html#maximum-likelihood-estimation-mle" style="font-size: 80%;">Maximum Likelihood Estimation (MLE)</a></li>
@@ -270,40 +262,22 @@ MathJax.Hub.Config({
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0001"></a>
<!-- !split -->
<h2 id="plans-for-week-37" class="anchor">Plans for week 37 </h2>
<ul>
<li> Thursday September 16: Summary of Ridge and Lasso with examples and start resampling techniques
<ol type="a"></li>
<li> <a href="https://www.uio.no/studier/emner/matnat/fys/FYS-STK3155/h21/forelesningsvideoer/LectureSeptember16Firstpart.mp4?vrtx=view-as-webpage" target="_self">Video of Lecture, first part</a></li>
<li> <a href="https://www.uio.no/studier/emner/matnat/fys/FYS-STK3155/h21/forelesningsvideoer/LectureSeptember16SecondPart.mp4?vrtx=view-as-webpage" target="_self">Video of Lecture, second part</a></li>
</ol>
<li> Friday September 17: Resampling methods, Cross-validation, Bootstrapping and jackknife
<ol type="a"></li>
<li> <a href="https://www.uio.no/studier/emner/matnat/fys/FYS-STK3155/h21/forelesningsvideoer/LectureSeptember17.mp4?vrtx=view-as-webpage" target="_self">Video of Lecture</a></li>
</ol>
<li> Thursday September 15: Summary of Ridge and Lasso with examples and start resampling techniques</li>
<li> Friday September 16: Resampling methods, Cross-validation, Bootstrapping and jackknife</li>
</ul>
Recommended Reading:
<p>Recommended Reading:</p>
<ol>
<li> Lectures on Resampling methods (these lectures)</li>
<li> Bishop 1.3 (cross-validation) and 3.2 (bias-variance tradeoff)</li>
<li> Hastie et al Chapter 7, here we recommend 7.1-7.5 and 7.10 (cross-validation) and 7.11 (bootstrap). This chapter is better than Bishop's on these topics. Goodfellow et al discuss this in a superficial way in sections 5.2-5.5.</li>
</ol>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -324,25 +298,18 @@ Recommended Reading:
<li><a href="._week37-bs002.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="https://..."><img width="250" align=right src="https://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright only on the titlepage -->
</center>
</body>
</html>
+7 -27
View File
@@ -1,6 +1,7 @@
<!--
Automatically generated HTML file from DocOnce source
HTML file automatically generated from DocOnce source
(https://github.com/doconce/doconce/)
doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako
-->
<html>
<head>
@@ -8,24 +9,20 @@ Automatically generated HTML file from DocOnce source
<meta name="generator" content="DocOnce: https://github.com/doconce/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Week 37: Summary of Ridge and Lasso Regression and Resampling Methods">
<title>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</title>
<!-- Bootstrap style: bootstrap -->
<!-- doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
@@ -35,18 +32,16 @@ Automatically generated HTML file from DocOnce source
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Plans for week 37', 2, None, 'plans-for-week-37'),
('Thursday September 16, Summary of Ridge and Lasso Regression '
('Thursday September 15, Summary of Ridge and Lasso Regression '
'and start Resampling methods',
2,
None,
'thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
'thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
('Deriving OLS from a probability distribution',
2,
None,
@@ -197,8 +192,6 @@ MathJax.Hub.Config({
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
@@ -209,14 +202,13 @@ MathJax.Hub.Config({
</button>
<a class="navbar-brand" href="week37-bs.html">Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week37-bs001.html#plans-for-week-37" style="font-size: 80%;">Plans for week 37</a></li>
<!-- navigation toc: --> <li><a href="#thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="#thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs003.html#deriving-ols-from-a-probability-distribution" style="font-size: 80%;">Deriving OLS from a probability distribution</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs004.html#independent-and-identically-distrubuted-iid" style="font-size: 80%;">Independent and Identically Distrubuted (iid)</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs005.html#maximum-likelihood-estimation-mle" style="font-size: 80%;">Maximum Likelihood Estimation (MLE)</a></li>
@@ -270,17 +262,12 @@ MathJax.Hub.Config({
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0002"></a>
<!-- !split -->
<h2 id="thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" class="anchor">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods </h2>
<h2 id="thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" class="anchor">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods </h2>
<p>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -302,25 +289,18 @@ MathJax.Hub.Config({
<li><a href="._week37-bs003.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="https://..."><img width="250" align=right src="https://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright only on the titlepage -->
</center>
</body>
</html>
+11 -30
View File
@@ -1,6 +1,7 @@
<!--
Automatically generated HTML file from DocOnce source
HTML file automatically generated from DocOnce source
(https://github.com/doconce/doconce/)
doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako
-->
<html>
<head>
@@ -8,24 +9,20 @@ Automatically generated HTML file from DocOnce source
<meta name="generator" content="DocOnce: https://github.com/doconce/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Week 37: Summary of Ridge and Lasso Regression and Resampling Methods">
<title>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</title>
<!-- Bootstrap style: bootstrap -->
<!-- doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
@@ -35,18 +32,16 @@ Automatically generated HTML file from DocOnce source
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Plans for week 37', 2, None, 'plans-for-week-37'),
('Thursday September 16, Summary of Ridge and Lasso Regression '
('Thursday September 15, Summary of Ridge and Lasso Regression '
'and start Resampling methods',
2,
None,
'thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
'thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
('Deriving OLS from a probability distribution',
2,
None,
@@ -197,8 +192,6 @@ MathJax.Hub.Config({
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
@@ -209,14 +202,13 @@ MathJax.Hub.Config({
</button>
<a class="navbar-brand" href="week37-bs.html">Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week37-bs001.html#plans-for-week-37" style="font-size: 80%;">Plans for week 37</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="#deriving-ols-from-a-probability-distribution" style="font-size: 80%;">Deriving OLS from a probability distribution</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs004.html#independent-and-identically-distrubuted-iid" style="font-size: 80%;">Independent and Identically Distrubuted (iid)</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs005.html#maximum-likelihood-estimation-mle" style="font-size: 80%;">Maximum Likelihood Estimation (MLE)</a></li>
@@ -270,36 +262,32 @@ MathJax.Hub.Config({
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0003"></a>
<!-- !split -->
<h2 id="deriving-ols-from-a-probability-distribution" class="anchor">Deriving OLS from a probability distribution </h2>
<p>
Our basic assumption when we derived the OLS equations was to assume
<p>Our basic assumption when we derived the OLS equations was to assume
that our output is determined by a given continuous function
\( f(\boldsymbol{x}) \) and a random noise \( \boldsymbol{\epsilon} \) given by the normal
distribution with zero mean value and an undetermined variance
\( \sigma^2 \).
</p>
<p>
We found above that the outputs \( \boldsymbol{y} \) have a mean value given by
<p>We found above that the outputs \( \boldsymbol{y} \) have a mean value given by
\( \boldsymbol{X}\hat{\boldsymbol{\beta}} \) and variance \( \sigma^2 \). Since the entries to
the design matrix are not stochastic variables, we can assume that the
probability distribution of our targets is also a normal distribution
but now with mean value \( \boldsymbol{X}\hat{\boldsymbol{\beta}} \). This means that a
single output \( y_i \) is given by the Gaussian distribution
</p>
$$
y_i\sim \mathcal{N}(\boldsymbol{X}_{i,*}\boldsymbol{\beta}, \sigma^2)=\frac{1}{\sqrt{2\pi\sigma^2}}\exp{\left[-\frac{(y_i-\boldsymbol{X}_{i,*}\boldsymbol{\beta})^2}{2\sigma^2}\right]}.
$$
<p>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -322,25 +310,18 @@ $$
<li><a href="._week37-bs004.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="https://..."><img width="250" align=right src="https://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright only on the titlepage -->
</center>
</body>
</html>
+15 -36
View File
@@ -1,6 +1,7 @@
<!--
Automatically generated HTML file from DocOnce source
HTML file automatically generated from DocOnce source
(https://github.com/doconce/doconce/)
doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako
-->
<html>
<head>
@@ -8,24 +9,20 @@ Automatically generated HTML file from DocOnce source
<meta name="generator" content="DocOnce: https://github.com/doconce/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Week 37: Summary of Ridge and Lasso Regression and Resampling Methods">
<title>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</title>
<!-- Bootstrap style: bootstrap -->
<!-- doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
@@ -35,18 +32,16 @@ Automatically generated HTML file from DocOnce source
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Plans for week 37', 2, None, 'plans-for-week-37'),
('Thursday September 16, Summary of Ridge and Lasso Regression '
('Thursday September 15, Summary of Ridge and Lasso Regression '
'and start Resampling methods',
2,
None,
'thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
'thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
('Deriving OLS from a probability distribution',
2,
None,
@@ -197,8 +192,6 @@ MathJax.Hub.Config({
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
@@ -209,14 +202,13 @@ MathJax.Hub.Config({
</button>
<a class="navbar-brand" href="week37-bs.html">Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week37-bs001.html#plans-for-week-37" style="font-size: 80%;">Plans for week 37</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs003.html#deriving-ols-from-a-probability-distribution" style="font-size: 80%;">Deriving OLS from a probability distribution</a></li>
<!-- navigation toc: --> <li><a href="#independent-and-identically-distrubuted-iid" style="font-size: 80%;">Independent and Identically Distrubuted (iid)</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs005.html#maximum-likelihood-estimation-mle" style="font-size: 80%;">Maximum Likelihood Estimation (MLE)</a></li>
@@ -270,49 +262,43 @@ MathJax.Hub.Config({
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0004"></a>
<!-- !split -->
<h2 id="independent-and-identically-distrubuted-iid" class="anchor">Independent and Identically Distrubuted (iid) </h2>
<p>
We assume now that the various \( y_i \) values are stochastically distributed according to the above Gaussian distribution.
<p>We assume now that the various \( y_i \) values are stochastically distributed according to the above Gaussian distribution.
We define this distribution as
</p>
$$
p(y_i, \boldsymbol{X}\vert\boldsymbol{\beta})=\frac{1}{\sqrt{2\pi\sigma^2}}\exp{\left[-\frac{(y_i-\boldsymbol{X}_{i,*}\boldsymbol{\beta})^2}{2\sigma^2}\right]},
$$
which reads as finding the likelihood of an event \( y_i \) with the input variables \( \boldsymbol{X} \) given the parameters (to be determined) \( \boldsymbol{\beta} \).
<p>which reads as finding the likelihood of an event \( y_i \) with the input variables \( \boldsymbol{X} \) given the parameters (to be determined) \( \boldsymbol{\beta} \).</p>
<p>
Since these events are assumed to be independent and identicall distributed we can build the probability distribution function (PDF) for all possible event \( \boldsymbol{y} \) as the product of the single events, that is we have
<p>Since these events are assumed to be independent and identicall distributed we can build the probability distribution function (PDF) for all possible event \( \boldsymbol{y} \) as the product of the single events, that is we have</p>
$$
p(\boldsymbol{y},\boldsymbol{X}\vert\boldsymbol{\beta})=\prod_{i=0}^{n-1}\frac{1}{\sqrt{2\pi\sigma^2}}\exp{\left[-\frac{(y_i-\boldsymbol{X}_{i,*}\boldsymbol{\beta})^2}{2\sigma^2}\right]}=\prod_{i=0}^{n-1}p(y_i,\boldsymbol{X}\vert\boldsymbol{\beta}).
$$
<p>
We will write this in a more compact form reserving \( \boldsymbol{D} \) for the domain of events, including the ouputs (targets) and the inputs. That is
<p>We will write this in a more compact form reserving \( \boldsymbol{D} \) for the domain of events, including the ouputs (targets) and the inputs. That is
in case we have a simple one-dimensional input and output case
</p>
$$
\boldsymbol{D}=[(x_0,y_0), (x_1,y_1),\dots, (x_{n-1},y_{n-1})].
$$
In the more general case the various inputs should be replaced by the possible features represented by the input data set \( \boldsymbol{X} \).
<p>In the more general case the various inputs should be replaced by the possible features represented by the input data set \( \boldsymbol{X} \).
We can now rewrite the above probability as
</p>
$$
p(\boldsymbol{D}\vert\boldsymbol{\beta})=\prod_{i=0}^{n-1}\frac{1}{\sqrt{2\pi\sigma^2}}\exp{\left[-\frac{(y_i-\boldsymbol{X}_{i,*}\boldsymbol{\beta})^2}{2\sigma^2}\right]}.
$$
<p>
It is a conditional probability (see below) and reads as the likelihood of a domain of events \( \boldsymbol{D} \) given a set of parameters \( \boldsymbol{\beta} \).
<p>It is a conditional probability (see below) and reads as the likelihood of a domain of events \( \boldsymbol{D} \) given a set of parameters \( \boldsymbol{\beta} \).</p>
<p>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -336,25 +322,18 @@ It is a conditional probability (see below) and reads as the likelihood of a dom
<li><a href="._week37-bs005.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="https://..."><img width="250" align=right src="https://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright only on the titlepage -->
</center>
</body>
</html>
+15 -35
View File
@@ -1,6 +1,7 @@
<!--
Automatically generated HTML file from DocOnce source
HTML file automatically generated from DocOnce source
(https://github.com/doconce/doconce/)
doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako
-->
<html>
<head>
@@ -8,24 +9,20 @@ Automatically generated HTML file from DocOnce source
<meta name="generator" content="DocOnce: https://github.com/doconce/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Week 37: Summary of Ridge and Lasso Regression and Resampling Methods">
<title>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</title>
<!-- Bootstrap style: bootstrap -->
<!-- doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
@@ -35,18 +32,16 @@ Automatically generated HTML file from DocOnce source
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Plans for week 37', 2, None, 'plans-for-week-37'),
('Thursday September 16, Summary of Ridge and Lasso Regression '
('Thursday September 15, Summary of Ridge and Lasso Regression '
'and start Resampling methods',
2,
None,
'thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
'thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
('Deriving OLS from a probability distribution',
2,
None,
@@ -197,8 +192,6 @@ MathJax.Hub.Config({
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
@@ -209,14 +202,13 @@ MathJax.Hub.Config({
</button>
<a class="navbar-brand" href="week37-bs.html">Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week37-bs001.html#plans-for-week-37" style="font-size: 80%;">Plans for week 37</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs003.html#deriving-ols-from-a-probability-distribution" style="font-size: 80%;">Deriving OLS from a probability distribution</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs004.html#independent-and-identically-distrubuted-iid" style="font-size: 80%;">Independent and Identically Distrubuted (iid)</a></li>
<!-- navigation toc: --> <li><a href="#maximum-likelihood-estimation-mle" style="font-size: 80%;">Maximum Likelihood Estimation (MLE)</a></li>
@@ -270,42 +262,37 @@ MathJax.Hub.Config({
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0005"></a>
<!-- !split -->
<h2 id="maximum-likelihood-estimation-mle" class="anchor">Maximum Likelihood Estimation (MLE) </h2>
<p>
In statistics, maximum likelihood estimation (MLE) is a method of
<p>In statistics, maximum likelihood estimation (MLE) is a method of
estimating the parameters of an assumed probability distribution,
given some observed data. This is achieved by maximizing a likelihood
function so that, under the assumed statistical model, the observed
data is the most probable.
data is the most probable.
</p>
<p>
We will assume here that our events are given by the above Gaussian
<p>We will assume here that our events are given by the above Gaussian
distribution and we will determine the optimal parameters \( \beta \) by
maximizing the above PDF. However, computing the derivatives of a
product function is cumbersome and can easily lead to overflow and/or
underflowproblems, with potentials for loss of numerical precision.
</p>
<p>
In practice, it is more convenient to maximize the logarithm of the
<p>In practice, it is more convenient to maximize the logarithm of the
PDF because it is a monotonically increasing function of the argument.
Alternatively, and this will be our option, we will minimize the
negative of the logarithm since this is a monotonically decreasing
function.
</p>
<p>
Note also that maximization/minimization of the logarithm of the PDF
<p>Note also that maximization/minimization of the logarithm of the PDF
is equivalent to the maximization/minimization of the function itself.
</p>
<p>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -330,25 +317,18 @@ is equivalent to the maximization/minimization of the function itself.
<li><a href="._week37-bs006.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="https://..."><img width="250" align=right src="https://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright only on the titlepage -->
</center>
</body>
</html>
+11 -32
View File
@@ -1,6 +1,7 @@
<!--
Automatically generated HTML file from DocOnce source
HTML file automatically generated from DocOnce source
(https://github.com/doconce/doconce/)
doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako
-->
<html>
<head>
@@ -8,24 +9,20 @@ Automatically generated HTML file from DocOnce source
<meta name="generator" content="DocOnce: https://github.com/doconce/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Week 37: Summary of Ridge and Lasso Regression and Resampling Methods">
<title>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</title>
<!-- Bootstrap style: bootstrap -->
<!-- doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
@@ -35,18 +32,16 @@ Automatically generated HTML file from DocOnce source
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Plans for week 37', 2, None, 'plans-for-week-37'),
('Thursday September 16, Summary of Ridge and Lasso Regression '
('Thursday September 15, Summary of Ridge and Lasso Regression '
'and start Resampling methods',
2,
None,
'thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
'thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
('Deriving OLS from a probability distribution',
2,
None,
@@ -197,8 +192,6 @@ MathJax.Hub.Config({
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
@@ -209,14 +202,13 @@ MathJax.Hub.Config({
</button>
<a class="navbar-brand" href="week37-bs.html">Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week37-bs001.html#plans-for-week-37" style="font-size: 80%;">Plans for week 37</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs003.html#deriving-ols-from-a-probability-distribution" style="font-size: 80%;">Deriving OLS from a probability distribution</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs004.html#independent-and-identically-distrubuted-iid" style="font-size: 80%;">Independent and Identically Distrubuted (iid)</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs005.html#maximum-likelihood-estimation-mle" style="font-size: 80%;">Maximum Likelihood Estimation (MLE)</a></li>
@@ -270,41 +262,35 @@ MathJax.Hub.Config({
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0006"></a>
<!-- !split -->
<h2 id="a-new-cost-function" class="anchor">A new Cost Function </h2>
<p>
We could now define a new cost function to minimize, namely the negative logarithm of the above PDF
<p>We could now define a new cost function to minimize, namely the negative logarithm of the above PDF</p>
$$
C(\boldsymbol{\beta}=-\log{\prod_{i=0}^{n-1}p(y_i,\boldsymbol{X}\vert\boldsymbol{\beta})}=-\sum_{i=0}^{n-1}\log{p(y_i,\boldsymbol{X}\vert\boldsymbol{\beta})},
$$
which becomes
<p>which becomes</p>
$$
C(\boldsymbol{\beta}=\frac{n}{2}\log{2\pi\sigma^2}+\frac{\vert\vert (\boldsymbol{y}-\boldsymbol{X}\boldsymbol{\beta})\vert\vert_2^2}{2\sigma^2}.
$$
<p>
Taking the derivative of the <em>new</em> cost function with respect to the parameters \( \beta \) we recognize our familiar OLS equation, namely
<p>Taking the derivative of the <em>new</em> cost function with respect to the parameters \( \beta \) we recognize our familiar OLS equation, namely</p>
$$
\boldsymbol{X}^T\left(\boldsymbol{y}-\boldsymbol{X}\boldsymbol{\beta}\right) =0,
$$
which leads to the well-known OLS equation for the optimal paramters \( \beta \)
<p>which leads to the well-known OLS equation for the optimal paramters \( \beta \)</p>
$$
\hat{\boldsymbol{\beta}}^{\mathrm{OLS}}=\left(\boldsymbol{X}^T\boldsymbol{X}\right)^{-1}\boldsymbol{X}^T\boldsymbol{y}!
$$
<p>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -330,25 +316,18 @@ $$
<li><a href="._week37-bs007.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="https://..."><img width="250" align=right src="https://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright only on the titlepage -->
</center>
</body>
</html>
+9 -30
View File
@@ -1,6 +1,7 @@
<!--
Automatically generated HTML file from DocOnce source
HTML file automatically generated from DocOnce source
(https://github.com/doconce/doconce/)
doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako
-->
<html>
<head>
@@ -8,24 +9,20 @@ Automatically generated HTML file from DocOnce source
<meta name="generator" content="DocOnce: https://github.com/doconce/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Week 37: Summary of Ridge and Lasso Regression and Resampling Methods">
<title>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</title>
<!-- Bootstrap style: bootstrap -->
<!-- doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
@@ -35,18 +32,16 @@ Automatically generated HTML file from DocOnce source
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Plans for week 37', 2, None, 'plans-for-week-37'),
('Thursday September 16, Summary of Ridge and Lasso Regression '
('Thursday September 15, Summary of Ridge and Lasso Regression '
'and start Resampling methods',
2,
None,
'thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
'thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
('Deriving OLS from a probability distribution',
2,
None,
@@ -197,8 +192,6 @@ MathJax.Hub.Config({
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
@@ -209,14 +202,13 @@ MathJax.Hub.Config({
</button>
<a class="navbar-brand" href="week37-bs.html">Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week37-bs001.html#plans-for-week-37" style="font-size: 80%;">Plans for week 37</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs003.html#deriving-ols-from-a-probability-distribution" style="font-size: 80%;">Deriving OLS from a probability distribution</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs004.html#independent-and-identically-distrubuted-iid" style="font-size: 80%;">Independent and Identically Distrubuted (iid)</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs005.html#maximum-likelihood-estimation-mle" style="font-size: 80%;">Maximum Likelihood Estimation (MLE)</a></li>
@@ -270,31 +262,25 @@ MathJax.Hub.Config({
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0007"></a>
<!-- !split -->
<h2 id="bayes-theorem" class="anchor">Bayes' Theorem </h2>
<p>
If we combine the conditional probability with the marginal probability and the standard product rule, we have
<p>If we combine the conditional probability with the marginal probability and the standard product rule, we have</p>
$$
p(X\vert Y)= \frac{p(X,Y)}{p(Y)},
$$
which we can rewrite as
<p>which we can rewrite as</p>
$$
p(X\vert Y)= \frac{p(X,Y)}{\sum_{i=0}^{n-1}p(Y\vert X=x_i)p(x_i)}=\frac{p(Y\vert X)p(X)}{\sum_{i=0}^{n-1}p(Y\vert X=x_i)p(x_i)},
$$
which is Bayes' theorem. It allows us to evaluate the uncertainty in in \( X \) after we have observed \( Y \). We can easily interchange \( X \) with \( Y \).
<p>which is Bayes' theorem. It allows us to evaluate the uncertainty in in \( X \) after we have observed \( Y \). We can easily interchange \( X \) with \( Y \). </p>
<p>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -321,25 +307,18 @@ which is Bayes' theorem. It allows us to evaluate the uncertainty in in \( X \)
<li><a href="._week37-bs008.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="https://..."><img width="250" align=right src="https://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright only on the titlepage -->
</center>
</body>
</html>
+9 -30
View File
@@ -1,6 +1,7 @@
<!--
Automatically generated HTML file from DocOnce source
HTML file automatically generated from DocOnce source
(https://github.com/doconce/doconce/)
doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako
-->
<html>
<head>
@@ -8,24 +9,20 @@ Automatically generated HTML file from DocOnce source
<meta name="generator" content="DocOnce: https://github.com/doconce/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Week 37: Summary of Ridge and Lasso Regression and Resampling Methods">
<title>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</title>
<!-- Bootstrap style: bootstrap -->
<!-- doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
@@ -35,18 +32,16 @@ Automatically generated HTML file from DocOnce source
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Plans for week 37', 2, None, 'plans-for-week-37'),
('Thursday September 16, Summary of Ridge and Lasso Regression '
('Thursday September 15, Summary of Ridge and Lasso Regression '
'and start Resampling methods',
2,
None,
'thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
'thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
('Deriving OLS from a probability distribution',
2,
None,
@@ -197,8 +192,6 @@ MathJax.Hub.Config({
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
@@ -209,14 +202,13 @@ MathJax.Hub.Config({
</button>
<a class="navbar-brand" href="week37-bs.html">Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week37-bs001.html#plans-for-week-37" style="font-size: 80%;">Plans for week 37</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs003.html#deriving-ols-from-a-probability-distribution" style="font-size: 80%;">Deriving OLS from a probability distribution</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs004.html#independent-and-identically-distrubuted-iid" style="font-size: 80%;">Independent and Identically Distrubuted (iid)</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs005.html#maximum-likelihood-estimation-mle" style="font-size: 80%;">Maximum Likelihood Estimation (MLE)</a></li>
@@ -270,26 +262,20 @@ MathJax.Hub.Config({
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0008"></a>
<!-- !split -->
<h2 id="interpretations-of-bayes-theorem" class="anchor">Interpretations of Bayes' Theorem </h2>
<p>
The quantity \( p(Y\vert X) \) on the right-hand side of the theorem is
<p>The quantity \( p(Y\vert X) \) on the right-hand side of the theorem is
evaluated for the observed data \( Y \) and can be viewed as a function of
the parameter space represented by \( X \). This function is not
necesseraly normalized and is normally called the likelihood function.
</p>
<p>
The function \( p(X) \) on the right hand side is called the prior while the function on the left hand side is the called the posterior probability. The denominator on the right hand side serves as a normalization factor for the posterior distribution.
<p>The function \( p(X) \) on the right hand side is called the prior while the function on the left hand side is the called the posterior probability. The denominator on the right hand side serves as a normalization factor for the posterior distribution.</p>
<p>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -317,25 +303,18 @@ The function \( p(X) \) on the right hand side is called the prior while the fun
<li><a href="._week37-bs009.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="https://..."><img width="250" align=right src="https://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright only on the titlepage -->
</center>
</body>
</html>
+31 -35
View File
@@ -1,6 +1,7 @@
<!--
Automatically generated HTML file from DocOnce source
HTML file automatically generated from DocOnce source
(https://github.com/doconce/doconce/)
doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako
-->
<html>
<head>
@@ -8,24 +9,20 @@ Automatically generated HTML file from DocOnce source
<meta name="generator" content="DocOnce: https://github.com/doconce/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Week 37: Summary of Ridge and Lasso Regression and Resampling Methods">
<title>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</title>
<!-- Bootstrap style: bootstrap -->
<!-- doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
@@ -35,18 +32,16 @@ Automatically generated HTML file from DocOnce source
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Plans for week 37', 2, None, 'plans-for-week-37'),
('Thursday September 16, Summary of Ridge and Lasso Regression '
('Thursday September 15, Summary of Ridge and Lasso Regression '
'and start Resampling methods',
2,
None,
'thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
'thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
('Deriving OLS from a probability distribution',
2,
None,
@@ -197,8 +192,6 @@ MathJax.Hub.Config({
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
@@ -209,14 +202,13 @@ MathJax.Hub.Config({
</button>
<a class="navbar-brand" href="week37-bs.html">Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week37-bs001.html#plans-for-week-37" style="font-size: 80%;">Plans for week 37</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs003.html#deriving-ols-from-a-probability-distribution" style="font-size: 80%;">Deriving OLS from a probability distribution</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs004.html#independent-and-identically-distrubuted-iid" style="font-size: 80%;">Independent and Identically Distrubuted (iid)</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs005.html#maximum-likelihood-estimation-mle" style="font-size: 80%;">Maximum Likelihood Estimation (MLE)</a></li>
@@ -270,30 +262,29 @@ MathJax.Hub.Config({
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0009"></a>
<!-- !split -->
<h2 id="test-function-for-what-happens-with-ols-ridge-and-lasso" class="anchor">Test Function for what happens with OLS, Ridge and Lasso </h2>
<p>
We will play around with a study of the values for the optimal
<p>We will play around with a study of the values for the optimal
parameters \( \boldsymbol{\beta} \) using OLS, Ridge and Lasso regression. For
OLS, you will notice as function of the noise and polynomial degree,
that the parameters \( \beta \) will fluctuate from order to order in the
polynomial fit and that for larger and larger polynomial degrees of freedom, the parameters will tend to increase in value for OLS.
</p>
<p>
For Ridge and Lasso regression, the higher order parameters will typically be reduced, providing thereby less fluctuations from one order to another one.
<p>For Ridge and Lasso regression, the higher order parameters will typically be reduced, providing thereby less fluctuations from one order to another one.</p>
<p>
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%;"><span></span><span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">numpy</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">np</span>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="inner_cell">
<div class="input_area">
<div class="highlight" style="background: #f8f8f8">
<pre style="line-height: 125%;"><span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">numpy</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">np</span>
<span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">matplotlib.pyplot</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">plt</span>
<span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">sklearn.model_selection</span> <span style="color: #008000; font-weight: bold">import</span> train_test_split
<span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">sklearn</span> <span style="color: #008000; font-weight: bold">import</span> linear_model
@@ -356,11 +347,23 @@ plt<span style="color: #666666">.</span>xlabel(<span style="color: #BA2121">&#39
plt<span style="color: #666666">.</span>ylabel(<span style="color: #BA2121">&#39;MSE&#39;</span>)
plt<span style="color: #666666">.</span>legend()
plt<span style="color: #666666">.</span>show()
</pre></div>
<p>
How can we understand this?
</pre>
</div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="output_subarea output_stream output_stdout output_text">
</div>
</div>
</div>
</div>
</div>
<p>How can we understand this? </p>
<p>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -389,25 +392,18 @@ How can we understand this?
<li><a href="._week37-bs010.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="https://..."><img width="250" align=right src="https://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright only on the titlepage -->
</center>
</body>
</html>
+34 -35
View File
@@ -1,6 +1,7 @@
<!--
Automatically generated HTML file from DocOnce source
HTML file automatically generated from DocOnce source
(https://github.com/doconce/doconce/)
doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako
-->
<html>
<head>
@@ -8,24 +9,20 @@ Automatically generated HTML file from DocOnce source
<meta name="generator" content="DocOnce: https://github.com/doconce/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Week 37: Summary of Ridge and Lasso Regression and Resampling Methods">
<title>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</title>
<!-- Bootstrap style: bootstrap -->
<!-- doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
@@ -35,18 +32,16 @@ Automatically generated HTML file from DocOnce source
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Plans for week 37', 2, None, 'plans-for-week-37'),
('Thursday September 16, Summary of Ridge and Lasso Regression '
('Thursday September 15, Summary of Ridge and Lasso Regression '
'and start Resampling methods',
2,
None,
'thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
'thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
('Deriving OLS from a probability distribution',
2,
None,
@@ -197,8 +192,6 @@ MathJax.Hub.Config({
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
@@ -209,14 +202,13 @@ MathJax.Hub.Config({
</button>
<a class="navbar-brand" href="week37-bs.html">Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week37-bs001.html#plans-for-week-37" style="font-size: 80%;">Plans for week 37</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs003.html#deriving-ols-from-a-probability-distribution" style="font-size: 80%;">Deriving OLS from a probability distribution</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs004.html#independent-and-identically-distrubuted-iid" style="font-size: 80%;">Independent and Identically Distrubuted (iid)</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs005.html#maximum-likelihood-estimation-mle" style="font-size: 80%;">Maximum Likelihood Estimation (MLE)</a></li>
@@ -270,30 +262,25 @@ MathJax.Hub.Config({
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0010"></a>
<!-- !split -->
<h2 id="rerunning-the-above-code" class="anchor">Rerunning the above code </h2>
<p>
Let us write out the values of the coefficients \( \beta_i \) as functions
<p>Let us write out the values of the coefficients \( \beta_i \) as functions
of the polynomial degree and noise. We will focus only on the Ridge
results and some few selected values of the hyperparameter \( \lambda \).
</p>
<p>
If we don't include any noise and run this code for different values
<p>If we don't include any noise and run this code for different values
of the polynomial degree, we notice that the results for \( \beta_i \) do
not show great changes from one order to the next. This is an
indication that for higher polynomial orders, our parameters become
less important.
</p>
<p>
If we however add noise, what happens is that the polynomial fit is
<p>If we however add noise, what happens is that the polynomial fit is
trying to adjust the fit to traverse in the best possible way all data
points. This can lead to large fluctuations in the parameters
\( \beta_i \) as functions of polynomial order. It will also be reflected
@@ -301,11 +288,16 @@ in a larger value of the variance of each parameter \( \beta_i \). What
Ridge regression (and Lasso as well) are doing then is to try to
quench the fluctuations in the parameters of \( \beta_i \) which have a
large variance (normally for higher orders in the polynomial).
</p>
<p>
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%;"><span></span><span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">numpy</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">np</span>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="inner_cell">
<div class="input_area">
<div class="highlight" style="background: #f8f8f8">
<pre style="line-height: 125%;"><span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">numpy</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">np</span>
<span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">pandas</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">pd</span>
<span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">IPython.display</span> <span style="color: #008000; font-weight: bold">import</span> display
<span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">matplotlib.pyplot</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">plt</span>
@@ -343,8 +335,22 @@ lambdas <span style="color: #666666">=</span> np<span style="color: #666666">.</
BetaValues <span style="color: #666666">=</span> pd<span style="color: #666666">.</span>DataFrame(Coeffs)
BetaValues<span style="color: #666666">.</span>columns <span style="color: #666666">=</span> [<span style="color: #BA2121">&#39;beta&#39;</span>]
display(BetaValues)
</pre></div>
<p>
</pre>
</div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="output_subarea output_stream output_stdout output_text">
</div>
</div>
</div>
</div>
</div>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -374,25 +380,18 @@ lambdas <span style="color: #666666">=</span> np<span style="color: #666666">.</
<li><a href="._week37-bs011.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="https://..."><img width="250" align=right src="https://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright only on the titlepage -->
</center>
</body>
</html>
+12 -37
View File
@@ -1,6 +1,7 @@
<!--
Automatically generated HTML file from DocOnce source
HTML file automatically generated from DocOnce source
(https://github.com/doconce/doconce/)
doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako
-->
<html>
<head>
@@ -8,24 +9,20 @@ Automatically generated HTML file from DocOnce source
<meta name="generator" content="DocOnce: https://github.com/doconce/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Week 37: Summary of Ridge and Lasso Regression and Resampling Methods">
<title>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</title>
<!-- Bootstrap style: bootstrap -->
<!-- doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
@@ -35,18 +32,16 @@ Automatically generated HTML file from DocOnce source
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Plans for week 37', 2, None, 'plans-for-week-37'),
('Thursday September 16, Summary of Ridge and Lasso Regression '
('Thursday September 15, Summary of Ridge and Lasso Regression '
'and start Resampling methods',
2,
None,
'thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
'thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
('Deriving OLS from a probability distribution',
2,
None,
@@ -197,8 +192,6 @@ MathJax.Hub.Config({
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
@@ -209,14 +202,13 @@ MathJax.Hub.Config({
</button>
<a class="navbar-brand" href="week37-bs.html">Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week37-bs001.html#plans-for-week-37" style="font-size: 80%;">Plans for week 37</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs003.html#deriving-ols-from-a-probability-distribution" style="font-size: 80%;">Deriving OLS from a probability distribution</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs004.html#independent-and-identically-distrubuted-iid" style="font-size: 80%;">Independent and Identically Distrubuted (iid)</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs005.html#maximum-likelihood-estimation-mle" style="font-size: 80%;">Maximum Likelihood Estimation (MLE)</a></li>
@@ -270,47 +262,37 @@ MathJax.Hub.Config({
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0011"></a>
<!-- !split -->
<h2 id="invoking-bayes-theorem" class="anchor">Invoking Bayes' theorem </h2>
<p>
Using Bayes' theorem we can gain a better intuition about Ridge and Lasso regression.
<p>Using Bayes' theorem we can gain a better intuition about Ridge and Lasso regression. </p>
<p>
For ordinary least squares we postulated that the maximum likelihood for the doamin of events \( \boldsymbol{D} \) (one-dimensional case)
<p>For ordinary least squares we postulated that the maximum likelihood for the doamin of events \( \boldsymbol{D} \) (one-dimensional case)</p>
$$
\boldsymbol{D}=[(x_0,y_0), (x_1,y_1),\dots, (x_{n-1},y_{n-1})],
$$
is given by
<p>is given by</p>
$$
p(\boldsymbol{D}\vert\boldsymbol{\beta})=\prod_{i=0}^{n-1}\frac{1}{\sqrt{2\pi\sigma^2}}\exp{\left[-\frac{(y_i-\boldsymbol{X}_{i,*}\boldsymbol{\beta})^2}{2\sigma^2}\right]}.
$$
<p>
In Bayes' theorem this function plays the role of the so-called likelihood. We could now ask the question what is the posterior probability of a parameter set \( \boldsymbol{\beta} \) given a domain of events \( \boldsymbol{D} \)? That is, how can we define the posterior probability
<p>In Bayes' theorem this function plays the role of the so-called likelihood. We could now ask the question what is the posterior probability of a parameter set \( \boldsymbol{\beta} \) given a domain of events \( \boldsymbol{D} \)? That is, how can we define the posterior probability </p>
$$
p(\boldsymbol{\beta}\vert\boldsymbol{D}).
$$
<p>
Bayes' theorem comes to our rescue here since (omitting the normalization constant)
<p>Bayes' theorem comes to our rescue here since (omitting the normalization constant)</p>
$$
p(\boldsymbol{\beta}\vert\boldsymbol{D})\propto p(\boldsymbol{D}\vert\boldsymbol{\beta})p(\boldsymbol{\beta}).
$$
<p>
We have a model for \( p(\boldsymbol{D}\vert\boldsymbol{\beta}) \) but need one for the <b>prior</b> \( p(\boldsymbol{\beta} \)!
<p>We have a model for \( p(\boldsymbol{D}\vert\boldsymbol{\beta}) \) but need one for the <b>prior</b> \( p(\boldsymbol{\beta} \)! </p>
<p>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -340,25 +322,18 @@ We have a model for \( p(\boldsymbol{D}\vert\boldsymbol{\beta}) \) but need one
<li><a href="._week37-bs012.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="https://..."><img width="250" align=right src="https://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright only on the titlepage -->
</center>
</body>
</html>
+14 -36
View File
@@ -1,6 +1,7 @@
<!--
Automatically generated HTML file from DocOnce source
HTML file automatically generated from DocOnce source
(https://github.com/doconce/doconce/)
doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako
-->
<html>
<head>
@@ -8,24 +9,20 @@ Automatically generated HTML file from DocOnce source
<meta name="generator" content="DocOnce: https://github.com/doconce/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Week 37: Summary of Ridge and Lasso Regression and Resampling Methods">
<title>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</title>
<!-- Bootstrap style: bootstrap -->
<!-- doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
@@ -35,18 +32,16 @@ Automatically generated HTML file from DocOnce source
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Plans for week 37', 2, None, 'plans-for-week-37'),
('Thursday September 16, Summary of Ridge and Lasso Regression '
('Thursday September 15, Summary of Ridge and Lasso Regression '
'and start Resampling methods',
2,
None,
'thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
'thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
('Deriving OLS from a probability distribution',
2,
None,
@@ -197,8 +192,6 @@ MathJax.Hub.Config({
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
@@ -209,14 +202,13 @@ MathJax.Hub.Config({
</button>
<a class="navbar-brand" href="week37-bs.html">Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week37-bs001.html#plans-for-week-37" style="font-size: 80%;">Plans for week 37</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs003.html#deriving-ols-from-a-probability-distribution" style="font-size: 80%;">Deriving OLS from a probability distribution</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs004.html#independent-and-identically-distrubuted-iid" style="font-size: 80%;">Independent and Identically Distrubuted (iid)</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs005.html#maximum-likelihood-estimation-mle" style="font-size: 80%;">Maximum Likelihood Estimation (MLE)</a></li>
@@ -270,53 +262,46 @@ MathJax.Hub.Config({
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0012"></a>
<!-- !split -->
<h2 id="ridge-and-bayes" class="anchor">Ridge and Bayes </h2>
<p>
With the posterior probability defined by a likelihood which we have
<p>With the posterior probability defined by a likelihood which we have
already modeled and an unknown prior, we are now ready to make
additional models for the prior.
</p>
<p>
We can, based on our discussions of the variance of \( \boldsymbol{\beta} \) and the mean value, assume that the prior for the values \( \boldsymbol{\beta} \) is given by a Gaussian with mean value zero and variance \( \tau^2 \), that is
<p>We can, based on our discussions of the variance of \( \boldsymbol{\beta} \) and the mean value, assume that the prior for the values \( \boldsymbol{\beta} \) is given by a Gaussian with mean value zero and variance \( \tau^2 \), that is</p>
$$
p(\boldsymbol{\beta})=\prod_{j=0}^{p-1}\exp{\left(-\frac{\beta_j^2}{2\tau^2}\right)}.
$$
<p>
Our posterior probability becomes then (omitting the normalization factor which is just a constant)
<p>Our posterior probability becomes then (omitting the normalization factor which is just a constant)</p>
$$
p(\boldsymbol{\beta\vert\boldsymbol{D})}=\prod_{i=0}^{n-1}\frac{1}{\sqrt{2\pi\sigma^2}}\exp{\left[-\frac{(y_i-\boldsymbol{X}_{i,*}\boldsymbol{\beta})^2}{2\sigma^2}\right]}\prod_{j=0}^{p-1}\exp{\left(-\frac{\beta_j^2}{2\tau^2}\right)}.
$$
<p>
We can now optimize this quantity with respect to \( \boldsymbol{\beta} \). As we
<p>We can now optimize this quantity with respect to \( \boldsymbol{\beta} \). As we
did for OLS, this is most conveniently done by taking the negative
logarithm of the posterior probability. Doing so and leaving out the
constants terms that do not depend on \( \beta \), we have
</p>
$$
C(\boldsymbol{\beta})=\frac{\vert\vert (\boldsymbol{y}-\boldsymbol{X}\boldsymbol{\beta})\vert\vert_2^2}{2\sigma^2}+\frac{1}{2\tau^2}\vert\vert\boldsymbol{\beta}\vert\vert_2^2,
$$
and replacing \( 1/2\tau^2 \) with \( \lambda \) we have
<p>and replacing \( 1/2\tau^2 \) with \( \lambda \) we have</p>
$$
C(\boldsymbol{\beta})=\frac{\vert\vert (\boldsymbol{y}-\boldsymbol{X}\boldsymbol{\beta})\vert\vert_2^2}{2\sigma^2}+\lambda\vert\vert\boldsymbol{\beta}\vert\vert_2^2,
$$
which is our Ridge cost function! Nice, isn't it?
<p>which is our Ridge cost function! Nice, isn't it?</p>
<p>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -346,25 +331,18 @@ which is our Ridge cost function! Nice, isn't it?
<li><a href="._week37-bs013.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="https://..."><img width="250" align=right src="https://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright only on the titlepage -->
</center>
</body>
</html>
+12 -34
View File
@@ -1,6 +1,7 @@
<!--
Automatically generated HTML file from DocOnce source
HTML file automatically generated from DocOnce source
(https://github.com/doconce/doconce/)
doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako
-->
<html>
<head>
@@ -8,24 +9,20 @@ Automatically generated HTML file from DocOnce source
<meta name="generator" content="DocOnce: https://github.com/doconce/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Week 37: Summary of Ridge and Lasso Regression and Resampling Methods">
<title>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</title>
<!-- Bootstrap style: bootstrap -->
<!-- doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
@@ -35,18 +32,16 @@ Automatically generated HTML file from DocOnce source
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Plans for week 37', 2, None, 'plans-for-week-37'),
('Thursday September 16, Summary of Ridge and Lasso Regression '
('Thursday September 15, Summary of Ridge and Lasso Regression '
'and start Resampling methods',
2,
None,
'thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
'thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
('Deriving OLS from a probability distribution',
2,
None,
@@ -197,8 +192,6 @@ MathJax.Hub.Config({
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
@@ -209,14 +202,13 @@ MathJax.Hub.Config({
</button>
<a class="navbar-brand" href="week37-bs.html">Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week37-bs001.html#plans-for-week-37" style="font-size: 80%;">Plans for week 37</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs003.html#deriving-ols-from-a-probability-distribution" style="font-size: 80%;">Deriving OLS from a probability distribution</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs004.html#independent-and-identically-distrubuted-iid" style="font-size: 80%;">Independent and Identically Distrubuted (iid)</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs005.html#maximum-likelihood-estimation-mle" style="font-size: 80%;">Maximum Likelihood Estimation (MLE)</a></li>
@@ -270,47 +262,40 @@ MathJax.Hub.Config({
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0013"></a>
<!-- !split -->
<h2 id="lasso-and-bayes" class="anchor">Lasso and Bayes </h2>
<p>
To derive the Lasso cost function, we simply replace the Gaussian prior with an exponential distribution (<a href="https://en.wikipedia.org/wiki/Laplace_distribution" target="_self">Laplace in this case</a>) with zero mean value, that is
<p>To derive the Lasso cost function, we simply replace the Gaussian prior with an exponential distribution (<a href="https://en.wikipedia.org/wiki/Laplace_distribution" target="_self">Laplace in this case</a>) with zero mean value, that is</p>
$$
p(\boldsymbol{\beta})=\prod_{j=0}^{p-1}\exp{\left(-\frac{\vert\beta_j\vert}{\tau}\right)}.
$$
<p>
Our posterior probability becomes then (omitting the normalization factor which is just a constant)
<p>Our posterior probability becomes then (omitting the normalization factor which is just a constant)</p>
$$
p(\boldsymbol{\beta}\vert\boldsymbol{D})=\prod_{i=0}^{n-1}\frac{1}{\sqrt{2\pi\sigma^2}}\exp{\left[-\frac{(y_i-\boldsymbol{X}_{i,*}\boldsymbol{\beta})^2}{2\sigma^2}\right]}\prod_{j=0}^{p-1}\exp{\left(-\frac{\vert\beta_j\vert}{\tau}\right)}.
$$
<p>
Taking the negative
<p>Taking the negative
logarithm of the posterior probability and leaving out the
constants terms that do not depend on \( \beta \), we have
</p>
$$
C(\boldsymbol{\beta}=\frac{\vert\vert (\boldsymbol{y}-\boldsymbol{X}\boldsymbol{\beta})\vert\vert_2^2}{2\sigma^2}+\frac{1}{\tau}\vert\vert\boldsymbol{\beta}\vert\vert_1,
$$
and replacing \( 1/\tau \) with \( \lambda \) we have
<p>and replacing \( 1/\tau \) with \( \lambda \) we have</p>
$$
C(\boldsymbol{\beta}=\frac{\vert\vert (\boldsymbol{y}-\boldsymbol{X}\boldsymbol{\beta})\vert\vert_2^2}{2\sigma^2}+\lambda\vert\vert\boldsymbol{\beta}\vert\vert_1,
$$
which is our Lasso cost function!
<p>which is our Lasso cost function! </p>
<p>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -340,25 +325,18 @@ which is our Lasso cost function!
<li><a href="._week37-bs014.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="https://..."><img width="250" align=right src="https://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright only on the titlepage -->
</center>
</body>
</html>
+9 -31
View File
@@ -1,6 +1,7 @@
<!--
Automatically generated HTML file from DocOnce source
HTML file automatically generated from DocOnce source
(https://github.com/doconce/doconce/)
doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako
-->
<html>
<head>
@@ -8,24 +9,20 @@ Automatically generated HTML file from DocOnce source
<meta name="generator" content="DocOnce: https://github.com/doconce/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Week 37: Summary of Ridge and Lasso Regression and Resampling Methods">
<title>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</title>
<!-- Bootstrap style: bootstrap -->
<!-- doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
@@ -35,18 +32,16 @@ Automatically generated HTML file from DocOnce source
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Plans for week 37', 2, None, 'plans-for-week-37'),
('Thursday September 16, Summary of Ridge and Lasso Regression '
('Thursday September 15, Summary of Ridge and Lasso Regression '
'and start Resampling methods',
2,
None,
'thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
'thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
('Deriving OLS from a probability distribution',
2,
None,
@@ -197,8 +192,6 @@ MathJax.Hub.Config({
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
@@ -209,14 +202,13 @@ MathJax.Hub.Config({
</button>
<a class="navbar-brand" href="week37-bs.html">Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week37-bs001.html#plans-for-week-37" style="font-size: 80%;">Plans for week 37</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs003.html#deriving-ols-from-a-probability-distribution" style="font-size: 80%;">Deriving OLS from a probability distribution</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs004.html#independent-and-identically-distrubuted-iid" style="font-size: 80%;">Independent and Identically Distrubuted (iid)</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs005.html#maximum-likelihood-estimation-mle" style="font-size: 80%;">Maximum Likelihood Estimation (MLE)</a></li>
@@ -270,29 +262,22 @@ MathJax.Hub.Config({
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0014"></a>
<!-- !split -->
<h2 id="why-resampling-methods" class="anchor">Why resampling methods </h2>
<p>
Before we proceed, we need to rethink what we have been doing. In our
<p>Before we proceed, we need to rethink what we have been doing. In our
eager to fit the data, we have omitted several important elements in
our regression analysis. In what follows we will
</p>
<ol>
<li> look at statistical properties, including a discussion of mean values, variance and the so-called bias-variance tradeoff</li>
<li> introduce resampling techniques like cross-validation, bootstrapping and jackknife and more</li>
</ol>
<p>and discuss how to select a given model (one of the difficult parts in machine learning).</p>
and discuss how to select a given model (one of the difficult parts in machine learning).
<p>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -322,25 +307,18 @@ and discuss how to select a given model (one of the difficult parts in machine l
<li><a href="._week37-bs015.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="https://..."><img width="250" align=right src="https://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright only on the titlepage -->
</center>
</body>
</html>
+13 -36
View File
@@ -1,6 +1,7 @@
<!--
Automatically generated HTML file from DocOnce source
HTML file automatically generated from DocOnce source
(https://github.com/doconce/doconce/)
doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako
-->
<html>
<head>
@@ -8,24 +9,20 @@ Automatically generated HTML file from DocOnce source
<meta name="generator" content="DocOnce: https://github.com/doconce/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Week 37: Summary of Ridge and Lasso Regression and Resampling Methods">
<title>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</title>
<!-- Bootstrap style: bootstrap -->
<!-- doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
@@ -35,18 +32,16 @@ Automatically generated HTML file from DocOnce source
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Plans for week 37', 2, None, 'plans-for-week-37'),
('Thursday September 16, Summary of Ridge and Lasso Regression '
('Thursday September 15, Summary of Ridge and Lasso Regression '
'and start Resampling methods',
2,
None,
'thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
'thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
('Deriving OLS from a probability distribution',
2,
None,
@@ -197,8 +192,6 @@ MathJax.Hub.Config({
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
@@ -209,14 +202,13 @@ MathJax.Hub.Config({
</button>
<a class="navbar-brand" href="week37-bs.html">Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week37-bs001.html#plans-for-week-37" style="font-size: 80%;">Plans for week 37</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs003.html#deriving-ols-from-a-probability-distribution" style="font-size: 80%;">Deriving OLS from a probability distribution</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs004.html#independent-and-identically-distrubuted-iid" style="font-size: 80%;">Independent and Identically Distrubuted (iid)</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs005.html#maximum-likelihood-estimation-mle" style="font-size: 80%;">Maximum Likelihood Estimation (MLE)</a></li>
@@ -270,19 +262,15 @@ MathJax.Hub.Config({
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0015"></a>
<!-- !split -->
<h2 id="resampling-methods" class="anchor">Resampling methods </h2>
<div class="panel panel-default">
<div class="panel-body">
<p> <!-- subsequent paragraphs come in larger fonts, so start with a paragraph -->
Resampling methods are an indispensable tool in modern
<!-- subsequent paragraphs come in larger fonts, so start with a paragraph -->
<p>Resampling methods are an indispensable tool in modern
statistics. They involve repeatedly drawing samples from a training
set and refitting a model of interest on each sample in order to
obtain additional information about the fitted model. For example, in
@@ -292,24 +280,20 @@ regression to each new sample, and then examine the extent to which
the resulting fits differ. Such an approach may allow us to obtain
information that would not be available from fitting the model only
once using the original training sample.
</p>
<p>
Two resampling methods are often used in Machine Learning analyses,
<p>Two resampling methods are often used in Machine Learning analyses,</p>
<ol>
<li> The <b>bootstrap method</b></li>
<li> and <b>Cross-Validation</b></li>
</ol>
In addition there are several other methods such as the Jackknife and the Blocking methods. We will discuss in particular
cross-validation and the bootstrap method.
<p>
<p>In addition there are several other methods such as the Jackknife and the Blocking methods. We will discuss in particular
cross-validation and the bootstrap method.
</p>
</div>
</div>
<p>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -339,25 +323,18 @@ cross-validation and the bootstrap method.
<li><a href="._week37-bs016.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="https://..."><img width="250" align=right src="https://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright only on the titlepage -->
</center>
</body>
</html>
+9 -31
View File
@@ -1,6 +1,7 @@
<!--
Automatically generated HTML file from DocOnce source
HTML file automatically generated from DocOnce source
(https://github.com/doconce/doconce/)
doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako
-->
<html>
<head>
@@ -8,24 +9,20 @@ Automatically generated HTML file from DocOnce source
<meta name="generator" content="DocOnce: https://github.com/doconce/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Week 37: Summary of Ridge and Lasso Regression and Resampling Methods">
<title>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</title>
<!-- Bootstrap style: bootstrap -->
<!-- doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
@@ -35,18 +32,16 @@ Automatically generated HTML file from DocOnce source
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Plans for week 37', 2, None, 'plans-for-week-37'),
('Thursday September 16, Summary of Ridge and Lasso Regression '
('Thursday September 15, Summary of Ridge and Lasso Regression '
'and start Resampling methods',
2,
None,
'thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
'thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
('Deriving OLS from a probability distribution',
2,
None,
@@ -197,8 +192,6 @@ MathJax.Hub.Config({
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
@@ -209,14 +202,13 @@ MathJax.Hub.Config({
</button>
<a class="navbar-brand" href="week37-bs.html">Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week37-bs001.html#plans-for-week-37" style="font-size: 80%;">Plans for week 37</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs003.html#deriving-ols-from-a-probability-distribution" style="font-size: 80%;">Deriving OLS from a probability distribution</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs004.html#independent-and-identically-distrubuted-iid" style="font-size: 80%;">Independent and Identically Distrubuted (iid)</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs005.html#maximum-likelihood-estimation-mle" style="font-size: 80%;">Maximum Likelihood Estimation (MLE)</a></li>
@@ -270,21 +262,16 @@ MathJax.Hub.Config({
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0016"></a>
<!-- !split -->
<h2 id="resampling-approaches-can-be-computationally-expensive" class="anchor">Resampling approaches can be computationally expensive </h2>
<div class="panel panel-default">
<div class="panel-body">
<p> <!-- subsequent paragraphs come in larger fonts, so start with a paragraph -->
<!-- subsequent paragraphs come in larger fonts, so start with a paragraph -->
<p>
Resampling approaches can be computationally expensive, because they
<p>Resampling approaches can be computationally expensive, because they
involve fitting the same statistical method multiple times using
different subsets of the training data. However, due to recent
advances in computing power, the computational requirements of
@@ -299,13 +286,11 @@ of flexibility. The process of evaluating a model&#8217;s performance is
known as model assessment, whereas the process of selecting the proper
level of flexibility for a model is known as model selection. The
bootstrap is widely used.
<p>
</p>
</div>
</div>
<p>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -335,25 +320,18 @@ bootstrap is widely used.
<li><a href="._week37-bs017.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="https://..."><img width="250" align=right src="https://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright only on the titlepage -->
</center>
</body>
</html>
+8 -28
View File
@@ -1,6 +1,7 @@
<!--
Automatically generated HTML file from DocOnce source
HTML file automatically generated from DocOnce source
(https://github.com/doconce/doconce/)
doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako
-->
<html>
<head>
@@ -8,24 +9,20 @@ Automatically generated HTML file from DocOnce source
<meta name="generator" content="DocOnce: https://github.com/doconce/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Week 37: Summary of Ridge and Lasso Regression and Resampling Methods">
<title>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</title>
<!-- Bootstrap style: bootstrap -->
<!-- doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
@@ -35,18 +32,16 @@ Automatically generated HTML file from DocOnce source
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Plans for week 37', 2, None, 'plans-for-week-37'),
('Thursday September 16, Summary of Ridge and Lasso Regression '
('Thursday September 15, Summary of Ridge and Lasso Regression '
'and start Resampling methods',
2,
None,
'thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
'thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
('Deriving OLS from a probability distribution',
2,
None,
@@ -197,8 +192,6 @@ MathJax.Hub.Config({
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
@@ -209,14 +202,13 @@ MathJax.Hub.Config({
</button>
<a class="navbar-brand" href="week37-bs.html">Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week37-bs001.html#plans-for-week-37" style="font-size: 80%;">Plans for week 37</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs003.html#deriving-ols-from-a-probability-distribution" style="font-size: 80%;">Deriving OLS from a probability distribution</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs004.html#independent-and-identically-distrubuted-iid" style="font-size: 80%;">Independent and Identically Distrubuted (iid)</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs005.html#maximum-likelihood-estimation-mle" style="font-size: 80%;">Maximum Likelihood Estimation (MLE)</a></li>
@@ -270,18 +262,14 @@ MathJax.Hub.Config({
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0017"></a>
<!-- !split -->
<h2 id="why-resampling-methods" class="anchor">Why resampling methods ? </h2>
<div class="panel panel-default">
<div class="panel-body">
<p> <!-- subsequent paragraphs come in larger fonts, so start with a paragraph -->
<!-- subsequent paragraphs come in larger fonts, so start with a paragraph -->
<ul>
<li> Our simulations can be treated as <em>computer experiments</em>. This is particularly the case for Monte Carlo methods which are widely used in statistical analyses.</li>
@@ -290,9 +278,8 @@ MathJax.Hub.Config({
</ul>
</div>
</div>
<p>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -322,25 +309,18 @@ MathJax.Hub.Config({
<li><a href="._week37-bs018.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="https://..."><img width="250" align=right src="https://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright only on the titlepage -->
</center>
</body>
</html>
+8 -30
View File
@@ -1,6 +1,7 @@
<!--
Automatically generated HTML file from DocOnce source
HTML file automatically generated from DocOnce source
(https://github.com/doconce/doconce/)
doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako
-->
<html>
<head>
@@ -8,24 +9,20 @@ Automatically generated HTML file from DocOnce source
<meta name="generator" content="DocOnce: https://github.com/doconce/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Week 37: Summary of Ridge and Lasso Regression and Resampling Methods">
<title>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</title>
<!-- Bootstrap style: bootstrap -->
<!-- doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
@@ -35,18 +32,16 @@ Automatically generated HTML file from DocOnce source
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Plans for week 37', 2, None, 'plans-for-week-37'),
('Thursday September 16, Summary of Ridge and Lasso Regression '
('Thursday September 15, Summary of Ridge and Lasso Regression '
'and start Resampling methods',
2,
None,
'thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
'thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
('Deriving OLS from a probability distribution',
2,
None,
@@ -197,8 +192,6 @@ MathJax.Hub.Config({
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
@@ -209,14 +202,13 @@ MathJax.Hub.Config({
</button>
<a class="navbar-brand" href="week37-bs.html">Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week37-bs001.html#plans-for-week-37" style="font-size: 80%;">Plans for week 37</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs003.html#deriving-ols-from-a-probability-distribution" style="font-size: 80%;">Deriving OLS from a probability distribution</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs004.html#independent-and-identically-distrubuted-iid" style="font-size: 80%;">Independent and Identically Distrubuted (iid)</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs005.html#maximum-likelihood-estimation-mle" style="font-size: 80%;">Maximum Likelihood Estimation (MLE)</a></li>
@@ -270,35 +262,28 @@ MathJax.Hub.Config({
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0018"></a>
<!-- !split -->
<h2 id="statistical-analysis" class="anchor">Statistical analysis </h2>
<div class="panel panel-default">
<div class="panel-body">
<p> <!-- subsequent paragraphs come in larger fonts, so start with a paragraph -->
<!-- subsequent paragraphs come in larger fonts, so start with a paragraph -->
<ul>
<li> As in other experiments, many numerical experiments have two classes of errors:</li>
<ul>
<li> Statistical errors</li>
<li> Systematical errors</li>
</ul>
<li> Statistical errors can be estimated using standard tools from statistics</li>
<li> Systematical errors are method specific and must be treated differently from case to case.</li>
</ul>
</div>
</div>
<p>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -328,25 +313,18 @@ MathJax.Hub.Config({
<li><a href="._week37-bs019.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="https://..."><img width="250" align=right src="https://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright only on the titlepage -->
</center>
</body>
</html>
+14 -35
View File
@@ -1,6 +1,7 @@
<!--
Automatically generated HTML file from DocOnce source
HTML file automatically generated from DocOnce source
(https://github.com/doconce/doconce/)
doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako
-->
<html>
<head>
@@ -8,24 +9,20 @@ Automatically generated HTML file from DocOnce source
<meta name="generator" content="DocOnce: https://github.com/doconce/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Week 37: Summary of Ridge and Lasso Regression and Resampling Methods">
<title>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</title>
<!-- Bootstrap style: bootstrap -->
<!-- doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
@@ -35,18 +32,16 @@ Automatically generated HTML file from DocOnce source
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Plans for week 37', 2, None, 'plans-for-week-37'),
('Thursday September 16, Summary of Ridge and Lasso Regression '
('Thursday September 15, Summary of Ridge and Lasso Regression '
'and start Resampling methods',
2,
None,
'thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
'thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
('Deriving OLS from a probability distribution',
2,
None,
@@ -197,8 +192,6 @@ MathJax.Hub.Config({
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
@@ -209,14 +202,13 @@ MathJax.Hub.Config({
</button>
<a class="navbar-brand" href="week37-bs.html">Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week37-bs001.html#plans-for-week-37" style="font-size: 80%;">Plans for week 37</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs003.html#deriving-ols-from-a-probability-distribution" style="font-size: 80%;">Deriving OLS from a probability distribution</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs004.html#independent-and-identically-distrubuted-iid" style="font-size: 80%;">Independent and Identically Distrubuted (iid)</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs005.html#maximum-likelihood-estimation-mle" style="font-size: 80%;">Maximum Likelihood Estimation (MLE)</a></li>
@@ -270,41 +262,35 @@ MathJax.Hub.Config({
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0019"></a>
<!-- !split -->
<h2 id="resampling-methods" class="anchor">Resampling methods </h2>
<p>
With all these analytical equations for both the OLS and Ridge
<p>With all these analytical equations for both the OLS and Ridge
regression, we will now outline how to assess a given model. This will
lead to a discussion of the so-called bias-variance tradeoff (see
below) and so-called resampling methods.
</p>
<p>
One of the quantities we have discussed as a way to measure errors is
<p>One of the quantities we have discussed as a way to measure errors is
the mean-squared error (MSE), mainly used for fitting of continuous
functions. Another choice is the absolute error.
</p>
<p>
In the discussions below we will focus on the MSE and in particular since we will split the data into test and training data,
<p>In the discussions below we will focus on the MSE and in particular since we will split the data into test and training data,
we discuss the
</p>
<ol>
<li> prediction error or simply the <b>test error</b> \( \mathrm{Err_{Test}} \), where we have a fixed training set and the test error is the MSE arising from the data reserved for testing. We discuss also the</li>
<li> training error \( \mathrm{Err_{Train}} \), which is the average loss over the training data.</li>
</ol>
As our model becomes more and more complex, more of the training data tends to used. The training may thence adapt to more complicated structures in the data. This may lead to a decrease in the bias (see below for code example) and a slight increase of the variance for the test error.
<p>As our model becomes more and more complex, more of the training data tends to used. The training may thence adapt to more complicated structures in the data. This may lead to a decrease in the bias (see below for code example) and a slight increase of the variance for the test error.
For a certain level of complexity the test error will reach minimum, before starting to increase again. The
training error reaches a saturation.
</p>
<p>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -334,25 +320,18 @@ training error reaches a saturation.
<li><a href="._week37-bs020.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="https://..."><img width="250" align=right src="https://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright only on the titlepage -->
</center>
</body>
</html>
+14 -34
View File
@@ -1,6 +1,7 @@
<!--
Automatically generated HTML file from DocOnce source
HTML file automatically generated from DocOnce source
(https://github.com/doconce/doconce/)
doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako
-->
<html>
<head>
@@ -8,24 +9,20 @@ Automatically generated HTML file from DocOnce source
<meta name="generator" content="DocOnce: https://github.com/doconce/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Week 37: Summary of Ridge and Lasso Regression and Resampling Methods">
<title>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</title>
<!-- Bootstrap style: bootstrap -->
<!-- doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
@@ -35,18 +32,16 @@ Automatically generated HTML file from DocOnce source
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Plans for week 37', 2, None, 'plans-for-week-37'),
('Thursday September 16, Summary of Ridge and Lasso Regression '
('Thursday September 15, Summary of Ridge and Lasso Regression '
'and start Resampling methods',
2,
None,
'thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
'thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
('Deriving OLS from a probability distribution',
2,
None,
@@ -197,8 +192,6 @@ MathJax.Hub.Config({
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
@@ -209,14 +202,13 @@ MathJax.Hub.Config({
</button>
<a class="navbar-brand" href="week37-bs.html">Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week37-bs001.html#plans-for-week-37" style="font-size: 80%;">Plans for week 37</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs003.html#deriving-ols-from-a-probability-distribution" style="font-size: 80%;">Deriving OLS from a probability distribution</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs004.html#independent-and-identically-distrubuted-iid" style="font-size: 80%;">Independent and Identically Distrubuted (iid)</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs005.html#maximum-likelihood-estimation-mle" style="font-size: 80%;">Maximum Likelihood Estimation (MLE)</a></li>
@@ -270,35 +262,30 @@ MathJax.Hub.Config({
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0020"></a>
<!-- !split -->
<h2 id="resampling-methods-jackknife-and-bootstrap" class="anchor">Resampling methods: Jackknife and Bootstrap </h2>
<p>
Two famous
resampling methods are the <b>independent bootstrap</b> and <b>the jackknife</b>.
<p>Two famous
resampling methods are the <b>independent bootstrap</b> and <b>the jackknife</b>.
</p>
<p>
The jackknife is a special case of the independent bootstrap. Still, the jackknife was made
<p>The jackknife is a special case of the independent bootstrap. Still, the jackknife was made
popular prior to the independent bootstrap. And as the popularity of
the independent bootstrap soared, new variants, such as <b>the dependent bootstrap</b> have also been developed..
</p>
<p>
The Jackknife and independent bootstrap work for
<p>The Jackknife and independent bootstrap work for
independent, identically distributed random variables.
If these conditions are not
satisfied, the methods will fail. Yet, it should be said that if the data are
independent, identically distributed, and we only want to estimate the
variance of \( \overline{X} \) (which often is the case), then there is no
need for bootstrapping.
need for bootstrapping.
</p>
<p>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -328,25 +315,18 @@ need for bootstrapping.
<li><a href="._week37-bs021.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="https://..."><img width="250" align=right src="https://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright only on the titlepage -->
</center>
</body>
</html>
+11 -31
View File
@@ -1,6 +1,7 @@
<!--
Automatically generated HTML file from DocOnce source
HTML file automatically generated from DocOnce source
(https://github.com/doconce/doconce/)
doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako
-->
<html>
<head>
@@ -8,24 +9,20 @@ Automatically generated HTML file from DocOnce source
<meta name="generator" content="DocOnce: https://github.com/doconce/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Week 37: Summary of Ridge and Lasso Regression and Resampling Methods">
<title>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</title>
<!-- Bootstrap style: bootstrap -->
<!-- doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
@@ -35,18 +32,16 @@ Automatically generated HTML file from DocOnce source
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Plans for week 37', 2, None, 'plans-for-week-37'),
('Thursday September 16, Summary of Ridge and Lasso Regression '
('Thursday September 15, Summary of Ridge and Lasso Regression '
'and start Resampling methods',
2,
None,
'thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
'thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
('Deriving OLS from a probability distribution',
2,
None,
@@ -197,8 +192,6 @@ MathJax.Hub.Config({
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
@@ -209,14 +202,13 @@ MathJax.Hub.Config({
</button>
<a class="navbar-brand" href="week37-bs.html">Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week37-bs001.html#plans-for-week-37" style="font-size: 80%;">Plans for week 37</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs003.html#deriving-ols-from-a-probability-distribution" style="font-size: 80%;">Deriving OLS from a probability distribution</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs004.html#independent-and-identically-distrubuted-iid" style="font-size: 80%;">Independent and Identically Distrubuted (iid)</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs005.html#maximum-likelihood-estimation-mle" style="font-size: 80%;">Maximum Likelihood Estimation (MLE)</a></li>
@@ -270,31 +262,26 @@ MathJax.Hub.Config({
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0021"></a>
<!-- !split -->
<h2 id="resampling-methods-jackknife" class="anchor">Resampling methods: Jackknife </h2>
<p>
The Jackknife works by making many replicas of the estimator \( \widehat{\beta} \).
<p>The Jackknife works by making many replicas of the estimator \( \widehat{\beta} \).
The jackknife is a resampling method where we systematically leave out one observation from the vector of observed values \( \boldsymbol{x} = (x_1,x_2,\cdots,X_n) \).
Let \( \boldsymbol{x}_i \) denote the vector
</p>
$$
\boldsymbol{x}_i = (x_1,x_2,\cdots,x_{i-1},x_{i+1},\cdots,x_n),
$$
<p>
which equals the vector \( \boldsymbol{x} \) with the exception that observation
<p>which equals the vector \( \boldsymbol{x} \) with the exception that observation
number \( i \) is left out. Using this notation, define
\( \widehat{\beta}_i \) to be the estimator
\( \widehat{\beta} \) computed using \( \vec{X}_i \).
\( \widehat{\beta} \) computed using \( \vec{X}_i \).
</p>
<p>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -324,25 +311,18 @@ number \( i \) is left out. Using this notation, define
<li><a href="._week37-bs022.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="https://..."><img width="250" align=right src="https://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright only on the titlepage -->
</center>
</body>
</html>
+28 -29
View File
@@ -1,6 +1,7 @@
<!--
Automatically generated HTML file from DocOnce source
HTML file automatically generated from DocOnce source
(https://github.com/doconce/doconce/)
doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako
-->
<html>
<head>
@@ -8,24 +9,20 @@ Automatically generated HTML file from DocOnce source
<meta name="generator" content="DocOnce: https://github.com/doconce/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Week 37: Summary of Ridge and Lasso Regression and Resampling Methods">
<title>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</title>
<!-- Bootstrap style: bootstrap -->
<!-- doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
@@ -35,18 +32,16 @@ Automatically generated HTML file from DocOnce source
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Plans for week 37', 2, None, 'plans-for-week-37'),
('Thursday September 16, Summary of Ridge and Lasso Regression '
('Thursday September 15, Summary of Ridge and Lasso Regression '
'and start Resampling methods',
2,
None,
'thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
'thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
('Deriving OLS from a probability distribution',
2,
None,
@@ -197,8 +192,6 @@ MathJax.Hub.Config({
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
@@ -209,14 +202,13 @@ MathJax.Hub.Config({
</button>
<a class="navbar-brand" href="week37-bs.html">Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week37-bs001.html#plans-for-week-37" style="font-size: 80%;">Plans for week 37</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs003.html#deriving-ols-from-a-probability-distribution" style="font-size: 80%;">Deriving OLS from a probability distribution</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs004.html#independent-and-identically-distrubuted-iid" style="font-size: 80%;">Independent and Identically Distrubuted (iid)</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs005.html#maximum-likelihood-estimation-mle" style="font-size: 80%;">Maximum Likelihood Estimation (MLE)</a></li>
@@ -270,19 +262,19 @@ MathJax.Hub.Config({
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0022"></a>
<!-- !split -->
<h2 id="jackknife-code-example" class="anchor">Jackknife code example </h2>
<p>
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%;"><span></span><span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">numpy</span> <span style="color: #008000; font-weight: bold">import</span> <span style="color: #666666">*</span>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="inner_cell">
<div class="input_area">
<div class="highlight" style="background: #f8f8f8">
<pre style="line-height: 125%;"><span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">numpy</span> <span style="color: #008000; font-weight: bold">import</span> <span style="color: #666666">*</span>
<span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">numpy.random</span> <span style="color: #008000; font-weight: bold">import</span> randint, randn
<span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">time</span> <span style="color: #008000; font-weight: bold">import</span> time
@@ -310,8 +302,22 @@ datapoints <span style="color: #666666">=</span> <span style="color: #666666">10
x <span style="color: #666666">=</span> mu <span style="color: #666666">+</span> sigma<span style="color: #666666">*</span>random<span style="color: #666666">.</span>randn(datapoints)
<span style="color: #408080; font-style: italic"># jackknife returns the data sample </span>
t <span style="color: #666666">=</span> jackknife(x, stat)
</pre></div>
<p>
</pre>
</div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="output_subarea output_stream output_stdout output_text">
</div>
</div>
</div>
</div>
</div>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -341,25 +347,18 @@ t <span style="color: #666666">=</span> jackknife(x, stat)
<li><a href="._week37-bs023.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="https://..."><img width="250" align=right src="https://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright only on the titlepage -->
</center>
</body>
</html>
+11 -33
View File
@@ -1,6 +1,7 @@
<!--
Automatically generated HTML file from DocOnce source
HTML file automatically generated from DocOnce source
(https://github.com/doconce/doconce/)
doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako
-->
<html>
<head>
@@ -8,24 +9,20 @@ Automatically generated HTML file from DocOnce source
<meta name="generator" content="DocOnce: https://github.com/doconce/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Week 37: Summary of Ridge and Lasso Regression and Resampling Methods">
<title>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</title>
<!-- Bootstrap style: bootstrap -->
<!-- doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
@@ -35,18 +32,16 @@ Automatically generated HTML file from DocOnce source
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Plans for week 37', 2, None, 'plans-for-week-37'),
('Thursday September 16, Summary of Ridge and Lasso Regression '
('Thursday September 15, Summary of Ridge and Lasso Regression '
'and start Resampling methods',
2,
None,
'thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
'thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
('Deriving OLS from a probability distribution',
2,
None,
@@ -197,8 +192,6 @@ MathJax.Hub.Config({
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
@@ -209,14 +202,13 @@ MathJax.Hub.Config({
</button>
<a class="navbar-brand" href="week37-bs.html">Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week37-bs001.html#plans-for-week-37" style="font-size: 80%;">Plans for week 37</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs003.html#deriving-ols-from-a-probability-distribution" style="font-size: 80%;">Deriving OLS from a probability distribution</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs004.html#independent-and-identically-distrubuted-iid" style="font-size: 80%;">Independent and Identically Distrubuted (iid)</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs005.html#maximum-likelihood-estimation-mle" style="font-size: 80%;">Maximum Likelihood Estimation (MLE)</a></li>
@@ -270,23 +262,19 @@ MathJax.Hub.Config({
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0023"></a>
<!-- !split -->
<h2 id="resampling-methods-bootstrap" class="anchor">Resampling methods: Bootstrap </h2>
<div class="panel panel-default">
<div class="panel-body">
<p> <!-- subsequent paragraphs come in larger fonts, so start with a paragraph -->
Bootstrapping is a non-parametric approach to statistical inference
<!-- subsequent paragraphs come in larger fonts, so start with a paragraph -->
<p>Bootstrapping is a non-parametric approach to statistical inference
that substitutes computation for more traditional distributional
assumptions and asymptotic results. Bootstrapping offers a number of
advantages:
</p>
<ol>
<li> The bootstrap is quite general, although there are some cases in which it fails.</li>
<li> Because it does not require distributional assumptions (such as normally distributed errors), the bootstrap can provide more accurate inferences when the data are not well behaved or when the sample size is small.</li>
@@ -297,13 +285,10 @@ advantages:
</div>
<p>
The textbook by <a href="https://www.cambridge.org/core/books/bootstrap-methods-and-their-application/ED2FD043579F27952363566DC09CBD6A" target="_self">Davison on the Bootstrap Methods and their Applications</a> provides many more insights and proofs. In this course we will take a more practical approach and use the results and theorems provided in the literature. For those interested in reading more about the bootstrap methods, we recommend the above text and the one by <a href="https://www.routledge.com/An-Introduction-to-the-Bootstrap/Efron-Tibshirani/p/book/9780412042317" target="_self">Efron and Tibshirani</a>.
<p>The textbook by <a href="https://www.cambridge.org/core/books/bootstrap-methods-and-their-application/ED2FD043579F27952363566DC09CBD6A" target="_self">Davison on the Bootstrap Methods and their Applications</a> provides many more insights and proofs. In this course we will take a more practical approach and use the results and theorems provided in the literature. For those interested in reading more about the bootstrap methods, we recommend the above text and the one by <a href="https://www.routledge.com/An-Introduction-to-the-Bootstrap/Efron-Tibshirani/p/book/9780412042317" target="_self">Efron and Tibshirani</a>.</p>
<p>
Before we proceed however, we need to remind ourselves about a central theorem in statistics, namely the so-called <b>central limit theorem</b>.
<p>Before we proceed however, we need to remind ourselves about a central theorem in statistics, namely the so-called <b>central limit theorem</b>.</p>
<p>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -333,25 +318,18 @@ Before we proceed however, we need to remind ourselves about a central theorem i
<li><a href="._week37-bs024.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="https://..."><img width="250" align=right src="https://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright only on the titlepage -->
</center>
</body>
</html>
+10 -31
View File
@@ -1,6 +1,7 @@
<!--
Automatically generated HTML file from DocOnce source
HTML file automatically generated from DocOnce source
(https://github.com/doconce/doconce/)
doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako
-->
<html>
<head>
@@ -8,24 +9,20 @@ Automatically generated HTML file from DocOnce source
<meta name="generator" content="DocOnce: https://github.com/doconce/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Week 37: Summary of Ridge and Lasso Regression and Resampling Methods">
<title>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</title>
<!-- Bootstrap style: bootstrap -->
<!-- doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
@@ -35,18 +32,16 @@ Automatically generated HTML file from DocOnce source
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Plans for week 37', 2, None, 'plans-for-week-37'),
('Thursday September 16, Summary of Ridge and Lasso Regression '
('Thursday September 15, Summary of Ridge and Lasso Regression '
'and start Resampling methods',
2,
None,
'thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
'thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
('Deriving OLS from a probability distribution',
2,
None,
@@ -197,8 +192,6 @@ MathJax.Hub.Config({
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
@@ -209,14 +202,13 @@ MathJax.Hub.Config({
</button>
<a class="navbar-brand" href="week37-bs.html">Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week37-bs001.html#plans-for-week-37" style="font-size: 80%;">Plans for week 37</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs003.html#deriving-ols-from-a-probability-distribution" style="font-size: 80%;">Deriving OLS from a probability distribution</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs004.html#independent-and-identically-distrubuted-iid" style="font-size: 80%;">Independent and Identically Distrubuted (iid)</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs005.html#maximum-likelihood-estimation-mle" style="font-size: 80%;">Maximum Likelihood Estimation (MLE)</a></li>
@@ -270,34 +262,28 @@ MathJax.Hub.Config({
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0024"></a>
<!-- !split -->
<h2 id="the-central-limit-theorem" class="anchor">The Central Limit Theorem </h2>
<p>
Suppose we have a PDF \( p(x) \) from which we generate a series \( N \)
<p>Suppose we have a PDF \( p(x) \) from which we generate a series \( N \)
of averages \( \mathbb{E}[x_i] \). Each mean value \( \mathbb{E}[x_i] \)
is viewed as the average of a specific measurement, e.g., throwing
dice 100 times and then taking the average value, or producing a certain
amount of random numbers.
For notational ease, we set \( \mathbb{E}[x_i]=x_i \) in the discussion
which follows. We do the same for \( \mathbb{E}[z]=z \).
</p>
<p>
If we compute the mean \( z \) of \( m \) such mean values \( x_i \)
<p>If we compute the mean \( z \) of \( m \) such mean values \( x_i \) </p>
$$
z=\frac{x_1+x_2+\dots+x_m}{m},
$$
the question we pose is which is the PDF of the new variable \( z \).
<p>the question we pose is which is the PDF of the new variable \( z \).</p>
<p>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -327,25 +313,18 @@ the question we pose is which is the PDF of the new variable \( z \).
<li><a href="._week37-bs025.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="https://..."><img width="250" align=right src="https://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright only on the titlepage -->
</center>
</body>
</html>
+10 -29
View File
@@ -1,6 +1,7 @@
<!--
Automatically generated HTML file from DocOnce source
HTML file automatically generated from DocOnce source
(https://github.com/doconce/doconce/)
doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako
-->
<html>
<head>
@@ -8,24 +9,20 @@ Automatically generated HTML file from DocOnce source
<meta name="generator" content="DocOnce: https://github.com/doconce/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Week 37: Summary of Ridge and Lasso Regression and Resampling Methods">
<title>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</title>
<!-- Bootstrap style: bootstrap -->
<!-- doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
@@ -35,18 +32,16 @@ Automatically generated HTML file from DocOnce source
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Plans for week 37', 2, None, 'plans-for-week-37'),
('Thursday September 16, Summary of Ridge and Lasso Regression '
('Thursday September 15, Summary of Ridge and Lasso Regression '
'and start Resampling methods',
2,
None,
'thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
'thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
('Deriving OLS from a probability distribution',
2,
None,
@@ -197,8 +192,6 @@ MathJax.Hub.Config({
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
@@ -209,14 +202,13 @@ MathJax.Hub.Config({
</button>
<a class="navbar-brand" href="week37-bs.html">Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week37-bs001.html#plans-for-week-37" style="font-size: 80%;">Plans for week 37</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs003.html#deriving-ols-from-a-probability-distribution" style="font-size: 80%;">Deriving OLS from a probability distribution</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs004.html#independent-and-identically-distrubuted-iid" style="font-size: 80%;">Independent and Identically Distrubuted (iid)</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs005.html#maximum-likelihood-estimation-mle" style="font-size: 80%;">Maximum Likelihood Estimation (MLE)</a></li>
@@ -270,32 +262,28 @@ MathJax.Hub.Config({
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0025"></a>
<!-- !split -->
<h2 id="finding-the-limit" class="anchor">Finding the Limit </h2>
<p>
The probability of obtaining an average value \( z \) is the product of the
<p>The probability of obtaining an average value \( z \) is the product of the
probabilities of obtaining arbitrary individual mean values \( x_i \),
but with the constraint that the average is \( z \). We can express this through
the following expression
</p>
$$
\tilde{p}(z)=\int dx_1p(x_1)\int dx_2p(x_2)\dots\int dx_mp(x_m)
\delta(z-\frac{x_1+x_2+\dots+x_m}{m}),
$$
where the \( \delta \)-function enbodies the constraint that the mean is \( z \).
<p>where the \( \delta \)-function enbodies the constraint that the mean is \( z \).
All measurements that lead to each individual \( x_i \) are expected to
be independent, which in turn means that we can express \( \tilde{p} \) as the
product of individual \( p(x_i) \). The independence assumption is important in the derivation of the central limit theorem.
</p>
<p>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -325,25 +313,18 @@ product of individual \( p(x_i) \). The independence assumption is important in
<li><a href="._week37-bs026.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="https://..."><img width="250" align=right src="https://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright only on the titlepage -->
</center>
</body>
</html>
+11 -30
View File
@@ -1,6 +1,7 @@
<!--
Automatically generated HTML file from DocOnce source
HTML file automatically generated from DocOnce source
(https://github.com/doconce/doconce/)
doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako
-->
<html>
<head>
@@ -8,24 +9,20 @@ Automatically generated HTML file from DocOnce source
<meta name="generator" content="DocOnce: https://github.com/doconce/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Week 37: Summary of Ridge and Lasso Regression and Resampling Methods">
<title>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</title>
<!-- Bootstrap style: bootstrap -->
<!-- doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
@@ -35,18 +32,16 @@ Automatically generated HTML file from DocOnce source
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Plans for week 37', 2, None, 'plans-for-week-37'),
('Thursday September 16, Summary of Ridge and Lasso Regression '
('Thursday September 15, Summary of Ridge and Lasso Regression '
'and start Resampling methods',
2,
None,
'thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
'thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
('Deriving OLS from a probability distribution',
2,
None,
@@ -197,8 +192,6 @@ MathJax.Hub.Config({
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
@@ -209,14 +202,13 @@ MathJax.Hub.Config({
</button>
<a class="navbar-brand" href="week37-bs.html">Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week37-bs001.html#plans-for-week-37" style="font-size: 80%;">Plans for week 37</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs003.html#deriving-ols-from-a-probability-distribution" style="font-size: 80%;">Deriving OLS from a probability distribution</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs004.html#independent-and-identically-distrubuted-iid" style="font-size: 80%;">Independent and Identically Distrubuted (iid)</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs005.html#maximum-likelihood-estimation-mle" style="font-size: 80%;">Maximum Likelihood Estimation (MLE)</a></li>
@@ -270,33 +262,29 @@ MathJax.Hub.Config({
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0026"></a>
<!-- !split -->
<h2 id="rewriting-the-delta-function" class="anchor">Rewriting the \( \delta \)-function </h2>
<p>
If we use the integral expression for the \( \delta \)-function
<p>If we use the integral expression for the \( \delta \)-function</p>
$$
\delta(z-\frac{x_1+x_2+\dots+x_m}{m})=\frac{1}{2\pi}\int_{-\infty}^{\infty}
dq\exp{\left(iq(z-\frac{x_1+x_2+\dots+x_m}{m})\right)},
$$
and inserting \( e^{i\mu q-i\mu q} \) where \( \mu \) is the mean value
<p>and inserting \( e^{i\mu q-i\mu q} \) where \( \mu \) is the mean value
we arrive at
</p>
$$
\tilde{p}(z)=\frac{1}{2\pi}\int_{-\infty}^{\infty}
dq\exp{\left(iq(z-\mu)\right)}\left[\int_{-\infty}^{\infty}
dxp(x)\exp{\left(iq(\mu-x)/m\right)}\right]^m,
$$
with the integral over \( x \) resulting in
<p>with the integral over \( x \) resulting in</p>
$$
\int_{-\infty}^{\infty}dxp(x)\exp{\left(iq(\mu-x)/m\right)}=
@@ -304,7 +292,7 @@ $$
\left[1+\frac{iq(\mu-x)}{m}-\frac{q^2(\mu-x)^2}{2m^2}+\dots\right].
$$
<p>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -334,25 +322,18 @@ $$
<li><a href="._week37-bs027.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="https://..."><img width="250" align=right src="https://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright only on the titlepage -->
</center>
</body>
</html>
+13 -32
View File
@@ -1,6 +1,7 @@
<!--
Automatically generated HTML file from DocOnce source
HTML file automatically generated from DocOnce source
(https://github.com/doconce/doconce/)
doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako
-->
<html>
<head>
@@ -8,24 +9,20 @@ Automatically generated HTML file from DocOnce source
<meta name="generator" content="DocOnce: https://github.com/doconce/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Week 37: Summary of Ridge and Lasso Regression and Resampling Methods">
<title>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</title>
<!-- Bootstrap style: bootstrap -->
<!-- doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
@@ -35,18 +32,16 @@ Automatically generated HTML file from DocOnce source
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Plans for week 37', 2, None, 'plans-for-week-37'),
('Thursday September 16, Summary of Ridge and Lasso Regression '
('Thursday September 15, Summary of Ridge and Lasso Regression '
'and start Resampling methods',
2,
None,
'thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
'thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
('Deriving OLS from a probability distribution',
2,
None,
@@ -197,8 +192,6 @@ MathJax.Hub.Config({
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
@@ -209,14 +202,13 @@ MathJax.Hub.Config({
</button>
<a class="navbar-brand" href="week37-bs.html">Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week37-bs001.html#plans-for-week-37" style="font-size: 80%;">Plans for week 37</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs003.html#deriving-ols-from-a-probability-distribution" style="font-size: 80%;">Deriving OLS from a probability distribution</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs004.html#independent-and-identically-distrubuted-iid" style="font-size: 80%;">Independent and Identically Distrubuted (iid)</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs005.html#maximum-likelihood-estimation-mle" style="font-size: 80%;">Maximum Likelihood Estimation (MLE)</a></li>
@@ -270,43 +262,39 @@ MathJax.Hub.Config({
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0027"></a>
<!-- !split -->
<h2 id="identifying-terms" class="anchor">Identifying Terms </h2>
<p>
The second term on the rhs disappears since this is just the mean and
<p>The second term on the rhs disappears since this is just the mean and
employing the definition of \( \sigma^2 \) we have
</p>
$$
\int_{-\infty}^{\infty}dxp(x)e^{\left(iq(\mu-x)/m\right)}=
1-\frac{q^2\sigma^2}{2m^2}+\dots,
$$
resulting in
<p>resulting in </p>
$$
\left[\int_{-\infty}^{\infty}dxp(x)\exp{\left(iq(\mu-x)/m\right)}\right]^m\approx
\left[1-\frac{q^2\sigma^2}{2m^2}+\dots \right]^m,
$$
and in the limit \( m\rightarrow \infty \) we obtain
<p>and in the limit \( m\rightarrow \infty \) we obtain </p>
$$
\tilde{p}(z)=\frac{1}{\sqrt{2\pi}(\sigma/\sqrt{m})}
\exp{\left(-\frac{(z-\mu)^2}{2(\sigma/\sqrt{m})^2}\right)},
$$
which is the normal distribution with variance
<p>which is the normal distribution with variance
\( \sigma^2_m=\sigma^2/m \), where \( \sigma \) is the variance of the PDF \( p(x) \)
and \( \mu \) is also the mean of the PDF \( p(x) \).
and \( \mu \) is also the mean of the PDF \( p(x) \).
</p>
<p>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -336,25 +324,18 @@ and \( \mu \) is also the mean of the PDF \( p(x) \).
<li><a href="._week37-bs028.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="https://..."><img width="250" align=right src="https://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright only on the titlepage -->
</center>
</body>
</html>
+16 -36
View File
@@ -1,6 +1,7 @@
<!--
Automatically generated HTML file from DocOnce source
HTML file automatically generated from DocOnce source
(https://github.com/doconce/doconce/)
doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako
-->
<html>
<head>
@@ -8,24 +9,20 @@ Automatically generated HTML file from DocOnce source
<meta name="generator" content="DocOnce: https://github.com/doconce/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Week 37: Summary of Ridge and Lasso Regression and Resampling Methods">
<title>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</title>
<!-- Bootstrap style: bootstrap -->
<!-- doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
@@ -35,18 +32,16 @@ Automatically generated HTML file from DocOnce source
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Plans for week 37', 2, None, 'plans-for-week-37'),
('Thursday September 16, Summary of Ridge and Lasso Regression '
('Thursday September 15, Summary of Ridge and Lasso Regression '
'and start Resampling methods',
2,
None,
'thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
'thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
('Deriving OLS from a probability distribution',
2,
None,
@@ -197,8 +192,6 @@ MathJax.Hub.Config({
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
@@ -209,14 +202,13 @@ MathJax.Hub.Config({
</button>
<a class="navbar-brand" href="week37-bs.html">Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week37-bs001.html#plans-for-week-37" style="font-size: 80%;">Plans for week 37</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs003.html#deriving-ols-from-a-probability-distribution" style="font-size: 80%;">Deriving OLS from a probability distribution</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs004.html#independent-and-identically-distrubuted-iid" style="font-size: 80%;">Independent and Identically Distrubuted (iid)</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs005.html#maximum-likelihood-estimation-mle" style="font-size: 80%;">Maximum Likelihood Estimation (MLE)</a></li>
@@ -270,56 +262,51 @@ MathJax.Hub.Config({
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0028"></a>
<!-- !split -->
<h2 id="wrapping-it-up" class="anchor">Wrapping it up </h2>
<p>
Thus, the central limit theorem states that the PDF \( \tilde{p}(z) \) of
<p>Thus, the central limit theorem states that the PDF \( \tilde{p}(z) \) of
the average of \( m \) random values corresponding to a PDF \( p(x) \)
is a normal distribution whose mean is the
mean value of the PDF \( p(x) \) and whose variance is the variance
of the PDF \( p(x) \) divided by \( m \), the number of values used to compute \( z \).
</p>
<p>
The central limit theorem leads to the well-known expression for the
<p>The central limit theorem leads to the well-known expression for the
standard deviation, given by
</p>
$$
\sigma_m=
\frac{\sigma}{\sqrt{m}}.
$$
<p>
The latter is true only if the average value is known exactly. This is obtained in the limit
<p>The latter is true only if the average value is known exactly. This is obtained in the limit
\( m\rightarrow \infty \) only. Because the mean and the variance are measured quantities we obtain
the familiar expression in statistics (the so-called Bessel correction)
</p>
$$
\sigma_m\approx
\frac{\sigma}{\sqrt{m-1}}.
$$
<p>
In many cases however the above estimate for the standard deviation,
<p>In many cases however the above estimate for the standard deviation,
in particular if correlations are strong, may be too simplistic. Keep
in mind that we have assumed that the variables \( x \) are independent
and identically distributed. This is obviously not always the
case. For example, the random numbers (or better pseudorandom numbers)
we generate in various calculations do always exhibit some
correlations.
</p>
<p>
The theorem is satisfied by a large class of PDFs. Note however that for a
<p>The theorem is satisfied by a large class of PDFs. Note however that for a
finite \( m \), it is not always possible to find a closed form /analytic expression for
\( \tilde{p}(x) \).
</p>
<p>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -349,25 +336,18 @@ finite \( m \), it is not always possible to find a closed form /analytic expres
<li><a href="._week37-bs029.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="https://..."><img width="250" align=right src="https://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright only on the titlepage -->
</center>
</body>
</html>
+14 -34
View File
@@ -1,6 +1,7 @@
<!--
Automatically generated HTML file from DocOnce source
HTML file automatically generated from DocOnce source
(https://github.com/doconce/doconce/)
doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako
-->
<html>
<head>
@@ -8,24 +9,20 @@ Automatically generated HTML file from DocOnce source
<meta name="generator" content="DocOnce: https://github.com/doconce/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Week 37: Summary of Ridge and Lasso Regression and Resampling Methods">
<title>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</title>
<!-- Bootstrap style: bootstrap -->
<!-- doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
@@ -35,18 +32,16 @@ Automatically generated HTML file from DocOnce source
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Plans for week 37', 2, None, 'plans-for-week-37'),
('Thursday September 16, Summary of Ridge and Lasso Regression '
('Thursday September 15, Summary of Ridge and Lasso Regression '
'and start Resampling methods',
2,
None,
'thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
'thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
('Deriving OLS from a probability distribution',
2,
None,
@@ -197,8 +192,6 @@ MathJax.Hub.Config({
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
@@ -209,14 +202,13 @@ MathJax.Hub.Config({
</button>
<a class="navbar-brand" href="week37-bs.html">Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week37-bs001.html#plans-for-week-37" style="font-size: 80%;">Plans for week 37</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs003.html#deriving-ols-from-a-probability-distribution" style="font-size: 80%;">Deriving OLS from a probability distribution</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs004.html#independent-and-identically-distrubuted-iid" style="font-size: 80%;">Independent and Identically Distrubuted (iid)</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs005.html#maximum-likelihood-estimation-mle" style="font-size: 80%;">Maximum Likelihood Estimation (MLE)</a></li>
@@ -270,34 +262,29 @@ MathJax.Hub.Config({
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0029"></a>
<!-- !split -->
<h2 id="confidence-intervals" class="anchor">Confidence Intervals </h2>
<p>
Confidence intervals are used in statistics and represent a type of estimate
<p>Confidence intervals are used in statistics and represent a type of estimate
computed from the observed data. This gives a range of values for an
unknown parameter such as the parameters \( \boldsymbol{\beta} \) from linear regression.
</p>
<p>
With the OLS expressions for the parameters \( \boldsymbol{\beta} \) we found
<p>With the OLS expressions for the parameters \( \boldsymbol{\beta} \) we found
\( \mathbb{E}(\boldsymbol{\beta}) = \boldsymbol{\beta} \), which means that the estimator of the regression parameters is unbiased.
</p>
<p>
We found also that the variance of the estimate of the \( j \)-th regression coefficient is
<p>We found also that the variance of the estimate of the \( j \)-th regression coefficient is
\( \boldsymbol{\sigma}^2 (\boldsymbol{\beta}_j ) = \boldsymbol{\sigma}^2 [(\mathbf{X}^{T} \mathbf{X})^{-1}]_{jj} \).
</p>
<p>
This quantity will be used to
<p>This quantity will be used to
construct a confidence interval for the estimates.
</p>
<p>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -327,25 +314,18 @@ construct a confidence interval for the estimates.
<li><a href="._week37-bs030.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="https://..."><img width="250" align=right src="https://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright only on the titlepage -->
</center>
</body>
</html>
+14 -35
View File
@@ -1,6 +1,7 @@
<!--
Automatically generated HTML file from DocOnce source
HTML file automatically generated from DocOnce source
(https://github.com/doconce/doconce/)
doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako
-->
<html>
<head>
@@ -8,24 +9,20 @@ Automatically generated HTML file from DocOnce source
<meta name="generator" content="DocOnce: https://github.com/doconce/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Week 37: Summary of Ridge and Lasso Regression and Resampling Methods">
<title>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</title>
<!-- Bootstrap style: bootstrap -->
<!-- doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
@@ -35,18 +32,16 @@ Automatically generated HTML file from DocOnce source
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Plans for week 37', 2, None, 'plans-for-week-37'),
('Thursday September 16, Summary of Ridge and Lasso Regression '
('Thursday September 15, Summary of Ridge and Lasso Regression '
'and start Resampling methods',
2,
None,
'thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
'thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
('Deriving OLS from a probability distribution',
2,
None,
@@ -197,8 +192,6 @@ MathJax.Hub.Config({
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
@@ -209,14 +202,13 @@ MathJax.Hub.Config({
</button>
<a class="navbar-brand" href="week37-bs.html">Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week37-bs001.html#plans-for-week-37" style="font-size: 80%;">Plans for week 37</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs003.html#deriving-ols-from-a-probability-distribution" style="font-size: 80%;">Deriving OLS from a probability distribution</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs004.html#independent-and-identically-distrubuted-iid" style="font-size: 80%;">Independent and Identically Distrubuted (iid)</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs005.html#maximum-likelihood-estimation-mle" style="font-size: 80%;">Maximum Likelihood Estimation (MLE)</a></li>
@@ -270,42 +262,36 @@ MathJax.Hub.Config({
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0030"></a>
<!-- !split -->
<h2 id="standard-approach-based-on-the-normal-distribution" class="anchor">Standard Approach based on the Normal Distribution </h2>
<p>
We will assume that the parameters \( \beta \) follow a normal
<p>We will assume that the parameters \( \beta \) follow a normal
distribution. We can then define the confidence interval. Here we will be using as
shorthands \( \mu_{\beta} \) for the above mean value and \( \sigma_{\beta} \)
for the standard deviation. We have then a confidence interval
</p>
$$
\left(\mu_{\beta}\pm \frac{z\sigma_{\beta}}{\sqrt{n}}\right),
$$
<p>
where \( z \) defines the level of certainty (or confidence). For a normal
<p>where \( z \) defines the level of certainty (or confidence). For a normal
distribution typical parameters are \( z=2.576 \) which corresponds to a
confidence of \( 99\% \) while \( z=1.96 \) corresponds to a confidence of
\( 95\% \). A confidence level of \( 95\% \) is commonly used and it is
normally referred to as a <em>two-sigmas</em> confidence level, that is we
approximate \( z\approx 2 \).
</p>
<p>
For more discussions of confidence intervals (and in particular linked with a discussion of the bootstrap method), see chapter 5 of the textbook by <a href="https://www.cambridge.org/core/books/bootstrap-methods-and-their-application/ED2FD043579F27952363566DC09CBD6A" target="_self">Davison on the Bootstrap Methods and their Applications</a>
<p>For more discussions of confidence intervals (and in particular linked with a discussion of the bootstrap method), see chapter 5 of the textbook by <a href="https://www.cambridge.org/core/books/bootstrap-methods-and-their-application/ED2FD043579F27952363566DC09CBD6A" target="_self">Davison on the Bootstrap Methods and their Applications</a></p>
<p>
In this text you will also find an in-depth discussion of the
Bootstrap method, why it works and various theorems related to it.
<p>In this text you will also find an in-depth discussion of the
Bootstrap method, why it works and various theorems related to it.
</p>
<p>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -335,25 +321,18 @@ Bootstrap method, why it works and various theorems related to it.
<li><a href="._week37-bs031.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="https://..."><img width="250" align=right src="https://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright only on the titlepage -->
</center>
</body>
</html>
+9 -29
View File
@@ -1,6 +1,7 @@
<!--
Automatically generated HTML file from DocOnce source
HTML file automatically generated from DocOnce source
(https://github.com/doconce/doconce/)
doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako
-->
<html>
<head>
@@ -8,24 +9,20 @@ Automatically generated HTML file from DocOnce source
<meta name="generator" content="DocOnce: https://github.com/doconce/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Week 37: Summary of Ridge and Lasso Regression and Resampling Methods">
<title>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</title>
<!-- Bootstrap style: bootstrap -->
<!-- doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
@@ -35,18 +32,16 @@ Automatically generated HTML file from DocOnce source
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Plans for week 37', 2, None, 'plans-for-week-37'),
('Thursday September 16, Summary of Ridge and Lasso Regression '
('Thursday September 15, Summary of Ridge and Lasso Regression '
'and start Resampling methods',
2,
None,
'thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
'thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
('Deriving OLS from a probability distribution',
2,
None,
@@ -197,8 +192,6 @@ MathJax.Hub.Config({
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
@@ -209,14 +202,13 @@ MathJax.Hub.Config({
</button>
<a class="navbar-brand" href="week37-bs.html">Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week37-bs001.html#plans-for-week-37" style="font-size: 80%;">Plans for week 37</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs003.html#deriving-ols-from-a-probability-distribution" style="font-size: 80%;">Deriving OLS from a probability distribution</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs004.html#independent-and-identically-distrubuted-iid" style="font-size: 80%;">Independent and Identically Distrubuted (iid)</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs005.html#maximum-likelihood-estimation-mle" style="font-size: 80%;">Maximum Likelihood Estimation (MLE)</a></li>
@@ -270,18 +262,13 @@ MathJax.Hub.Config({
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0031"></a>
<!-- !split -->
<h2 id="resampling-methods-bootstrap-background" class="anchor">Resampling methods: Bootstrap background </h2>
<p>
Since \( \widehat{\beta} = \widehat{\beta}(\boldsymbol{X}) \) is a function of random variables,
<p>Since \( \widehat{\beta} = \widehat{\beta}(\boldsymbol{X}) \) is a function of random variables,
\( \widehat{\beta} \) itself must be a random variable. Thus it has
a pdf, call this function \( p(\boldsymbol{t}) \). The aim of the bootstrap is to
estimate \( p(\boldsymbol{t}) \) by the relative frequency of
@@ -289,9 +276,9 @@ estimate \( p(\boldsymbol{t}) \) by the relative frequency of
in the place of \( p(\boldsymbol{t}) \). If the relative frequency closely
resembles \( p(\vec{t}) \), then using numerics, it is straight forward to
estimate all the interesting parameters of \( p(\boldsymbol{t}) \) using point
estimators.
estimators.
</p>
<p>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -321,25 +308,18 @@ estimators.
<li><a href="._week37-bs032.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="https://..."><img width="250" align=right src="https://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright only on the titlepage -->
</center>
</body>
</html>
+10 -31
View File
@@ -1,6 +1,7 @@
<!--
Automatically generated HTML file from DocOnce source
HTML file automatically generated from DocOnce source
(https://github.com/doconce/doconce/)
doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako
-->
<html>
<head>
@@ -8,24 +9,20 @@ Automatically generated HTML file from DocOnce source
<meta name="generator" content="DocOnce: https://github.com/doconce/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Week 37: Summary of Ridge and Lasso Regression and Resampling Methods">
<title>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</title>
<!-- Bootstrap style: bootstrap -->
<!-- doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
@@ -35,18 +32,16 @@ Automatically generated HTML file from DocOnce source
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Plans for week 37', 2, None, 'plans-for-week-37'),
('Thursday September 16, Summary of Ridge and Lasso Regression '
('Thursday September 15, Summary of Ridge and Lasso Regression '
'and start Resampling methods',
2,
None,
'thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
'thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
('Deriving OLS from a probability distribution',
2,
None,
@@ -197,8 +192,6 @@ MathJax.Hub.Config({
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
@@ -209,14 +202,13 @@ MathJax.Hub.Config({
</button>
<a class="navbar-brand" href="week37-bs.html">Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week37-bs001.html#plans-for-week-37" style="font-size: 80%;">Plans for week 37</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs003.html#deriving-ols-from-a-probability-distribution" style="font-size: 80%;">Deriving OLS from a probability distribution</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs004.html#independent-and-identically-distrubuted-iid" style="font-size: 80%;">Independent and Identically Distrubuted (iid)</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs005.html#maximum-likelihood-estimation-mle" style="font-size: 80%;">Maximum Likelihood Estimation (MLE)</a></li>
@@ -270,34 +262,28 @@ MathJax.Hub.Config({
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0032"></a>
<!-- !split -->
<h2 id="resampling-methods-more-bootstrap-background" class="anchor">Resampling methods: More Bootstrap background </h2>
<p>
In the case that \( \widehat{\beta} \) has
<p>In the case that \( \widehat{\beta} \) has
more than one component, and the components are independent, we use the
same estimator on each component separately. If the probability
density function of \( X_i \), \( p(x) \), had been known, then it would have
been straightforward to do this by:
</p>
<ol>
<li> Drawing lots of numbers from \( p(x) \), suppose we call one such set of numbers \( (X_1^*, X_2^*, \cdots, X_n^*) \).</li>
<li> Then using these numbers, we could compute a replica of \( \widehat{\beta} \) called \( \widehat{\beta}^* \).</li>
</ol>
By repeated use of the above two points, many
<p>By repeated use of the above two points, many
estimates of \( \widehat{\beta} \) can be obtained. The
idea is to use the relative frequency of \( \widehat{\beta}^* \)
(think of a histogram) as an estimate of \( p(\boldsymbol{t}) \).
</p>
<p>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -327,25 +313,18 @@ idea is to use the relative frequency of \( \widehat{\beta}^* \)
<li><a href="._week37-bs033.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="https://..."><img width="250" align=right src="https://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright only on the titlepage -->
</center>
</body>
</html>
+10 -30
View File
@@ -1,6 +1,7 @@
<!--
Automatically generated HTML file from DocOnce source
HTML file automatically generated from DocOnce source
(https://github.com/doconce/doconce/)
doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako
-->
<html>
<head>
@@ -8,24 +9,20 @@ Automatically generated HTML file from DocOnce source
<meta name="generator" content="DocOnce: https://github.com/doconce/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Week 37: Summary of Ridge and Lasso Regression and Resampling Methods">
<title>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</title>
<!-- Bootstrap style: bootstrap -->
<!-- doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
@@ -35,18 +32,16 @@ Automatically generated HTML file from DocOnce source
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Plans for week 37', 2, None, 'plans-for-week-37'),
('Thursday September 16, Summary of Ridge and Lasso Regression '
('Thursday September 15, Summary of Ridge and Lasso Regression '
'and start Resampling methods',
2,
None,
'thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
'thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
('Deriving OLS from a probability distribution',
2,
None,
@@ -197,8 +192,6 @@ MathJax.Hub.Config({
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
@@ -209,14 +202,13 @@ MathJax.Hub.Config({
</button>
<a class="navbar-brand" href="week37-bs.html">Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week37-bs001.html#plans-for-week-37" style="font-size: 80%;">Plans for week 37</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs003.html#deriving-ols-from-a-probability-distribution" style="font-size: 80%;">Deriving OLS from a probability distribution</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs004.html#independent-and-identically-distrubuted-iid" style="font-size: 80%;">Independent and Identically Distrubuted (iid)</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs005.html#maximum-likelihood-estimation-mle" style="font-size: 80%;">Maximum Likelihood Estimation (MLE)</a></li>
@@ -270,30 +262,25 @@ MathJax.Hub.Config({
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0033"></a>
<!-- !split -->
<h2 id="resampling-methods-bootstrap-approach" class="anchor">Resampling methods: Bootstrap approach </h2>
<p>
But
<p>But
unless there is enough information available about the process that
generated \( X_1,X_2,\cdots,X_n \), \( p(x) \) is in general
unknown. Therefore, <a href="https://projecteuclid.org/euclid.aos/1176344552" target="_self">Efron in 1979</a> asked the
question: What if we replace \( p(x) \) by the relative frequency
of the observation \( X_i \)?
</p>
<p>
If we draw observations in accordance with
<p>If we draw observations in accordance with
the relative frequency of the observations, will we obtain the same
result in some asymptotic sense? The answer is yes.
</p>
<p>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -323,25 +310,18 @@ result in some asymptotic sense? The answer is yes.
<li><a href="._week37-bs034.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="https://..."><img width="250" align=right src="https://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright only on the titlepage -->
</center>
</body>
</html>
+9 -30
View File
@@ -1,6 +1,7 @@
<!--
Automatically generated HTML file from DocOnce source
HTML file automatically generated from DocOnce source
(https://github.com/doconce/doconce/)
doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako
-->
<html>
<head>
@@ -8,24 +9,20 @@ Automatically generated HTML file from DocOnce source
<meta name="generator" content="DocOnce: https://github.com/doconce/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Week 37: Summary of Ridge and Lasso Regression and Resampling Methods">
<title>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</title>
<!-- Bootstrap style: bootstrap -->
<!-- doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
@@ -35,18 +32,16 @@ Automatically generated HTML file from DocOnce source
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Plans for week 37', 2, None, 'plans-for-week-37'),
('Thursday September 16, Summary of Ridge and Lasso Regression '
('Thursday September 15, Summary of Ridge and Lasso Regression '
'and start Resampling methods',
2,
None,
'thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
'thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
('Deriving OLS from a probability distribution',
2,
None,
@@ -197,8 +192,6 @@ MathJax.Hub.Config({
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
@@ -209,14 +202,13 @@ MathJax.Hub.Config({
</button>
<a class="navbar-brand" href="week37-bs.html">Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week37-bs001.html#plans-for-week-37" style="font-size: 80%;">Plans for week 37</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs003.html#deriving-ols-from-a-probability-distribution" style="font-size: 80%;">Deriving OLS from a probability distribution</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs004.html#independent-and-identically-distrubuted-iid" style="font-size: 80%;">Independent and Identically Distrubuted (iid)</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs005.html#maximum-likelihood-estimation-mle" style="font-size: 80%;">Maximum Likelihood Estimation (MLE)</a></li>
@@ -270,18 +262,13 @@ MathJax.Hub.Config({
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0034"></a>
<!-- !split -->
<h2 id="resampling-methods-bootstrap-steps" class="anchor">Resampling methods: Bootstrap steps </h2>
<p>
The independent bootstrap works like this:
<p>The independent bootstrap works like this: </p>
<ol>
<li> Draw with replacement \( n \) numbers for the observed variables \( \boldsymbol{x} = (x_1,x_2,\cdots,x_n) \).</li>
@@ -289,8 +276,7 @@ The independent bootstrap works like this:
<li> Using the vector \( \boldsymbol{x}^* \) compute \( \widehat{\beta}^* \) by evaluating \( \widehat \beta \) under the observations \( \boldsymbol{x}^* \).</li>
<li> Repeat this process \( k \) times.</li>
</ol>
When you are done, you can draw a histogram of the relative frequency
<p>When you are done, you can draw a histogram of the relative frequency
of \( \widehat \beta^* \). This is your estimate of the probability
distribution \( p(t) \). Using this probability distribution you can
estimate any statistics thereof. In principle you never draw the
@@ -299,8 +285,8 @@ you use the estimators corresponding to the statistic of interest. For
example, if you are interested in estimating the variance of \( \widehat
\beta \), apply the etsimator \( \widehat \sigma^2 \) to the values
\( \widehat \beta^* \).
</p>
<p>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -330,25 +316,18 @@ example, if you are interested in estimating the variance of \( \widehat
<li><a href="._week37-bs035.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="https://..."><img width="250" align=right src="https://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright only on the titlepage -->
</center>
</body>
</html>
+30 -33
View File
@@ -1,6 +1,7 @@
<!--
Automatically generated HTML file from DocOnce source
HTML file automatically generated from DocOnce source
(https://github.com/doconce/doconce/)
doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako
-->
<html>
<head>
@@ -8,24 +9,20 @@ Automatically generated HTML file from DocOnce source
<meta name="generator" content="DocOnce: https://github.com/doconce/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Week 37: Summary of Ridge and Lasso Regression and Resampling Methods">
<title>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</title>
<!-- Bootstrap style: bootstrap -->
<!-- doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
@@ -35,18 +32,16 @@ Automatically generated HTML file from DocOnce source
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Plans for week 37', 2, None, 'plans-for-week-37'),
('Thursday September 16, Summary of Ridge and Lasso Regression '
('Thursday September 15, Summary of Ridge and Lasso Regression '
'and start Resampling methods',
2,
None,
'thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
'thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
('Deriving OLS from a probability distribution',
2,
None,
@@ -197,8 +192,6 @@ MathJax.Hub.Config({
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
@@ -209,14 +202,13 @@ MathJax.Hub.Config({
</button>
<a class="navbar-brand" href="week37-bs.html">Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week37-bs001.html#plans-for-week-37" style="font-size: 80%;">Plans for week 37</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs003.html#deriving-ols-from-a-probability-distribution" style="font-size: 80%;">Deriving OLS from a probability distribution</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs004.html#independent-and-identically-distrubuted-iid" style="font-size: 80%;">Independent and Identically Distrubuted (iid)</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs005.html#maximum-likelihood-estimation-mle" style="font-size: 80%;">Maximum Likelihood Estimation (MLE)</a></li>
@@ -270,18 +262,13 @@ MathJax.Hub.Config({
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0035"></a>
<!-- !split -->
<h2 id="code-example-for-the-bootstrap-method" class="anchor">Code example for the Bootstrap method </h2>
<p>
The following code starts with a Gaussian distribution with mean value
<p>The following code starts with a Gaussian distribution with mean value
\( \mu =100 \) and variance \( \sigma=15 \). We use this to generate the data
used in the bootstrap analysis. The bootstrap analysis returns a data
set after a given number of bootstrap operations (as many as we have
@@ -293,11 +280,16 @@ centered around the mean value \( \mu=100 \) but with standard deviation
this case the same as the number of original data points). The value
of the standard deviation is what we expect from the central limit
theorem.
</p>
<p>
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%;"><span></span><span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">numpy</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">np</span>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="inner_cell">
<div class="input_area">
<div class="highlight" style="background: #f8f8f8">
<pre style="line-height: 125%;"><span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">numpy</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">np</span>
<span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">time</span> <span style="color: #008000; font-weight: bold">import</span> time
<span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">scipy.stats</span> <span style="color: #008000; font-weight: bold">import</span> norm
<span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">matplotlib.pyplot</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">plt</span>
@@ -323,11 +315,23 @@ datapoints <span style="color: #666666">=</span> <span style="color: #666666">10
x <span style="color: #666666">=</span> mu <span style="color: #666666">+</span> sigma<span style="color: #666666">*</span>np<span style="color: #666666">.</span>random<span style="color: #666666">.</span>randn(datapoints)
<span style="color: #408080; font-style: italic"># bootstrap returns the data sample </span>
t <span style="color: #666666">=</span> bootstrap(x, datapoints)
</pre></div>
<p>
We see that our new variance and from that the standard deviation, agrees with the central limit theorem.
</pre>
</div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="output_subarea output_stream output_stdout output_text">
</div>
</div>
</div>
</div>
</div>
<p>We see that our new variance and from that the standard deviation, agrees with the central limit theorem.</p>
<p>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -357,25 +361,18 @@ We see that our new variance and from that the standard deviation, agrees with t
<li><a href="._week37-bs036.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="https://..."><img width="250" align=right src="https://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright only on the titlepage -->
</center>
</body>
</html>
+28 -29
View File
@@ -1,6 +1,7 @@
<!--
Automatically generated HTML file from DocOnce source
HTML file automatically generated from DocOnce source
(https://github.com/doconce/doconce/)
doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako
-->
<html>
<head>
@@ -8,24 +9,20 @@ Automatically generated HTML file from DocOnce source
<meta name="generator" content="DocOnce: https://github.com/doconce/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Week 37: Summary of Ridge and Lasso Regression and Resampling Methods">
<title>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</title>
<!-- Bootstrap style: bootstrap -->
<!-- doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
@@ -35,18 +32,16 @@ Automatically generated HTML file from DocOnce source
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Plans for week 37', 2, None, 'plans-for-week-37'),
('Thursday September 16, Summary of Ridge and Lasso Regression '
('Thursday September 15, Summary of Ridge and Lasso Regression '
'and start Resampling methods',
2,
None,
'thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
'thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
('Deriving OLS from a probability distribution',
2,
None,
@@ -197,8 +192,6 @@ MathJax.Hub.Config({
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
@@ -209,14 +202,13 @@ MathJax.Hub.Config({
</button>
<a class="navbar-brand" href="week37-bs.html">Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week37-bs001.html#plans-for-week-37" style="font-size: 80%;">Plans for week 37</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs003.html#deriving-ols-from-a-probability-distribution" style="font-size: 80%;">Deriving OLS from a probability distribution</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs004.html#independent-and-identically-distrubuted-iid" style="font-size: 80%;">Independent and Identically Distrubuted (iid)</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs005.html#maximum-likelihood-estimation-mle" style="font-size: 80%;">Maximum Likelihood Estimation (MLE)</a></li>
@@ -270,19 +262,19 @@ MathJax.Hub.Config({
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0036"></a>
<!-- !split -->
<h2 id="plotting-the-histogram" class="anchor">Plotting the Histogram </h2>
<p>
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%;"><span></span><span style="color: #408080; font-style: italic"># the histogram of the bootstrapped data (normalized data if density = True)</span>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="inner_cell">
<div class="input_area">
<div class="highlight" style="background: #f8f8f8">
<pre style="line-height: 125%;"><span style="color: #408080; font-style: italic"># the histogram of the bootstrapped data (normalized data if density = True)</span>
n, binsboot, patches <span style="color: #666666">=</span> plt<span style="color: #666666">.</span>hist(t, <span style="color: #666666">50</span>, density<span style="color: #666666">=</span><span style="color: #008000; font-weight: bold">True</span>, facecolor<span style="color: #666666">=</span><span style="color: #BA2121">&#39;red&#39;</span>, alpha<span style="color: #666666">=0.75</span>)
<span style="color: #408080; font-style: italic"># add a &#39;best fit&#39; line </span>
y <span style="color: #666666">=</span> norm<span style="color: #666666">.</span>pdf(binsboot, np<span style="color: #666666">.</span>mean(t), np<span style="color: #666666">.</span>std(t))
@@ -291,8 +283,22 @@ plt<span style="color: #666666">.</span>xlabel(<span style="color: #BA2121">&#39
plt<span style="color: #666666">.</span>ylabel(<span style="color: #BA2121">&#39;Probability&#39;</span>)
plt<span style="color: #666666">.</span>grid(<span style="color: #008000; font-weight: bold">True</span>)
plt<span style="color: #666666">.</span>show()
</pre></div>
<p>
</pre>
</div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="output_subarea output_stream output_stdout output_text">
</div>
</div>
</div>
</div>
</div>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -322,25 +328,18 @@ plt<span style="color: #666666">.</span>show()
<li><a href="._week37-bs037.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="https://..."><img width="250" align=right src="https://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright only on the titlepage -->
</center>
</body>
</html>
+23 -47
View File
@@ -1,6 +1,7 @@
<!--
Automatically generated HTML file from DocOnce source
HTML file automatically generated from DocOnce source
(https://github.com/doconce/doconce/)
doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako
-->
<html>
<head>
@@ -8,24 +9,20 @@ Automatically generated HTML file from DocOnce source
<meta name="generator" content="DocOnce: https://github.com/doconce/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Week 37: Summary of Ridge and Lasso Regression and Resampling Methods">
<title>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</title>
<!-- Bootstrap style: bootstrap -->
<!-- doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
@@ -35,18 +32,16 @@ Automatically generated HTML file from DocOnce source
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Plans for week 37', 2, None, 'plans-for-week-37'),
('Thursday September 16, Summary of Ridge and Lasso Regression '
('Thursday September 15, Summary of Ridge and Lasso Regression '
'and start Resampling methods',
2,
None,
'thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
'thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
('Deriving OLS from a probability distribution',
2,
None,
@@ -197,8 +192,6 @@ MathJax.Hub.Config({
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
@@ -209,14 +202,13 @@ MathJax.Hub.Config({
</button>
<a class="navbar-brand" href="week37-bs.html">Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week37-bs001.html#plans-for-week-37" style="font-size: 80%;">Plans for week 37</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs003.html#deriving-ols-from-a-probability-distribution" style="font-size: 80%;">Deriving OLS from a probability distribution</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs004.html#independent-and-identically-distrubuted-iid" style="font-size: 80%;">Independent and Identically Distrubuted (iid)</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs005.html#maximum-likelihood-estimation-mle" style="font-size: 80%;">Maximum Likelihood Estimation (MLE)</a></li>
@@ -270,78 +262,69 @@ MathJax.Hub.Config({
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0037"></a>
<!-- !split -->
<h2 id="the-bias-variance-tradeoff" class="anchor">The bias-variance tradeoff </h2>
<p>
We will discuss the bias-variance tradeoff in the context of
<p>We will discuss the bias-variance tradeoff in the context of
continuous predictions such as regression. However, many of the
intuitions and ideas discussed here also carry over to classification
tasks. Consider a dataset \( \mathcal{D} \) consisting of the data
\( \mathbf{X}_\mathcal{D}=\{(y_j, \boldsymbol{x}_j), j=0\ldots n-1\} \).
\( \mathbf{X}_\mathcal{D}=\{(y_j, \boldsymbol{x}_j), j=0\ldots n-1\} \).
</p>
<p>
Let us assume that the true data is generated from a noisy model
<p>Let us assume that the true data is generated from a noisy model</p>
$$
\boldsymbol{y}=f(\boldsymbol{x}) + \boldsymbol{\epsilon}
$$
<p>
where \( \epsilon \) is normally distributed with mean zero and standard deviation \( \sigma^2 \).
<p>where \( \epsilon \) is normally distributed with mean zero and standard deviation \( \sigma^2 \).</p>
<p>
In our derivation of the ordinary least squares method we defined then
<p>In our derivation of the ordinary least squares method we defined then
an approximation to the function \( f \) in terms of the parameters
\( \boldsymbol{\beta} \) and the design matrix \( \boldsymbol{X} \) which embody our model,
that is \( \boldsymbol{\tilde{y}}=\boldsymbol{X}\boldsymbol{\beta} \).
that is \( \boldsymbol{\tilde{y}}=\boldsymbol{X}\boldsymbol{\beta} \).
</p>
<p>
Thereafter we found the parameters \( \boldsymbol{\beta} \) by optimizing the means squared error via the so-called cost function
<p>Thereafter we found the parameters \( \boldsymbol{\beta} \) by optimizing the means squared error via the so-called cost function</p>
$$
C(\boldsymbol{X},\boldsymbol{\beta}) =\frac{1}{n}\sum_{i=0}^{n-1}(y_i-\tilde{y}_i)^2=\mathbb{E}\left[(\boldsymbol{y}-\boldsymbol{\tilde{y}})^2\right].
$$
<p>
We can rewrite this as
<p>We can rewrite this as </p>
$$
\mathbb{E}\left[(\boldsymbol{y}-\boldsymbol{\tilde{y}})^2\right]=\frac{1}{n}\sum_i(f_i-\mathbb{E}\left[\boldsymbol{\tilde{y}}\right])^2+\frac{1}{n}\sum_i(\tilde{y}_i-\mathbb{E}\left[\boldsymbol{\tilde{y}}\right])^2+\sigma^2.
$$
<p>
The three terms represent the square of the bias of the learning
<p>The three terms represent the square of the bias of the learning
method, which can be thought of as the error caused by the simplifying
assumptions built into the method. The second term represents the
variance of the chosen model and finally the last terms is variance of
the error \( \boldsymbol{\epsilon} \).
</p>
<p>
To derive this equation, we need to recall that the variance of \( \boldsymbol{y} \) and \( \boldsymbol{\epsilon} \) are both equal to \( \sigma^2 \). The mean value of \( \boldsymbol{\epsilon} \) is by definition equal to zero. Furthermore, the function \( f \) is not a stochastics variable, idem for \( \boldsymbol{\tilde{y}} \).
<p>To derive this equation, we need to recall that the variance of \( \boldsymbol{y} \) and \( \boldsymbol{\epsilon} \) are both equal to \( \sigma^2 \). The mean value of \( \boldsymbol{\epsilon} \) is by definition equal to zero. Furthermore, the function \( f \) is not a stochastics variable, idem for \( \boldsymbol{\tilde{y}} \).
We use a more compact notation in terms of the expectation value
</p>
$$
\mathbb{E}\left[(\boldsymbol{y}-\boldsymbol{\tilde{y}})^2\right]=\mathbb{E}\left[(\boldsymbol{f}+\boldsymbol{\epsilon}-\boldsymbol{\tilde{y}})^2\right],
$$
and adding and subtracting \( \mathbb{E}\left[\boldsymbol{\tilde{y}}\right] \) we get
<p>and adding and subtracting \( \mathbb{E}\left[\boldsymbol{\tilde{y}}\right] \) we get</p>
$$
\mathbb{E}\left[(\boldsymbol{y}-\boldsymbol{\tilde{y}})^2\right]=\mathbb{E}\left[(\boldsymbol{f}+\boldsymbol{\epsilon}-\boldsymbol{\tilde{y}}+\mathbb{E}\left[\boldsymbol{\tilde{y}}\right]-\mathbb{E}\left[\boldsymbol{\tilde{y}}\right])^2\right],
$$
which, using the abovementioned expectation values can be rewritten as
<p>which, using the abovementioned expectation values can be rewritten as </p>
$$
\mathbb{E}\left[(\boldsymbol{y}-\boldsymbol{\tilde{y}})^2\right]=\mathbb{E}\left[(\boldsymbol{y}-\mathbb{E}\left[\boldsymbol{\tilde{y}}\right])^2\right]+\mathrm{Var}\left[\boldsymbol{\tilde{y}}\right]+\sigma^2,
$$
that is the rewriting in terms of the so-called bias, the variance of the model \( \boldsymbol{\tilde{y}} \) and the variance of \( \boldsymbol{\epsilon} \).
<p>that is the rewriting in terms of the so-called bias, the variance of the model \( \boldsymbol{\tilde{y}} \) and the variance of \( \boldsymbol{\epsilon} \).</p>
<p>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -371,25 +354,18 @@ that is the rewriting in terms of the so-called bias, the variance of the model
<li><a href="._week37-bs038.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="https://..."><img width="250" align=right src="https://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright only on the titlepage -->
</center>
</body>
</html>
+11 -28
View File
@@ -1,6 +1,7 @@
<!--
Automatically generated HTML file from DocOnce source
HTML file automatically generated from DocOnce source
(https://github.com/doconce/doconce/)
doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako
-->
<html>
<head>
@@ -8,24 +9,20 @@ Automatically generated HTML file from DocOnce source
<meta name="generator" content="DocOnce: https://github.com/doconce/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Week 37: Summary of Ridge and Lasso Regression and Resampling Methods">
<title>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</title>
<!-- Bootstrap style: bootstrap -->
<!-- doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
@@ -35,18 +32,16 @@ Automatically generated HTML file from DocOnce source
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Plans for week 37', 2, None, 'plans-for-week-37'),
('Thursday September 16, Summary of Ridge and Lasso Regression '
('Thursday September 15, Summary of Ridge and Lasso Regression '
'and start Resampling methods',
2,
None,
'thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
'thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
('Deriving OLS from a probability distribution',
2,
None,
@@ -197,8 +192,6 @@ MathJax.Hub.Config({
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
@@ -209,14 +202,13 @@ MathJax.Hub.Config({
</button>
<a class="navbar-brand" href="week37-bs.html">Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week37-bs001.html#plans-for-week-37" style="font-size: 80%;">Plans for week 37</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs003.html#deriving-ols-from-a-probability-distribution" style="font-size: 80%;">Deriving OLS from a probability distribution</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs004.html#independent-and-identically-distrubuted-iid" style="font-size: 80%;">Independent and Identically Distrubuted (iid)</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs005.html#maximum-likelihood-estimation-mle" style="font-size: 80%;">Maximum Likelihood Estimation (MLE)</a></li>
@@ -270,20 +262,18 @@ MathJax.Hub.Config({
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0038"></a>
<!-- !split -->
<h2 id="a-way-to-read-the-bias-variance-tradeoff" class="anchor">A way to Read the Bias-Variance Tradeoff </h2>
<p>
<br /><br /><center><p><img src="figures/BiasVariance.png" align="bottom" width=600></p></center><br /><br />
<br/><br/>
<center>
<p><img src="figures/BiasVariance.png" width="600" align="bottom"></p>
</center>
<br/><br/>
<p>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -313,25 +303,18 @@ MathJax.Hub.Config({
<li><a href="._week37-bs039.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="https://..."><img width="250" align=right src="https://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright only on the titlepage -->
</center>
</body>
</html>
+28 -29
View File
@@ -1,6 +1,7 @@
<!--
Automatically generated HTML file from DocOnce source
HTML file automatically generated from DocOnce source
(https://github.com/doconce/doconce/)
doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako
-->
<html>
<head>
@@ -8,24 +9,20 @@ Automatically generated HTML file from DocOnce source
<meta name="generator" content="DocOnce: https://github.com/doconce/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Week 37: Summary of Ridge and Lasso Regression and Resampling Methods">
<title>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</title>
<!-- Bootstrap style: bootstrap -->
<!-- doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
@@ -35,18 +32,16 @@ Automatically generated HTML file from DocOnce source
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Plans for week 37', 2, None, 'plans-for-week-37'),
('Thursday September 16, Summary of Ridge and Lasso Regression '
('Thursday September 15, Summary of Ridge and Lasso Regression '
'and start Resampling methods',
2,
None,
'thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
'thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
('Deriving OLS from a probability distribution',
2,
None,
@@ -197,8 +192,6 @@ MathJax.Hub.Config({
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
@@ -209,14 +202,13 @@ MathJax.Hub.Config({
</button>
<a class="navbar-brand" href="week37-bs.html">Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week37-bs001.html#plans-for-week-37" style="font-size: 80%;">Plans for week 37</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs003.html#deriving-ols-from-a-probability-distribution" style="font-size: 80%;">Deriving OLS from a probability distribution</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs004.html#independent-and-identically-distrubuted-iid" style="font-size: 80%;">Independent and Identically Distrubuted (iid)</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs005.html#maximum-likelihood-estimation-mle" style="font-size: 80%;">Maximum Likelihood Estimation (MLE)</a></li>
@@ -270,19 +262,19 @@ MathJax.Hub.Config({
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0039"></a>
<!-- !split -->
<h2 id="example-code-for-bias-variance-tradeoff" class="anchor">Example code for Bias-Variance tradeoff </h2>
<p>
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%;"><span></span><span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">matplotlib.pyplot</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">plt</span>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="inner_cell">
<div class="input_area">
<div class="highlight" style="background: #f8f8f8">
<pre style="line-height: 125%;"><span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">matplotlib.pyplot</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">plt</span>
<span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">numpy</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">np</span>
<span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">sklearn.linear_model</span> <span style="color: #008000; font-weight: bold">import</span> LinearRegression, Ridge, Lasso
<span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">sklearn.preprocessing</span> <span style="color: #008000; font-weight: bold">import</span> PolynomialFeatures
@@ -336,8 +328,22 @@ plt<span style="color: #666666">.</span>scatter(x_test, y_test, label<span style
plt<span style="color: #666666">.</span>scatter(x_test, np<span style="color: #666666">.</span>mean(y_pred, axis<span style="color: #666666">=1</span>), label<span style="color: #666666">=</span><span style="color: #BA2121">&#39;Pred&#39;</span>)
plt<span style="color: #666666">.</span>legend()
plt<span style="color: #666666">.</span>show()
</pre></div>
<p>
</pre>
</div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="output_subarea output_stream output_stdout output_text">
</div>
</div>
</div>
</div>
</div>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -365,25 +371,18 @@ plt<span style="color: #666666">.</span>show()
<li><a href="._week37-bs040.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="https://..."><img width="250" align=right src="https://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright only on the titlepage -->
</center>
</body>
</html>
+28 -29
View File
@@ -1,6 +1,7 @@
<!--
Automatically generated HTML file from DocOnce source
HTML file automatically generated from DocOnce source
(https://github.com/doconce/doconce/)
doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako
-->
<html>
<head>
@@ -8,24 +9,20 @@ Automatically generated HTML file from DocOnce source
<meta name="generator" content="DocOnce: https://github.com/doconce/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Week 37: Summary of Ridge and Lasso Regression and Resampling Methods">
<title>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</title>
<!-- Bootstrap style: bootstrap -->
<!-- doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
@@ -35,18 +32,16 @@ Automatically generated HTML file from DocOnce source
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Plans for week 37', 2, None, 'plans-for-week-37'),
('Thursday September 16, Summary of Ridge and Lasso Regression '
('Thursday September 15, Summary of Ridge and Lasso Regression '
'and start Resampling methods',
2,
None,
'thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
'thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
('Deriving OLS from a probability distribution',
2,
None,
@@ -197,8 +192,6 @@ MathJax.Hub.Config({
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
@@ -209,14 +202,13 @@ MathJax.Hub.Config({
</button>
<a class="navbar-brand" href="week37-bs.html">Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week37-bs001.html#plans-for-week-37" style="font-size: 80%;">Plans for week 37</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs003.html#deriving-ols-from-a-probability-distribution" style="font-size: 80%;">Deriving OLS from a probability distribution</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs004.html#independent-and-identically-distrubuted-iid" style="font-size: 80%;">Independent and Identically Distrubuted (iid)</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs005.html#maximum-likelihood-estimation-mle" style="font-size: 80%;">Maximum Likelihood Estimation (MLE)</a></li>
@@ -270,19 +262,19 @@ MathJax.Hub.Config({
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0040"></a>
<!-- !split -->
<h2 id="understanding-what-happens" class="anchor">Understanding what happens </h2>
<p>
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%;"><span></span><span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">matplotlib.pyplot</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">plt</span>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="inner_cell">
<div class="input_area">
<div class="highlight" style="background: #f8f8f8">
<pre style="line-height: 125%;"><span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">matplotlib.pyplot</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">plt</span>
<span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">numpy</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">np</span>
<span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">sklearn.linear_model</span> <span style="color: #008000; font-weight: bold">import</span> LinearRegression, Ridge, Lasso
<span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">sklearn.preprocessing</span> <span style="color: #008000; font-weight: bold">import</span> PolynomialFeatures
@@ -328,8 +320,22 @@ plt<span style="color: #666666">.</span>plot(polydegree, bias, label<span style=
plt<span style="color: #666666">.</span>plot(polydegree, variance, label<span style="color: #666666">=</span><span style="color: #BA2121">&#39;Variance&#39;</span>)
plt<span style="color: #666666">.</span>legend()
plt<span style="color: #666666">.</span>show()
</pre></div>
<p>
</pre>
</div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="output_subarea output_stream output_stdout output_text">
</div>
</div>
</div>
</div>
</div>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -356,25 +362,18 @@ plt<span style="color: #666666">.</span>show()
<li><a href="._week37-bs041.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="https://..."><img width="250" align=right src="https://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright only on the titlepage -->
</center>
</body>
</html>
+14 -35
View File
@@ -1,6 +1,7 @@
<!--
Automatically generated HTML file from DocOnce source
HTML file automatically generated from DocOnce source
(https://github.com/doconce/doconce/)
doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako
-->
<html>
<head>
@@ -8,24 +9,20 @@ Automatically generated HTML file from DocOnce source
<meta name="generator" content="DocOnce: https://github.com/doconce/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Week 37: Summary of Ridge and Lasso Regression and Resampling Methods">
<title>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</title>
<!-- Bootstrap style: bootstrap -->
<!-- doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
@@ -35,18 +32,16 @@ Automatically generated HTML file from DocOnce source
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Plans for week 37', 2, None, 'plans-for-week-37'),
('Thursday September 16, Summary of Ridge and Lasso Regression '
('Thursday September 15, Summary of Ridge and Lasso Regression '
'and start Resampling methods',
2,
None,
'thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
'thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
('Deriving OLS from a probability distribution',
2,
None,
@@ -197,8 +192,6 @@ MathJax.Hub.Config({
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
@@ -209,14 +202,13 @@ MathJax.Hub.Config({
</button>
<a class="navbar-brand" href="week37-bs.html">Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week37-bs001.html#plans-for-week-37" style="font-size: 80%;">Plans for week 37</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs003.html#deriving-ols-from-a-probability-distribution" style="font-size: 80%;">Deriving OLS from a probability distribution</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs004.html#independent-and-identically-distrubuted-iid" style="font-size: 80%;">Independent and Identically Distrubuted (iid)</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs005.html#maximum-likelihood-estimation-mle" style="font-size: 80%;">Maximum Likelihood Estimation (MLE)</a></li>
@@ -270,36 +262,31 @@ MathJax.Hub.Config({
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0041"></a>
<!-- !split -->
<h2 id="summing-up" class="anchor">Summing up </h2>
<p>
The bias-variance tradeoff summarizes the fundamental tension in
<p>The bias-variance tradeoff summarizes the fundamental tension in
machine learning, particularly supervised learning, between the
complexity of a model and the amount of training data needed to train
it. Since data is often limited, in practice it is often useful to
use a less-complex model with higher bias, that is a model whose asymptotic
performance is worse than another model because it is easier to
train and less sensitive to sampling noise arising from having a
finite-sized training dataset (smaller variance).
finite-sized training dataset (smaller variance).
</p>
<p>
The above equations tell us that in
<p>The above equations tell us that in
order to minimize the expected test error, we need to select a
statistical learning method that simultaneously achieves low variance
and low bias. Note that variance is inherently a nonnegative quantity,
and squared bias is also nonnegative. Hence, we see that the expected
test MSE can never lie below \( Var(\epsilon) \), the irreducible error.
</p>
<p>
What do we mean by the variance and bias of a statistical learning
<p>What do we mean by the variance and bias of a statistical learning
method? The variance refers to the amount by which our model would change if we
estimated it using a different training data set. Since the training
data are used to fit the statistical learning method, different
@@ -308,11 +295,10 @@ estimate for our model should not vary too much between training
sets. However, if a method has high variance then small changes in
the training data can result in large changes in the model. In general, more
flexible statistical methods have higher variance.
</p>
<p>
You may also find this recent <a href="https://www.pnas.org/content/116/32/15849" target="_self">article</a> of interest.
<p>You may also find this recent <a href="https://www.pnas.org/content/116/32/15849" target="_self">article</a> of interest.</p>
<p>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -338,25 +324,18 @@ You may also find this recent <a href="https://www.pnas.org/content/116/32/15849
<li><a href="._week37-bs042.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="https://..."><img width="250" align=right src="https://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright only on the titlepage -->
</center>
</body>
</html>
+28 -29
View File
@@ -1,6 +1,7 @@
<!--
Automatically generated HTML file from DocOnce source
HTML file automatically generated from DocOnce source
(https://github.com/doconce/doconce/)
doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako
-->
<html>
<head>
@@ -8,24 +9,20 @@ Automatically generated HTML file from DocOnce source
<meta name="generator" content="DocOnce: https://github.com/doconce/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Week 37: Summary of Ridge and Lasso Regression and Resampling Methods">
<title>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</title>
<!-- Bootstrap style: bootstrap -->
<!-- doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
@@ -35,18 +32,16 @@ Automatically generated HTML file from DocOnce source
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Plans for week 37', 2, None, 'plans-for-week-37'),
('Thursday September 16, Summary of Ridge and Lasso Regression '
('Thursday September 15, Summary of Ridge and Lasso Regression '
'and start Resampling methods',
2,
None,
'thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
'thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
('Deriving OLS from a probability distribution',
2,
None,
@@ -197,8 +192,6 @@ MathJax.Hub.Config({
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
@@ -209,14 +202,13 @@ MathJax.Hub.Config({
</button>
<a class="navbar-brand" href="week37-bs.html">Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week37-bs001.html#plans-for-week-37" style="font-size: 80%;">Plans for week 37</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs003.html#deriving-ols-from-a-probability-distribution" style="font-size: 80%;">Deriving OLS from a probability distribution</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs004.html#independent-and-identically-distrubuted-iid" style="font-size: 80%;">Independent and Identically Distrubuted (iid)</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs005.html#maximum-likelihood-estimation-mle" style="font-size: 80%;">Maximum Likelihood Estimation (MLE)</a></li>
@@ -270,19 +262,19 @@ MathJax.Hub.Config({
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0042"></a>
<!-- !split -->
<h2 id="another-example-from-scikit-learn-s-repository" class="anchor">Another Example from Scikit-Learn's Repository </h2>
<p>
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%;"><span></span><span style="color: #BA2121; font-style: italic">&quot;&quot;&quot;</span>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="inner_cell">
<div class="input_area">
<div class="highlight" style="background: #f8f8f8">
<pre style="line-height: 125%;"><span style="color: #BA2121; font-style: italic">&quot;&quot;&quot;</span>
<span style="color: #BA2121; font-style: italic">============================</span>
<span style="color: #BA2121; font-style: italic">Underfitting vs. Overfitting</span>
<span style="color: #BA2121; font-style: italic">============================</span>
@@ -353,8 +345,22 @@ plt<span style="color: #666666">.</span>figure(figsize<span style="color: #66666
plt<span style="color: #666666">.</span>title(<span style="color: #BA2121">&quot;Degree </span><span style="color: #BB6688; font-weight: bold">{}</span><span style="color: #BB6622; font-weight: bold">\n</span><span style="color: #BA2121">MSE = </span><span style="color: #BB6688; font-weight: bold">{:.2e}</span><span style="color: #BA2121">(+/- </span><span style="color: #BB6688; font-weight: bold">{:.2e}</span><span style="color: #BA2121">)&quot;</span><span style="color: #666666">.</span>format(
degrees[i], <span style="color: #666666">-</span>scores<span style="color: #666666">.</span>mean(), scores<span style="color: #666666">.</span>std()))
plt<span style="color: #666666">.</span>show()
</pre></div>
<p>
</pre>
</div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="output_subarea output_stream output_stdout output_text">
</div>
</div>
</div>
</div>
</div>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -379,25 +385,18 @@ plt<span style="color: #666666">.</span>show()
<li><a href="._week37-bs043.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="https://..."><img width="250" align=right src="https://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright only on the titlepage -->
</center>
</body>
</html>
+9 -29
View File
@@ -1,6 +1,7 @@
<!--
Automatically generated HTML file from DocOnce source
HTML file automatically generated from DocOnce source
(https://github.com/doconce/doconce/)
doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako
-->
<html>
<head>
@@ -8,24 +9,20 @@ Automatically generated HTML file from DocOnce source
<meta name="generator" content="DocOnce: https://github.com/doconce/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Week 37: Summary of Ridge and Lasso Regression and Resampling Methods">
<title>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</title>
<!-- Bootstrap style: bootstrap -->
<!-- doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
@@ -35,18 +32,16 @@ Automatically generated HTML file from DocOnce source
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Plans for week 37', 2, None, 'plans-for-week-37'),
('Thursday September 16, Summary of Ridge and Lasso Regression '
('Thursday September 15, Summary of Ridge and Lasso Regression '
'and start Resampling methods',
2,
None,
'thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
'thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
('Deriving OLS from a probability distribution',
2,
None,
@@ -197,8 +192,6 @@ MathJax.Hub.Config({
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
@@ -209,14 +202,13 @@ MathJax.Hub.Config({
</button>
<a class="navbar-brand" href="week37-bs.html">Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week37-bs001.html#plans-for-week-37" style="font-size: 80%;">Plans for week 37</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs003.html#deriving-ols-from-a-probability-distribution" style="font-size: 80%;">Deriving OLS from a probability distribution</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs004.html#independent-and-identically-distrubuted-iid" style="font-size: 80%;">Independent and Identically Distrubuted (iid)</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs005.html#maximum-likelihood-estimation-mle" style="font-size: 80%;">Maximum Likelihood Estimation (MLE)</a></li>
@@ -270,18 +262,13 @@ MathJax.Hub.Config({
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0043"></a>
<!-- !split -->
<h2 id="various-steps-in-cross-validation" class="anchor">Various steps in cross-validation </h2>
<p>
When the repetitive splitting of the data set is done randomly,
<p>When the repetitive splitting of the data set is done randomly,
samples may accidently end up in a fast majority of the splits in
either training or test set. Such samples may have an unbalanced
influence on either model building or prediction evaluation. To avoid
@@ -294,9 +281,9 @@ warrants a balanced representation of each sample in both training and
test set over the splits. Still the division into the \( k \) subsets
involves a degree of randomness. This may be fully excluded when
choosing \( k=n \). This particular case is referred to as leave-one-out
cross-validation (LOOCV).
cross-validation (LOOCV).
</p>
<p>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -320,25 +307,18 @@ cross-validation (LOOCV).
<li><a href="._week37-bs044.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="https://..."><img width="250" align=right src="https://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright only on the titlepage -->
</center>
</body>
</html>
+7 -28
View File
@@ -1,6 +1,7 @@
<!--
Automatically generated HTML file from DocOnce source
HTML file automatically generated from DocOnce source
(https://github.com/doconce/doconce/)
doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako
-->
<html>
<head>
@@ -8,24 +9,20 @@ Automatically generated HTML file from DocOnce source
<meta name="generator" content="DocOnce: https://github.com/doconce/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Week 37: Summary of Ridge and Lasso Regression and Resampling Methods">
<title>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</title>
<!-- Bootstrap style: bootstrap -->
<!-- doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
@@ -35,18 +32,16 @@ Automatically generated HTML file from DocOnce source
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Plans for week 37', 2, None, 'plans-for-week-37'),
('Thursday September 16, Summary of Ridge and Lasso Regression '
('Thursday September 15, Summary of Ridge and Lasso Regression '
'and start Resampling methods',
2,
None,
'thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
'thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
('Deriving OLS from a probability distribution',
2,
None,
@@ -197,8 +192,6 @@ MathJax.Hub.Config({
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
@@ -209,14 +202,13 @@ MathJax.Hub.Config({
</button>
<a class="navbar-brand" href="week37-bs.html">Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week37-bs001.html#plans-for-week-37" style="font-size: 80%;">Plans for week 37</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs003.html#deriving-ols-from-a-probability-distribution" style="font-size: 80%;">Deriving OLS from a probability distribution</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs004.html#independent-and-identically-distrubuted-iid" style="font-size: 80%;">Independent and Identically Distrubuted (iid)</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs005.html#maximum-likelihood-estimation-mle" style="font-size: 80%;">Maximum Likelihood Estimation (MLE)</a></li>
@@ -270,14 +262,10 @@ MathJax.Hub.Config({
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0044"></a>
<!-- !split -->
<h2 id="how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" class="anchor">How to set up the cross-validation for Ridge and/or Lasso </h2>
<ul>
@@ -285,7 +273,6 @@ MathJax.Hub.Config({
<li> Divide the data set into training and test set comprising samples \( \{1, \ldots, n\} \setminus i \) and \( \{ i \} \), respectively.</li>
<li> Fit the linear regression model by means of ridge estimation for each \( \lambda \) in the grid using the training set, and the corresponding estimate of the error variance \( \boldsymbol{\sigma}_{-i}^2(\lambda) \), as</li>
</ul>
$$
\begin{align*}
\boldsymbol{\beta}_{-i}(\lambda) & = ( \boldsymbol{X}_{-i, \ast}^{T}
@@ -300,14 +287,13 @@ $$
<li> Repeat the first three steps such that each sample plays the role of the test set once.</li>
<li> Average the prediction performances of the test sets at each grid point of the penalty bias/parameter. It is an estimate of the prediction performance of the model corresponding to this value of the penalty parameter on novel data. It is defined as</li>
</ul>
$$
\begin{align*}
\frac{1}{n} \sum_{i = 1}^n \log\{L[y_i, \mathbf{X}_{i, \ast}; \boldsymbol{\beta}_{-i}(\lambda), \boldsymbol{\sigma}_{-i}^2(\lambda)]\}.
\end{align*}
$$
<p>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -330,25 +316,18 @@ $$
<li><a href="._week37-bs045.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="https://..."><img width="250" align=right src="https://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright only on the titlepage -->
</center>
</body>
</html>
+7 -30
View File
@@ -1,6 +1,7 @@
<!--
Automatically generated HTML file from DocOnce source
HTML file automatically generated from DocOnce source
(https://github.com/doconce/doconce/)
doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako
-->
<html>
<head>
@@ -8,24 +9,20 @@ Automatically generated HTML file from DocOnce source
<meta name="generator" content="DocOnce: https://github.com/doconce/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Week 37: Summary of Ridge and Lasso Regression and Resampling Methods">
<title>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</title>
<!-- Bootstrap style: bootstrap -->
<!-- doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
@@ -35,18 +32,16 @@ Automatically generated HTML file from DocOnce source
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Plans for week 37', 2, None, 'plans-for-week-37'),
('Thursday September 16, Summary of Ridge and Lasso Regression '
('Thursday September 15, Summary of Ridge and Lasso Regression '
'and start Resampling methods',
2,
None,
'thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
'thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
('Deriving OLS from a probability distribution',
2,
None,
@@ -197,8 +192,6 @@ MathJax.Hub.Config({
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
@@ -209,14 +202,13 @@ MathJax.Hub.Config({
</button>
<a class="navbar-brand" href="week37-bs.html">Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week37-bs001.html#plans-for-week-37" style="font-size: 80%;">Plans for week 37</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs003.html#deriving-ols-from-a-probability-distribution" style="font-size: 80%;">Deriving OLS from a probability distribution</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs004.html#independent-and-identically-distrubuted-iid" style="font-size: 80%;">Independent and Identically Distrubuted (iid)</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs005.html#maximum-likelihood-estimation-mle" style="font-size: 80%;">Maximum Likelihood Estimation (MLE)</a></li>
@@ -270,34 +262,26 @@ MathJax.Hub.Config({
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0045"></a>
<!-- !split -->
<h2 id="cross-validation-in-brief" class="anchor">Cross-validation in brief </h2>
<p>
For the various values of \( k \)
<p>For the various values of \( k \)</p>
<ol>
<li> shuffle the dataset randomly.</li>
<li> Split the dataset into \( k \) groups.</li>
<li> For each unique group:
<ol type="a"></li>
<li> Decide which group to use as set for test data</li>
<li> Take the remaining groups as a training data set</li>
<li> Fit a model on the training set and evaluate it on the test set</li>
<li> Retain the evaluation score and discard the model</li>
</ol>
<li> Summarize the model using the sample of model evaluation scores</li>
</ol>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -319,25 +303,18 @@ For the various values of \( k \)
<li><a href="._week37-bs046.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="https://..."><img width="250" align=right src="https://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright only on the titlepage -->
</center>
</body>
</html>
+29 -31
View File
@@ -1,6 +1,7 @@
<!--
Automatically generated HTML file from DocOnce source
HTML file automatically generated from DocOnce source
(https://github.com/doconce/doconce/)
doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako
-->
<html>
<head>
@@ -8,24 +9,20 @@ Automatically generated HTML file from DocOnce source
<meta name="generator" content="DocOnce: https://github.com/doconce/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Week 37: Summary of Ridge and Lasso Regression and Resampling Methods">
<title>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</title>
<!-- Bootstrap style: bootstrap -->
<!-- doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
@@ -35,18 +32,16 @@ Automatically generated HTML file from DocOnce source
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Plans for week 37', 2, None, 'plans-for-week-37'),
('Thursday September 16, Summary of Ridge and Lasso Regression '
('Thursday September 15, Summary of Ridge and Lasso Regression '
'and start Resampling methods',
2,
None,
'thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
'thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
('Deriving OLS from a probability distribution',
2,
None,
@@ -197,8 +192,6 @@ MathJax.Hub.Config({
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
@@ -209,14 +202,13 @@ MathJax.Hub.Config({
</button>
<a class="navbar-brand" href="week37-bs.html">Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week37-bs001.html#plans-for-week-37" style="font-size: 80%;">Plans for week 37</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs003.html#deriving-ols-from-a-probability-distribution" style="font-size: 80%;">Deriving OLS from a probability distribution</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs004.html#independent-and-identically-distrubuted-iid" style="font-size: 80%;">Independent and Identically Distrubuted (iid)</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs005.html#maximum-likelihood-estimation-mle" style="font-size: 80%;">Maximum Likelihood Estimation (MLE)</a></li>
@@ -270,22 +262,21 @@ MathJax.Hub.Config({
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0046"></a>
<!-- !split -->
<h2 id="code-example-for-cross-validation-and-k-fold-cross-validation" class="anchor">Code Example for Cross-validation and \( k \)-fold Cross-validation </h2>
<p>
The code here uses Ridge regression with cross-validation (CV) resampling and \( k \)-fold CV in order to fit a specific polynomial.
<p>
<p>The code here uses Ridge regression with cross-validation (CV) resampling and \( k \)-fold CV in order to fit a specific polynomial. </p>
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%;"><span></span><span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">numpy</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">np</span>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="inner_cell">
<div class="input_area">
<div class="highlight" style="background: #f8f8f8">
<pre style="line-height: 125%;"><span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">numpy</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">np</span>
<span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">matplotlib.pyplot</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">plt</span>
<span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">sklearn.model_selection</span> <span style="color: #008000; font-weight: bold">import</span> KFold
<span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">sklearn.linear_model</span> <span style="color: #008000; font-weight: bold">import</span> Ridge
@@ -374,8 +365,22 @@ plt<span style="color: #666666">.</span>ylabel(<span style="color: #BA2121">&#39
plt<span style="color: #666666">.</span>legend()
plt<span style="color: #666666">.</span>show()
</pre></div>
<p>
</pre>
</div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="output_subarea output_stream output_stdout output_text">
</div>
</div>
</div>
</div>
</div>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -396,25 +401,18 @@ plt<span style="color: #666666">.</span>show()
<li><a href="._week37-bs047.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="https://..."><img width="250" align=right src="https://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright only on the titlepage -->
</center>
</body>
</html>
+28 -31
View File
@@ -1,6 +1,7 @@
<!--
Automatically generated HTML file from DocOnce source
HTML file automatically generated from DocOnce source
(https://github.com/doconce/doconce/)
doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako
-->
<html>
<head>
@@ -8,24 +9,20 @@ Automatically generated HTML file from DocOnce source
<meta name="generator" content="DocOnce: https://github.com/doconce/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Week 37: Summary of Ridge and Lasso Regression and Resampling Methods">
<title>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</title>
<!-- Bootstrap style: bootstrap -->
<!-- doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
@@ -35,18 +32,16 @@ Automatically generated HTML file from DocOnce source
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Plans for week 37', 2, None, 'plans-for-week-37'),
('Thursday September 16, Summary of Ridge and Lasso Regression '
('Thursday September 15, Summary of Ridge and Lasso Regression '
'and start Resampling methods',
2,
None,
'thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
'thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
('Deriving OLS from a probability distribution',
2,
None,
@@ -197,8 +192,6 @@ MathJax.Hub.Config({
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
@@ -209,14 +202,13 @@ MathJax.Hub.Config({
</button>
<a class="navbar-brand" href="week37-bs.html">Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week37-bs001.html#plans-for-week-37" style="font-size: 80%;">Plans for week 37</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs003.html#deriving-ols-from-a-probability-distribution" style="font-size: 80%;">Deriving OLS from a probability distribution</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs004.html#independent-and-identically-distrubuted-iid" style="font-size: 80%;">Independent and Identically Distrubuted (iid)</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs005.html#maximum-likelihood-estimation-mle" style="font-size: 80%;">Maximum Likelihood Estimation (MLE)</a></li>
@@ -270,20 +262,20 @@ MathJax.Hub.Config({
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0047"></a>
<!-- !split -->
<h2 id="more-examples-on-bootstrap-and-cross-validation-and-errors" class="anchor">More examples on bootstrap and cross-validation and errors </h2>
<p>
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%;"><span></span><span style="color: #408080; font-style: italic"># Common imports</span>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="inner_cell">
<div class="input_area">
<div class="highlight" style="background: #f8f8f8">
<pre style="line-height: 125%;"><span style="color: #408080; font-style: italic"># Common imports</span>
<span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">os</span>
<span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">numpy</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">np</span>
<span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">pandas</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">pd</span>
@@ -361,11 +353,23 @@ plt<span style="color: #666666">.</span>xlabel(<span style="color: #BA2121">&#39
plt<span style="color: #666666">.</span>ylabel(<span style="color: #BA2121">&#39;log10[MSE]&#39;</span>)
plt<span style="color: #666666">.</span>legend()
plt<span style="color: #666666">.</span>show()
</pre></div>
<p>
Note that we kept the intercept column in the fitting here. This means that we need to set the <b>intercept</b> in the call to the <b>Scikit-Learn</b> function as <b>False</b>. Alternatively, we could have set up the design matrix \( X \) without the first column of ones.
</pre>
</div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="output_subarea output_stream output_stdout output_text">
</div>
</div>
</div>
</div>
</div>
<p>Note that we kept the intercept column in the fitting here. This means that we need to set the <b>intercept</b> in the call to the <b>Scikit-Learn</b> function as <b>False</b>. Alternatively, we could have set up the design matrix \( X \) without the first column of ones.</p>
<p>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -385,25 +389,18 @@ Note that we kept the intercept column in the fitting here. This means that we n
<li><a href="._week37-bs048.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="https://..."><img width="250" align=right src="https://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright only on the titlepage -->
</center>
</body>
</html>
+27 -31
View File
@@ -1,6 +1,7 @@
<!--
Automatically generated HTML file from DocOnce source
HTML file automatically generated from DocOnce source
(https://github.com/doconce/doconce/)
doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako
-->
<html>
<head>
@@ -8,24 +9,20 @@ Automatically generated HTML file from DocOnce source
<meta name="generator" content="DocOnce: https://github.com/doconce/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Week 37: Summary of Ridge and Lasso Regression and Resampling Methods">
<title>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</title>
<!-- Bootstrap style: bootstrap -->
<!-- doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
@@ -35,18 +32,16 @@ Automatically generated HTML file from DocOnce source
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Plans for week 37', 2, None, 'plans-for-week-37'),
('Thursday September 16, Summary of Ridge and Lasso Regression '
('Thursday September 15, Summary of Ridge and Lasso Regression '
'and start Resampling methods',
2,
None,
'thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
'thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
('Deriving OLS from a probability distribution',
2,
None,
@@ -197,8 +192,6 @@ MathJax.Hub.Config({
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
@@ -209,14 +202,13 @@ MathJax.Hub.Config({
</button>
<a class="navbar-brand" href="week37-bs.html">Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week37-bs001.html#plans-for-week-37" style="font-size: 80%;">Plans for week 37</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs003.html#deriving-ols-from-a-probability-distribution" style="font-size: 80%;">Deriving OLS from a probability distribution</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs004.html#independent-and-identically-distrubuted-iid" style="font-size: 80%;">Independent and Identically Distrubuted (iid)</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs005.html#maximum-likelihood-estimation-mle" style="font-size: 80%;">Maximum Likelihood Estimation (MLE)</a></li>
@@ -270,22 +262,21 @@ MathJax.Hub.Config({
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0048"></a>
<!-- !split -->
<h2 id="the-same-example-but-now-with-cross-validation" class="anchor">The same example but now with cross-validation </h2>
<p>
In this example we keep the intercept column again but add cross-validation in order to estimate the best possible value of the means squared error.
<p>
<p>In this example we keep the intercept column again but add cross-validation in order to estimate the best possible value of the means squared error.</p>
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%;"><span></span><span style="color: #408080; font-style: italic"># Common imports</span>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="inner_cell">
<div class="input_area">
<div class="highlight" style="background: #f8f8f8">
<pre style="line-height: 125%;"><span style="color: #408080; font-style: italic"># Common imports</span>
<span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">os</span>
<span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">numpy</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">np</span>
<span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">pandas</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">pd</span>
@@ -352,8 +343,20 @@ plt<span style="color: #666666">.</span>xlabel(<span style="color: #BA2121">&#39
plt<span style="color: #666666">.</span>ylabel(<span style="color: #BA2121">&#39;log10[MSE]&#39;</span>)
plt<span style="color: #666666">.</span>legend()
plt<span style="color: #666666">.</span>show()
</pre></div>
<p>
</pre>
</div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="output_subarea output_stream output_stdout output_text">
</div>
</div>
</div>
</div>
</div>
<p>
<!-- navigation buttons at the bottom of the page -->
@@ -372,25 +375,18 @@ plt<span style="color: #666666">.</span>show()
<li class="active"><a href="._week37-bs048.html">49</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="https://..."><img width="250" align=right src="https://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright only on the titlepage -->
</center>
</body>
</html>
+21 -40
View File
@@ -1,6 +1,7 @@
<!--
Automatically generated HTML file from DocOnce source
HTML file automatically generated from DocOnce source
(https://github.com/doconce/doconce/)
doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako
-->
<html>
<head>
@@ -8,24 +9,20 @@ Automatically generated HTML file from DocOnce source
<meta name="generator" content="DocOnce: https://github.com/doconce/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Week 37: Summary of Ridge and Lasso Regression and Resampling Methods">
<title>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</title>
<!-- Bootstrap style: bootstrap -->
<!-- doconce format html week37.do.txt --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=week37-bs --no_mako -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- not necessary
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
-->
<style type="text/css">
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
.dropdown-menu {
height: auto;
max-height: 400px;
overflow-x: hidden;
}
/* Adds an invisible element before each target to offset for the navigation
bar */
.anchor::before {
@@ -35,18 +32,16 @@ Automatically generated HTML file from DocOnce source
margin:-50px 0 0; /* negative fixed header height */
}
</style>
</head>
<!-- tocinfo
{'highest level': 2,
'sections': [('Plans for week 37', 2, None, 'plans-for-week-37'),
('Thursday September 16, Summary of Ridge and Lasso Regression '
('Thursday September 15, Summary of Ridge and Lasso Regression '
'and start Resampling methods',
2,
None,
'thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
'thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods'),
('Deriving OLS from a probability distribution',
2,
None,
@@ -197,8 +192,6 @@ MathJax.Hub.Config({
</script>
<!-- Bootstrap navigation bar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
@@ -209,14 +202,13 @@ MathJax.Hub.Config({
</button>
<a class="navbar-brand" href="week37-bs.html">Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._week37-bs001.html#plans-for-week-37" style="font-size: 80%;">Plans for week 37</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-16-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs002.html#thursday-september-15-summary-of-ridge-and-lasso-regression-and-start-resampling-methods" style="font-size: 80%;">Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs003.html#deriving-ols-from-a-probability-distribution" style="font-size: 80%;">Deriving OLS from a probability distribution</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs004.html#independent-and-identically-distrubuted-iid" style="font-size: 80%;">Independent and Identically Distrubuted (iid)</a></li>
<!-- navigation toc: --> <li><a href="._week37-bs005.html#maximum-likelihood-estimation-mle" style="font-size: 80%;">Maximum Likelihood Estimation (MLE)</a></li>
@@ -270,36 +262,32 @@ MathJax.Hub.Config({
</div>
</div>
</div> <!-- end of navigation bar -->
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0000"></a>
<!-- ------------------- main content ---------------------- -->
<div class="jumbotron">
<center><h1>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</h1></center> <!-- document title -->
<center>
<h1>Week 37: Summary of Ridge and Lasso Regression and Resampling Methods</h1>
</center> <!-- document title -->
<p>
<!-- author(s): Morten Hjorth-Jensen -->
<center>
<b>Morten Hjorth-Jensen</b> [1, 2]
</center>
<p>
<!-- institution(s) -->
<center>
[1] <b>Department of Physics, University of Oslo</b>
</center>
<center>
[2] <b>Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory, Michigan State University</b>
</center>
<br>
<center>
<h4>Aug 23, 2022</h4>
</center> <!-- date -->
<br>
<center>[1] <b>Department of Physics, University of Oslo</b></center>
<center>[2] <b>Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory, Michigan State University</b></center>
<br>
<p>
<center><h4>Sep 28, 2021</h4></center> <!-- date -->
<br>
<p>
<p><a href="._week37-bs001.html" class="btn btn-primary btn-lg">Read &raquo;</a></p>
@@ -325,25 +313,18 @@ MathJax.Hub.Config({
<li><a href="._week37-bs001.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
</div> <!-- end container -->
<!-- include javascript, jQuery *first* -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<!-- Bootstrap footer
<footer>
<a href="https://..."><img width="250" align=right src="https://..."></a>
</footer>
-->
<center style="font-size:80%">
<!-- copyright --> &copy; 1999-2021, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license
<!-- copyright --> &copy; 1999-2022, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license
</center>
</body>
</html>
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because one or more lines are too long
-47
View File
@@ -1,47 +0,0 @@
import numpy as np
import matplotlib.pyplot as plt
from sklearn.model_selection import KFold
from sklearn.linear_model import Ridge, LinearRegression
from sklearn.model_selection import cross_val_score
from sklearn.preprocessing import PolynomialFeatures
# A seed just to ensure that the random numbers are the same for every run.
# Useful for eventual debugging.
np.random.seed(3155)
# Generate the data.
nsamples = 1000
x = np.random.randn(nsamples)
y = 3*x**2 + np.random.randn(nsamples)
## Cross-validation on Ridge regression using KFold only
# Decide degree on polynomial to fit
poly = PolynomialFeatures(degree = 6)
# Initialize a KFold instance
k = 10
kfold = KFold(n_splits = k)
# Perform the cross-validation to estimate MSE using OLS
scores_KFold = np.zeros((k))
model = LinearRegression()
j = 0
for train_inds, test_inds in kfold.split(x):
xtrain = x[train_inds]
ytrain = y[train_inds]
xtest = x[test_inds]
ytest = y[test_inds]
Xtrain = poly.fit_transform(xtrain[:, np.newaxis])
model.fit(Xtrain, ytrain[:, np.newaxis])
Xtest = poly.fit_transform(xtest[:, np.newaxis])
ypred = model.predict(Xtest)
scores_KFold[j] = np.sum((ypred - ytest[:, np.newaxis])**2)/np.size(ypred)
print(f"Score for each fold:{scores_KFold[j]}")
j += 1
estimated_mse_KFold = np.mean(scores_KFold)
print(f"Average OLS score:{estimated_mse_KFold}")
+4 -6
View File
@@ -5,11 +5,9 @@ DATE: today
!split
===== Plans for week 37 =====
* Thursday September 16: Summary of Ridge and Lasso with examples and start resampling techniques
o "Video of Lecture, first part":"https://www.uio.no/studier/emner/matnat/fys/FYS-STK3155/h21/forelesningsvideoer/LectureSeptember16Firstpart.mp4?vrtx=view-as-webpage"
o "Video of Lecture, second part":"https://www.uio.no/studier/emner/matnat/fys/FYS-STK3155/h21/forelesningsvideoer/LectureSeptember16SecondPart.mp4?vrtx=view-as-webpage"
* Friday September 17: Resampling methods, Cross-validation, Bootstrapping and jackknife
o "Video of Lecture":"https://www.uio.no/studier/emner/matnat/fys/FYS-STK3155/h21/forelesningsvideoer/LectureSeptember17.mp4?vrtx=view-as-webpage"
* Thursday September 15: Summary of Ridge and Lasso with examples and start resampling techniques
* Friday September 16: Resampling methods, Cross-validation, Bootstrapping and jackknife
Recommended Reading:
o Lectures on Resampling methods (these lectures)
o Bishop 1.3 (cross-validation) and 3.2 (bias-variance tradeoff)
@@ -18,7 +16,7 @@ o Hastie et al Chapter 7, here we recommend 7.1-7.5 and 7.10 (cross-validation)
!split
===== Thursday September 16, Summary of Ridge and Lasso Regression and start Resampling methods =====
===== Thursday September 15, Summary of Ridge and Lasso Regression and start Resampling methods =====
!split