wrong dates in week 38

This commit is contained in:
Morten Hjorth-Jensen
2024-09-17 06:30:04 +02:00
parent d97bf07317
commit 47fa701ec3
50 changed files with 2632 additions and 2731 deletions
+45 -47
View File
@@ -48,10 +48,10 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
2,
None,
'plans-for-the-lab-sessions'),
('Material for lecture Thursday September 21',
('Material for lecture Monday September 16',
2,
None,
'material-for-lecture-thursday-september-21'),
'material-for-lecture-monday-september-16'),
('Logistic Regression', 2, None, 'logistic-regression'),
('Classification problems', 2, None, 'classification-problems'),
('Optimization and Deep learning',
@@ -92,7 +92,6 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
'extending-to-more-predictors'),
('Including more classes', 2, None, 'including-more-classes'),
('More classes', 2, None, 'more-classes'),
('Friday September 23', 2, None, 'friday-september-23'),
('Searching for Optimal Regularization Parameters $\\lambda$',
2,
None,
@@ -249,7 +248,7 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs001.html#plans-for-week-38-lecture-monday-september-16" style="font-size: 80%;">Plans for week 38, lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs002.html#suggested-reading-and-videos" style="font-size: 80%;">Suggested reading and videos</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs003.html#plans-for-the-lab-sessions" style="font-size: 80%;">Plans for the lab sessions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-thursday-september-21" style="font-size: 80%;">Material for lecture Thursday September 21</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-monday-september-16" style="font-size: 80%;">Material for lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs005.html#logistic-regression" style="font-size: 80%;">Logistic Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs006.html#classification-problems" style="font-size: 80%;">Classification problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs007.html#optimization-and-deep-learning" style="font-size: 80%;">Optimization and Deep learning</a></li>
@@ -268,48 +267,47 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs020.html#extending-to-more-predictors" style="font-size: 80%;">Extending to more predictors</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs021.html#including-more-classes" style="font-size: 80%;">Including more classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs022.html#more-classes" style="font-size: 80%;">More classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#friday-september-23" style="font-size: 80%;">Friday September 23</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs048.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs064.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs049.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
</ul>
</li>
@@ -364,7 +362,7 @@ MathJax.Hub.Config({
<li><a href="._week38-bs008.html">9</a></li>
<li><a href="._week38-bs009.html">10</a></li>
<li><a href="">...</a></li>
<li><a href="._week38-bs064.html">65</a></li>
<li><a href="._week38-bs063.html">64</a></li>
<li><a href="._week38-bs001.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+45 -47
View File
@@ -48,10 +48,10 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
2,
None,
'plans-for-the-lab-sessions'),
('Material for lecture Thursday September 21',
('Material for lecture Monday September 16',
2,
None,
'material-for-lecture-thursday-september-21'),
'material-for-lecture-monday-september-16'),
('Logistic Regression', 2, None, 'logistic-regression'),
('Classification problems', 2, None, 'classification-problems'),
('Optimization and Deep learning',
@@ -92,7 +92,6 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
'extending-to-more-predictors'),
('Including more classes', 2, None, 'including-more-classes'),
('More classes', 2, None, 'more-classes'),
('Friday September 23', 2, None, 'friday-september-23'),
('Searching for Optimal Regularization Parameters $\\lambda$',
2,
None,
@@ -249,7 +248,7 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="#plans-for-week-38-lecture-monday-september-16" style="font-size: 80%;">Plans for week 38, lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs002.html#suggested-reading-and-videos" style="font-size: 80%;">Suggested reading and videos</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs003.html#plans-for-the-lab-sessions" style="font-size: 80%;">Plans for the lab sessions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-thursday-september-21" style="font-size: 80%;">Material for lecture Thursday September 21</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-monday-september-16" style="font-size: 80%;">Material for lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs005.html#logistic-regression" style="font-size: 80%;">Logistic Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs006.html#classification-problems" style="font-size: 80%;">Classification problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs007.html#optimization-and-deep-learning" style="font-size: 80%;">Optimization and Deep learning</a></li>
@@ -268,48 +267,47 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs020.html#extending-to-more-predictors" style="font-size: 80%;">Extending to more predictors</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs021.html#including-more-classes" style="font-size: 80%;">Including more classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs022.html#more-classes" style="font-size: 80%;">More classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#friday-september-23" style="font-size: 80%;">Friday September 23</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs048.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs064.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs049.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
</ul>
</li>
@@ -352,7 +350,7 @@ MathJax.Hub.Config({
<li><a href="._week38-bs009.html">10</a></li>
<li><a href="._week38-bs010.html">11</a></li>
<li><a href="">...</a></li>
<li><a href="._week38-bs064.html">65</a></li>
<li><a href="._week38-bs063.html">64</a></li>
<li><a href="._week38-bs002.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+45 -47
View File
@@ -48,10 +48,10 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
2,
None,
'plans-for-the-lab-sessions'),
('Material for lecture Thursday September 21',
('Material for lecture Monday September 16',
2,
None,
'material-for-lecture-thursday-september-21'),
'material-for-lecture-monday-september-16'),
('Logistic Regression', 2, None, 'logistic-regression'),
('Classification problems', 2, None, 'classification-problems'),
('Optimization and Deep learning',
@@ -92,7 +92,6 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
'extending-to-more-predictors'),
('Including more classes', 2, None, 'including-more-classes'),
('More classes', 2, None, 'more-classes'),
('Friday September 23', 2, None, 'friday-september-23'),
('Searching for Optimal Regularization Parameters $\\lambda$',
2,
None,
@@ -249,7 +248,7 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs001.html#plans-for-week-38-lecture-monday-september-16" style="font-size: 80%;">Plans for week 38, lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="#suggested-reading-and-videos" style="font-size: 80%;">Suggested reading and videos</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs003.html#plans-for-the-lab-sessions" style="font-size: 80%;">Plans for the lab sessions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-thursday-september-21" style="font-size: 80%;">Material for lecture Thursday September 21</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-monday-september-16" style="font-size: 80%;">Material for lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs005.html#logistic-regression" style="font-size: 80%;">Logistic Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs006.html#classification-problems" style="font-size: 80%;">Classification problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs007.html#optimization-and-deep-learning" style="font-size: 80%;">Optimization and Deep learning</a></li>
@@ -268,48 +267,47 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs020.html#extending-to-more-predictors" style="font-size: 80%;">Extending to more predictors</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs021.html#including-more-classes" style="font-size: 80%;">Including more classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs022.html#more-classes" style="font-size: 80%;">More classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#friday-september-23" style="font-size: 80%;">Friday September 23</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs048.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs064.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs049.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
</ul>
</li>
@@ -357,7 +355,7 @@ MathJax.Hub.Config({
<li><a href="._week38-bs010.html">11</a></li>
<li><a href="._week38-bs011.html">12</a></li>
<li><a href="">...</a></li>
<li><a href="._week38-bs064.html">65</a></li>
<li><a href="._week38-bs063.html">64</a></li>
<li><a href="._week38-bs003.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+45 -47
View File
@@ -48,10 +48,10 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
2,
None,
'plans-for-the-lab-sessions'),
('Material for lecture Thursday September 21',
('Material for lecture Monday September 16',
2,
None,
'material-for-lecture-thursday-september-21'),
'material-for-lecture-monday-september-16'),
('Logistic Regression', 2, None, 'logistic-regression'),
('Classification problems', 2, None, 'classification-problems'),
('Optimization and Deep learning',
@@ -92,7 +92,6 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
'extending-to-more-predictors'),
('Including more classes', 2, None, 'including-more-classes'),
('More classes', 2, None, 'more-classes'),
('Friday September 23', 2, None, 'friday-september-23'),
('Searching for Optimal Regularization Parameters $\\lambda$',
2,
None,
@@ -249,7 +248,7 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs001.html#plans-for-week-38-lecture-monday-september-16" style="font-size: 80%;">Plans for week 38, lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs002.html#suggested-reading-and-videos" style="font-size: 80%;">Suggested reading and videos</a></li>
<!-- navigation toc: --> <li><a href="#plans-for-the-lab-sessions" style="font-size: 80%;">Plans for the lab sessions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-thursday-september-21" style="font-size: 80%;">Material for lecture Thursday September 21</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-monday-september-16" style="font-size: 80%;">Material for lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs005.html#logistic-regression" style="font-size: 80%;">Logistic Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs006.html#classification-problems" style="font-size: 80%;">Classification problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs007.html#optimization-and-deep-learning" style="font-size: 80%;">Optimization and Deep learning</a></li>
@@ -268,48 +267,47 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs020.html#extending-to-more-predictors" style="font-size: 80%;">Extending to more predictors</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs021.html#including-more-classes" style="font-size: 80%;">Including more classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs022.html#more-classes" style="font-size: 80%;">More classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#friday-september-23" style="font-size: 80%;">Friday September 23</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs048.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs064.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs049.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
</ul>
</li>
@@ -354,7 +352,7 @@ MathJax.Hub.Config({
<li><a href="._week38-bs011.html">12</a></li>
<li><a href="._week38-bs012.html">13</a></li>
<li><a href="">...</a></li>
<li><a href="._week38-bs064.html">65</a></li>
<li><a href="._week38-bs063.html">64</a></li>
<li><a href="._week38-bs004.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+46 -48
View File
@@ -48,10 +48,10 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
2,
None,
'plans-for-the-lab-sessions'),
('Material for lecture Thursday September 21',
('Material for lecture Monday September 16',
2,
None,
'material-for-lecture-thursday-september-21'),
'material-for-lecture-monday-september-16'),
('Logistic Regression', 2, None, 'logistic-regression'),
('Classification problems', 2, None, 'classification-problems'),
('Optimization and Deep learning',
@@ -92,7 +92,6 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
'extending-to-more-predictors'),
('Including more classes', 2, None, 'including-more-classes'),
('More classes', 2, None, 'more-classes'),
('Friday September 23', 2, None, 'friday-september-23'),
('Searching for Optimal Regularization Parameters $\\lambda$',
2,
None,
@@ -249,7 +248,7 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs001.html#plans-for-week-38-lecture-monday-september-16" style="font-size: 80%;">Plans for week 38, lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs002.html#suggested-reading-and-videos" style="font-size: 80%;">Suggested reading and videos</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs003.html#plans-for-the-lab-sessions" style="font-size: 80%;">Plans for the lab sessions</a></li>
<!-- navigation toc: --> <li><a href="#material-for-lecture-thursday-september-21" style="font-size: 80%;">Material for lecture Thursday September 21</a></li>
<!-- navigation toc: --> <li><a href="#material-for-lecture-monday-september-16" style="font-size: 80%;">Material for lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs005.html#logistic-regression" style="font-size: 80%;">Logistic Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs006.html#classification-problems" style="font-size: 80%;">Classification problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs007.html#optimization-and-deep-learning" style="font-size: 80%;">Optimization and Deep learning</a></li>
@@ -268,48 +267,47 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs020.html#extending-to-more-predictors" style="font-size: 80%;">Extending to more predictors</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs021.html#including-more-classes" style="font-size: 80%;">Including more classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs022.html#more-classes" style="font-size: 80%;">More classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#friday-september-23" style="font-size: 80%;">Friday September 23</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs048.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs064.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs049.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
</ul>
</li>
@@ -321,7 +319,7 @@ MathJax.Hub.Config({
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0004"></a>
<!-- !split -->
<h2 id="material-for-lecture-thursday-september-21" class="anchor">Material for lecture Thursday September 21 </h2>
<h2 id="material-for-lecture-monday-september-16" class="anchor">Material for lecture Monday September 16 </h2>
<p>
<!-- navigation buttons at the bottom of the page -->
@@ -342,7 +340,7 @@ MathJax.Hub.Config({
<li><a href="._week38-bs012.html">13</a></li>
<li><a href="._week38-bs013.html">14</a></li>
<li><a href="">...</a></li>
<li><a href="._week38-bs064.html">65</a></li>
<li><a href="._week38-bs063.html">64</a></li>
<li><a href="._week38-bs005.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+45 -47
View File
@@ -48,10 +48,10 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
2,
None,
'plans-for-the-lab-sessions'),
('Material for lecture Thursday September 21',
('Material for lecture Monday September 16',
2,
None,
'material-for-lecture-thursday-september-21'),
'material-for-lecture-monday-september-16'),
('Logistic Regression', 2, None, 'logistic-regression'),
('Classification problems', 2, None, 'classification-problems'),
('Optimization and Deep learning',
@@ -92,7 +92,6 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
'extending-to-more-predictors'),
('Including more classes', 2, None, 'including-more-classes'),
('More classes', 2, None, 'more-classes'),
('Friday September 23', 2, None, 'friday-september-23'),
('Searching for Optimal Regularization Parameters $\\lambda$',
2,
None,
@@ -249,7 +248,7 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs001.html#plans-for-week-38-lecture-monday-september-16" style="font-size: 80%;">Plans for week 38, lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs002.html#suggested-reading-and-videos" style="font-size: 80%;">Suggested reading and videos</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs003.html#plans-for-the-lab-sessions" style="font-size: 80%;">Plans for the lab sessions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-thursday-september-21" style="font-size: 80%;">Material for lecture Thursday September 21</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-monday-september-16" style="font-size: 80%;">Material for lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="#logistic-regression" style="font-size: 80%;">Logistic Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs006.html#classification-problems" style="font-size: 80%;">Classification problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs007.html#optimization-and-deep-learning" style="font-size: 80%;">Optimization and Deep learning</a></li>
@@ -268,48 +267,47 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs020.html#extending-to-more-predictors" style="font-size: 80%;">Extending to more predictors</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs021.html#including-more-classes" style="font-size: 80%;">Including more classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs022.html#more-classes" style="font-size: 80%;">More classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#friday-september-23" style="font-size: 80%;">Friday September 23</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs048.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs064.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs049.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
</ul>
</li>
@@ -356,7 +354,7 @@ simple recipe for fitting our data.
<li><a href="._week38-bs013.html">14</a></li>
<li><a href="._week38-bs014.html">15</a></li>
<li><a href="">...</a></li>
<li><a href="._week38-bs064.html">65</a></li>
<li><a href="._week38-bs063.html">64</a></li>
<li><a href="._week38-bs006.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+45 -47
View File
@@ -48,10 +48,10 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
2,
None,
'plans-for-the-lab-sessions'),
('Material for lecture Thursday September 21',
('Material for lecture Monday September 16',
2,
None,
'material-for-lecture-thursday-september-21'),
'material-for-lecture-monday-september-16'),
('Logistic Regression', 2, None, 'logistic-regression'),
('Classification problems', 2, None, 'classification-problems'),
('Optimization and Deep learning',
@@ -92,7 +92,6 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
'extending-to-more-predictors'),
('Including more classes', 2, None, 'including-more-classes'),
('More classes', 2, None, 'more-classes'),
('Friday September 23', 2, None, 'friday-september-23'),
('Searching for Optimal Regularization Parameters $\\lambda$',
2,
None,
@@ -249,7 +248,7 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs001.html#plans-for-week-38-lecture-monday-september-16" style="font-size: 80%;">Plans for week 38, lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs002.html#suggested-reading-and-videos" style="font-size: 80%;">Suggested reading and videos</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs003.html#plans-for-the-lab-sessions" style="font-size: 80%;">Plans for the lab sessions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-thursday-september-21" style="font-size: 80%;">Material for lecture Thursday September 21</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-monday-september-16" style="font-size: 80%;">Material for lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs005.html#logistic-regression" style="font-size: 80%;">Logistic Regression</a></li>
<!-- navigation toc: --> <li><a href="#classification-problems" style="font-size: 80%;">Classification problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs007.html#optimization-and-deep-learning" style="font-size: 80%;">Optimization and Deep learning</a></li>
@@ -268,48 +267,47 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs020.html#extending-to-more-predictors" style="font-size: 80%;">Extending to more predictors</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs021.html#including-more-classes" style="font-size: 80%;">Including more classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs022.html#more-classes" style="font-size: 80%;">More classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#friday-september-23" style="font-size: 80%;">Friday September 23</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs048.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs064.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs049.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
</ul>
</li>
@@ -362,7 +360,7 @@ failure etc.
<li><a href="._week38-bs014.html">15</a></li>
<li><a href="._week38-bs015.html">16</a></li>
<li><a href="">...</a></li>
<li><a href="._week38-bs064.html">65</a></li>
<li><a href="._week38-bs063.html">64</a></li>
<li><a href="._week38-bs007.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+45 -47
View File
@@ -48,10 +48,10 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
2,
None,
'plans-for-the-lab-sessions'),
('Material for lecture Thursday September 21',
('Material for lecture Monday September 16',
2,
None,
'material-for-lecture-thursday-september-21'),
'material-for-lecture-monday-september-16'),
('Logistic Regression', 2, None, 'logistic-regression'),
('Classification problems', 2, None, 'classification-problems'),
('Optimization and Deep learning',
@@ -92,7 +92,6 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
'extending-to-more-predictors'),
('Including more classes', 2, None, 'including-more-classes'),
('More classes', 2, None, 'more-classes'),
('Friday September 23', 2, None, 'friday-september-23'),
('Searching for Optimal Regularization Parameters $\\lambda$',
2,
None,
@@ -249,7 +248,7 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs001.html#plans-for-week-38-lecture-monday-september-16" style="font-size: 80%;">Plans for week 38, lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs002.html#suggested-reading-and-videos" style="font-size: 80%;">Suggested reading and videos</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs003.html#plans-for-the-lab-sessions" style="font-size: 80%;">Plans for the lab sessions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-thursday-september-21" style="font-size: 80%;">Material for lecture Thursday September 21</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-monday-september-16" style="font-size: 80%;">Material for lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs005.html#logistic-regression" style="font-size: 80%;">Logistic Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs006.html#classification-problems" style="font-size: 80%;">Classification problems</a></li>
<!-- navigation toc: --> <li><a href="#optimization-and-deep-learning" style="font-size: 80%;">Optimization and Deep learning</a></li>
@@ -268,48 +267,47 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs020.html#extending-to-more-predictors" style="font-size: 80%;">Extending to more predictors</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs021.html#including-more-classes" style="font-size: 80%;">Including more classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs022.html#more-classes" style="font-size: 80%;">More classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#friday-september-23" style="font-size: 80%;">Friday September 23</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs048.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs064.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs049.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
</ul>
</li>
@@ -361,7 +359,7 @@ models, as we will see later.
<li><a href="._week38-bs015.html">16</a></li>
<li><a href="._week38-bs016.html">17</a></li>
<li><a href="">...</a></li>
<li><a href="._week38-bs064.html">65</a></li>
<li><a href="._week38-bs063.html">64</a></li>
<li><a href="._week38-bs008.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+45 -47
View File
@@ -48,10 +48,10 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
2,
None,
'plans-for-the-lab-sessions'),
('Material for lecture Thursday September 21',
('Material for lecture Monday September 16',
2,
None,
'material-for-lecture-thursday-september-21'),
'material-for-lecture-monday-september-16'),
('Logistic Regression', 2, None, 'logistic-regression'),
('Classification problems', 2, None, 'classification-problems'),
('Optimization and Deep learning',
@@ -92,7 +92,6 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
'extending-to-more-predictors'),
('Including more classes', 2, None, 'including-more-classes'),
('More classes', 2, None, 'more-classes'),
('Friday September 23', 2, None, 'friday-september-23'),
('Searching for Optimal Regularization Parameters $\\lambda$',
2,
None,
@@ -249,7 +248,7 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs001.html#plans-for-week-38-lecture-monday-september-16" style="font-size: 80%;">Plans for week 38, lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs002.html#suggested-reading-and-videos" style="font-size: 80%;">Suggested reading and videos</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs003.html#plans-for-the-lab-sessions" style="font-size: 80%;">Plans for the lab sessions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-thursday-september-21" style="font-size: 80%;">Material for lecture Thursday September 21</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-monday-september-16" style="font-size: 80%;">Material for lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs005.html#logistic-regression" style="font-size: 80%;">Logistic Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs006.html#classification-problems" style="font-size: 80%;">Classification problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs007.html#optimization-and-deep-learning" style="font-size: 80%;">Optimization and Deep learning</a></li>
@@ -268,48 +267,47 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs020.html#extending-to-more-predictors" style="font-size: 80%;">Extending to more predictors</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs021.html#including-more-classes" style="font-size: 80%;">Including more classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs022.html#more-classes" style="font-size: 80%;">More classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#friday-september-23" style="font-size: 80%;">Friday September 23</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs048.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs064.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs049.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
</ul>
</li>
@@ -369,7 +367,7 @@ $$
<li><a href="._week38-bs016.html">17</a></li>
<li><a href="._week38-bs017.html">18</a></li>
<li><a href="">...</a></li>
<li><a href="._week38-bs064.html">65</a></li>
<li><a href="._week38-bs063.html">64</a></li>
<li><a href="._week38-bs009.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+45 -47
View File
@@ -48,10 +48,10 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
2,
None,
'plans-for-the-lab-sessions'),
('Material for lecture Thursday September 21',
('Material for lecture Monday September 16',
2,
None,
'material-for-lecture-thursday-september-21'),
'material-for-lecture-monday-september-16'),
('Logistic Regression', 2, None, 'logistic-regression'),
('Classification problems', 2, None, 'classification-problems'),
('Optimization and Deep learning',
@@ -92,7 +92,6 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
'extending-to-more-predictors'),
('Including more classes', 2, None, 'including-more-classes'),
('More classes', 2, None, 'more-classes'),
('Friday September 23', 2, None, 'friday-september-23'),
('Searching for Optimal Regularization Parameters $\\lambda$',
2,
None,
@@ -249,7 +248,7 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs001.html#plans-for-week-38-lecture-monday-september-16" style="font-size: 80%;">Plans for week 38, lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs002.html#suggested-reading-and-videos" style="font-size: 80%;">Suggested reading and videos</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs003.html#plans-for-the-lab-sessions" style="font-size: 80%;">Plans for the lab sessions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-thursday-september-21" style="font-size: 80%;">Material for lecture Thursday September 21</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-monday-september-16" style="font-size: 80%;">Material for lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs005.html#logistic-regression" style="font-size: 80%;">Logistic Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs006.html#classification-problems" style="font-size: 80%;">Classification problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs007.html#optimization-and-deep-learning" style="font-size: 80%;">Optimization and Deep learning</a></li>
@@ -268,48 +267,47 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs020.html#extending-to-more-predictors" style="font-size: 80%;">Extending to more predictors</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs021.html#including-more-classes" style="font-size: 80%;">Including more classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs022.html#more-classes" style="font-size: 80%;">More classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#friday-september-23" style="font-size: 80%;">Friday September 23</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs048.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs064.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs049.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
</ul>
</li>
@@ -367,7 +365,7 @@ $$
<li><a href="._week38-bs017.html">18</a></li>
<li><a href="._week38-bs018.html">19</a></li>
<li><a href="">...</a></li>
<li><a href="._week38-bs064.html">65</a></li>
<li><a href="._week38-bs063.html">64</a></li>
<li><a href="._week38-bs010.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+45 -47
View File
@@ -48,10 +48,10 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
2,
None,
'plans-for-the-lab-sessions'),
('Material for lecture Thursday September 21',
('Material for lecture Monday September 16',
2,
None,
'material-for-lecture-thursday-september-21'),
'material-for-lecture-monday-september-16'),
('Logistic Regression', 2, None, 'logistic-regression'),
('Classification problems', 2, None, 'classification-problems'),
('Optimization and Deep learning',
@@ -92,7 +92,6 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
'extending-to-more-predictors'),
('Including more classes', 2, None, 'including-more-classes'),
('More classes', 2, None, 'more-classes'),
('Friday September 23', 2, None, 'friday-september-23'),
('Searching for Optimal Regularization Parameters $\\lambda$',
2,
None,
@@ -249,7 +248,7 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs001.html#plans-for-week-38-lecture-monday-september-16" style="font-size: 80%;">Plans for week 38, lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs002.html#suggested-reading-and-videos" style="font-size: 80%;">Suggested reading and videos</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs003.html#plans-for-the-lab-sessions" style="font-size: 80%;">Plans for the lab sessions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-thursday-september-21" style="font-size: 80%;">Material for lecture Thursday September 21</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-monday-september-16" style="font-size: 80%;">Material for lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs005.html#logistic-regression" style="font-size: 80%;">Logistic Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs006.html#classification-problems" style="font-size: 80%;">Classification problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs007.html#optimization-and-deep-learning" style="font-size: 80%;">Optimization and Deep learning</a></li>
@@ -268,48 +267,47 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs020.html#extending-to-more-predictors" style="font-size: 80%;">Extending to more predictors</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs021.html#including-more-classes" style="font-size: 80%;">Including more classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs022.html#more-classes" style="font-size: 80%;">More classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#friday-september-23" style="font-size: 80%;">Friday September 23</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs048.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs064.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs049.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
</ul>
</li>
@@ -368,7 +366,7 @@ the probability of a given category. This leads us to the logistic function.
<li><a href="._week38-bs018.html">19</a></li>
<li><a href="._week38-bs019.html">20</a></li>
<li><a href="">...</a></li>
<li><a href="._week38-bs064.html">65</a></li>
<li><a href="._week38-bs063.html">64</a></li>
<li><a href="._week38-bs011.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+45 -47
View File
@@ -48,10 +48,10 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
2,
None,
'plans-for-the-lab-sessions'),
('Material for lecture Thursday September 21',
('Material for lecture Monday September 16',
2,
None,
'material-for-lecture-thursday-september-21'),
'material-for-lecture-monday-september-16'),
('Logistic Regression', 2, None, 'logistic-regression'),
('Classification problems', 2, None, 'classification-problems'),
('Optimization and Deep learning',
@@ -92,7 +92,6 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
'extending-to-more-predictors'),
('Including more classes', 2, None, 'including-more-classes'),
('More classes', 2, None, 'more-classes'),
('Friday September 23', 2, None, 'friday-september-23'),
('Searching for Optimal Regularization Parameters $\\lambda$',
2,
None,
@@ -249,7 +248,7 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs001.html#plans-for-week-38-lecture-monday-september-16" style="font-size: 80%;">Plans for week 38, lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs002.html#suggested-reading-and-videos" style="font-size: 80%;">Suggested reading and videos</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs003.html#plans-for-the-lab-sessions" style="font-size: 80%;">Plans for the lab sessions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-thursday-september-21" style="font-size: 80%;">Material for lecture Thursday September 21</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-monday-september-16" style="font-size: 80%;">Material for lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs005.html#logistic-regression" style="font-size: 80%;">Logistic Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs006.html#classification-problems" style="font-size: 80%;">Classification problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs007.html#optimization-and-deep-learning" style="font-size: 80%;">Optimization and Deep learning</a></li>
@@ -268,48 +267,47 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs020.html#extending-to-more-predictors" style="font-size: 80%;">Extending to more predictors</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs021.html#including-more-classes" style="font-size: 80%;">Including more classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs022.html#more-classes" style="font-size: 80%;">More classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#friday-september-23" style="font-size: 80%;">Friday September 23</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs048.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs064.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs049.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
</ul>
</li>
@@ -427,7 +425,7 @@ plt<span style="color: #666666">.</span>show()
<li><a href="._week38-bs019.html">20</a></li>
<li><a href="._week38-bs020.html">21</a></li>
<li><a href="">...</a></li>
<li><a href="._week38-bs064.html">65</a></li>
<li><a href="._week38-bs063.html">64</a></li>
<li><a href="._week38-bs012.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+45 -47
View File
@@ -48,10 +48,10 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
2,
None,
'plans-for-the-lab-sessions'),
('Material for lecture Thursday September 21',
('Material for lecture Monday September 16',
2,
None,
'material-for-lecture-thursday-september-21'),
'material-for-lecture-monday-september-16'),
('Logistic Regression', 2, None, 'logistic-regression'),
('Classification problems', 2, None, 'classification-problems'),
('Optimization and Deep learning',
@@ -92,7 +92,6 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
'extending-to-more-predictors'),
('Including more classes', 2, None, 'including-more-classes'),
('More classes', 2, None, 'more-classes'),
('Friday September 23', 2, None, 'friday-september-23'),
('Searching for Optimal Regularization Parameters $\\lambda$',
2,
None,
@@ -249,7 +248,7 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs001.html#plans-for-week-38-lecture-monday-september-16" style="font-size: 80%;">Plans for week 38, lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs002.html#suggested-reading-and-videos" style="font-size: 80%;">Suggested reading and videos</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs003.html#plans-for-the-lab-sessions" style="font-size: 80%;">Plans for the lab sessions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-thursday-september-21" style="font-size: 80%;">Material for lecture Thursday September 21</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-monday-september-16" style="font-size: 80%;">Material for lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs005.html#logistic-regression" style="font-size: 80%;">Logistic Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs006.html#classification-problems" style="font-size: 80%;">Classification problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs007.html#optimization-and-deep-learning" style="font-size: 80%;">Optimization and Deep learning</a></li>
@@ -268,48 +267,47 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs020.html#extending-to-more-predictors" style="font-size: 80%;">Extending to more predictors</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs021.html#including-more-classes" style="font-size: 80%;">Including more classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs022.html#more-classes" style="font-size: 80%;">More classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#friday-september-23" style="font-size: 80%;">Friday September 23</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs048.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs064.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs049.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
</ul>
</li>
@@ -399,7 +397,7 @@ representing the probability for finding a value of \( y_i \) with a given
<li><a href="._week38-bs020.html">21</a></li>
<li><a href="._week38-bs021.html">22</a></li>
<li><a href="">...</a></li>
<li><a href="._week38-bs064.html">65</a></li>
<li><a href="._week38-bs063.html">64</a></li>
<li><a href="._week38-bs013.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+45 -47
View File
@@ -48,10 +48,10 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
2,
None,
'plans-for-the-lab-sessions'),
('Material for lecture Thursday September 21',
('Material for lecture Monday September 16',
2,
None,
'material-for-lecture-thursday-september-21'),
'material-for-lecture-monday-september-16'),
('Logistic Regression', 2, None, 'logistic-regression'),
('Classification problems', 2, None, 'classification-problems'),
('Optimization and Deep learning',
@@ -92,7 +92,6 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
'extending-to-more-predictors'),
('Including more classes', 2, None, 'including-more-classes'),
('More classes', 2, None, 'more-classes'),
('Friday September 23', 2, None, 'friday-september-23'),
('Searching for Optimal Regularization Parameters $\\lambda$',
2,
None,
@@ -249,7 +248,7 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs001.html#plans-for-week-38-lecture-monday-september-16" style="font-size: 80%;">Plans for week 38, lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs002.html#suggested-reading-and-videos" style="font-size: 80%;">Suggested reading and videos</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs003.html#plans-for-the-lab-sessions" style="font-size: 80%;">Plans for the lab sessions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-thursday-september-21" style="font-size: 80%;">Material for lecture Thursday September 21</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-monday-september-16" style="font-size: 80%;">Material for lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs005.html#logistic-regression" style="font-size: 80%;">Logistic Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs006.html#classification-problems" style="font-size: 80%;">Classification problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs007.html#optimization-and-deep-learning" style="font-size: 80%;">Optimization and Deep learning</a></li>
@@ -268,48 +267,47 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs020.html#extending-to-more-predictors" style="font-size: 80%;">Extending to more predictors</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs021.html#including-more-classes" style="font-size: 80%;">Including more classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs022.html#more-classes" style="font-size: 80%;">More classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#friday-september-23" style="font-size: 80%;">Friday September 23</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs048.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs064.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs049.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
</ul>
</li>
@@ -366,7 +364,7 @@ $$
<li><a href="._week38-bs021.html">22</a></li>
<li><a href="._week38-bs022.html">23</a></li>
<li><a href="">...</a></li>
<li><a href="._week38-bs064.html">65</a></li>
<li><a href="._week38-bs063.html">64</a></li>
<li><a href="._week38-bs014.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+45 -47
View File
@@ -48,10 +48,10 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
2,
None,
'plans-for-the-lab-sessions'),
('Material for lecture Thursday September 21',
('Material for lecture Monday September 16',
2,
None,
'material-for-lecture-thursday-september-21'),
'material-for-lecture-monday-september-16'),
('Logistic Regression', 2, None, 'logistic-regression'),
('Classification problems', 2, None, 'classification-problems'),
('Optimization and Deep learning',
@@ -92,7 +92,6 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
'extending-to-more-predictors'),
('Including more classes', 2, None, 'including-more-classes'),
('More classes', 2, None, 'more-classes'),
('Friday September 23', 2, None, 'friday-september-23'),
('Searching for Optimal Regularization Parameters $\\lambda$',
2,
None,
@@ -249,7 +248,7 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs001.html#plans-for-week-38-lecture-monday-september-16" style="font-size: 80%;">Plans for week 38, lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs002.html#suggested-reading-and-videos" style="font-size: 80%;">Suggested reading and videos</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs003.html#plans-for-the-lab-sessions" style="font-size: 80%;">Plans for the lab sessions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-thursday-september-21" style="font-size: 80%;">Material for lecture Thursday September 21</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-monday-september-16" style="font-size: 80%;">Material for lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs005.html#logistic-regression" style="font-size: 80%;">Logistic Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs006.html#classification-problems" style="font-size: 80%;">Classification problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs007.html#optimization-and-deep-learning" style="font-size: 80%;">Optimization and Deep learning</a></li>
@@ -268,48 +267,47 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs020.html#extending-to-more-predictors" style="font-size: 80%;">Extending to more predictors</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs021.html#including-more-classes" style="font-size: 80%;">Including more classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs022.html#more-classes" style="font-size: 80%;">More classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#friday-september-23" style="font-size: 80%;">Friday September 23</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs048.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs064.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs049.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
</ul>
</li>
@@ -427,7 +425,7 @@ plt<span style="color: #666666">.</span>show()
<li><a href="._week38-bs022.html">23</a></li>
<li><a href="._week38-bs023.html">24</a></li>
<li><a href="">...</a></li>
<li><a href="._week38-bs064.html">65</a></li>
<li><a href="._week38-bs063.html">64</a></li>
<li><a href="._week38-bs015.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+45 -47
View File
@@ -48,10 +48,10 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
2,
None,
'plans-for-the-lab-sessions'),
('Material for lecture Thursday September 21',
('Material for lecture Monday September 16',
2,
None,
'material-for-lecture-thursday-september-21'),
'material-for-lecture-monday-september-16'),
('Logistic Regression', 2, None, 'logistic-regression'),
('Classification problems', 2, None, 'classification-problems'),
('Optimization and Deep learning',
@@ -92,7 +92,6 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
'extending-to-more-predictors'),
('Including more classes', 2, None, 'including-more-classes'),
('More classes', 2, None, 'more-classes'),
('Friday September 23', 2, None, 'friday-september-23'),
('Searching for Optimal Regularization Parameters $\\lambda$',
2,
None,
@@ -249,7 +248,7 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs001.html#plans-for-week-38-lecture-monday-september-16" style="font-size: 80%;">Plans for week 38, lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs002.html#suggested-reading-and-videos" style="font-size: 80%;">Suggested reading and videos</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs003.html#plans-for-the-lab-sessions" style="font-size: 80%;">Plans for the lab sessions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-thursday-september-21" style="font-size: 80%;">Material for lecture Thursday September 21</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-monday-september-16" style="font-size: 80%;">Material for lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs005.html#logistic-regression" style="font-size: 80%;">Logistic Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs006.html#classification-problems" style="font-size: 80%;">Classification problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs007.html#optimization-and-deep-learning" style="font-size: 80%;">Optimization and Deep learning</a></li>
@@ -268,48 +267,47 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs020.html#extending-to-more-predictors" style="font-size: 80%;">Extending to more predictors</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs021.html#including-more-classes" style="font-size: 80%;">Including more classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs022.html#more-classes" style="font-size: 80%;">More classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#friday-september-23" style="font-size: 80%;">Friday September 23</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs048.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs064.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs049.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
</ul>
</li>
@@ -364,7 +362,7 @@ $$
<li><a href="._week38-bs023.html">24</a></li>
<li><a href="._week38-bs024.html">25</a></li>
<li><a href="">...</a></li>
<li><a href="._week38-bs064.html">65</a></li>
<li><a href="._week38-bs063.html">64</a></li>
<li><a href="._week38-bs016.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+45 -47
View File
@@ -48,10 +48,10 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
2,
None,
'plans-for-the-lab-sessions'),
('Material for lecture Thursday September 21',
('Material for lecture Monday September 16',
2,
None,
'material-for-lecture-thursday-september-21'),
'material-for-lecture-monday-september-16'),
('Logistic Regression', 2, None, 'logistic-regression'),
('Classification problems', 2, None, 'classification-problems'),
('Optimization and Deep learning',
@@ -92,7 +92,6 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
'extending-to-more-predictors'),
('Including more classes', 2, None, 'including-more-classes'),
('More classes', 2, None, 'more-classes'),
('Friday September 23', 2, None, 'friday-september-23'),
('Searching for Optimal Regularization Parameters $\\lambda$',
2,
None,
@@ -249,7 +248,7 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs001.html#plans-for-week-38-lecture-monday-september-16" style="font-size: 80%;">Plans for week 38, lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs002.html#suggested-reading-and-videos" style="font-size: 80%;">Suggested reading and videos</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs003.html#plans-for-the-lab-sessions" style="font-size: 80%;">Plans for the lab sessions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-thursday-september-21" style="font-size: 80%;">Material for lecture Thursday September 21</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-monday-september-16" style="font-size: 80%;">Material for lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs005.html#logistic-regression" style="font-size: 80%;">Logistic Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs006.html#classification-problems" style="font-size: 80%;">Classification problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs007.html#optimization-and-deep-learning" style="font-size: 80%;">Optimization and Deep learning</a></li>
@@ -268,48 +267,47 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs020.html#extending-to-more-predictors" style="font-size: 80%;">Extending to more predictors</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs021.html#including-more-classes" style="font-size: 80%;">Including more classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs022.html#more-classes" style="font-size: 80%;">More classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#friday-september-23" style="font-size: 80%;">Friday September 23</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs048.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs064.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs049.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
</ul>
</li>
@@ -367,7 +365,7 @@ $$
<li><a href="._week38-bs024.html">25</a></li>
<li><a href="._week38-bs025.html">26</a></li>
<li><a href="">...</a></li>
<li><a href="._week38-bs064.html">65</a></li>
<li><a href="._week38-bs063.html">64</a></li>
<li><a href="._week38-bs017.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+45 -47
View File
@@ -48,10 +48,10 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
2,
None,
'plans-for-the-lab-sessions'),
('Material for lecture Thursday September 21',
('Material for lecture Monday September 16',
2,
None,
'material-for-lecture-thursday-september-21'),
'material-for-lecture-monday-september-16'),
('Logistic Regression', 2, None, 'logistic-regression'),
('Classification problems', 2, None, 'classification-problems'),
('Optimization and Deep learning',
@@ -92,7 +92,6 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
'extending-to-more-predictors'),
('Including more classes', 2, None, 'including-more-classes'),
('More classes', 2, None, 'more-classes'),
('Friday September 23', 2, None, 'friday-september-23'),
('Searching for Optimal Regularization Parameters $\\lambda$',
2,
None,
@@ -249,7 +248,7 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs001.html#plans-for-week-38-lecture-monday-september-16" style="font-size: 80%;">Plans for week 38, lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs002.html#suggested-reading-and-videos" style="font-size: 80%;">Suggested reading and videos</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs003.html#plans-for-the-lab-sessions" style="font-size: 80%;">Plans for the lab sessions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-thursday-september-21" style="font-size: 80%;">Material for lecture Thursday September 21</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-monday-september-16" style="font-size: 80%;">Material for lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs005.html#logistic-regression" style="font-size: 80%;">Logistic Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs006.html#classification-problems" style="font-size: 80%;">Classification problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs007.html#optimization-and-deep-learning" style="font-size: 80%;">Optimization and Deep learning</a></li>
@@ -268,48 +267,47 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs020.html#extending-to-more-predictors" style="font-size: 80%;">Extending to more predictors</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs021.html#including-more-classes" style="font-size: 80%;">Including more classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs022.html#more-classes" style="font-size: 80%;">More classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#friday-september-23" style="font-size: 80%;">Friday September 23</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs048.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs064.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs049.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
</ul>
</li>
@@ -364,7 +362,7 @@ in practice we often supplement the cross-entropy with additional regularization
<li><a href="._week38-bs025.html">26</a></li>
<li><a href="._week38-bs026.html">27</a></li>
<li><a href="">...</a></li>
<li><a href="._week38-bs064.html">65</a></li>
<li><a href="._week38-bs063.html">64</a></li>
<li><a href="._week38-bs018.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+45 -47
View File
@@ -48,10 +48,10 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
2,
None,
'plans-for-the-lab-sessions'),
('Material for lecture Thursday September 21',
('Material for lecture Monday September 16',
2,
None,
'material-for-lecture-thursday-september-21'),
'material-for-lecture-monday-september-16'),
('Logistic Regression', 2, None, 'logistic-regression'),
('Classification problems', 2, None, 'classification-problems'),
('Optimization and Deep learning',
@@ -92,7 +92,6 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
'extending-to-more-predictors'),
('Including more classes', 2, None, 'including-more-classes'),
('More classes', 2, None, 'more-classes'),
('Friday September 23', 2, None, 'friday-september-23'),
('Searching for Optimal Regularization Parameters $\\lambda$',
2,
None,
@@ -249,7 +248,7 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs001.html#plans-for-week-38-lecture-monday-september-16" style="font-size: 80%;">Plans for week 38, lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs002.html#suggested-reading-and-videos" style="font-size: 80%;">Suggested reading and videos</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs003.html#plans-for-the-lab-sessions" style="font-size: 80%;">Plans for the lab sessions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-thursday-september-21" style="font-size: 80%;">Material for lecture Thursday September 21</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-monday-september-16" style="font-size: 80%;">Material for lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs005.html#logistic-regression" style="font-size: 80%;">Logistic Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs006.html#classification-problems" style="font-size: 80%;">Classification problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs007.html#optimization-and-deep-learning" style="font-size: 80%;">Optimization and Deep learning</a></li>
@@ -268,48 +267,47 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs020.html#extending-to-more-predictors" style="font-size: 80%;">Extending to more predictors</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs021.html#including-more-classes" style="font-size: 80%;">Including more classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs022.html#more-classes" style="font-size: 80%;">More classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#friday-september-23" style="font-size: 80%;">Friday September 23</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs048.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs064.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs049.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
</ul>
</li>
@@ -366,7 +364,7 @@ $$
<li><a href="._week38-bs026.html">27</a></li>
<li><a href="._week38-bs027.html">28</a></li>
<li><a href="">...</a></li>
<li><a href="._week38-bs064.html">65</a></li>
<li><a href="._week38-bs063.html">64</a></li>
<li><a href="._week38-bs019.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+45 -47
View File
@@ -48,10 +48,10 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
2,
None,
'plans-for-the-lab-sessions'),
('Material for lecture Thursday September 21',
('Material for lecture Monday September 16',
2,
None,
'material-for-lecture-thursday-september-21'),
'material-for-lecture-monday-september-16'),
('Logistic Regression', 2, None, 'logistic-regression'),
('Classification problems', 2, None, 'classification-problems'),
('Optimization and Deep learning',
@@ -92,7 +92,6 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
'extending-to-more-predictors'),
('Including more classes', 2, None, 'including-more-classes'),
('More classes', 2, None, 'more-classes'),
('Friday September 23', 2, None, 'friday-september-23'),
('Searching for Optimal Regularization Parameters $\\lambda$',
2,
None,
@@ -249,7 +248,7 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs001.html#plans-for-week-38-lecture-monday-september-16" style="font-size: 80%;">Plans for week 38, lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs002.html#suggested-reading-and-videos" style="font-size: 80%;">Suggested reading and videos</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs003.html#plans-for-the-lab-sessions" style="font-size: 80%;">Plans for the lab sessions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-thursday-september-21" style="font-size: 80%;">Material for lecture Thursday September 21</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-monday-september-16" style="font-size: 80%;">Material for lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs005.html#logistic-regression" style="font-size: 80%;">Logistic Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs006.html#classification-problems" style="font-size: 80%;">Classification problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs007.html#optimization-and-deep-learning" style="font-size: 80%;">Optimization and Deep learning</a></li>
@@ -268,48 +267,47 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs020.html#extending-to-more-predictors" style="font-size: 80%;">Extending to more predictors</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs021.html#including-more-classes" style="font-size: 80%;">Including more classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs022.html#more-classes" style="font-size: 80%;">More classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#friday-september-23" style="font-size: 80%;">Friday September 23</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs048.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs064.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs049.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
</ul>
</li>
@@ -367,7 +365,7 @@ $$
<li><a href="._week38-bs027.html">28</a></li>
<li><a href="._week38-bs028.html">29</a></li>
<li><a href="">...</a></li>
<li><a href="._week38-bs064.html">65</a></li>
<li><a href="._week38-bs063.html">64</a></li>
<li><a href="._week38-bs020.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+45 -47
View File
@@ -48,10 +48,10 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
2,
None,
'plans-for-the-lab-sessions'),
('Material for lecture Thursday September 21',
('Material for lecture Monday September 16',
2,
None,
'material-for-lecture-thursday-september-21'),
'material-for-lecture-monday-september-16'),
('Logistic Regression', 2, None, 'logistic-regression'),
('Classification problems', 2, None, 'classification-problems'),
('Optimization and Deep learning',
@@ -92,7 +92,6 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
'extending-to-more-predictors'),
('Including more classes', 2, None, 'including-more-classes'),
('More classes', 2, None, 'more-classes'),
('Friday September 23', 2, None, 'friday-september-23'),
('Searching for Optimal Regularization Parameters $\\lambda$',
2,
None,
@@ -249,7 +248,7 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs001.html#plans-for-week-38-lecture-monday-september-16" style="font-size: 80%;">Plans for week 38, lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs002.html#suggested-reading-and-videos" style="font-size: 80%;">Suggested reading and videos</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs003.html#plans-for-the-lab-sessions" style="font-size: 80%;">Plans for the lab sessions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-thursday-september-21" style="font-size: 80%;">Material for lecture Thursday September 21</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-monday-september-16" style="font-size: 80%;">Material for lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs005.html#logistic-regression" style="font-size: 80%;">Logistic Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs006.html#classification-problems" style="font-size: 80%;">Classification problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs007.html#optimization-and-deep-learning" style="font-size: 80%;">Optimization and Deep learning</a></li>
@@ -268,48 +267,47 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="#extending-to-more-predictors" style="font-size: 80%;">Extending to more predictors</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs021.html#including-more-classes" style="font-size: 80%;">Including more classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs022.html#more-classes" style="font-size: 80%;">More classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#friday-september-23" style="font-size: 80%;">Friday September 23</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs048.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs064.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs049.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
</ul>
</li>
@@ -359,7 +357,7 @@ $$
<li><a href="._week38-bs028.html">29</a></li>
<li><a href="._week38-bs029.html">30</a></li>
<li><a href="">...</a></li>
<li><a href="._week38-bs064.html">65</a></li>
<li><a href="._week38-bs063.html">64</a></li>
<li><a href="._week38-bs021.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+45 -47
View File
@@ -48,10 +48,10 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
2,
None,
'plans-for-the-lab-sessions'),
('Material for lecture Thursday September 21',
('Material for lecture Monday September 16',
2,
None,
'material-for-lecture-thursday-september-21'),
'material-for-lecture-monday-september-16'),
('Logistic Regression', 2, None, 'logistic-regression'),
('Classification problems', 2, None, 'classification-problems'),
('Optimization and Deep learning',
@@ -92,7 +92,6 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
'extending-to-more-predictors'),
('Including more classes', 2, None, 'including-more-classes'),
('More classes', 2, None, 'more-classes'),
('Friday September 23', 2, None, 'friday-september-23'),
('Searching for Optimal Regularization Parameters $\\lambda$',
2,
None,
@@ -249,7 +248,7 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs001.html#plans-for-week-38-lecture-monday-september-16" style="font-size: 80%;">Plans for week 38, lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs002.html#suggested-reading-and-videos" style="font-size: 80%;">Suggested reading and videos</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs003.html#plans-for-the-lab-sessions" style="font-size: 80%;">Plans for the lab sessions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-thursday-september-21" style="font-size: 80%;">Material for lecture Thursday September 21</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-monday-september-16" style="font-size: 80%;">Material for lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs005.html#logistic-regression" style="font-size: 80%;">Logistic Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs006.html#classification-problems" style="font-size: 80%;">Classification problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs007.html#optimization-and-deep-learning" style="font-size: 80%;">Optimization and Deep learning</a></li>
@@ -268,48 +267,47 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs020.html#extending-to-more-predictors" style="font-size: 80%;">Extending to more predictors</a></li>
<!-- navigation toc: --> <li><a href="#including-more-classes" style="font-size: 80%;">Including more classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs022.html#more-classes" style="font-size: 80%;">More classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#friday-september-23" style="font-size: 80%;">Friday September 23</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs048.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs064.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs049.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
</ul>
</li>
@@ -371,7 +369,7 @@ $$
<li><a href="._week38-bs029.html">30</a></li>
<li><a href="._week38-bs030.html">31</a></li>
<li><a href="">...</a></li>
<li><a href="._week38-bs064.html">65</a></li>
<li><a href="._week38-bs063.html">64</a></li>
<li><a href="._week38-bs022.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+45 -47
View File
@@ -48,10 +48,10 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
2,
None,
'plans-for-the-lab-sessions'),
('Material for lecture Thursday September 21',
('Material for lecture Monday September 16',
2,
None,
'material-for-lecture-thursday-september-21'),
'material-for-lecture-monday-september-16'),
('Logistic Regression', 2, None, 'logistic-regression'),
('Classification problems', 2, None, 'classification-problems'),
('Optimization and Deep learning',
@@ -92,7 +92,6 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
'extending-to-more-predictors'),
('Including more classes', 2, None, 'including-more-classes'),
('More classes', 2, None, 'more-classes'),
('Friday September 23', 2, None, 'friday-september-23'),
('Searching for Optimal Regularization Parameters $\\lambda$',
2,
None,
@@ -249,7 +248,7 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs001.html#plans-for-week-38-lecture-monday-september-16" style="font-size: 80%;">Plans for week 38, lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs002.html#suggested-reading-and-videos" style="font-size: 80%;">Suggested reading and videos</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs003.html#plans-for-the-lab-sessions" style="font-size: 80%;">Plans for the lab sessions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-thursday-september-21" style="font-size: 80%;">Material for lecture Thursday September 21</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-monday-september-16" style="font-size: 80%;">Material for lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs005.html#logistic-regression" style="font-size: 80%;">Logistic Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs006.html#classification-problems" style="font-size: 80%;">Classification problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs007.html#optimization-and-deep-learning" style="font-size: 80%;">Optimization and Deep learning</a></li>
@@ -268,48 +267,47 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs020.html#extending-to-more-predictors" style="font-size: 80%;">Extending to more predictors</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs021.html#including-more-classes" style="font-size: 80%;">Including more classes</a></li>
<!-- navigation toc: --> <li><a href="#more-classes" style="font-size: 80%;">More classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#friday-september-23" style="font-size: 80%;">Friday September 23</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs048.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs064.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs049.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
</ul>
</li>
@@ -383,7 +381,7 @@ methods</a>.
<li><a href="._week38-bs030.html">31</a></li>
<li><a href="._week38-bs031.html">32</a></li>
<li><a href="">...</a></li>
<li><a href="._week38-bs064.html">65</a></li>
<li><a href="._week38-bs063.html">64</a></li>
<li><a href="._week38-bs023.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+125 -48
View File
@@ -48,10 +48,10 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
2,
None,
'plans-for-the-lab-sessions'),
('Material for lecture Thursday September 21',
('Material for lecture Monday September 16',
2,
None,
'material-for-lecture-thursday-september-21'),
'material-for-lecture-monday-september-16'),
('Logistic Regression', 2, None, 'logistic-regression'),
('Classification problems', 2, None, 'classification-problems'),
('Optimization and Deep learning',
@@ -92,7 +92,6 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
'extending-to-more-predictors'),
('Including more classes', 2, None, 'including-more-classes'),
('More classes', 2, None, 'more-classes'),
('Friday September 23', 2, None, 'friday-september-23'),
('Searching for Optimal Regularization Parameters $\\lambda$',
2,
None,
@@ -249,7 +248,7 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs001.html#plans-for-week-38-lecture-monday-september-16" style="font-size: 80%;">Plans for week 38, lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs002.html#suggested-reading-and-videos" style="font-size: 80%;">Suggested reading and videos</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs003.html#plans-for-the-lab-sessions" style="font-size: 80%;">Plans for the lab sessions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-thursday-september-21" style="font-size: 80%;">Material for lecture Thursday September 21</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-monday-september-16" style="font-size: 80%;">Material for lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs005.html#logistic-regression" style="font-size: 80%;">Logistic Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs006.html#classification-problems" style="font-size: 80%;">Classification problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs007.html#optimization-and-deep-learning" style="font-size: 80%;">Optimization and Deep learning</a></li>
@@ -268,48 +267,47 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs020.html#extending-to-more-predictors" style="font-size: 80%;">Extending to more predictors</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs021.html#including-more-classes" style="font-size: 80%;">Including more classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs022.html#more-classes" style="font-size: 80%;">More classes</a></li>
<!-- navigation toc: --> <li><a href="#friday-september-23" style="font-size: 80%;">Friday September 23</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs048.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs064.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
<!-- navigation toc: --> <li><a href="#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs049.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
</ul>
</li>
@@ -321,7 +319,86 @@ MathJax.Hub.Config({
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0023"></a>
<!-- !split -->
<h2 id="friday-september-23" class="anchor">Friday September 23 </h2>
<h2 id="searching-for-optimal-regularization-parameters-lambda" class="anchor">Searching for Optimal Regularization Parameters \( \lambda \) </h2>
<p>In project 1, when using Ridge and Lasso regression, we end up
searching for the optimal parameter \( \lambda \) which minimizes our
selected scores (MSE or \( R2 \) values for example). The brute force
approach, as discussed in the code here for Ridge regression, consists
in evaluating the MSE as function of different \( \lambda \) values.
Based on these calculations, one tries then to determine the value of the hyperparameter \( \lambda \)
which results in optimal scores (for example the smallest MSE or an \( R2=1 \)).
</p>
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
<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">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
<span style="color: #008000; font-weight: bold">def</span> <span style="color: #0000FF">MSE</span>(y_data,y_model):
n <span style="color: #666666">=</span> np<span style="color: #666666">.</span>size(y_model)
<span style="color: #008000; font-weight: bold">return</span> np<span style="color: #666666">.</span>sum((y_data<span style="color: #666666">-</span>y_model)<span style="color: #666666">**2</span>)<span style="color: #666666">/</span>n
<span style="color: #408080; font-style: italic"># A seed just to ensure that the random numbers are the same for every run.</span>
<span style="color: #408080; font-style: italic"># Useful for eventual debugging.</span>
np<span style="color: #666666">.</span>random<span style="color: #666666">.</span>seed(<span style="color: #666666">2021</span>)
n <span style="color: #666666">=</span> <span style="color: #666666">100</span>
x <span style="color: #666666">=</span> np<span style="color: #666666">.</span>random<span style="color: #666666">.</span>rand(n)
y <span style="color: #666666">=</span> np<span style="color: #666666">.</span>exp(<span style="color: #666666">-</span>x<span style="color: #666666">**2</span>) <span style="color: #666666">+</span> <span style="color: #666666">1.5</span> <span style="color: #666666">*</span> np<span style="color: #666666">.</span>exp(<span style="color: #666666">-</span>(x<span style="color: #666666">-2</span>)<span style="color: #666666">**2</span>)<span style="color: #666666">+</span> np<span style="color: #666666">.</span>random<span style="color: #666666">.</span>randn(n)
Maxpolydegree <span style="color: #666666">=</span> <span style="color: #666666">5</span>
X <span style="color: #666666">=</span> np<span style="color: #666666">.</span>zeros((n,Maxpolydegree<span style="color: #666666">-1</span>))
<span style="color: #008000; font-weight: bold">for</span> degree <span style="color: #AA22FF; font-weight: bold">in</span> <span style="color: #008000">range</span>(<span style="color: #666666">1</span>,Maxpolydegree): <span style="color: #408080; font-style: italic">#No intercept column</span>
X[:,degree<span style="color: #666666">-1</span>] <span style="color: #666666">=</span> x<span style="color: #666666">**</span>(degree)
<span style="color: #408080; font-style: italic"># We split the data in test and training data</span>
X_train, X_test, y_train, y_test <span style="color: #666666">=</span> train_test_split(X, y, test_size<span style="color: #666666">=0.2</span>)
<span style="color: #408080; font-style: italic"># Decide which values of lambda to use</span>
nlambdas <span style="color: #666666">=</span> <span style="color: #666666">500</span>
MSERidgePredict <span style="color: #666666">=</span> np<span style="color: #666666">.</span>zeros(nlambdas)
lambdas <span style="color: #666666">=</span> np<span style="color: #666666">.</span>logspace(<span style="color: #666666">-4</span>, <span style="color: #666666">2</span>, nlambdas)
<span style="color: #008000; font-weight: bold">for</span> i <span style="color: #AA22FF; font-weight: bold">in</span> <span style="color: #008000">range</span>(nlambdas):
lmb <span style="color: #666666">=</span> lambdas[i]
RegRidge <span style="color: #666666">=</span> linear_model<span style="color: #666666">.</span>Ridge(lmb)
RegRidge<span style="color: #666666">.</span>fit(X_train,y_train)
ypredictRidge <span style="color: #666666">=</span> RegRidge<span style="color: #666666">.</span>predict(X_test)
MSERidgePredict[i] <span style="color: #666666">=</span> MSE(y_test,ypredictRidge)
<span style="color: #408080; font-style: italic"># Now plot the results</span>
plt<span style="color: #666666">.</span>figure()
plt<span style="color: #666666">.</span>plot(np<span style="color: #666666">.</span>log10(lambdas), MSERidgePredict, <span style="color: #BA2121">&#39;g--&#39;</span>, label <span style="color: #666666">=</span> <span style="color: #BA2121">&#39;MSE SL Ridge Test&#39;</span>)
plt<span style="color: #666666">.</span>xlabel(<span style="color: #BA2121">&#39;log10(lambda)&#39;</span>)
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>
</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>Here we have performed a rather data greedy calculation as function of the regularization parameter \( \lambda \). There is no resampling here. The latter can easily be added by employing the function <b>RidgeCV</b> instead of just calling the <b>Ridge</b> function. For <b>RidgeCV</b> we need to pass the array of \( \lambda \) values.
By inspecting the figure we can in turn determine which is the optimal regularization parameter.
This becomes however less functional in the long run.
</p>
<p>
<!-- navigation buttons at the bottom of the page -->
@@ -348,7 +425,7 @@ MathJax.Hub.Config({
<li><a href="._week38-bs031.html">32</a></li>
<li><a href="._week38-bs032.html">33</a></li>
<li><a href="">...</a></li>
<li><a href="._week38-bs064.html">65</a></li>
<li><a href="._week38-bs063.html">64</a></li>
<li><a href="._week38-bs024.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+73 -77
View File
@@ -48,10 +48,10 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
2,
None,
'plans-for-the-lab-sessions'),
('Material for lecture Thursday September 21',
('Material for lecture Monday September 16',
2,
None,
'material-for-lecture-thursday-september-21'),
'material-for-lecture-monday-september-16'),
('Logistic Regression', 2, None, 'logistic-regression'),
('Classification problems', 2, None, 'classification-problems'),
('Optimization and Deep learning',
@@ -92,7 +92,6 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
'extending-to-more-predictors'),
('Including more classes', 2, None, 'including-more-classes'),
('More classes', 2, None, 'more-classes'),
('Friday September 23', 2, None, 'friday-september-23'),
('Searching for Optimal Regularization Parameters $\\lambda$',
2,
None,
@@ -249,7 +248,7 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs001.html#plans-for-week-38-lecture-monday-september-16" style="font-size: 80%;">Plans for week 38, lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs002.html#suggested-reading-and-videos" style="font-size: 80%;">Suggested reading and videos</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs003.html#plans-for-the-lab-sessions" style="font-size: 80%;">Plans for the lab sessions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-thursday-september-21" style="font-size: 80%;">Material for lecture Thursday September 21</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-monday-september-16" style="font-size: 80%;">Material for lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs005.html#logistic-regression" style="font-size: 80%;">Logistic Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs006.html#classification-problems" style="font-size: 80%;">Classification problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs007.html#optimization-and-deep-learning" style="font-size: 80%;">Optimization and Deep learning</a></li>
@@ -268,48 +267,47 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs020.html#extending-to-more-predictors" style="font-size: 80%;">Extending to more predictors</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs021.html#including-more-classes" style="font-size: 80%;">Including more classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs022.html#more-classes" style="font-size: 80%;">More classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#friday-september-23" style="font-size: 80%;">Friday September 23</a></li>
<!-- navigation toc: --> <li><a href="#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs048.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs064.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs049.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
</ul>
</li>
@@ -321,17 +319,14 @@ MathJax.Hub.Config({
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0024"></a>
<!-- !split -->
<h2 id="searching-for-optimal-regularization-parameters-lambda" class="anchor">Searching for Optimal Regularization Parameters \( \lambda \) </h2>
<h2 id="grid-search" class="anchor">Grid Search </h2>
<p>In project 1, when using Ridge and Lasso regression, we end up
searching for the optimal parameter \( \lambda \) which minimizes our
selected scores (MSE or \( R2 \) values for example). The brute force
approach, as discussed in the code here for Ridge regression, consists
in evaluating the MSE as function of different \( \lambda \) values.
Based on these calculations, one tries then to determine the value of the hyperparameter \( \lambda \)
which results in optimal scores (for example the smallest MSE or an \( R2=1 \)).
<p>An alternative is to use the so-called grid search functionality
included with the library <b>Scikit-Learn</b>, as demonstrated for the same
example here.
</p>
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
@@ -339,14 +334,17 @@ which results in optimal scores (for example the smallest MSE or an \( R2=1 \)).
<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">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
<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
<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> GridSearchCV
<span style="color: #008000; font-weight: bold">def</span> <span style="color: #0000FF">R2</span>(y_data, y_model):
<span style="color: #008000; font-weight: bold">return</span> <span style="color: #666666">1</span> <span style="color: #666666">-</span> np<span style="color: #666666">.</span>sum((y_data <span style="color: #666666">-</span> y_model) <span style="color: #666666">**</span> <span style="color: #666666">2</span>) <span style="color: #666666">/</span> np<span style="color: #666666">.</span>sum((y_data <span style="color: #666666">-</span> np<span style="color: #666666">.</span>mean(y_data)) <span style="color: #666666">**</span> <span style="color: #666666">2</span>)
<span style="color: #008000; font-weight: bold">def</span> <span style="color: #0000FF">MSE</span>(y_data,y_model):
n <span style="color: #666666">=</span> np<span style="color: #666666">.</span>size(y_model)
<span style="color: #008000; font-weight: bold">return</span> np<span style="color: #666666">.</span>sum((y_data<span style="color: #666666">-</span>y_model)<span style="color: #666666">**2</span>)<span style="color: #666666">/</span>n
<span style="color: #408080; font-style: italic"># A seed just to ensure that the random numbers are the same for every run.</span>
<span style="color: #408080; font-style: italic"># Useful for eventual debugging.</span>
np<span style="color: #666666">.</span>random<span style="color: #666666">.</span>seed(<span style="color: #666666">2021</span>)
@@ -365,23 +363,18 @@ X <span style="color: #666666">=</span> np<span style="color: #666666">.</span>z
X_train, X_test, y_train, y_test <span style="color: #666666">=</span> train_test_split(X, y, test_size<span style="color: #666666">=0.2</span>)
<span style="color: #408080; font-style: italic"># Decide which values of lambda to use</span>
nlambdas <span style="color: #666666">=</span> <span style="color: #666666">500</span>
MSERidgePredict <span style="color: #666666">=</span> np<span style="color: #666666">.</span>zeros(nlambdas)
nlambdas <span style="color: #666666">=</span> <span style="color: #666666">10</span>
lambdas <span style="color: #666666">=</span> np<span style="color: #666666">.</span>logspace(<span style="color: #666666">-4</span>, <span style="color: #666666">2</span>, nlambdas)
<span style="color: #008000; font-weight: bold">for</span> i <span style="color: #AA22FF; font-weight: bold">in</span> <span style="color: #008000">range</span>(nlambdas):
lmb <span style="color: #666666">=</span> lambdas[i]
RegRidge <span style="color: #666666">=</span> linear_model<span style="color: #666666">.</span>Ridge(lmb)
RegRidge<span style="color: #666666">.</span>fit(X_train,y_train)
ypredictRidge <span style="color: #666666">=</span> RegRidge<span style="color: #666666">.</span>predict(X_test)
MSERidgePredict[i] <span style="color: #666666">=</span> MSE(y_test,ypredictRidge)
<span style="color: #408080; font-style: italic"># Now plot the results</span>
plt<span style="color: #666666">.</span>figure()
plt<span style="color: #666666">.</span>plot(np<span style="color: #666666">.</span>log10(lambdas), MSERidgePredict, <span style="color: #BA2121">&#39;g--&#39;</span>, label <span style="color: #666666">=</span> <span style="color: #BA2121">&#39;MSE SL Ridge Test&#39;</span>)
plt<span style="color: #666666">.</span>xlabel(<span style="color: #BA2121">&#39;log10(lambda)&#39;</span>)
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()
<span style="color: #408080; font-style: italic"># create and fit a ridge regression model, testing each alpha</span>
model <span style="color: #666666">=</span> Ridge()
gridsearch <span style="color: #666666">=</span> GridSearchCV(estimator<span style="color: #666666">=</span>model, param_grid<span style="color: #666666">=</span><span style="color: #008000">dict</span>(alpha<span style="color: #666666">=</span>lambdas))
gridsearch<span style="color: #666666">.</span>fit(X_train, y_train)
<span style="color: #008000">print</span>(gridsearch)
ypredictRidge <span style="color: #666666">=</span> gridsearch<span style="color: #666666">.</span>predict(X_test)
<span style="color: #408080; font-style: italic"># summarize the results of the grid search</span>
<span style="color: #008000">print</span>(<span style="color: #BA2121">f&quot;Best estimated lambda-value: </span><span style="color: #BB6688; font-weight: bold">{</span>gridsearch<span style="color: #666666">.</span>best_estimator_<span style="color: #666666">.</span>alpha<span style="color: #BB6688; font-weight: bold">}</span><span style="color: #BA2121">&quot;</span>)
<span style="color: #008000">print</span>(<span style="color: #BA2121">f&quot;MSE score: </span><span style="color: #BB6688; font-weight: bold">{</span>MSE(y_test,ypredictRidge)<span style="color: #BB6688; font-weight: bold">}</span><span style="color: #BA2121">&quot;</span>)
<span style="color: #008000">print</span>(<span style="color: #BA2121">f&quot;R2 score: </span><span style="color: #BB6688; font-weight: bold">{</span>R2(y_test,ypredictRidge)<span style="color: #BB6688; font-weight: bold">}</span><span style="color: #BA2121">&quot;</span>)
</pre>
</div>
</div>
@@ -397,11 +390,14 @@ plt<span style="color: #666666">.</span>show()
</div>
</div>
<p>Here we have performed a rather data greedy calculation as function of the regularization parameter \( \lambda \). There is no resampling here. The latter can easily be added by employing the function <b>RidgeCV</b> instead of just calling the <b>Ridge</b> function. For <b>RidgeCV</b> we need to pass the array of \( \lambda \) values.
By inspecting the figure we can in turn determine which is the optimal regularization parameter.
This becomes however less functional in the long run.
<p>By default the grid search function includes cross validation with
five folds. The <a href="https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.GridSearchCV.html#sklearn.model_selection.GridSearchCV" target="_self">Scikit-Learn
documentation</a>
contains more information on how to set the different parameters.
</p>
<p>If we take out the random noise, running the above codes results in \( \lambda=0 \) yielding the best fit. </p>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -427,7 +423,7 @@ This becomes however less functional in the long run.
<li><a href="._week38-bs032.html">33</a></li>
<li><a href="._week38-bs033.html">34</a></li>
<li><a href="">...</a></li>
<li><a href="._week38-bs064.html">65</a></li>
<li><a href="._week38-bs063.html">64</a></li>
<li><a href="._week38-bs025.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+59 -62
View File
@@ -48,10 +48,10 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
2,
None,
'plans-for-the-lab-sessions'),
('Material for lecture Thursday September 21',
('Material for lecture Monday September 16',
2,
None,
'material-for-lecture-thursday-september-21'),
'material-for-lecture-monday-september-16'),
('Logistic Regression', 2, None, 'logistic-regression'),
('Classification problems', 2, None, 'classification-problems'),
('Optimization and Deep learning',
@@ -92,7 +92,6 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
'extending-to-more-predictors'),
('Including more classes', 2, None, 'including-more-classes'),
('More classes', 2, None, 'more-classes'),
('Friday September 23', 2, None, 'friday-september-23'),
('Searching for Optimal Regularization Parameters $\\lambda$',
2,
None,
@@ -249,7 +248,7 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs001.html#plans-for-week-38-lecture-monday-september-16" style="font-size: 80%;">Plans for week 38, lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs002.html#suggested-reading-and-videos" style="font-size: 80%;">Suggested reading and videos</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs003.html#plans-for-the-lab-sessions" style="font-size: 80%;">Plans for the lab sessions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-thursday-september-21" style="font-size: 80%;">Material for lecture Thursday September 21</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-monday-september-16" style="font-size: 80%;">Material for lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs005.html#logistic-regression" style="font-size: 80%;">Logistic Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs006.html#classification-problems" style="font-size: 80%;">Classification problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs007.html#optimization-and-deep-learning" style="font-size: 80%;">Optimization and Deep learning</a></li>
@@ -268,48 +267,47 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs020.html#extending-to-more-predictors" style="font-size: 80%;">Extending to more predictors</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs021.html#including-more-classes" style="font-size: 80%;">Including more classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs022.html#more-classes" style="font-size: 80%;">More classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#friday-september-23" style="font-size: 80%;">Friday September 23</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs048.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs064.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs049.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
</ul>
</li>
@@ -321,11 +319,16 @@ MathJax.Hub.Config({
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0025"></a>
<!-- !split -->
<h2 id="grid-search" class="anchor">Grid Search </h2>
<h2 id="randomized-grid-search" class="anchor">Randomized Grid Search </h2>
<p>An alternative is to use the so-called grid search functionality
included with the library <b>Scikit-Learn</b>, as demonstrated for the same
example here.
<p>An alternative to the above manual grid set up, is to use a random
search where the parameters are tuned from a random distribution
(uniform below) for a fixed number of iterations. A model is
constructed and evaluated for each combination of chosen parameters.
We repeat the previous example but now with a random search. Note
that values of \( \lambda \) are now limited to be within \( x\in
[0,1] \). This domain may not be the most relevant one for the specific
case under study.
</p>
@@ -339,6 +342,9 @@ example here.
<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.linear_model</span> <span style="color: #008000; font-weight: bold">import</span> Ridge
<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> GridSearchCV
<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> uniform <span style="color: #008000; font-weight: bold">as</span> randuniform
<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> RandomizedSearchCV
<span style="color: #008000; font-weight: bold">def</span> <span style="color: #0000FF">R2</span>(y_data, y_model):
<span style="color: #008000; font-weight: bold">return</span> <span style="color: #666666">1</span> <span style="color: #666666">-</span> np<span style="color: #666666">.</span>sum((y_data <span style="color: #666666">-</span> y_model) <span style="color: #666666">**</span> <span style="color: #666666">2</span>) <span style="color: #666666">/</span> np<span style="color: #666666">.</span>sum((y_data <span style="color: #666666">-</span> np<span style="color: #666666">.</span>mean(y_data)) <span style="color: #666666">**</span> <span style="color: #666666">2</span>)
@@ -364,12 +370,10 @@ X <span style="color: #666666">=</span> np<span style="color: #666666">.</span>z
<span style="color: #408080; font-style: italic"># We split the data in test and training data</span>
X_train, X_test, y_train, y_test <span style="color: #666666">=</span> train_test_split(X, y, test_size<span style="color: #666666">=0.2</span>)
<span style="color: #408080; font-style: italic"># Decide which values of lambda to use</span>
nlambdas <span style="color: #666666">=</span> <span style="color: #666666">10</span>
lambdas <span style="color: #666666">=</span> np<span style="color: #666666">.</span>logspace(<span style="color: #666666">-4</span>, <span style="color: #666666">2</span>, nlambdas)
param_grid <span style="color: #666666">=</span> {<span style="color: #BA2121">&#39;alpha&#39;</span>: randuniform()}
<span style="color: #408080; font-style: italic"># create and fit a ridge regression model, testing each alpha</span>
model <span style="color: #666666">=</span> Ridge()
gridsearch <span style="color: #666666">=</span> GridSearchCV(estimator<span style="color: #666666">=</span>model, param_grid<span style="color: #666666">=</span><span style="color: #008000">dict</span>(alpha<span style="color: #666666">=</span>lambdas))
gridsearch <span style="color: #666666">=</span> RandomizedSearchCV(estimator<span style="color: #666666">=</span>model, param_distributions<span style="color: #666666">=</span>param_grid, n_iter<span style="color: #666666">=100</span>)
gridsearch<span style="color: #666666">.</span>fit(X_train, y_train)
<span style="color: #008000">print</span>(gridsearch)
ypredictRidge <span style="color: #666666">=</span> gridsearch<span style="color: #666666">.</span>predict(X_test)
@@ -392,13 +396,6 @@ ypredictRidge <span style="color: #666666">=</span> gridsearch<span style="color
</div>
</div>
<p>By default the grid search function includes cross validation with
five folds. The <a href="https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.GridSearchCV.html#sklearn.model_selection.GridSearchCV" target="_self">Scikit-Learn
documentation</a>
contains more information on how to set the different parameters.
</p>
<p>If we take out the random noise, running the above codes results in \( \lambda=0 \) yielding the best fit. </p>
<p>
<!-- navigation buttons at the bottom of the page -->
@@ -425,7 +422,7 @@ contains more information on how to set the different parameters.
<li><a href="._week38-bs033.html">34</a></li>
<li><a href="._week38-bs034.html">35</a></li>
<li><a href="">...</a></li>
<li><a href="._week38-bs064.html">65</a></li>
<li><a href="._week38-bs063.html">64</a></li>
<li><a href="._week38-bs026.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+63 -97
View File
@@ -48,10 +48,10 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
2,
None,
'plans-for-the-lab-sessions'),
('Material for lecture Thursday September 21',
('Material for lecture Monday September 16',
2,
None,
'material-for-lecture-thursday-september-21'),
'material-for-lecture-monday-september-16'),
('Logistic Regression', 2, None, 'logistic-regression'),
('Classification problems', 2, None, 'classification-problems'),
('Optimization and Deep learning',
@@ -92,7 +92,6 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
'extending-to-more-predictors'),
('Including more classes', 2, None, 'including-more-classes'),
('More classes', 2, None, 'more-classes'),
('Friday September 23', 2, None, 'friday-september-23'),
('Searching for Optimal Regularization Parameters $\\lambda$',
2,
None,
@@ -249,7 +248,7 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs001.html#plans-for-week-38-lecture-monday-september-16" style="font-size: 80%;">Plans for week 38, lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs002.html#suggested-reading-and-videos" style="font-size: 80%;">Suggested reading and videos</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs003.html#plans-for-the-lab-sessions" style="font-size: 80%;">Plans for the lab sessions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-thursday-september-21" style="font-size: 80%;">Material for lecture Thursday September 21</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-monday-september-16" style="font-size: 80%;">Material for lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs005.html#logistic-regression" style="font-size: 80%;">Logistic Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs006.html#classification-problems" style="font-size: 80%;">Classification problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs007.html#optimization-and-deep-learning" style="font-size: 80%;">Optimization and Deep learning</a></li>
@@ -268,48 +267,47 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs020.html#extending-to-more-predictors" style="font-size: 80%;">Extending to more predictors</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs021.html#including-more-classes" style="font-size: 80%;">Including more classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs022.html#more-classes" style="font-size: 80%;">More classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#friday-september-23" style="font-size: 80%;">Friday September 23</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs048.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs064.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs049.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
</ul>
</li>
@@ -321,16 +319,11 @@ MathJax.Hub.Config({
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0026"></a>
<!-- !split -->
<h2 id="randomized-grid-search" class="anchor">Randomized Grid Search </h2>
<h2 id="wisconsin-cancer-data" class="anchor">Wisconsin Cancer Data </h2>
<p>An alternative to the above manual grid set up, is to use a random
search where the parameters are tuned from a random distribution
(uniform below) for a fixed number of iterations. A model is
constructed and evaluated for each combination of chosen parameters.
We repeat the previous example but now with a random search. Note
that values of \( \lambda \) are now limited to be within \( x\in
[0,1] \). This domain may not be the most relevant one for the specific
case under study.
<p>We show here how we can use a simple regression case on the breast
cancer data using Logistic regression as our algorithm for
classification.
</p>
@@ -340,49 +333,22 @@ case under study.
<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">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.linear_model</span> <span style="color: #008000; font-weight: bold">import</span> Ridge
<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> GridSearchCV
<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> uniform <span style="color: #008000; font-weight: bold">as</span> randuniform
<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> RandomizedSearchCV
<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.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.datasets</span> <span style="color: #008000; font-weight: bold">import</span> load_breast_cancer
<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> LogisticRegression
<span style="color: #408080; font-style: italic"># Load the data</span>
cancer <span style="color: #666666">=</span> load_breast_cancer()
<span style="color: #008000; font-weight: bold">def</span> <span style="color: #0000FF">R2</span>(y_data, y_model):
<span style="color: #008000; font-weight: bold">return</span> <span style="color: #666666">1</span> <span style="color: #666666">-</span> np<span style="color: #666666">.</span>sum((y_data <span style="color: #666666">-</span> y_model) <span style="color: #666666">**</span> <span style="color: #666666">2</span>) <span style="color: #666666">/</span> np<span style="color: #666666">.</span>sum((y_data <span style="color: #666666">-</span> np<span style="color: #666666">.</span>mean(y_data)) <span style="color: #666666">**</span> <span style="color: #666666">2</span>)
<span style="color: #008000; font-weight: bold">def</span> <span style="color: #0000FF">MSE</span>(y_data,y_model):
n <span style="color: #666666">=</span> np<span style="color: #666666">.</span>size(y_model)
<span style="color: #008000; font-weight: bold">return</span> np<span style="color: #666666">.</span>sum((y_data<span style="color: #666666">-</span>y_model)<span style="color: #666666">**2</span>)<span style="color: #666666">/</span>n
<span style="color: #408080; font-style: italic"># A seed just to ensure that the random numbers are the same for every run.</span>
<span style="color: #408080; font-style: italic"># Useful for eventual debugging.</span>
np<span style="color: #666666">.</span>random<span style="color: #666666">.</span>seed(<span style="color: #666666">2021</span>)
n <span style="color: #666666">=</span> <span style="color: #666666">100</span>
x <span style="color: #666666">=</span> np<span style="color: #666666">.</span>random<span style="color: #666666">.</span>rand(n)
y <span style="color: #666666">=</span> np<span style="color: #666666">.</span>exp(<span style="color: #666666">-</span>x<span style="color: #666666">**2</span>) <span style="color: #666666">+</span> <span style="color: #666666">1.5</span> <span style="color: #666666">*</span> np<span style="color: #666666">.</span>exp(<span style="color: #666666">-</span>(x<span style="color: #666666">-2</span>)<span style="color: #666666">**2</span>)<span style="color: #666666">+</span> np<span style="color: #666666">.</span>random<span style="color: #666666">.</span>randn(n)
Maxpolydegree <span style="color: #666666">=</span> <span style="color: #666666">5</span>
X <span style="color: #666666">=</span> np<span style="color: #666666">.</span>zeros((n,Maxpolydegree<span style="color: #666666">-1</span>))
<span style="color: #008000; font-weight: bold">for</span> degree <span style="color: #AA22FF; font-weight: bold">in</span> <span style="color: #008000">range</span>(<span style="color: #666666">1</span>,Maxpolydegree): <span style="color: #408080; font-style: italic">#No intercept column</span>
X[:,degree<span style="color: #666666">-1</span>] <span style="color: #666666">=</span> x<span style="color: #666666">**</span>(degree)
<span style="color: #408080; font-style: italic"># We split the data in test and training data</span>
X_train, X_test, y_train, y_test <span style="color: #666666">=</span> train_test_split(X, y, test_size<span style="color: #666666">=0.2</span>)
param_grid <span style="color: #666666">=</span> {<span style="color: #BA2121">&#39;alpha&#39;</span>: randuniform()}
<span style="color: #408080; font-style: italic"># create and fit a ridge regression model, testing each alpha</span>
model <span style="color: #666666">=</span> Ridge()
gridsearch <span style="color: #666666">=</span> RandomizedSearchCV(estimator<span style="color: #666666">=</span>model, param_distributions<span style="color: #666666">=</span>param_grid, n_iter<span style="color: #666666">=100</span>)
gridsearch<span style="color: #666666">.</span>fit(X_train, y_train)
<span style="color: #008000">print</span>(gridsearch)
ypredictRidge <span style="color: #666666">=</span> gridsearch<span style="color: #666666">.</span>predict(X_test)
<span style="color: #408080; font-style: italic"># summarize the results of the grid search</span>
<span style="color: #008000">print</span>(<span style="color: #BA2121">f&quot;Best estimated lambda-value: </span><span style="color: #BB6688; font-weight: bold">{</span>gridsearch<span style="color: #666666">.</span>best_estimator_<span style="color: #666666">.</span>alpha<span style="color: #BB6688; font-weight: bold">}</span><span style="color: #BA2121">&quot;</span>)
<span style="color: #008000">print</span>(<span style="color: #BA2121">f&quot;MSE score: </span><span style="color: #BB6688; font-weight: bold">{</span>MSE(y_test,ypredictRidge)<span style="color: #BB6688; font-weight: bold">}</span><span style="color: #BA2121">&quot;</span>)
<span style="color: #008000">print</span>(<span style="color: #BA2121">f&quot;R2 score: </span><span style="color: #BB6688; font-weight: bold">{</span>R2(y_test,ypredictRidge)<span style="color: #BB6688; font-weight: bold">}</span><span style="color: #BA2121">&quot;</span>)
X_train, X_test, y_train, y_test <span style="color: #666666">=</span> train_test_split(cancer<span style="color: #666666">.</span>data,cancer<span style="color: #666666">.</span>target,random_state<span style="color: #666666">=0</span>)
<span style="color: #008000">print</span>(X_train<span style="color: #666666">.</span>shape)
<span style="color: #008000">print</span>(X_test<span style="color: #666666">.</span>shape)
<span style="color: #408080; font-style: italic"># Logistic Regression</span>
logreg <span style="color: #666666">=</span> LogisticRegression(solver<span style="color: #666666">=</span><span style="color: #BA2121">&#39;lbfgs&#39;</span>)
logreg<span style="color: #666666">.</span>fit(X_train, y_train)
<span style="color: #008000">print</span>(<span style="color: #BA2121">&quot;Test set accuracy with Logistic Regression: </span><span style="color: #BB6688; font-weight: bold">{:.2f}</span><span style="color: #BA2121">&quot;</span><span style="color: #666666">.</span>format(logreg<span style="color: #666666">.</span>score(X_test,y_test)))
</pre>
</div>
</div>
@@ -424,7 +390,7 @@ ypredictRidge <span style="color: #666666">=</span> gridsearch<span style="color
<li><a href="._week38-bs034.html">35</a></li>
<li><a href="._week38-bs035.html">36</a></li>
<li><a href="">...</a></li>
<li><a href="._week38-bs064.html">65</a></li>
<li><a href="._week38-bs063.html">64</a></li>
<li><a href="._week38-bs027.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+75 -61
View File
@@ -48,10 +48,10 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
2,
None,
'plans-for-the-lab-sessions'),
('Material for lecture Thursday September 21',
('Material for lecture Monday September 16',
2,
None,
'material-for-lecture-thursday-september-21'),
'material-for-lecture-monday-september-16'),
('Logistic Regression', 2, None, 'logistic-regression'),
('Classification problems', 2, None, 'classification-problems'),
('Optimization and Deep learning',
@@ -92,7 +92,6 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
'extending-to-more-predictors'),
('Including more classes', 2, None, 'including-more-classes'),
('More classes', 2, None, 'more-classes'),
('Friday September 23', 2, None, 'friday-september-23'),
('Searching for Optimal Regularization Parameters $\\lambda$',
2,
None,
@@ -249,7 +248,7 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs001.html#plans-for-week-38-lecture-monday-september-16" style="font-size: 80%;">Plans for week 38, lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs002.html#suggested-reading-and-videos" style="font-size: 80%;">Suggested reading and videos</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs003.html#plans-for-the-lab-sessions" style="font-size: 80%;">Plans for the lab sessions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-thursday-september-21" style="font-size: 80%;">Material for lecture Thursday September 21</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-monday-september-16" style="font-size: 80%;">Material for lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs005.html#logistic-regression" style="font-size: 80%;">Logistic Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs006.html#classification-problems" style="font-size: 80%;">Classification problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs007.html#optimization-and-deep-learning" style="font-size: 80%;">Optimization and Deep learning</a></li>
@@ -268,48 +267,47 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs020.html#extending-to-more-predictors" style="font-size: 80%;">Extending to more predictors</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs021.html#including-more-classes" style="font-size: 80%;">Including more classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs022.html#more-classes" style="font-size: 80%;">More classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#friday-september-23" style="font-size: 80%;">Friday September 23</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs048.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs064.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs049.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
</ul>
</li>
@@ -321,14 +319,12 @@ MathJax.Hub.Config({
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0027"></a>
<!-- !split -->
<h2 id="wisconsin-cancer-data" class="anchor">Wisconsin Cancer Data </h2>
<h2 id="using-the-correlation-matrix" class="anchor">Using the correlation matrix </h2>
<p>We show here how we can use a simple regression case on the breast
cancer data using Logistic regression as our algorithm for
classification.
<p>In addition to the above scores, we could also study the covariance (and the correlation matrix).
We use <b>Pandas</b> to compute the correlation matrix.
</p>
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
@@ -340,17 +336,35 @@ classification.
<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.datasets</span> <span style="color: #008000; font-weight: bold">import</span> load_breast_cancer
<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> LogisticRegression
<span style="color: #408080; font-style: italic"># Load the data</span>
cancer <span style="color: #666666">=</span> load_breast_cancer()
<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: #408080; font-style: italic"># Making a data frame</span>
cancerpd <span style="color: #666666">=</span> pd<span style="color: #666666">.</span>DataFrame(cancer<span style="color: #666666">.</span>data, columns<span style="color: #666666">=</span>cancer<span style="color: #666666">.</span>feature_names)
X_train, X_test, y_train, y_test <span style="color: #666666">=</span> train_test_split(cancer<span style="color: #666666">.</span>data,cancer<span style="color: #666666">.</span>target,random_state<span style="color: #666666">=0</span>)
<span style="color: #008000">print</span>(X_train<span style="color: #666666">.</span>shape)
<span style="color: #008000">print</span>(X_test<span style="color: #666666">.</span>shape)
<span style="color: #408080; font-style: italic"># Logistic Regression</span>
logreg <span style="color: #666666">=</span> LogisticRegression(solver<span style="color: #666666">=</span><span style="color: #BA2121">&#39;lbfgs&#39;</span>)
logreg<span style="color: #666666">.</span>fit(X_train, y_train)
<span style="color: #008000">print</span>(<span style="color: #BA2121">&quot;Test set accuracy with Logistic Regression: </span><span style="color: #BB6688; font-weight: bold">{:.2f}</span><span style="color: #BA2121">&quot;</span><span style="color: #666666">.</span>format(logreg<span style="color: #666666">.</span>score(X_test,y_test)))
fig, axes <span style="color: #666666">=</span> plt<span style="color: #666666">.</span>subplots(<span style="color: #666666">15</span>,<span style="color: #666666">2</span>,figsize<span style="color: #666666">=</span>(<span style="color: #666666">10</span>,<span style="color: #666666">20</span>))
malignant <span style="color: #666666">=</span> cancer<span style="color: #666666">.</span>data[cancer<span style="color: #666666">.</span>target <span style="color: #666666">==</span> <span style="color: #666666">0</span>]
benign <span style="color: #666666">=</span> cancer<span style="color: #666666">.</span>data[cancer<span style="color: #666666">.</span>target <span style="color: #666666">==</span> <span style="color: #666666">1</span>]
ax <span style="color: #666666">=</span> axes<span style="color: #666666">.</span>ravel()
<span style="color: #008000; font-weight: bold">for</span> i <span style="color: #AA22FF; font-weight: bold">in</span> <span style="color: #008000">range</span>(<span style="color: #666666">30</span>):
_, bins <span style="color: #666666">=</span> np<span style="color: #666666">.</span>histogram(cancer<span style="color: #666666">.</span>data[:,i], bins <span style="color: #666666">=50</span>)
ax[i]<span style="color: #666666">.</span>hist(malignant[:,i], bins <span style="color: #666666">=</span> bins, alpha <span style="color: #666666">=</span> <span style="color: #666666">0.5</span>)
ax[i]<span style="color: #666666">.</span>hist(benign[:,i], bins <span style="color: #666666">=</span> bins, alpha <span style="color: #666666">=</span> <span style="color: #666666">0.5</span>)
ax[i]<span style="color: #666666">.</span>set_title(cancer<span style="color: #666666">.</span>feature_names[i])
ax[i]<span style="color: #666666">.</span>set_yticks(())
ax[<span style="color: #666666">0</span>]<span style="color: #666666">.</span>set_xlabel(<span style="color: #BA2121">&quot;Feature magnitude&quot;</span>)
ax[<span style="color: #666666">0</span>]<span style="color: #666666">.</span>set_ylabel(<span style="color: #BA2121">&quot;Frequency&quot;</span>)
ax[<span style="color: #666666">0</span>]<span style="color: #666666">.</span>legend([<span style="color: #BA2121">&quot;Malignant&quot;</span>, <span style="color: #BA2121">&quot;Benign&quot;</span>], loc <span style="color: #666666">=</span><span style="color: #BA2121">&quot;best&quot;</span>)
fig<span style="color: #666666">.</span>tight_layout()
plt<span style="color: #666666">.</span>show()
<span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">seaborn</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">sns</span>
correlation_matrix <span style="color: #666666">=</span> cancerpd<span style="color: #666666">.</span>corr()<span style="color: #666666">.</span>round(<span style="color: #666666">1</span>)
<span style="color: #408080; font-style: italic"># use the heatmap function from seaborn to plot the correlation matrix</span>
<span style="color: #408080; font-style: italic"># annot = True to print the values inside the square</span>
plt<span style="color: #666666">.</span>figure(figsize<span style="color: #666666">=</span>(<span style="color: #666666">15</span>,<span style="color: #666666">8</span>))
sns<span style="color: #666666">.</span>heatmap(data<span style="color: #666666">=</span>correlation_matrix, annot<span style="color: #666666">=</span><span style="color: #008000; font-weight: bold">True</span>)
plt<span style="color: #666666">.</span>show()
</pre>
</div>
</div>
@@ -392,7 +406,7 @@ logreg<span style="color: #666666">.</span>fit(X_train, y_train)
<li><a href="._week38-bs035.html">36</a></li>
<li><a href="._week38-bs036.html">37</a></li>
<li><a href="">...</a></li>
<li><a href="._week38-bs064.html">65</a></li>
<li><a href="._week38-bs063.html">64</a></li>
<li><a href="._week38-bs028.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+90 -84
View File
@@ -48,10 +48,10 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
2,
None,
'plans-for-the-lab-sessions'),
('Material for lecture Thursday September 21',
('Material for lecture Monday September 16',
2,
None,
'material-for-lecture-thursday-september-21'),
'material-for-lecture-monday-september-16'),
('Logistic Regression', 2, None, 'logistic-regression'),
('Classification problems', 2, None, 'classification-problems'),
('Optimization and Deep learning',
@@ -92,7 +92,6 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
'extending-to-more-predictors'),
('Including more classes', 2, None, 'including-more-classes'),
('More classes', 2, None, 'more-classes'),
('Friday September 23', 2, None, 'friday-september-23'),
('Searching for Optimal Regularization Parameters $\\lambda$',
2,
None,
@@ -249,7 +248,7 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs001.html#plans-for-week-38-lecture-monday-september-16" style="font-size: 80%;">Plans for week 38, lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs002.html#suggested-reading-and-videos" style="font-size: 80%;">Suggested reading and videos</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs003.html#plans-for-the-lab-sessions" style="font-size: 80%;">Plans for the lab sessions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-thursday-september-21" style="font-size: 80%;">Material for lecture Thursday September 21</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-monday-september-16" style="font-size: 80%;">Material for lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs005.html#logistic-regression" style="font-size: 80%;">Logistic Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs006.html#classification-problems" style="font-size: 80%;">Classification problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs007.html#optimization-and-deep-learning" style="font-size: 80%;">Optimization and Deep learning</a></li>
@@ -268,48 +267,47 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs020.html#extending-to-more-predictors" style="font-size: 80%;">Extending to more predictors</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs021.html#including-more-classes" style="font-size: 80%;">Including more classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs022.html#more-classes" style="font-size: 80%;">More classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#friday-september-23" style="font-size: 80%;">Friday September 23</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs048.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs064.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs049.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
</ul>
</li>
@@ -321,52 +319,31 @@ MathJax.Hub.Config({
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0028"></a>
<!-- !split -->
<h2 id="using-the-correlation-matrix" class="anchor">Using the correlation matrix </h2>
<h2 id="discussing-the-correlation-data" class="anchor">Discussing the correlation data </h2>
<p>In addition to the above scores, we could also study the covariance (and the correlation matrix).
We use <b>Pandas</b> to compute the correlation matrix.
<p>In the above example we note two things. In the first plot we display
the overlap of benign and malignant tumors as functions of the various
features in the Wisconsing breast cancer data set. We see that for
some of the features we can distinguish clearly the benign and
malignant cases while for other features we cannot. This can point to
us which features may be of greater interest when we wish to classify
a benign or not benign tumour.
</p>
<p>In the second figure we have computed the so-called correlation
matrix, which in our case with thirty features becomes a \( 30\times 30 \)
matrix.
</p>
<p>We constructed this matrix using <b>pandas</b> via the statements</p>
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
<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.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.datasets</span> <span style="color: #008000; font-weight: bold">import</span> load_breast_cancer
<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> LogisticRegression
cancer <span style="color: #666666">=</span> load_breast_cancer()
<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: #408080; font-style: italic"># Making a data frame</span>
cancerpd <span style="color: #666666">=</span> pd<span style="color: #666666">.</span>DataFrame(cancer<span style="color: #666666">.</span>data, columns<span style="color: #666666">=</span>cancer<span style="color: #666666">.</span>feature_names)
fig, axes <span style="color: #666666">=</span> plt<span style="color: #666666">.</span>subplots(<span style="color: #666666">15</span>,<span style="color: #666666">2</span>,figsize<span style="color: #666666">=</span>(<span style="color: #666666">10</span>,<span style="color: #666666">20</span>))
malignant <span style="color: #666666">=</span> cancer<span style="color: #666666">.</span>data[cancer<span style="color: #666666">.</span>target <span style="color: #666666">==</span> <span style="color: #666666">0</span>]
benign <span style="color: #666666">=</span> cancer<span style="color: #666666">.</span>data[cancer<span style="color: #666666">.</span>target <span style="color: #666666">==</span> <span style="color: #666666">1</span>]
ax <span style="color: #666666">=</span> axes<span style="color: #666666">.</span>ravel()
<span style="color: #008000; font-weight: bold">for</span> i <span style="color: #AA22FF; font-weight: bold">in</span> <span style="color: #008000">range</span>(<span style="color: #666666">30</span>):
_, bins <span style="color: #666666">=</span> np<span style="color: #666666">.</span>histogram(cancer<span style="color: #666666">.</span>data[:,i], bins <span style="color: #666666">=50</span>)
ax[i]<span style="color: #666666">.</span>hist(malignant[:,i], bins <span style="color: #666666">=</span> bins, alpha <span style="color: #666666">=</span> <span style="color: #666666">0.5</span>)
ax[i]<span style="color: #666666">.</span>hist(benign[:,i], bins <span style="color: #666666">=</span> bins, alpha <span style="color: #666666">=</span> <span style="color: #666666">0.5</span>)
ax[i]<span style="color: #666666">.</span>set_title(cancer<span style="color: #666666">.</span>feature_names[i])
ax[i]<span style="color: #666666">.</span>set_yticks(())
ax[<span style="color: #666666">0</span>]<span style="color: #666666">.</span>set_xlabel(<span style="color: #BA2121">&quot;Feature magnitude&quot;</span>)
ax[<span style="color: #666666">0</span>]<span style="color: #666666">.</span>set_ylabel(<span style="color: #BA2121">&quot;Frequency&quot;</span>)
ax[<span style="color: #666666">0</span>]<span style="color: #666666">.</span>legend([<span style="color: #BA2121">&quot;Malignant&quot;</span>, <span style="color: #BA2121">&quot;Benign&quot;</span>], loc <span style="color: #666666">=</span><span style="color: #BA2121">&quot;best&quot;</span>)
fig<span style="color: #666666">.</span>tight_layout()
plt<span style="color: #666666">.</span>show()
<span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">seaborn</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">sns</span>
correlation_matrix <span style="color: #666666">=</span> cancerpd<span style="color: #666666">.</span>corr()<span style="color: #666666">.</span>round(<span style="color: #666666">1</span>)
<span style="color: #408080; font-style: italic"># use the heatmap function from seaborn to plot the correlation matrix</span>
<span style="color: #408080; font-style: italic"># annot = True to print the values inside the square</span>
plt<span style="color: #666666">.</span>figure(figsize<span style="color: #666666">=</span>(<span style="color: #666666">15</span>,<span style="color: #666666">8</span>))
sns<span style="color: #666666">.</span>heatmap(data<span style="color: #666666">=</span>correlation_matrix, annot<span style="color: #666666">=</span><span style="color: #008000; font-weight: bold">True</span>)
plt<span style="color: #666666">.</span>show()
<pre style="line-height: 125%;">cancerpd <span style="color: #666666">=</span> pd<span style="color: #666666">.</span>DataFrame(cancer<span style="color: #666666">.</span>data, columns<span style="color: #666666">=</span>cancer<span style="color: #666666">.</span>feature_names)
</pre>
</div>
</div>
@@ -382,6 +359,35 @@ plt<span style="color: #666666">.</span>show()
</div>
</div>
<p>and then</p>
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
<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%;">correlation_matrix <span style="color: #666666">=</span> cancerpd<span style="color: #666666">.</span>corr()<span style="color: #666666">.</span>round(<span style="color: #666666">1</span>)
</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>Diagonalizing this matrix we can in turn say something about which
features are of relevance and which are not. This leads us to
the classical Principal Component Analysis (PCA) theorem with
applications. This will be discussed later this semester (<a href="https://compphysics.github.io/MachineLearning/doc/pub/week43/html/week43-bs.html" target="_self">week 43</a>).
</p>
<p>
<!-- navigation buttons at the bottom of the page -->
@@ -408,7 +414,7 @@ plt<span style="color: #666666">.</span>show()
<li><a href="._week38-bs036.html">37</a></li>
<li><a href="._week38-bs037.html">38</a></li>
<li><a href="">...</a></li>
<li><a href="._week38-bs064.html">65</a></li>
<li><a href="._week38-bs063.html">64</a></li>
<li><a href="._week38-bs029.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+78 -94
View File
@@ -48,10 +48,10 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
2,
None,
'plans-for-the-lab-sessions'),
('Material for lecture Thursday September 21',
('Material for lecture Monday September 16',
2,
None,
'material-for-lecture-thursday-september-21'),
'material-for-lecture-monday-september-16'),
('Logistic Regression', 2, None, 'logistic-regression'),
('Classification problems', 2, None, 'classification-problems'),
('Optimization and Deep learning',
@@ -92,7 +92,6 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
'extending-to-more-predictors'),
('Including more classes', 2, None, 'including-more-classes'),
('More classes', 2, None, 'more-classes'),
('Friday September 23', 2, None, 'friday-september-23'),
('Searching for Optimal Regularization Parameters $\\lambda$',
2,
None,
@@ -249,7 +248,7 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs001.html#plans-for-week-38-lecture-monday-september-16" style="font-size: 80%;">Plans for week 38, lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs002.html#suggested-reading-and-videos" style="font-size: 80%;">Suggested reading and videos</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs003.html#plans-for-the-lab-sessions" style="font-size: 80%;">Plans for the lab sessions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-thursday-september-21" style="font-size: 80%;">Material for lecture Thursday September 21</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-monday-september-16" style="font-size: 80%;">Material for lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs005.html#logistic-regression" style="font-size: 80%;">Logistic Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs006.html#classification-problems" style="font-size: 80%;">Classification problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs007.html#optimization-and-deep-learning" style="font-size: 80%;">Optimization and Deep learning</a></li>
@@ -268,48 +267,47 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs020.html#extending-to-more-predictors" style="font-size: 80%;">Extending to more predictors</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs021.html#including-more-classes" style="font-size: 80%;">Including more classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs022.html#more-classes" style="font-size: 80%;">More classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#friday-september-23" style="font-size: 80%;">Friday September 23</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs048.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs064.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs049.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
</ul>
</li>
@@ -321,23 +319,7 @@ MathJax.Hub.Config({
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0029"></a>
<!-- !split -->
<h2 id="discussing-the-correlation-data" class="anchor">Discussing the correlation data </h2>
<p>In the above example we note two things. In the first plot we display
the overlap of benign and malignant tumors as functions of the various
features in the Wisconsing breast cancer data set. We see that for
some of the features we can distinguish clearly the benign and
malignant cases while for other features we cannot. This can point to
us which features may be of greater interest when we wish to classify
a benign or not benign tumour.
</p>
<p>In the second figure we have computed the so-called correlation
matrix, which in our case with thirty features becomes a \( 30\times 30 \)
matrix.
</p>
<p>We constructed this matrix using <b>pandas</b> via the statements</p>
<h2 id="other-measures-in-classification-studies-cancer-data-again" class="anchor">Other measures in classification studies: Cancer Data again </h2>
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
<div class="cell border-box-sizing code_cell rendered">
@@ -345,7 +327,38 @@ matrix.
<div class="inner_cell">
<div class="input_area">
<div class="highlight" style="background: #f8f8f8">
<pre style="line-height: 125%;">cancerpd <span style="color: #666666">=</span> pd<span style="color: #666666">.</span>DataFrame(cancer<span style="color: #666666">.</span>data, columns<span style="color: #666666">=</span>cancer<span style="color: #666666">.</span>feature_names)
<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.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.datasets</span> <span style="color: #008000; font-weight: bold">import</span> load_breast_cancer
<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> LogisticRegression
<span style="color: #408080; font-style: italic"># Load the data</span>
cancer <span style="color: #666666">=</span> load_breast_cancer()
X_train, X_test, y_train, y_test <span style="color: #666666">=</span> train_test_split(cancer<span style="color: #666666">.</span>data,cancer<span style="color: #666666">.</span>target,random_state<span style="color: #666666">=0</span>)
<span style="color: #008000">print</span>(X_train<span style="color: #666666">.</span>shape)
<span style="color: #008000">print</span>(X_test<span style="color: #666666">.</span>shape)
<span style="color: #408080; font-style: italic"># Logistic Regression</span>
logreg <span style="color: #666666">=</span> LogisticRegression(solver<span style="color: #666666">=</span><span style="color: #BA2121">&#39;lbfgs&#39;</span>)
logreg<span style="color: #666666">.</span>fit(X_train, y_train)
<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> LabelEncoder
<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> cross_validate
<span style="color: #408080; font-style: italic">#Cross validation</span>
accuracy <span style="color: #666666">=</span> cross_validate(logreg,X_test,y_test,cv<span style="color: #666666">=10</span>)[<span style="color: #BA2121">&#39;test_score&#39;</span>]
<span style="color: #008000">print</span>(accuracy)
<span style="color: #008000">print</span>(<span style="color: #BA2121">&quot;Test set accuracy with Logistic Regression: </span><span style="color: #BB6688; font-weight: bold">{:.2f}</span><span style="color: #BA2121">&quot;</span><span style="color: #666666">.</span>format(logreg<span style="color: #666666">.</span>score(X_test,y_test)))
<span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">scikitplot</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">skplt</span>
y_pred <span style="color: #666666">=</span> logreg<span style="color: #666666">.</span>predict(X_test)
skplt<span style="color: #666666">.</span>metrics<span style="color: #666666">.</span>plot_confusion_matrix(y_test, y_pred, normalize<span style="color: #666666">=</span><span style="color: #008000; font-weight: bold">True</span>)
plt<span style="color: #666666">.</span>show()
y_probas <span style="color: #666666">=</span> logreg<span style="color: #666666">.</span>predict_proba(X_test)
skplt<span style="color: #666666">.</span>metrics<span style="color: #666666">.</span>plot_roc(y_test, y_probas)
plt<span style="color: #666666">.</span>show()
skplt<span style="color: #666666">.</span>metrics<span style="color: #666666">.</span>plot_cumulative_gain(y_test, y_probas)
plt<span style="color: #666666">.</span>show()
</pre>
</div>
</div>
@@ -361,35 +374,6 @@ matrix.
</div>
</div>
<p>and then</p>
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
<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%;">correlation_matrix <span style="color: #666666">=</span> cancerpd<span style="color: #666666">.</span>corr()<span style="color: #666666">.</span>round(<span style="color: #666666">1</span>)
</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>Diagonalizing this matrix we can in turn say something about which
features are of relevance and which are not. This leads us to
the classical Principal Component Analysis (PCA) theorem with
applications. This will be discussed later this semester (<a href="https://compphysics.github.io/MachineLearning/doc/pub/week43/html/week43-bs.html" target="_self">week 43</a>).
</p>
<p>
<!-- navigation buttons at the bottom of the page -->
@@ -416,7 +400,7 @@ applications. This will be discussed later this semester (<a href="https://compp
<li><a href="._week38-bs037.html">38</a></li>
<li><a href="._week38-bs038.html">39</a></li>
<li><a href="">...</a></li>
<li><a href="._week38-bs064.html">65</a></li>
<li><a href="._week38-bs063.html">64</a></li>
<li><a href="._week38-bs030.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+56 -100
View File
@@ -48,10 +48,10 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
2,
None,
'plans-for-the-lab-sessions'),
('Material for lecture Thursday September 21',
('Material for lecture Monday September 16',
2,
None,
'material-for-lecture-thursday-september-21'),
'material-for-lecture-monday-september-16'),
('Logistic Regression', 2, None, 'logistic-regression'),
('Classification problems', 2, None, 'classification-problems'),
('Optimization and Deep learning',
@@ -92,7 +92,6 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
'extending-to-more-predictors'),
('Including more classes', 2, None, 'including-more-classes'),
('More classes', 2, None, 'more-classes'),
('Friday September 23', 2, None, 'friday-september-23'),
('Searching for Optimal Regularization Parameters $\\lambda$',
2,
None,
@@ -249,7 +248,7 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs001.html#plans-for-week-38-lecture-monday-september-16" style="font-size: 80%;">Plans for week 38, lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs002.html#suggested-reading-and-videos" style="font-size: 80%;">Suggested reading and videos</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs003.html#plans-for-the-lab-sessions" style="font-size: 80%;">Plans for the lab sessions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-thursday-september-21" style="font-size: 80%;">Material for lecture Thursday September 21</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-monday-september-16" style="font-size: 80%;">Material for lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs005.html#logistic-regression" style="font-size: 80%;">Logistic Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs006.html#classification-problems" style="font-size: 80%;">Classification problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs007.html#optimization-and-deep-learning" style="font-size: 80%;">Optimization and Deep learning</a></li>
@@ -268,48 +267,47 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs020.html#extending-to-more-predictors" style="font-size: 80%;">Extending to more predictors</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs021.html#including-more-classes" style="font-size: 80%;">Including more classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs022.html#more-classes" style="font-size: 80%;">More classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#friday-september-23" style="font-size: 80%;">Friday September 23</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs048.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs064.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs049.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
</ul>
</li>
@@ -321,61 +319,19 @@ MathJax.Hub.Config({
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0030"></a>
<!-- !split -->
<h2 id="other-measures-in-classification-studies-cancer-data-again" class="anchor">Other measures in classification studies: Cancer Data again </h2>
<h2 id="optimization-the-central-part-of-any-machine-learning-algortithm" class="anchor">Optimization, the central part of any Machine Learning algortithm </h2>
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
<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.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.datasets</span> <span style="color: #008000; font-weight: bold">import</span> load_breast_cancer
<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> LogisticRegression
<span style="color: #408080; font-style: italic"># Load the data</span>
cancer <span style="color: #666666">=</span> load_breast_cancer()
X_train, X_test, y_train, y_test <span style="color: #666666">=</span> train_test_split(cancer<span style="color: #666666">.</span>data,cancer<span style="color: #666666">.</span>target,random_state<span style="color: #666666">=0</span>)
<span style="color: #008000">print</span>(X_train<span style="color: #666666">.</span>shape)
<span style="color: #008000">print</span>(X_test<span style="color: #666666">.</span>shape)
<span style="color: #408080; font-style: italic"># Logistic Regression</span>
logreg <span style="color: #666666">=</span> LogisticRegression(solver<span style="color: #666666">=</span><span style="color: #BA2121">&#39;lbfgs&#39;</span>)
logreg<span style="color: #666666">.</span>fit(X_train, y_train)
<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> LabelEncoder
<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> cross_validate
<span style="color: #408080; font-style: italic">#Cross validation</span>
accuracy <span style="color: #666666">=</span> cross_validate(logreg,X_test,y_test,cv<span style="color: #666666">=10</span>)[<span style="color: #BA2121">&#39;test_score&#39;</span>]
<span style="color: #008000">print</span>(accuracy)
<span style="color: #008000">print</span>(<span style="color: #BA2121">&quot;Test set accuracy with Logistic Regression: </span><span style="color: #BB6688; font-weight: bold">{:.2f}</span><span style="color: #BA2121">&quot;</span><span style="color: #666666">.</span>format(logreg<span style="color: #666666">.</span>score(X_test,y_test)))
<span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">scikitplot</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">skplt</span>
y_pred <span style="color: #666666">=</span> logreg<span style="color: #666666">.</span>predict(X_test)
skplt<span style="color: #666666">.</span>metrics<span style="color: #666666">.</span>plot_confusion_matrix(y_test, y_pred, normalize<span style="color: #666666">=</span><span style="color: #008000; font-weight: bold">True</span>)
plt<span style="color: #666666">.</span>show()
y_probas <span style="color: #666666">=</span> logreg<span style="color: #666666">.</span>predict_proba(X_test)
skplt<span style="color: #666666">.</span>metrics<span style="color: #666666">.</span>plot_roc(y_test, y_probas)
plt<span style="color: #666666">.</span>show()
skplt<span style="color: #666666">.</span>metrics<span style="color: #666666">.</span>plot_cumulative_gain(y_test, y_probas)
plt<span style="color: #666666">.</span>show()
</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>
<a href="https://www.uio.no/studier/emner/matnat/fys/FYS-STK3155/h20/forelesningsvideoer/OverarchingAimsWeek39.mp4?vrtx=view-as-webpage" target="_self">Overview Video, why do we care about gradient methods?</a>
<p>Almost every problem in machine learning and data science starts with
a dataset \( X \), a model \( g(\beta) \), which is a function of the
parameters \( \beta \) and a cost function \( C(X, g(\beta)) \) that allows
us to judge how well the model \( g(\beta) \) explains the observations
\( X \). The model is fit by finding the values of \( \beta \) that minimize
the cost function. Ideally we would be able to solve for \( \beta \)
analytically, however this is not possible in general and we must use
some approximative/numerical method to compute the minimum.
</p>
<p>
<!-- navigation buttons at the bottom of the page -->
@@ -402,7 +358,7 @@ plt<span style="color: #666666">.</span>show()
<li><a href="._week38-bs038.html">39</a></li>
<li><a href="._week38-bs039.html">40</a></li>
<li><a href="">...</a></li>
<li><a href="._week38-bs064.html">65</a></li>
<li><a href="._week38-bs063.html">64</a></li>
<li><a href="._week38-bs031.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+61 -58
View File
@@ -48,10 +48,10 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
2,
None,
'plans-for-the-lab-sessions'),
('Material for lecture Thursday September 21',
('Material for lecture Monday September 16',
2,
None,
'material-for-lecture-thursday-september-21'),
'material-for-lecture-monday-september-16'),
('Logistic Regression', 2, None, 'logistic-regression'),
('Classification problems', 2, None, 'classification-problems'),
('Optimization and Deep learning',
@@ -92,7 +92,6 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
'extending-to-more-predictors'),
('Including more classes', 2, None, 'including-more-classes'),
('More classes', 2, None, 'more-classes'),
('Friday September 23', 2, None, 'friday-september-23'),
('Searching for Optimal Regularization Parameters $\\lambda$',
2,
None,
@@ -249,7 +248,7 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs001.html#plans-for-week-38-lecture-monday-september-16" style="font-size: 80%;">Plans for week 38, lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs002.html#suggested-reading-and-videos" style="font-size: 80%;">Suggested reading and videos</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs003.html#plans-for-the-lab-sessions" style="font-size: 80%;">Plans for the lab sessions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-thursday-september-21" style="font-size: 80%;">Material for lecture Thursday September 21</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-monday-september-16" style="font-size: 80%;">Material for lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs005.html#logistic-regression" style="font-size: 80%;">Logistic Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs006.html#classification-problems" style="font-size: 80%;">Classification problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs007.html#optimization-and-deep-learning" style="font-size: 80%;">Optimization and Deep learning</a></li>
@@ -268,48 +267,47 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs020.html#extending-to-more-predictors" style="font-size: 80%;">Extending to more predictors</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs021.html#including-more-classes" style="font-size: 80%;">Including more classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs022.html#more-classes" style="font-size: 80%;">More classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#friday-september-23" style="font-size: 80%;">Friday September 23</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs048.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs064.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs049.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
</ul>
</li>
@@ -321,20 +319,25 @@ MathJax.Hub.Config({
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0031"></a>
<!-- !split -->
<h2 id="optimization-the-central-part-of-any-machine-learning-algortithm" class="anchor">Optimization, the central part of any Machine Learning algortithm </h2>
<h2 id="revisiting-our-logistic-regression-case" class="anchor">Revisiting our Logistic Regression case </h2>
<a href="https://www.uio.no/studier/emner/matnat/fys/FYS-STK3155/h20/forelesningsvideoer/OverarchingAimsWeek39.mp4?vrtx=view-as-webpage" target="_self">Overview Video, why do we care about gradient methods?</a>
<p>Almost every problem in machine learning and data science starts with
a dataset \( X \), a model \( g(\beta) \), which is a function of the
parameters \( \beta \) and a cost function \( C(X, g(\beta)) \) that allows
us to judge how well the model \( g(\beta) \) explains the observations
\( X \). The model is fit by finding the values of \( \beta \) that minimize
the cost function. Ideally we would be able to solve for \( \beta \)
analytically, however this is not possible in general and we must use
some approximative/numerical method to compute the minimum.
<p>In our discussion on Logistic Regression we studied the
case of
two classes, with \( y_i \) either
\( 0 \) or \( 1 \). Furthermore we assumed also that we have only two
parameters \( \beta \) in our fitting, that is we
defined probabilities
</p>
$$
\begin{align*}
p(y_i=1|x_i,\boldsymbol{\beta}) &= \frac{\exp{(\beta_0+\beta_1x_i)}}{1+\exp{(\beta_0+\beta_1x_i)}},\nonumber\\
p(y_i=0|x_i,\boldsymbol{\beta}) &= 1 - p(y_i=1|x_i,\boldsymbol{\beta}),
\end{align*}
$$
<p>where \( \boldsymbol{\beta} \) are the weights we wish to extract from data, in our case \( \beta_0 \) and \( \beta_1 \). </p>
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -360,7 +363,7 @@ some approximative/numerical method to compute the minimum.
<li><a href="._week38-bs039.html">40</a></li>
<li><a href="._week38-bs040.html">41</a></li>
<li><a href="">...</a></li>
<li><a href="._week38-bs064.html">65</a></li>
<li><a href="._week38-bs063.html">64</a></li>
<li><a href="._week38-bs032.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+61 -59
View File
@@ -48,10 +48,10 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
2,
None,
'plans-for-the-lab-sessions'),
('Material for lecture Thursday September 21',
('Material for lecture Monday September 16',
2,
None,
'material-for-lecture-thursday-september-21'),
'material-for-lecture-monday-september-16'),
('Logistic Regression', 2, None, 'logistic-regression'),
('Classification problems', 2, None, 'classification-problems'),
('Optimization and Deep learning',
@@ -92,7 +92,6 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
'extending-to-more-predictors'),
('Including more classes', 2, None, 'including-more-classes'),
('More classes', 2, None, 'more-classes'),
('Friday September 23', 2, None, 'friday-september-23'),
('Searching for Optimal Regularization Parameters $\\lambda$',
2,
None,
@@ -249,7 +248,7 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs001.html#plans-for-week-38-lecture-monday-september-16" style="font-size: 80%;">Plans for week 38, lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs002.html#suggested-reading-and-videos" style="font-size: 80%;">Suggested reading and videos</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs003.html#plans-for-the-lab-sessions" style="font-size: 80%;">Plans for the lab sessions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-thursday-september-21" style="font-size: 80%;">Material for lecture Thursday September 21</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-monday-september-16" style="font-size: 80%;">Material for lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs005.html#logistic-regression" style="font-size: 80%;">Logistic Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs006.html#classification-problems" style="font-size: 80%;">Classification problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs007.html#optimization-and-deep-learning" style="font-size: 80%;">Optimization and Deep learning</a></li>
@@ -268,48 +267,47 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs020.html#extending-to-more-predictors" style="font-size: 80%;">Extending to more predictors</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs021.html#including-more-classes" style="font-size: 80%;">Including more classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs022.html#more-classes" style="font-size: 80%;">More classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#friday-september-23" style="font-size: 80%;">Friday September 23</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs048.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs064.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs049.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
</ul>
</li>
@@ -321,24 +319,28 @@ MathJax.Hub.Config({
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0032"></a>
<!-- !split -->
<h2 id="revisiting-our-logistic-regression-case" class="anchor">Revisiting our Logistic Regression case </h2>
<h2 id="the-equations-to-solve" class="anchor">The equations to solve </h2>
<p>In our discussion on Logistic Regression we studied the
case of
two classes, with \( y_i \) either
\( 0 \) or \( 1 \). Furthermore we assumed also that we have only two
parameters \( \beta \) in our fitting, that is we
defined probabilities
<p>Our compact equations used a definition of a vector \( \boldsymbol{y} \) with \( n \)
elements \( y_i \), an \( n\times p \) matrix \( \boldsymbol{X} \) which contains the
\( x_i \) values and a vector \( \boldsymbol{p} \) of fitted probabilities
\( p(y_i\vert x_i,\boldsymbol{\beta}) \). We rewrote in a more compact form
the first derivative of the cost function as
</p>
$$
\begin{align*}
p(y_i=1|x_i,\boldsymbol{\beta}) &= \frac{\exp{(\beta_0+\beta_1x_i)}}{1+\exp{(\beta_0+\beta_1x_i)}},\nonumber\\
p(y_i=0|x_i,\boldsymbol{\beta}) &= 1 - p(y_i=1|x_i,\boldsymbol{\beta}),
\end{align*}
\frac{\partial \mathcal{C}(\boldsymbol{\beta})}{\partial \boldsymbol{\beta}} = -\boldsymbol{X}^T\left(\boldsymbol{y}-\boldsymbol{p}\right).
$$
<p>where \( \boldsymbol{\beta} \) are the weights we wish to extract from data, in our case \( \beta_0 \) and \( \beta_1 \). </p>
<p>If we in addition define a diagonal matrix \( \boldsymbol{W} \) with elements
\( p(y_i\vert x_i,\boldsymbol{\beta})(1-p(y_i\vert x_i,\boldsymbol{\beta}) \), we can obtain a compact expression of the second derivative as
</p>
$$
\frac{\partial^2 \mathcal{C}(\boldsymbol{\beta})}{\partial \boldsymbol{\beta}\partial \boldsymbol{\beta}^T} = \boldsymbol{X}^T\boldsymbol{W}\boldsymbol{X}.
$$
<p>This defines what is called the Hessian matrix.</p>
<p>
<!-- navigation buttons at the bottom of the page -->
@@ -365,7 +367,7 @@ $$
<li><a href="._week38-bs040.html">41</a></li>
<li><a href="._week38-bs041.html">42</a></li>
<li><a href="">...</a></li>
<li><a href="._week38-bs064.html">65</a></li>
<li><a href="._week38-bs063.html">64</a></li>
<li><a href="._week38-bs033.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+55 -60
View File
@@ -48,10 +48,10 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
2,
None,
'plans-for-the-lab-sessions'),
('Material for lecture Thursday September 21',
('Material for lecture Monday September 16',
2,
None,
'material-for-lecture-thursday-september-21'),
'material-for-lecture-monday-september-16'),
('Logistic Regression', 2, None, 'logistic-regression'),
('Classification problems', 2, None, 'classification-problems'),
('Optimization and Deep learning',
@@ -92,7 +92,6 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
'extending-to-more-predictors'),
('Including more classes', 2, None, 'including-more-classes'),
('More classes', 2, None, 'more-classes'),
('Friday September 23', 2, None, 'friday-september-23'),
('Searching for Optimal Regularization Parameters $\\lambda$',
2,
None,
@@ -249,7 +248,7 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs001.html#plans-for-week-38-lecture-monday-september-16" style="font-size: 80%;">Plans for week 38, lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs002.html#suggested-reading-and-videos" style="font-size: 80%;">Suggested reading and videos</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs003.html#plans-for-the-lab-sessions" style="font-size: 80%;">Plans for the lab sessions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-thursday-september-21" style="font-size: 80%;">Material for lecture Thursday September 21</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-monday-september-16" style="font-size: 80%;">Material for lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs005.html#logistic-regression" style="font-size: 80%;">Logistic Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs006.html#classification-problems" style="font-size: 80%;">Classification problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs007.html#optimization-and-deep-learning" style="font-size: 80%;">Optimization and Deep learning</a></li>
@@ -268,48 +267,47 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs020.html#extending-to-more-predictors" style="font-size: 80%;">Extending to more predictors</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs021.html#including-more-classes" style="font-size: 80%;">Including more classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs022.html#more-classes" style="font-size: 80%;">More classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#friday-september-23" style="font-size: 80%;">Friday September 23</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs048.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs064.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs049.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
</ul>
</li>
@@ -321,28 +319,25 @@ MathJax.Hub.Config({
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0033"></a>
<!-- !split -->
<h2 id="the-equations-to-solve" class="anchor">The equations to solve </h2>
<h2 id="solving-using-newton-raphson-s-method" class="anchor">Solving using Newton-Raphson's method </h2>
<p>Our compact equations used a definition of a vector \( \boldsymbol{y} \) with \( n \)
elements \( y_i \), an \( n\times p \) matrix \( \boldsymbol{X} \) which contains the
\( x_i \) values and a vector \( \boldsymbol{p} \) of fitted probabilities
\( p(y_i\vert x_i,\boldsymbol{\beta}) \). We rewrote in a more compact form
the first derivative of the cost function as
</p>
<p>If we can set up these equations, Newton-Raphson's iterative method is normally the method of choice. It requires however that we can compute in an efficient way the matrices that define the first and second derivatives. </p>
<p>Our iterative scheme is then given by</p>
$$
\frac{\partial \mathcal{C}(\boldsymbol{\beta})}{\partial \boldsymbol{\beta}} = -\boldsymbol{X}^T\left(\boldsymbol{y}-\boldsymbol{p}\right).
\boldsymbol{\beta}^{\mathrm{new}} = \boldsymbol{\beta}^{\mathrm{old}}-\left(\frac{\partial^2 \mathcal{C}(\boldsymbol{\beta})}{\partial \boldsymbol{\beta}\partial \boldsymbol{\beta}^T}\right)^{-1}_{\boldsymbol{\beta}^{\mathrm{old}}}\times \left(\frac{\partial \mathcal{C}(\boldsymbol{\beta})}{\partial \boldsymbol{\beta}}\right)_{\boldsymbol{\beta}^{\mathrm{old}}},
$$
<p>If we in addition define a diagonal matrix \( \boldsymbol{W} \) with elements
\( p(y_i\vert x_i,\boldsymbol{\beta})(1-p(y_i\vert x_i,\boldsymbol{\beta}) \), we can obtain a compact expression of the second derivative as
</p>
<p>or in matrix form as</p>
$$
\frac{\partial^2 \mathcal{C}(\boldsymbol{\beta})}{\partial \boldsymbol{\beta}\partial \boldsymbol{\beta}^T} = \boldsymbol{X}^T\boldsymbol{W}\boldsymbol{X}.
\boldsymbol{\beta}^{\mathrm{new}} = \boldsymbol{\beta}^{\mathrm{old}}-\left(\boldsymbol{X}^T\boldsymbol{W}\boldsymbol{X} \right)^{-1}\times \left(-\boldsymbol{X}^T(\boldsymbol{y}-\boldsymbol{p}) \right)_{\boldsymbol{\beta}^{\mathrm{old}}}.
$$
<p>This defines what is called the Hessian matrix.</p>
<p>The right-hand side is computed with the old values of \( \beta \). </p>
<p>If we can compute these matrices, in particular the Hessian, the above is often the easiest method to implement. </p>
<p>
<!-- navigation buttons at the bottom of the page -->
@@ -369,7 +364,7 @@ $$
<li><a href="._week38-bs041.html">42</a></li>
<li><a href="._week38-bs042.html">43</a></li>
<li><a href="">...</a></li>
<li><a href="._week38-bs064.html">65</a></li>
<li><a href="._week38-bs063.html">64</a></li>
<li><a href="._week38-bs034.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+55 -64
View File
@@ -48,10 +48,10 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
2,
None,
'plans-for-the-lab-sessions'),
('Material for lecture Thursday September 21',
('Material for lecture Monday September 16',
2,
None,
'material-for-lecture-thursday-september-21'),
'material-for-lecture-monday-september-16'),
('Logistic Regression', 2, None, 'logistic-regression'),
('Classification problems', 2, None, 'classification-problems'),
('Optimization and Deep learning',
@@ -92,7 +92,6 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
'extending-to-more-predictors'),
('Including more classes', 2, None, 'including-more-classes'),
('More classes', 2, None, 'more-classes'),
('Friday September 23', 2, None, 'friday-september-23'),
('Searching for Optimal Regularization Parameters $\\lambda$',
2,
None,
@@ -249,7 +248,7 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs001.html#plans-for-week-38-lecture-monday-september-16" style="font-size: 80%;">Plans for week 38, lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs002.html#suggested-reading-and-videos" style="font-size: 80%;">Suggested reading and videos</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs003.html#plans-for-the-lab-sessions" style="font-size: 80%;">Plans for the lab sessions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-thursday-september-21" style="font-size: 80%;">Material for lecture Thursday September 21</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-monday-september-16" style="font-size: 80%;">Material for lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs005.html#logistic-regression" style="font-size: 80%;">Logistic Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs006.html#classification-problems" style="font-size: 80%;">Classification problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs007.html#optimization-and-deep-learning" style="font-size: 80%;">Optimization and Deep learning</a></li>
@@ -268,48 +267,47 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs020.html#extending-to-more-predictors" style="font-size: 80%;">Extending to more predictors</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs021.html#including-more-classes" style="font-size: 80%;">Including more classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs022.html#more-classes" style="font-size: 80%;">More classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#friday-september-23" style="font-size: 80%;">Friday September 23</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs048.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs064.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs049.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
</ul>
</li>
@@ -321,25 +319,18 @@ MathJax.Hub.Config({
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0034"></a>
<!-- !split -->
<h2 id="solving-using-newton-raphson-s-method" class="anchor">Solving using Newton-Raphson's method </h2>
<h2 id="brief-reminder-on-newton-raphson-s-method" class="anchor">Brief reminder on Newton-Raphson's method </h2>
<p>If we can set up these equations, Newton-Raphson's iterative method is normally the method of choice. It requires however that we can compute in an efficient way the matrices that define the first and second derivatives. </p>
<p>Let us quickly remind ourselves how we derive the above method.</p>
<p>Our iterative scheme is then given by</p>
$$
\boldsymbol{\beta}^{\mathrm{new}} = \boldsymbol{\beta}^{\mathrm{old}}-\left(\frac{\partial^2 \mathcal{C}(\boldsymbol{\beta})}{\partial \boldsymbol{\beta}\partial \boldsymbol{\beta}^T}\right)^{-1}_{\boldsymbol{\beta}^{\mathrm{old}}}\times \left(\frac{\partial \mathcal{C}(\boldsymbol{\beta})}{\partial \boldsymbol{\beta}}\right)_{\boldsymbol{\beta}^{\mathrm{old}}},
$$
<p>or in matrix form as</p>
$$
\boldsymbol{\beta}^{\mathrm{new}} = \boldsymbol{\beta}^{\mathrm{old}}-\left(\boldsymbol{X}^T\boldsymbol{W}\boldsymbol{X} \right)^{-1}\times \left(-\boldsymbol{X}^T(\boldsymbol{y}-\boldsymbol{p}) \right)_{\boldsymbol{\beta}^{\mathrm{old}}}.
$$
<p>The right-hand side is computed with the old values of \( \beta \). </p>
<p>If we can compute these matrices, in particular the Hessian, the above is often the easiest method to implement. </p>
<p>Perhaps the most celebrated of all one-dimensional root-finding
routines is Newton's method, also called the Newton-Raphson
method. This method requires the evaluation of both the
function \( f \) and its derivative \( f' \) at arbitrary points.
If you can only calculate the derivative
numerically and/or your function is not of the smooth type, we
normally discourage the use of this method.
</p>
<p>
<!-- navigation buttons at the bottom of the page -->
@@ -366,7 +357,7 @@ $$
<li><a href="._week38-bs042.html">43</a></li>
<li><a href="._week38-bs043.html">44</a></li>
<li><a href="">...</a></li>
<li><a href="._week38-bs064.html">65</a></li>
<li><a href="._week38-bs063.html">64</a></li>
<li><a href="._week38-bs035.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+75 -57
View File
@@ -48,10 +48,10 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
2,
None,
'plans-for-the-lab-sessions'),
('Material for lecture Thursday September 21',
('Material for lecture Monday September 16',
2,
None,
'material-for-lecture-thursday-september-21'),
'material-for-lecture-monday-september-16'),
('Logistic Regression', 2, None, 'logistic-regression'),
('Classification problems', 2, None, 'classification-problems'),
('Optimization and Deep learning',
@@ -92,7 +92,6 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
'extending-to-more-predictors'),
('Including more classes', 2, None, 'including-more-classes'),
('More classes', 2, None, 'more-classes'),
('Friday September 23', 2, None, 'friday-september-23'),
('Searching for Optimal Regularization Parameters $\\lambda$',
2,
None,
@@ -249,7 +248,7 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs001.html#plans-for-week-38-lecture-monday-september-16" style="font-size: 80%;">Plans for week 38, lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs002.html#suggested-reading-and-videos" style="font-size: 80%;">Suggested reading and videos</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs003.html#plans-for-the-lab-sessions" style="font-size: 80%;">Plans for the lab sessions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-thursday-september-21" style="font-size: 80%;">Material for lecture Thursday September 21</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-monday-september-16" style="font-size: 80%;">Material for lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs005.html#logistic-regression" style="font-size: 80%;">Logistic Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs006.html#classification-problems" style="font-size: 80%;">Classification problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs007.html#optimization-and-deep-learning" style="font-size: 80%;">Optimization and Deep learning</a></li>
@@ -268,48 +267,47 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs020.html#extending-to-more-predictors" style="font-size: 80%;">Extending to more predictors</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs021.html#including-more-classes" style="font-size: 80%;">Including more classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs022.html#more-classes" style="font-size: 80%;">More classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#friday-september-23" style="font-size: 80%;">Friday September 23</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs048.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs064.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs049.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
</ul>
</li>
@@ -321,19 +319,39 @@ MathJax.Hub.Config({
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0035"></a>
<!-- !split -->
<h2 id="brief-reminder-on-newton-raphson-s-method" class="anchor">Brief reminder on Newton-Raphson's method </h2>
<h2 id="the-equations" class="anchor">The equations </h2>
<p>Let us quickly remind ourselves how we derive the above method.</p>
<p>Perhaps the most celebrated of all one-dimensional root-finding
routines is Newton's method, also called the Newton-Raphson
method. This method requires the evaluation of both the
function \( f \) and its derivative \( f' \) at arbitrary points.
If you can only calculate the derivative
numerically and/or your function is not of the smooth type, we
normally discourage the use of this method.
<p>The Newton-Raphson formula consists geometrically of extending the
tangent line at a current point until it crosses zero, then setting
the next guess to the abscissa of that zero-crossing. The mathematics
behind this method is rather simple. Employing a Taylor expansion for
\( x \) sufficiently close to the solution \( s \), we have
</p>
$$
f(s)=0=f(x)+(s-x)f'(x)+\frac{(s-x)^2}{2}f''(x) +\dots.
\tag{2}
$$
<p>For small enough values of the function and for well-behaved
functions, the terms beyond linear are unimportant, hence we obtain
</p>
$$
f(x)+(s-x)f'(x)\approx 0,
$$
<p>yielding</p>
$$
s\approx x-\frac{f(x)}{f'(x)}.
$$
<p>Having in mind an iterative procedure, it is natural to start iterating with</p>
$$
x_{n+1}=x_n-\frac{f(x_n)}{f'(x_n)}.
$$
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -359,7 +377,7 @@ normally discourage the use of this method.
<li><a href="._week38-bs043.html">44</a></li>
<li><a href="._week38-bs044.html">45</a></li>
<li><a href="">...</a></li>
<li><a href="._week38-bs064.html">65</a></li>
<li><a href="._week38-bs063.html">64</a></li>
<li><a href="._week38-bs036.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+57 -77
View File
@@ -48,10 +48,10 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
2,
None,
'plans-for-the-lab-sessions'),
('Material for lecture Thursday September 21',
('Material for lecture Monday September 16',
2,
None,
'material-for-lecture-thursday-september-21'),
'material-for-lecture-monday-september-16'),
('Logistic Regression', 2, None, 'logistic-regression'),
('Classification problems', 2, None, 'classification-problems'),
('Optimization and Deep learning',
@@ -92,7 +92,6 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
'extending-to-more-predictors'),
('Including more classes', 2, None, 'including-more-classes'),
('More classes', 2, None, 'more-classes'),
('Friday September 23', 2, None, 'friday-september-23'),
('Searching for Optimal Regularization Parameters $\\lambda$',
2,
None,
@@ -249,7 +248,7 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs001.html#plans-for-week-38-lecture-monday-september-16" style="font-size: 80%;">Plans for week 38, lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs002.html#suggested-reading-and-videos" style="font-size: 80%;">Suggested reading and videos</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs003.html#plans-for-the-lab-sessions" style="font-size: 80%;">Plans for the lab sessions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-thursday-september-21" style="font-size: 80%;">Material for lecture Thursday September 21</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-monday-september-16" style="font-size: 80%;">Material for lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs005.html#logistic-regression" style="font-size: 80%;">Logistic Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs006.html#classification-problems" style="font-size: 80%;">Classification problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs007.html#optimization-and-deep-learning" style="font-size: 80%;">Optimization and Deep learning</a></li>
@@ -268,48 +267,47 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs020.html#extending-to-more-predictors" style="font-size: 80%;">Extending to more predictors</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs021.html#including-more-classes" style="font-size: 80%;">Including more classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs022.html#more-classes" style="font-size: 80%;">More classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#friday-september-23" style="font-size: 80%;">Friday September 23</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs048.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs064.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs049.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
</ul>
</li>
@@ -321,39 +319,21 @@ MathJax.Hub.Config({
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0036"></a>
<!-- !split -->
<h2 id="the-equations" class="anchor">The equations </h2>
<h2 id="simple-geometric-interpretation" class="anchor">Simple geometric interpretation </h2>
<p>The Newton-Raphson formula consists geometrically of extending the
tangent line at a current point until it crosses zero, then setting
the next guess to the abscissa of that zero-crossing. The mathematics
behind this method is rather simple. Employing a Taylor expansion for
\( x \) sufficiently close to the solution \( s \), we have
<p>The above is Newton-Raphson's method. It has a simple geometric
interpretation, namely \( x_{n+1} \) is the point where the tangent from
\( (x_n,f(x_n)) \) crosses the \( x \)-axis. Close to the solution,
Newton-Raphson converges fast to the desired result. However, if we
are far from a root, where the higher-order terms in the series are
important, the Newton-Raphson formula can give grossly inaccurate
results. For instance, the initial guess for the root might be so far
from the true root as to let the search interval include a local
maximum or minimum of the function. If an iteration places a trial
guess near such a local extremum, so that the first derivative nearly
vanishes, then Newton-Raphson may fail totally
</p>
$$
f(s)=0=f(x)+(s-x)f'(x)+\frac{(s-x)^2}{2}f''(x) +\dots.
\tag{2}
$$
<p>For small enough values of the function and for well-behaved
functions, the terms beyond linear are unimportant, hence we obtain
</p>
$$
f(x)+(s-x)f'(x)\approx 0,
$$
<p>yielding</p>
$$
s\approx x-\frac{f(x)}{f'(x)}.
$$
<p>Having in mind an iterative procedure, it is natural to start iterating with</p>
$$
x_{n+1}=x_n-\frac{f(x_n)}{f'(x_n)}.
$$
<p>
<!-- navigation buttons at the bottom of the page -->
<ul class="pagination">
@@ -379,7 +359,7 @@ $$
<li><a href="._week38-bs044.html">45</a></li>
<li><a href="._week38-bs045.html">46</a></li>
<li><a href="">...</a></li>
<li><a href="._week38-bs064.html">65</a></li>
<li><a href="._week38-bs063.html">64</a></li>
<li><a href="._week38-bs037.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+95 -59
View File
@@ -48,10 +48,10 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
2,
None,
'plans-for-the-lab-sessions'),
('Material for lecture Thursday September 21',
('Material for lecture Monday September 16',
2,
None,
'material-for-lecture-thursday-september-21'),
'material-for-lecture-monday-september-16'),
('Logistic Regression', 2, None, 'logistic-regression'),
('Classification problems', 2, None, 'classification-problems'),
('Optimization and Deep learning',
@@ -92,7 +92,6 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
'extending-to-more-predictors'),
('Including more classes', 2, None, 'including-more-classes'),
('More classes', 2, None, 'more-classes'),
('Friday September 23', 2, None, 'friday-september-23'),
('Searching for Optimal Regularization Parameters $\\lambda$',
2,
None,
@@ -249,7 +248,7 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs001.html#plans-for-week-38-lecture-monday-september-16" style="font-size: 80%;">Plans for week 38, lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs002.html#suggested-reading-and-videos" style="font-size: 80%;">Suggested reading and videos</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs003.html#plans-for-the-lab-sessions" style="font-size: 80%;">Plans for the lab sessions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-thursday-september-21" style="font-size: 80%;">Material for lecture Thursday September 21</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-monday-september-16" style="font-size: 80%;">Material for lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs005.html#logistic-regression" style="font-size: 80%;">Logistic Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs006.html#classification-problems" style="font-size: 80%;">Classification problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs007.html#optimization-and-deep-learning" style="font-size: 80%;">Optimization and Deep learning</a></li>
@@ -268,48 +267,47 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs020.html#extending-to-more-predictors" style="font-size: 80%;">Extending to more predictors</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs021.html#including-more-classes" style="font-size: 80%;">Including more classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs022.html#more-classes" style="font-size: 80%;">More classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#friday-september-23" style="font-size: 80%;">Friday September 23</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs048.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs064.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs049.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
</ul>
</li>
@@ -321,19 +319,57 @@ MathJax.Hub.Config({
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0037"></a>
<!-- !split -->
<h2 id="simple-geometric-interpretation" class="anchor">Simple geometric interpretation </h2>
<h2 id="extending-to-more-than-one-variable" class="anchor">Extending to more than one variable </h2>
<p>The above is Newton-Raphson's method. It has a simple geometric
interpretation, namely \( x_{n+1} \) is the point where the tangent from
\( (x_n,f(x_n)) \) crosses the \( x \)-axis. Close to the solution,
Newton-Raphson converges fast to the desired result. However, if we
are far from a root, where the higher-order terms in the series are
important, the Newton-Raphson formula can give grossly inaccurate
results. For instance, the initial guess for the root might be so far
from the true root as to let the search interval include a local
maximum or minimum of the function. If an iteration places a trial
guess near such a local extremum, so that the first derivative nearly
vanishes, then Newton-Raphson may fail totally
<p>Newton's method can be generalized to systems of several non-linear equations
and variables. Consider the case with two equations
</p>
$$
\begin{array}{cc} f_1(x_1,x_2) &=0\\
f_2(x_1,x_2) &=0,\end{array}
$$
<p>which we Taylor expand to obtain</p>
$$
\begin{array}{cc} 0=f_1(x_1+h_1,x_2+h_2)=&f_1(x_1,x_2)+h_1
\partial f_1/\partial x_1+h_2
\partial f_1/\partial x_2+\dots\\
0=f_2(x_1+h_1,x_2+h_2)=&f_2(x_1,x_2)+h_1
\partial f_2/\partial x_1+h_2
\partial f_2/\partial x_2+\dots
\end{array}.
$$
<p>Defining the Jacobian matrix \( {\bf \boldsymbol{J}} \) we have</p>
$$
{\bf \boldsymbol{J}}=\left( \begin{array}{cc}
\partial f_1/\partial x_1 & \partial f_1/\partial x_2 \\
\partial f_2/\partial x_1 &\partial f_2/\partial x_2
\end{array} \right),
$$
<p>we can rephrase Newton's method as</p>
$$
\left(\begin{array}{c} x_1^{n+1} \\ x_2^{n+1} \end{array} \right)=
\left(\begin{array}{c} x_1^{n} \\ x_2^{n} \end{array} \right)+
\left(\begin{array}{c} h_1^{n} \\ h_2^{n} \end{array} \right),
$$
<p>where we have defined</p>
$$
\left(\begin{array}{c} h_1^{n} \\ h_2^{n} \end{array} \right)=
-{\bf \boldsymbol{J}}^{-1}
\left(\begin{array}{c} f_1(x_1^{n},x_2^{n}) \\ f_2(x_1^{n},x_2^{n}) \end{array} \right).
$$
<p>We need thus to compute the inverse of the Jacobian matrix and it
is to understand that difficulties may
arise in case \( {\bf \boldsymbol{J}} \) is nearly singular.
</p>
<p>It is rather straightforward to extend the above scheme to systems of
more than two non-linear equations. In our case, the Jacobian matrix is given by the Hessian that represents the second derivative of cost function.
</p>
<p>
@@ -361,7 +397,7 @@ vanishes, then Newton-Raphson may fail totally
<li><a href="._week38-bs045.html">46</a></li>
<li><a href="._week38-bs046.html">47</a></li>
<li><a href="">...</a></li>
<li><a href="._week38-bs064.html">65</a></li>
<li><a href="._week38-bs063.html">64</a></li>
<li><a href="._week38-bs038.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+60 -95
View File
@@ -48,10 +48,10 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
2,
None,
'plans-for-the-lab-sessions'),
('Material for lecture Thursday September 21',
('Material for lecture Monday September 16',
2,
None,
'material-for-lecture-thursday-september-21'),
'material-for-lecture-monday-september-16'),
('Logistic Regression', 2, None, 'logistic-regression'),
('Classification problems', 2, None, 'classification-problems'),
('Optimization and Deep learning',
@@ -92,7 +92,6 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
'extending-to-more-predictors'),
('Including more classes', 2, None, 'including-more-classes'),
('More classes', 2, None, 'more-classes'),
('Friday September 23', 2, None, 'friday-september-23'),
('Searching for Optimal Regularization Parameters $\\lambda$',
2,
None,
@@ -249,7 +248,7 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs001.html#plans-for-week-38-lecture-monday-september-16" style="font-size: 80%;">Plans for week 38, lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs002.html#suggested-reading-and-videos" style="font-size: 80%;">Suggested reading and videos</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs003.html#plans-for-the-lab-sessions" style="font-size: 80%;">Plans for the lab sessions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-thursday-september-21" style="font-size: 80%;">Material for lecture Thursday September 21</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-monday-september-16" style="font-size: 80%;">Material for lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs005.html#logistic-regression" style="font-size: 80%;">Logistic Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs006.html#classification-problems" style="font-size: 80%;">Classification problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs007.html#optimization-and-deep-learning" style="font-size: 80%;">Optimization and Deep learning</a></li>
@@ -268,48 +267,47 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs020.html#extending-to-more-predictors" style="font-size: 80%;">Extending to more predictors</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs021.html#including-more-classes" style="font-size: 80%;">Including more classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs022.html#more-classes" style="font-size: 80%;">More classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#friday-september-23" style="font-size: 80%;">Friday September 23</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs048.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs064.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs049.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
</ul>
</li>
@@ -321,57 +319,24 @@ MathJax.Hub.Config({
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0038"></a>
<!-- !split -->
<h2 id="extending-to-more-than-one-variable" class="anchor">Extending to more than one variable </h2>
<h2 id="steepest-descent" class="anchor">Steepest descent </h2>
<p>Newton's method can be generalized to systems of several non-linear equations
and variables. Consider the case with two equations
</p>
$$
\begin{array}{cc} f_1(x_1,x_2) &=0\\
f_2(x_1,x_2) &=0,\end{array}
$$
<p>which we Taylor expand to obtain</p>
$$
\begin{array}{cc} 0=f_1(x_1+h_1,x_2+h_2)=&f_1(x_1,x_2)+h_1
\partial f_1/\partial x_1+h_2
\partial f_1/\partial x_2+\dots\\
0=f_2(x_1+h_1,x_2+h_2)=&f_2(x_1,x_2)+h_1
\partial f_2/\partial x_1+h_2
\partial f_2/\partial x_2+\dots
\end{array}.
$$
<p>Defining the Jacobian matrix \( {\bf \boldsymbol{J}} \) we have</p>
$$
{\bf \boldsymbol{J}}=\left( \begin{array}{cc}
\partial f_1/\partial x_1 & \partial f_1/\partial x_2 \\
\partial f_2/\partial x_1 &\partial f_2/\partial x_2
\end{array} \right),
$$
<p>we can rephrase Newton's method as</p>
$$
\left(\begin{array}{c} x_1^{n+1} \\ x_2^{n+1} \end{array} \right)=
\left(\begin{array}{c} x_1^{n} \\ x_2^{n} \end{array} \right)+
\left(\begin{array}{c} h_1^{n} \\ h_2^{n} \end{array} \right),
$$
<p>where we have defined</p>
$$
\left(\begin{array}{c} h_1^{n} \\ h_2^{n} \end{array} \right)=
-{\bf \boldsymbol{J}}^{-1}
\left(\begin{array}{c} f_1(x_1^{n},x_2^{n}) \\ f_2(x_1^{n},x_2^{n}) \end{array} \right).
$$
<p>We need thus to compute the inverse of the Jacobian matrix and it
is to understand that difficulties may
arise in case \( {\bf \boldsymbol{J}} \) is nearly singular.
<p>The basic idea of gradient descent is
that a function \( F(\mathbf{x}) \),
\( \mathbf{x} \equiv (x_1,\cdots,x_n) \), decreases fastest if one goes from \( \bf {x} \) in the
direction of the negative gradient \( -\nabla F(\mathbf{x}) \).
</p>
<p>It is rather straightforward to extend the above scheme to systems of
more than two non-linear equations. In our case, the Jacobian matrix is given by the Hessian that represents the second derivative of cost function.
<p>It can be shown that if </p>
$$
\mathbf{x}_{k+1} = \mathbf{x}_k - \gamma_k \nabla F(\mathbf{x}_k),
$$
<p>with \( \gamma_k > 0 \).</p>
<p>For \( \gamma_k \) small enough, then \( F(\mathbf{x}_{k+1}) \leq
F(\mathbf{x}_k) \). This means that for a sufficiently small \( \gamma_k \)
we are always moving towards smaller function values, i.e a minimum.
</p>
<p>
@@ -399,7 +364,7 @@ more than two non-linear equations. In our case, the Jacobian matrix is given by
<li><a href="._week38-bs046.html">47</a></li>
<li><a href="._week38-bs047.html">48</a></li>
<li><a href="">...</a></li>
<li><a href="._week38-bs064.html">65</a></li>
<li><a href="._week38-bs063.html">64</a></li>
<li><a href="._week38-bs039.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+54 -60
View File
@@ -48,10 +48,10 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
2,
None,
'plans-for-the-lab-sessions'),
('Material for lecture Thursday September 21',
('Material for lecture Monday September 16',
2,
None,
'material-for-lecture-thursday-september-21'),
'material-for-lecture-monday-september-16'),
('Logistic Regression', 2, None, 'logistic-regression'),
('Classification problems', 2, None, 'classification-problems'),
('Optimization and Deep learning',
@@ -92,7 +92,6 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
'extending-to-more-predictors'),
('Including more classes', 2, None, 'including-more-classes'),
('More classes', 2, None, 'more-classes'),
('Friday September 23', 2, None, 'friday-september-23'),
('Searching for Optimal Regularization Parameters $\\lambda$',
2,
None,
@@ -249,7 +248,7 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs001.html#plans-for-week-38-lecture-monday-september-16" style="font-size: 80%;">Plans for week 38, lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs002.html#suggested-reading-and-videos" style="font-size: 80%;">Suggested reading and videos</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs003.html#plans-for-the-lab-sessions" style="font-size: 80%;">Plans for the lab sessions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-thursday-september-21" style="font-size: 80%;">Material for lecture Thursday September 21</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-monday-september-16" style="font-size: 80%;">Material for lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs005.html#logistic-regression" style="font-size: 80%;">Logistic Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs006.html#classification-problems" style="font-size: 80%;">Classification problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs007.html#optimization-and-deep-learning" style="font-size: 80%;">Optimization and Deep learning</a></li>
@@ -268,48 +267,47 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs020.html#extending-to-more-predictors" style="font-size: 80%;">Extending to more predictors</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs021.html#including-more-classes" style="font-size: 80%;">Including more classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs022.html#more-classes" style="font-size: 80%;">More classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#friday-september-23" style="font-size: 80%;">Friday September 23</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs048.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs064.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs049.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
</ul>
</li>
@@ -320,25 +318,21 @@ MathJax.Hub.Config({
<div class="container">
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0039"></a>
<!-- !split -->
<h2 id="steepest-descent" class="anchor">Steepest descent </h2>
<!-- !split -->
<h2 id="more-on-steepest-descent" class="anchor">More on Steepest descent </h2>
<p>The basic idea of gradient descent is
that a function \( F(\mathbf{x}) \),
\( \mathbf{x} \equiv (x_1,\cdots,x_n) \), decreases fastest if one goes from \( \bf {x} \) in the
direction of the negative gradient \( -\nabla F(\mathbf{x}) \).
<p>The previous observation is the basis of the method of steepest
descent, which is also referred to as just gradient descent (GD). One
starts with an initial guess \( \mathbf{x}_0 \) for a minimum of \( F \) and
computes new approximations according to
</p>
<p>It can be shown that if </p>
$$
\mathbf{x}_{k+1} = \mathbf{x}_k - \gamma_k \nabla F(\mathbf{x}_k),
\mathbf{x}_{k+1} = \mathbf{x}_k - \gamma_k \nabla F(\mathbf{x}_k), \ \ k \geq 0.
$$
<p>with \( \gamma_k > 0 \).</p>
<p>For \( \gamma_k \) small enough, then \( F(\mathbf{x}_{k+1}) \leq
F(\mathbf{x}_k) \). This means that for a sufficiently small \( \gamma_k \)
we are always moving towards smaller function values, i.e a minimum.
<p>The parameter \( \gamma_k \) is often referred to as the step length or
the learning rate within the context of Machine Learning.
</p>
<p>
@@ -366,7 +360,7 @@ we are always moving towards smaller function values, i.e a minimum.
<li><a href="._week38-bs047.html">48</a></li>
<li><a href="._week38-bs048.html">49</a></li>
<li><a href="">...</a></li>
<li><a href="._week38-bs064.html">65</a></li>
<li><a href="._week38-bs063.html">64</a></li>
<li><a href="._week38-bs040.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+62 -57
View File
@@ -48,10 +48,10 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
2,
None,
'plans-for-the-lab-sessions'),
('Material for lecture Thursday September 21',
('Material for lecture Monday September 16',
2,
None,
'material-for-lecture-thursday-september-21'),
'material-for-lecture-monday-september-16'),
('Logistic Regression', 2, None, 'logistic-regression'),
('Classification problems', 2, None, 'classification-problems'),
('Optimization and Deep learning',
@@ -92,7 +92,6 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
'extending-to-more-predictors'),
('Including more classes', 2, None, 'including-more-classes'),
('More classes', 2, None, 'more-classes'),
('Friday September 23', 2, None, 'friday-september-23'),
('Searching for Optimal Regularization Parameters $\\lambda$',
2,
None,
@@ -249,7 +248,7 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs001.html#plans-for-week-38-lecture-monday-september-16" style="font-size: 80%;">Plans for week 38, lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs002.html#suggested-reading-and-videos" style="font-size: 80%;">Suggested reading and videos</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs003.html#plans-for-the-lab-sessions" style="font-size: 80%;">Plans for the lab sessions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-thursday-september-21" style="font-size: 80%;">Material for lecture Thursday September 21</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-monday-september-16" style="font-size: 80%;">Material for lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs005.html#logistic-regression" style="font-size: 80%;">Logistic Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs006.html#classification-problems" style="font-size: 80%;">Classification problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs007.html#optimization-and-deep-learning" style="font-size: 80%;">Optimization and Deep learning</a></li>
@@ -268,48 +267,47 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs020.html#extending-to-more-predictors" style="font-size: 80%;">Extending to more predictors</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs021.html#including-more-classes" style="font-size: 80%;">Including more classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs022.html#more-classes" style="font-size: 80%;">More classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#friday-september-23" style="font-size: 80%;">Friday September 23</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs048.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs064.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs049.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
</ul>
</li>
@@ -321,20 +319,27 @@ MathJax.Hub.Config({
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0040"></a>
<!-- !split -->
<h2 id="more-on-steepest-descent" class="anchor">More on Steepest descent </h2>
<h2 id="the-ideal" class="anchor">The ideal </h2>
<p>The previous observation is the basis of the method of steepest
descent, which is also referred to as just gradient descent (GD). One
starts with an initial guess \( \mathbf{x}_0 \) for a minimum of \( F \) and
computes new approximations according to
<p>Ideally the sequence \( \{\mathbf{x}_k \}_{k=0} \) converges to a global
minimum of the function \( F \). In general we do not know if we are in a
global or local minimum. In the special case when \( F \) is a convex
function, all local minima are also global minima, so in this case
gradient descent can converge to the global solution. The advantage of
this scheme is that it is conceptually simple and straightforward to
implement. However the method in this form has some severe
limitations:
</p>
$$
\mathbf{x}_{k+1} = \mathbf{x}_k - \gamma_k \nabla F(\mathbf{x}_k), \ \ k \geq 0.
$$
<p>In machine learing we are often faced with non-convex high dimensional
cost functions with many local minima. Since GD is deterministic we
will get stuck in a local minimum, if the method converges, unless we
have a very good intial guess. This also implies that the scheme is
sensitive to the chosen initial condition.
</p>
<p>The parameter \( \gamma_k \) is often referred to as the step length or
the learning rate within the context of Machine Learning.
<p>Note that the gradient is a function of \( \mathbf{x} =
(x_1,\cdots,x_n) \) which makes it expensive to compute numerically.
</p>
<p>
@@ -362,7 +367,7 @@ the learning rate within the context of Machine Learning.
<li><a href="._week38-bs048.html">49</a></li>
<li><a href="._week38-bs049.html">50</a></li>
<li><a href="">...</a></li>
<li><a href="._week38-bs064.html">65</a></li>
<li><a href="._week38-bs063.html">64</a></li>
<li><a href="._week38-bs041.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+56 -65
View File
@@ -48,10 +48,10 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
2,
None,
'plans-for-the-lab-sessions'),
('Material for lecture Thursday September 21',
('Material for lecture Monday September 16',
2,
None,
'material-for-lecture-thursday-september-21'),
'material-for-lecture-monday-september-16'),
('Logistic Regression', 2, None, 'logistic-regression'),
('Classification problems', 2, None, 'classification-problems'),
('Optimization and Deep learning',
@@ -92,7 +92,6 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
'extending-to-more-predictors'),
('Including more classes', 2, None, 'including-more-classes'),
('More classes', 2, None, 'more-classes'),
('Friday September 23', 2, None, 'friday-september-23'),
('Searching for Optimal Regularization Parameters $\\lambda$',
2,
None,
@@ -249,7 +248,7 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs001.html#plans-for-week-38-lecture-monday-september-16" style="font-size: 80%;">Plans for week 38, lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs002.html#suggested-reading-and-videos" style="font-size: 80%;">Suggested reading and videos</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs003.html#plans-for-the-lab-sessions" style="font-size: 80%;">Plans for the lab sessions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-thursday-september-21" style="font-size: 80%;">Material for lecture Thursday September 21</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-monday-september-16" style="font-size: 80%;">Material for lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs005.html#logistic-regression" style="font-size: 80%;">Logistic Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs006.html#classification-problems" style="font-size: 80%;">Classification problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs007.html#optimization-and-deep-learning" style="font-size: 80%;">Optimization and Deep learning</a></li>
@@ -268,48 +267,47 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs020.html#extending-to-more-predictors" style="font-size: 80%;">Extending to more predictors</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs021.html#including-more-classes" style="font-size: 80%;">Including more classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs022.html#more-classes" style="font-size: 80%;">More classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#friday-september-23" style="font-size: 80%;">Friday September 23</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs048.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs064.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs049.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
</ul>
</li>
@@ -321,27 +319,20 @@ MathJax.Hub.Config({
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0041"></a>
<!-- !split -->
<h2 id="the-ideal" class="anchor">The ideal </h2>
<h2 id="the-sensitiveness-of-the-gradient-descent" class="anchor">The sensitiveness of the gradient descent </h2>
<p>Ideally the sequence \( \{\mathbf{x}_k \}_{k=0} \) converges to a global
minimum of the function \( F \). In general we do not know if we are in a
global or local minimum. In the special case when \( F \) is a convex
function, all local minima are also global minima, so in this case
gradient descent can converge to the global solution. The advantage of
this scheme is that it is conceptually simple and straightforward to
implement. However the method in this form has some severe
limitations:
<p>The gradient descent method
is sensitive to the choice of learning rate \( \gamma_k \). This is due
to the fact that we are only guaranteed that \( F(\mathbf{x}_{k+1}) \leq
F(\mathbf{x}_k) \) for sufficiently small \( \gamma_k \). The problem is to
determine an optimal learning rate. If the learning rate is chosen too
small the method will take a long time to converge and if it is too
large we can experience erratic behavior.
</p>
<p>In machine learing we are often faced with non-convex high dimensional
cost functions with many local minima. Since GD is deterministic we
will get stuck in a local minimum, if the method converges, unless we
have a very good intial guess. This also implies that the scheme is
sensitive to the chosen initial condition.
</p>
<p>Note that the gradient is a function of \( \mathbf{x} =
(x_1,\cdots,x_n) \) which makes it expensive to compute numerically.
<p>Many of these shortcomings can be alleviated by introducing
randomness. One such method is that of Stochastic Gradient Descent
(SGD), to be discussed next week.
</p>
<p>
@@ -369,7 +360,7 @@ sensitive to the chosen initial condition.
<li><a href="._week38-bs049.html">50</a></li>
<li><a href="._week38-bs050.html">51</a></li>
<li><a href="">...</a></li>
<li><a href="._week38-bs064.html">65</a></li>
<li><a href="._week38-bs063.html">64</a></li>
<li><a href="._week38-bs042.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+56 -58
View File
@@ -48,10 +48,10 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
2,
None,
'plans-for-the-lab-sessions'),
('Material for lecture Thursday September 21',
('Material for lecture Monday September 16',
2,
None,
'material-for-lecture-thursday-september-21'),
'material-for-lecture-monday-september-16'),
('Logistic Regression', 2, None, 'logistic-regression'),
('Classification problems', 2, None, 'classification-problems'),
('Optimization and Deep learning',
@@ -92,7 +92,6 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
'extending-to-more-predictors'),
('Including more classes', 2, None, 'including-more-classes'),
('More classes', 2, None, 'more-classes'),
('Friday September 23', 2, None, 'friday-september-23'),
('Searching for Optimal Regularization Parameters $\\lambda$',
2,
None,
@@ -249,7 +248,7 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs001.html#plans-for-week-38-lecture-monday-september-16" style="font-size: 80%;">Plans for week 38, lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs002.html#suggested-reading-and-videos" style="font-size: 80%;">Suggested reading and videos</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs003.html#plans-for-the-lab-sessions" style="font-size: 80%;">Plans for the lab sessions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-thursday-september-21" style="font-size: 80%;">Material for lecture Thursday September 21</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-monday-september-16" style="font-size: 80%;">Material for lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs005.html#logistic-regression" style="font-size: 80%;">Logistic Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs006.html#classification-problems" style="font-size: 80%;">Classification problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs007.html#optimization-and-deep-learning" style="font-size: 80%;">Optimization and Deep learning</a></li>
@@ -268,48 +267,47 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs020.html#extending-to-more-predictors" style="font-size: 80%;">Extending to more predictors</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs021.html#including-more-classes" style="font-size: 80%;">Including more classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs022.html#more-classes" style="font-size: 80%;">More classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#friday-september-23" style="font-size: 80%;">Friday September 23</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs048.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs064.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs049.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
</ul>
</li>
@@ -321,20 +319,20 @@ MathJax.Hub.Config({
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p> <!-- add vertical space -->
<a name="part0042"></a>
<!-- !split -->
<h2 id="the-sensitiveness-of-the-gradient-descent" class="anchor">The sensitiveness of the gradient descent </h2>
<h2 id="convex-functions" class="anchor">Convex functions </h2>
<p>The gradient descent method
is sensitive to the choice of learning rate \( \gamma_k \). This is due
to the fact that we are only guaranteed that \( F(\mathbf{x}_{k+1}) \leq
F(\mathbf{x}_k) \) for sufficiently small \( \gamma_k \). The problem is to
determine an optimal learning rate. If the learning rate is chosen too
small the method will take a long time to converge and if it is too
large we can experience erratic behavior.
<p>Ideally we want our cost/loss function to be convex(concave).</p>
<p>First we give the definition of a convex set: A set \( C \) in
\( \mathbb{R}^n \) is said to be convex if, for all \( x \) and \( y \) in \( C \) and
all \( t \in (0,1) \) , the point \( (1 &#8722; t)x + ty \) also belongs to
C. Geometrically this means that every point on the line segment
connecting \( x \) and \( y \) is in \( C \) as discussed below.
</p>
<p>Many of these shortcomings can be alleviated by introducing
randomness. One such method is that of Stochastic Gradient Descent
(SGD), to be discussed next week.
<p>The convex subsets of \( \mathbb{R} \) are the intervals of
\( \mathbb{R} \). Examples of convex sets of \( \mathbb{R}^2 \) are the
regular polygons (triangles, rectangles, pentagons, etc...).
</p>
<p>
@@ -362,7 +360,7 @@ randomness. One such method is that of Stochastic Gradient Descent
<li><a href="._week38-bs050.html">51</a></li>
<li><a href="._week38-bs051.html">52</a></li>
<li><a href="">...</a></li>
<li><a href="._week38-bs064.html">65</a></li>
<li><a href="._week38-bs063.html">64</a></li>
<li><a href="._week38-bs043.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+45 -47
View File
@@ -48,10 +48,10 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
2,
None,
'plans-for-the-lab-sessions'),
('Material for lecture Thursday September 21',
('Material for lecture Monday September 16',
2,
None,
'material-for-lecture-thursday-september-21'),
'material-for-lecture-monday-september-16'),
('Logistic Regression', 2, None, 'logistic-regression'),
('Classification problems', 2, None, 'classification-problems'),
('Optimization and Deep learning',
@@ -92,7 +92,6 @@ doconce format html week38.do.txt --html_style=bootstrap --pygments_html_style=d
'extending-to-more-predictors'),
('Including more classes', 2, None, 'including-more-classes'),
('More classes', 2, None, 'more-classes'),
('Friday September 23', 2, None, 'friday-september-23'),
('Searching for Optimal Regularization Parameters $\\lambda$',
2,
None,
@@ -249,7 +248,7 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs001.html#plans-for-week-38-lecture-monday-september-16" style="font-size: 80%;">Plans for week 38, lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs002.html#suggested-reading-and-videos" style="font-size: 80%;">Suggested reading and videos</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs003.html#plans-for-the-lab-sessions" style="font-size: 80%;">Plans for the lab sessions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-thursday-september-21" style="font-size: 80%;">Material for lecture Thursday September 21</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs004.html#material-for-lecture-monday-september-16" style="font-size: 80%;">Material for lecture Monday September 16</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs005.html#logistic-regression" style="font-size: 80%;">Logistic Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs006.html#classification-problems" style="font-size: 80%;">Classification problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs007.html#optimization-and-deep-learning" style="font-size: 80%;">Optimization and Deep learning</a></li>
@@ -268,48 +267,47 @@ MathJax.Hub.Config({
<!-- navigation toc: --> <li><a href="._week38-bs020.html#extending-to-more-predictors" style="font-size: 80%;">Extending to more predictors</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs021.html#including-more-classes" style="font-size: 80%;">Including more classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs022.html#more-classes" style="font-size: 80%;">More classes</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#friday-september-23" style="font-size: 80%;">Friday September 23</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs048.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs064.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs023.html#searching-for-optimal-regularization-parameters-lambda" style="font-size: 80%;">Searching for Optimal Regularization Parameters \( \lambda \)</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs024.html#grid-search" style="font-size: 80%;">Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs025.html#randomized-grid-search" style="font-size: 80%;">Randomized Grid Search</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs026.html#wisconsin-cancer-data" style="font-size: 80%;">Wisconsin Cancer Data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs027.html#using-the-correlation-matrix" style="font-size: 80%;">Using the correlation matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs028.html#discussing-the-correlation-data" style="font-size: 80%;">Discussing the correlation data</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs029.html#other-measures-in-classification-studies-cancer-data-again" style="font-size: 80%;">Other measures in classification studies: Cancer Data again</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs030.html#optimization-the-central-part-of-any-machine-learning-algortithm" style="font-size: 80%;">Optimization, the central part of any Machine Learning algortithm</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs031.html#revisiting-our-logistic-regression-case" style="font-size: 80%;">Revisiting our Logistic Regression case</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs032.html#the-equations-to-solve" style="font-size: 80%;">The equations to solve</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs033.html#solving-using-newton-raphson-s-method" style="font-size: 80%;">Solving using Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs034.html#brief-reminder-on-newton-raphson-s-method" style="font-size: 80%;">Brief reminder on Newton-Raphson's method</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs035.html#the-equations" style="font-size: 80%;">The equations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs036.html#simple-geometric-interpretation" style="font-size: 80%;">Simple geometric interpretation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs037.html#extending-to-more-than-one-variable" style="font-size: 80%;">Extending to more than one variable</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs038.html#steepest-descent" style="font-size: 80%;">Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs039.html#more-on-steepest-descent" style="font-size: 80%;">More on Steepest descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs040.html#the-ideal" style="font-size: 80%;">The ideal</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs041.html#the-sensitiveness-of-the-gradient-descent" style="font-size: 80%;">The sensitiveness of the gradient descent</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs042.html#convex-functions" style="font-size: 80%;">Convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs043.html#convex-function" style="font-size: 80%;">Convex function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs044.html#conditions-on-convex-functions" style="font-size: 80%;">Conditions on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs045.html#more-on-convex-functions" style="font-size: 80%;">More on convex functions</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs046.html#some-simple-problems" style="font-size: 80%;">Some simple problems</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs047.html#revisiting-our-first-homework" style="font-size: 80%;">Revisiting our first homework</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient descent example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs049.html#the-derivative-of-the-cost-loss-function" style="font-size: 80%;">The derivative of the cost/loss function</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs050.html#the-hessian-matrix" style="font-size: 80%;">The Hessian matrix</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs051.html#simple-program" style="font-size: 80%;">Simple program</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs052.html#gradient-descent-example" style="font-size: 80%;">Gradient Descent Example</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs053.html#and-a-corresponding-example-using-scikit-learn" style="font-size: 80%;">And a corresponding example using <b>scikit-learn</b></a></li>
<!-- navigation toc: --> <li><a href="._week38-bs054.html#gradient-descent-and-ridge" style="font-size: 80%;">Gradient descent and Ridge</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs055.html#the-hessian-matrix-for-ridge-regression" style="font-size: 80%;">The Hessian matrix for Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs056.html#program-example-for-gradient-descent-with-ridge-regression" style="font-size: 80%;">Program example for gradient descent with Ridge Regression</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs057.html#using-gradient-descent-methods-limitations" style="font-size: 80%;">Using gradient descent methods, limitations</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs058.html#challenge-yourself-the-coming-weekend" style="font-size: 80%;">Challenge yourself the coming weekend</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs059.html#lab-session-material-from-last-week-and-relevant-for-the-first-project" style="font-size: 80%;">Lab session: Material from last week and relevant for the first project</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs060.html#various-steps-in-cross-validation" style="font-size: 80%;">Various steps in cross-validation</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs061.html#how-to-set-up-the-cross-validation-for-ridge-and-or-lasso" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs062.html#cross-validation-in-brief" style="font-size: 80%;">Cross-validation in brief</a></li>
<!-- navigation toc: --> <li><a href="._week38-bs063.html#code-example-for-cross-validation-and-k-fold-cross-validation" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
</ul>
</li>
@@ -364,7 +362,7 @@ MathJax.Hub.Config({
<li><a href="._week38-bs008.html">9</a></li>
<li><a href="._week38-bs009.html">10</a></li>
<li><a href="">...</a></li>
<li><a href="._week38-bs064.html">65</a></li>
<li><a href="._week38-bs063.html">64</a></li>
<li><a href="._week38-bs001.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+1 -5
View File
@@ -260,7 +260,7 @@ MathJax.Hub.Config({
</section>
<section>
<h2 id="material-for-lecture-thursday-september-21">Material for lecture Thursday September 21 </h2>
<h2 id="material-for-lecture-monday-september-16">Material for lecture Monday September 16 </h2>
</section>
<section>
@@ -863,10 +863,6 @@ methods</a>.
</p>
</section>
<section>
<h2 id="friday-september-23">Friday September 23 </h2>
</section>
<section>
<h2 id="searching-for-optimal-regularization-parameters-lambda">Searching for Optimal Regularization Parameters \( \lambda \) </h2>
+3 -7
View File
@@ -75,10 +75,10 @@ div.toc p,a {
2,
None,
'plans-for-the-lab-sessions'),
('Material for lecture Thursday September 21',
('Material for lecture Monday September 16',
2,
None,
'material-for-lecture-thursday-september-21'),
'material-for-lecture-monday-september-16'),
('Logistic Regression', 2, None, 'logistic-regression'),
('Classification problems', 2, None, 'classification-problems'),
('Optimization and Deep learning',
@@ -119,7 +119,6 @@ div.toc p,a {
'extending-to-more-predictors'),
('Including more classes', 2, None, 'including-more-classes'),
('More classes', 2, None, 'more-classes'),
('Friday September 23', 2, None, 'friday-september-23'),
('Searching for Optimal Regularization Parameters $\\lambda$',
2,
None,
@@ -330,7 +329,7 @@ MathJax.Hub.Config({
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="material-for-lecture-thursday-september-21">Material for lecture Thursday September 21 </h2>
<h2 id="material-for-lecture-monday-september-16">Material for lecture Monday September 16 </h2>
<!-- !split -->
<h2 id="logistic-regression">Logistic Regression </h2>
@@ -880,9 +879,6 @@ discussed in the material on <a href="https://compphysics.github.io/MachineLearn
methods</a>.
</p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="friday-september-23">Friday September 23 </h2>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="searching-for-optimal-regularization-parameters-lambda">Searching for Optimal Regularization Parameters \( \lambda \) </h2>
+3 -7
View File
@@ -152,10 +152,10 @@ div.toc p,a {
2,
None,
'plans-for-the-lab-sessions'),
('Material for lecture Thursday September 21',
('Material for lecture Monday September 16',
2,
None,
'material-for-lecture-thursday-september-21'),
'material-for-lecture-monday-september-16'),
('Logistic Regression', 2, None, 'logistic-regression'),
('Classification problems', 2, None, 'classification-problems'),
('Optimization and Deep learning',
@@ -196,7 +196,6 @@ div.toc p,a {
'extending-to-more-predictors'),
('Including more classes', 2, None, 'including-more-classes'),
('More classes', 2, None, 'more-classes'),
('Friday September 23', 2, None, 'friday-september-23'),
('Searching for Optimal Regularization Parameters $\\lambda$',
2,
None,
@@ -407,7 +406,7 @@ MathJax.Hub.Config({
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="material-for-lecture-thursday-september-21">Material for lecture Thursday September 21 </h2>
<h2 id="material-for-lecture-monday-september-16">Material for lecture Monday September 16 </h2>
<!-- !split -->
<h2 id="logistic-regression">Logistic Regression </h2>
@@ -957,9 +956,6 @@ discussed in the material on <a href="https://compphysics.github.io/MachineLearn
methods</a>.
</p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="friday-september-23">Friday September 23 </h2>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="searching-for-optimal-regularization-parameters-lambda">Searching for Optimal Regularization Parameters \( \lambda \) </h2>
Binary file not shown.
File diff suppressed because it is too large Load Diff
+1 -4
View File
@@ -42,7 +42,7 @@ DATE: September 16-20, 2024
!split
===== Material for lecture Thursday September 21 =====
===== Material for lecture Monday September 16 =====
!split
@@ -539,9 +539,6 @@ discussed in the material on "optimization
methods":"https://compphysics.github.io/MachineLearning/doc/pub/Splines/html/Splines-bs.html".
!split
===== Friday September 23 =====
!split
===== Searching for Optimal Regularization Parameters $\lambda$ =====