diff --git a/doc/Projects/2018/hw2/html/hw2-bs.html b/doc/Projects/2018/hw2/html/hw2-bs.html index f97cff804..367aaa066 100644 --- a/doc/Projects/2018/hw2/html/hw2-bs.html +++ b/doc/Projects/2018/hw2/html/hw2-bs.html @@ -150,12 +150,7 @@ Compare and analyze your results with those from exercise 2. Study the dependenc
  1. Repeat the above but using the functionality of scikit-learn. Compare your code with the results from scikit-learn. Remember to run with the same random numbers for generating \( x \) and \( y \).
  2. -
  3. Our next step is to study the variance of the parameters \( \beta_1 \) and \( \beta_2 \) (assuming that we are parametrizing our function with a second-order polynomial. We will use standard linear regression and the Ridge regression.
  4. -
- -You can now opt for either writing your own function that calculates the variance of these paramaters (recall that this is equal to the diagonal elements of the matrix \( (\hat{X}^T\hat{X})^{-1}+\lambda\hat{I} \)) or use the functionality of scikit-learn and computetheir variances. Discuss the results of these variances as functions of \( \lambda \). In particular, try to link your discussion with the discussion in Hastie et al. and their figure 3.11. - -
    +
  1. Our next step is to study the variance of the parameters \( \beta_1 \) and \( \beta_2 \) (assuming that we are parametrizing our function with a second-order polynomial. We will use standard linear regression and the Ridge regression. You can now opt for either writing your own function that calculates the variance of these paramaters (recall that this is equal to the diagonal elements of the matrix \( (\hat{X}^T\hat{X})^{-1}+\lambda\hat{I} \)) or use the functionality of scikit-learn and computetheir variances. Discuss the results of these variances as functions of \( \lambda \). In particular, try to link your discussion with the discussion in Hastie et al. and their figure 3.11.
  2. Repeat the previous step but add now the Lasso method, see equation (3.53) of Hastie et al.. Discuss your results and compare with standard regression and the Ridge regression results. You can write your own code or use the functionality of scikit-learn.
  3. Finally, using scikit-learn or your own code, compute also the mean square error, a risk metric corresponding to the expected value of the squared (quadratic) error defined as
@@ -186,7 +181,7 @@ $$ \mathrm{Var}(\hat{z}_i)=\frac{d_i^2}{N}, $$ -where \( d_i \) are the singular values of the matrix \( \hat{X} \). Give an interprepation of these results, in particular in connection with the variance of the coefficients you obtained in the previous exercise. +where \( d_i \) are the singular values of the matrix \( \hat{X} \). Give an interpretation of these results, in particular in connection with the variance of the coefficients you obtained in the previous exercise.

diff --git a/doc/Projects/2018/hw2/html/hw2.html b/doc/Projects/2018/hw2/html/hw2.html index 3e2d44270..81b326f5d 100644 --- a/doc/Projects/2018/hw2/html/hw2.html +++ b/doc/Projects/2018/hw2/html/hw2.html @@ -115,12 +115,7 @@ Compare and analyze your results with those from exercise 2. Study the dependenc

  1. Repeat the above but using the functionality of scikit-learn. Compare your code with the results from scikit-learn. Remember to run with the same random numbers for generating \( x \) and \( y \).
  2. -
  3. Our next step is to study the variance of the parameters \( \beta_1 \) and \( \beta_2 \) (assuming that we are parametrizing our function with a second-order polynomial. We will use standard linear regression and the Ridge regression.
  4. -
- -You can now opt for either writing your own function that calculates the variance of these paramaters (recall that this is equal to the diagonal elements of the matrix \( (\hat{X}^T\hat{X})^{-1}+\lambda\hat{I} \)) or use the functionality of scikit-learn and computetheir variances. Discuss the results of these variances as functions of \( \lambda \). In particular, try to link your discussion with the discussion in Hastie et al. and their figure 3.11. - -
    +
  1. Our next step is to study the variance of the parameters \( \beta_1 \) and \( \beta_2 \) (assuming that we are parametrizing our function with a second-order polynomial. We will use standard linear regression and the Ridge regression. You can now opt for either writing your own function that calculates the variance of these paramaters (recall that this is equal to the diagonal elements of the matrix \( (\hat{X}^T\hat{X})^{-1}+\lambda\hat{I} \)) or use the functionality of scikit-learn and computetheir variances. Discuss the results of these variances as functions of \( \lambda \). In particular, try to link your discussion with the discussion in Hastie et al. and their figure 3.11.
  2. Repeat the previous step but add now the Lasso method, see equation (3.53) of Hastie et al.. Discuss your results and compare with standard regression and the Ridge regression results. You can write your own code or use the functionality of scikit-learn.
  3. Finally, using scikit-learn or your own code, compute also the mean square error, a risk metric corresponding to the expected value of the squared (quadratic) error defined as
@@ -151,7 +146,7 @@ $$ \mathrm{Var}(\hat{z}_i)=\frac{d_i^2}{N}, $$ -where \( d_i \) are the singular values of the matrix \( \hat{X} \). Give an interprepation of these results, in particular in connection with the variance of the coefficients you obtained in the previous exercise. +where \( d_i \) are the singular values of the matrix \( \hat{X} \). Give an interpretation of these results, in particular in connection with the variance of the coefficients you obtained in the previous exercise. diff --git a/doc/Projects/2018/hw2/ipynb/ipynb-hw2-src.tar.gz b/doc/Projects/2018/hw2/ipynb/ipynb-hw2-src.tar.gz index 4b1da116e..b45bada77 100644 Binary files a/doc/Projects/2018/hw2/ipynb/ipynb-hw2-src.tar.gz and b/doc/Projects/2018/hw2/ipynb/ipynb-hw2-src.tar.gz differ diff --git a/doc/Projects/2018/hw2/pdf/hw2.p.tex b/doc/Projects/2018/hw2/pdf/hw2.p.tex index 7824027f3..dd6529e49 100644 --- a/doc/Projects/2018/hw2/pdf/hw2.p.tex +++ b/doc/Projects/2018/hw2/pdf/hw2.p.tex @@ -191,13 +191,8 @@ Compare and analyze your results with those from exercise 2. Study the dependenc \begin{enumerate} \item Repeat the above but using the functionality of \textbf{scikit-learn}. Compare your code with the results from \textbf{scikit-learn}. Remember to run with the same random numbers for generating $x$ and $y$. -\item Our next step is to study the variance of the parameters $\beta_1$ and $\beta_2$ (assuming that we are parametrizing our function with a second-order polynomial. We will use standard linear regression and the Ridge regression. -\end{enumerate} +\item Our next step is to study the variance of the parameters $\beta_1$ and $\beta_2$ (assuming that we are parametrizing our function with a second-order polynomial. We will use standard linear regression and the Ridge regression. You can now opt for either writing your own function that calculates the variance of these paramaters (recall that this is equal to the diagonal elements of the matrix $(\hat{X}^T\hat{X})^{-1}+\lambda\hat{I}$) or use the functionality of \textbf{scikit-learn} and computetheir variances. Discuss the results of these variances as functions of $\lambda$. In particular, try to link your discussion with the discussion in Hastie \emph{et al.} and their figure 3.11. -\noindent -You can now opt for either writing your own function that calculates the variance of these paramaters (recall that this is equal to the diagonal elements of the matrix $(\hat{X}^T\hat{X})^{-1}+\lambda\hat{I}$) or use the functionality of \textbf{scikit-learn} and computetheir variances. Discuss the results of these variances as functions of $\lambda$. In particular, try to link your discussion with the discussion in Hastie \emph{et al.} and their figure 3.11. - -\begin{enumerate} \item Repeat the previous step but add now the Lasso method, see equation (3.53) of Hastie \emph{et al.}. Discuss your results and compare with standard regression and the Ridge regression results. You can write your own code or use the functionality of \textbf{scikit-learn}. \item Finally, using \textbf{scikit-learn} or your own code, compute also the mean square error, a risk metric corresponding to the expected value of the squared (quadratic) error defined as @@ -225,7 +220,7 @@ $\hat{z}_i=\hat{X}\hat{v}_i$ is equal to (equation (3.49) of Hastie \emph{et a \[ \mathrm{Var}(\hat{z}_i)=\frac{d_i^2}{N}, \] -where $d_i$ are the singular values of the matrix $\hat{X}$. Give an interprepation of these results, in particular in connection with the variance of the coefficients you obtained in the previous exercise. +where $d_i$ are the singular values of the matrix $\hat{X}$. Give an interpretation of these results, in particular in connection with the variance of the coefficients you obtained in the previous exercise. % ------------------- end of main content --------------- diff --git a/doc/Projects/2018/hw2/pdf/hw2.pdf b/doc/Projects/2018/hw2/pdf/hw2.pdf index d5d7c1f38..1fbd9008a 100644 Binary files a/doc/Projects/2018/hw2/pdf/hw2.pdf and b/doc/Projects/2018/hw2/pdf/hw2.pdf differ diff --git a/doc/Projects/2018/hw2/pdf/hw2.tex b/doc/Projects/2018/hw2/pdf/hw2.tex index 84344cbca..05027f064 100644 --- a/doc/Projects/2018/hw2/pdf/hw2.tex +++ b/doc/Projects/2018/hw2/pdf/hw2.tex @@ -161,13 +161,8 @@ Compare and analyze your results with those from exercise 2. Study the dependenc \begin{enumerate} \item Repeat the above but using the functionality of \textbf{scikit-learn}. Compare your code with the results from \textbf{scikit-learn}. Remember to run with the same random numbers for generating $x$ and $y$. -\item Our next step is to study the variance of the parameters $\beta_1$ and $\beta_2$ (assuming that we are parametrizing our function with a second-order polynomial. We will use standard linear regression and the Ridge regression. -\end{enumerate} +\item Our next step is to study the variance of the parameters $\beta_1$ and $\beta_2$ (assuming that we are parametrizing our function with a second-order polynomial. We will use standard linear regression and the Ridge regression. You can now opt for either writing your own function that calculates the variance of these paramaters (recall that this is equal to the diagonal elements of the matrix $(\hat{X}^T\hat{X})^{-1}+\lambda\hat{I}$) or use the functionality of \textbf{scikit-learn} and computetheir variances. Discuss the results of these variances as functions of $\lambda$. In particular, try to link your discussion with the discussion in Hastie \emph{et al.} and their figure 3.11. -\noindent -You can now opt for either writing your own function that calculates the variance of these paramaters (recall that this is equal to the diagonal elements of the matrix $(\hat{X}^T\hat{X})^{-1}+\lambda\hat{I}$) or use the functionality of \textbf{scikit-learn} and computetheir variances. Discuss the results of these variances as functions of $\lambda$. In particular, try to link your discussion with the discussion in Hastie \emph{et al.} and their figure 3.11. - -\begin{enumerate} \item Repeat the previous step but add now the Lasso method, see equation (3.53) of Hastie \emph{et al.}. Discuss your results and compare with standard regression and the Ridge regression results. You can write your own code or use the functionality of \textbf{scikit-learn}. \item Finally, using \textbf{scikit-learn} or your own code, compute also the mean square error, a risk metric corresponding to the expected value of the squared (quadratic) error defined as @@ -195,7 +190,7 @@ $\hat{z}_i=\hat{X}\hat{v}_i$ is equal to (equation (3.49) of Hastie \emph{et a \[ \mathrm{Var}(\hat{z}_i)=\frac{d_i^2}{N}, \] -where $d_i$ are the singular values of the matrix $\hat{X}$. Give an interprepation of these results, in particular in connection with the variance of the coefficients you obtained in the previous exercise. +where $d_i$ are the singular values of the matrix $\hat{X}$. Give an interpretation of these results, in particular in connection with the variance of the coefficients you obtained in the previous exercise. % ------------------- end of main content --------------- diff --git a/doc/src/Projects/2018/Exercises/hw2.do.txt b/doc/src/Projects/2018/Exercises/hw2.do.txt index 48412eeb1..add3555f6 100644 --- a/doc/src/Projects/2018/Exercises/hw2.do.txt +++ b/doc/src/Projects/2018/Exercises/hw2.do.txt @@ -27,8 +27,7 @@ Compare and analyze your results with those from exercise 2. Study the dependenc o Repeat the above but using the functionality of _scikit-learn_. Compare your code with the results from _scikit-learn_. Remember to run with the same random numbers for generating $x$ and $y$. -o Our next step is to study the variance of the parameters $\beta_1$ and $\beta_2$ (assuming that we are parametrizing our function with a second-order polynomial. We will use standard linear regression and the Ridge regression. -You can now opt for either writing your own function that calculates the variance of these paramaters (recall that this is equal to the diagonal elements of the matrix $(\hat{X}^T\hat{X})^{-1}+\lambda\hat{I}$) or use the functionality of _scikit-learn_ and computetheir variances. Discuss the results of these variances as functions of $\lambda$. In particular, try to link your discussion with the discussion in Hastie *et al.* and their figure 3.11. +o Our next step is to study the variance of the parameters $\beta_1$ and $\beta_2$ (assuming that we are parametrizing our function with a second-order polynomial. We will use standard linear regression and the Ridge regression. You can now opt for either writing your own function that calculates the variance of these paramaters (recall that this is equal to the diagonal elements of the matrix $(\hat{X}^T\hat{X})^{-1}+\lambda\hat{I}$) or use the functionality of _scikit-learn_ and computetheir variances. Discuss the results of these variances as functions of $\lambda$. In particular, try to link your discussion with the discussion in Hastie *et al.* and their figure 3.11. o Repeat the previous step but add now the Lasso method, see equation (3.53) of Hastie *et al.*. Discuss your results and compare with standard regression and the Ridge regression results. You can write your own code or use the functionality of _scikit-learn_. @@ -62,4 +61,4 @@ $\hat{z}_i=\hat{X}\hat{v}_i$ is equal to (equation (3.49) of Hastie *et al.*) \mathrm{Var}(\hat{z}_i)=\frac{d_i^2}{N}, \] !et -where $d_i$ are the singular values of the matrix $\hat{X}$. Give an interprepation of these results, in particular in connection with the variance of the coefficients you obtained in the previous exercise. +where $d_i$ are the singular values of the matrix $\hat{X}$. Give an interpretation of these results, in particular in connection with the variance of the coefficients you obtained in the previous exercise.