updating week 38

This commit is contained in:
Morten Hjorth-Jensen
2021-09-23 16:41:49 +02:00
parent ad6b5bf463
commit 8e2eac6aa1
9 changed files with 261 additions and 499 deletions
+1
View File
@@ -422,6 +422,7 @@ MathJax.Hub.Config({
<ul>
<li> Thursday: Summary of regression methods and discussion of project 1. Start Logistic Regression</li>
<li> <a href="https://www.uio.no/studier/emner/matnat/fys/FYS-STK4155/h21/forelesningsvideoer/LectureSeptember23.mp4?vrtx=view-as-webpage" target="_self">Video of Lecture September 23</a></li>
<li> Friday: Logistic Regression and Optimization methods</li>
</ul>
+3
View File
@@ -544,6 +544,9 @@ $$
\lambda \vert\vert \boldsymbol{\beta} \vert\vert_1 = \lambda \sum_{j=1}^{p-1}\vert\beta_j\vert.
$$
<p>
It means that, when scaling the design matrix and the outputs/targets, by subtracting the mean values, we have an optimization problem which is not penalized by the intercept. The MSE value can then be smaller since it focuses only on the remaining quantities. If we however bring back the intercept, we will get a MSE which then contains the intercept.
<p>
<p>
<!-- navigation buttons at the bottom of the page -->
+7 -3
View File
@@ -506,11 +506,15 @@ plt<span style="color: #666666">.</span>show()
<p>
We see here, when compared to the code which includes explicitely the
intercept column, that our MSE value is actually smaller. This is
because the regularization term does not include the intercept value \( \beta_0 \) in the
fitting. This applies to Lasso regularization as well.
because the regularization term does not include the intercept value
\( \beta_0 \) in the fitting. This applies to Lasso regularization as
well. It means that our optimization is now done only with the
centered matrix and/or vector that enter the fitting procedure. Note
also that the problem with the intercept occurs mainly in these type
of polynomial fitting problem.
<p>
If we stay with ordinary least squares, there is no dependence on the value of the intercept when we perform the fitting.
The next example is indeed an example where all these discussions about the role of intercept are not present.
<p>
<p>
+11 -3
View File
@@ -163,6 +163,7 @@ MathJax.Hub.Config({
<ul>
<p><li> Thursday: Summary of regression methods and discussion of project 1. Start Logistic Regression</li>
<p><li> <a href="https://www.uio.no/studier/emner/matnat/fys/FYS-STK4155/h21/forelesningsvideoer/LectureSeptember23.mp4?vrtx=view-as-webpage" target="_blank">Video of Lecture September 23</a></li>
<p><li> Friday: Logistic Regression and Optimization methods</li>
</ul>
</section>
@@ -795,6 +796,9 @@ $$
\lambda \vert\vert \boldsymbol{\beta} \vert\vert_1 = \lambda \sum_{j=1}^{p-1}\vert\beta_j\vert.
$$
<p>&nbsp;<br>
<p>
It means that, when scaling the design matrix and the outputs/targets, by subtracting the mean values, we have an optimization problem which is not penalized by the intercept. The MSE value can then be smaller since it focuses only on the remaining quantities. If we however bring back the intercept, we will get a MSE which then contains the intercept.
</section>
@@ -970,11 +974,15 @@ plt.show()
<p>
We see here, when compared to the code which includes explicitely the
intercept column, that our MSE value is actually smaller. This is
because the regularization term does not include the intercept value \( \beta_0 \) in the
fitting. This applies to Lasso regularization as well.
because the regularization term does not include the intercept value
\( \beta_0 \) in the fitting. This applies to Lasso regularization as
well. It means that our optimization is now done only with the
centered matrix and/or vector that enter the fitting procedure. Note
also that the problem with the intercept occurs mainly in these type
of polynomial fitting problem.
<p>
If we stay with ordinary least squares, there is no dependence on the value of the intercept when we perform the fitting.
The next example is indeed an example where all these discussions about the role of intercept are not present.
</section>
+11 -3
View File
@@ -346,6 +346,7 @@ MathJax.Hub.Config({
<ul>
<li> Thursday: Summary of regression methods and discussion of project 1. Start Logistic Regression</li>
<li> <a href="https://www.uio.no/studier/emner/matnat/fys/FYS-STK4155/h21/forelesningsvideoer/LectureSeptember23.mp4?vrtx=view-as-webpage" target="_blank">Video of Lecture September 23</a></li>
<li> Friday: Logistic Regression and Optimization methods</li>
</ul>
@@ -924,6 +925,9 @@ $$
\lambda \vert\vert \boldsymbol{\beta} \vert\vert_1 = \lambda \sum_{j=1}^{p-1}\vert\beta_j\vert.
$$
<p>
It means that, when scaling the design matrix and the outputs/targets, by subtracting the mean values, we have an optimization problem which is not penalized by the intercept. The MSE value can then be smaller since it focuses only on the remaining quantities. If we however bring back the intercept, we will get a MSE which then contains the intercept.
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
@@ -1098,11 +1102,15 @@ plt.show()
<p>
We see here, when compared to the code which includes explicitely the
intercept column, that our MSE value is actually smaller. This is
because the regularization term does not include the intercept value \( \beta_0 \) in the
fitting. This applies to Lasso regularization as well.
because the regularization term does not include the intercept value
\( \beta_0 \) in the fitting. This applies to Lasso regularization as
well. It means that our optimization is now done only with the
centered matrix and/or vector that enter the fitting procedure. Note
also that the problem with the intercept occurs mainly in these type
of polynomial fitting problem.
<p>
If we stay with ordinary least squares, there is no dependence on the value of the intercept when we perform the fitting.
The next example is indeed an example where all these discussions about the role of intercept are not present.
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
+11 -3
View File
@@ -351,6 +351,7 @@ MathJax.Hub.Config({
<ul>
<li> Thursday: Summary of regression methods and discussion of project 1. Start Logistic Regression</li>
<li> <a href="https://www.uio.no/studier/emner/matnat/fys/FYS-STK4155/h21/forelesningsvideoer/LectureSeptember23.mp4?vrtx=view-as-webpage" target="_blank">Video of Lecture September 23</a></li>
<li> Friday: Logistic Regression and Optimization methods</li>
</ul>
@@ -929,6 +930,9 @@ $$
\lambda \vert\vert \boldsymbol{\beta} \vert\vert_1 = \lambda \sum_{j=1}^{p-1}\vert\beta_j\vert.
$$
<p>
It means that, when scaling the design matrix and the outputs/targets, by subtracting the mean values, we have an optimization problem which is not penalized by the intercept. The MSE value can then be smaller since it focuses only on the remaining quantities. If we however bring back the intercept, we will get a MSE which then contains the intercept.
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
@@ -1103,11 +1107,15 @@ plt<span style="color: #666666">.</span>show()
<p>
We see here, when compared to the code which includes explicitely the
intercept column, that our MSE value is actually smaller. This is
because the regularization term does not include the intercept value \( \beta_0 \) in the
fitting. This applies to Lasso regularization as well.
because the regularization term does not include the intercept value
\( \beta_0 \) in the fitting. This applies to Lasso regularization as
well. It means that our optimization is now done only with the
centered matrix and/or vector that enter the fitting procedure. Note
also that the problem with the intercept occurs mainly in these type
of polynomial fitting problem.
<p>
If we stay with ordinary least squares, there is no dependence on the value of the intercept when we perform the fitting.
The next example is indeed an example where all these discussions about the role of intercept are not present.
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
Binary file not shown.
File diff suppressed because one or more lines are too long
+11 -4
View File
@@ -10,6 +10,7 @@ DATE: today
===== Plans for week 38 =====
* Thursday: Summary of regression methods and discussion of project 1. Start Logistic Regression
* "Video of Lecture September 23":"https://www.uio.no/studier/emner/matnat/fys/FYS-STK4155/h21/forelesningsvideoer/LectureSeptember23.mp4?vrtx=view-as-webpage"
* Friday: Logistic Regression and Optimization methods
@@ -553,7 +554,7 @@ the way we treat the intercept may give a larger or smaller MSE,
meaning that the MSE can be penalized by the value of the
intercept. Not including the intercept in the fit, means that the
regularization term does not include $\beta_0$. For different values
of $\lambda$, this may lead to differeing MSE values.
of $\lambda$, this may lead to differeing MSE values.
To remind the reader, the regularization term, with the intercept in Ridge regression is given by
!bt
@@ -575,6 +576,7 @@ For Lasso regression we have
\]
!et
It means that, when scaling the design matrix and the outputs/targets, by subtracting the mean values, we have an optimization problem which is not penalized by the intercept. The MSE value can then be smaller since it focuses only on the remaining quantities. If we however bring back the intercept, we will get a MSE which then contains the intercept.
!split
===== Code Examples =====
@@ -743,10 +745,15 @@ plt.show()
We see here, when compared to the code which includes explicitely the
intercept column, that our MSE value is actually smaller. This is
because the regularization term does not include the intercept value $\beta_0$ in the
fitting. This applies to Lasso regularization as well.
because the regularization term does not include the intercept value
$\beta_0$ in the fitting. This applies to Lasso regularization as
well. It means that our optimization is now done only with the
centered matrix and/or vector that enter the fitting procedure. Note
also that the problem with the intercept occurs mainly in these type
of polynomial fitting problem.
The next example is indeed an example where all these discussions about the role of intercept are not present.
If we stay with ordinary least squares, there is no dependence on the value of the intercept when we perform the fitting.
!split
===== More complicated Example: The Ising model =====