From 4478797b242f833d5bd33f7eaa3f76a849676b1a Mon Sep 17 00:00:00 2001 From: mhjensen Date: Mon, 3 Sep 2018 16:38:00 +0200 Subject: [PATCH] more typos grrr --- doc/Projects/2018/hw2/html/hw2-bs.html | 9 ++------- doc/Projects/2018/hw2/html/hw2.html | 9 ++------- .../2018/hw2/ipynb/ipynb-hw2-src.tar.gz | Bin 207 -> 207 bytes doc/Projects/2018/hw2/pdf/hw2.p.tex | 9 ++------- doc/Projects/2018/hw2/pdf/hw2.pdf | Bin 198064 -> 198096 bytes doc/Projects/2018/hw2/pdf/hw2.tex | 9 ++------- doc/src/Projects/2018/Exercises/hw2.do.txt | 5 ++--- 7 files changed, 10 insertions(+), 31 deletions(-) diff --git a/doc/Projects/2018/hw2/html/hw2-bs.html b/doc/Projects/2018/hw2/html/hw2-bs.html index 367aaa066..7e1d9a41e 100644 --- a/doc/Projects/2018/hw2/html/hw2-bs.html +++ b/doc/Projects/2018/hw2/html/hw2-bs.html @@ -143,14 +143,9 @@ The following simple Python instructions define our \( x \) and \( y \) values ( y = 5*x*x+0.1*np.random.randn(100,1)
    -
  1. Write your own code for the Ridge method (see chapter 3.4 of Hastie et al., equations (3.43) and (3.44)) and compute the parametrization for different values of \( \lambda \).
  2. -
- -Compare and analyze your results with those from exercise 2. Study the dependence on \( \lambda \) while also varying the strength of the noise in your expression for \( y(x) \). - -
    +
  1. Write your own code for the Ridge method (see chapter 3.4 of Hastie et al., equations (3.43) and (3.44)) and compute the parametrization for different values of \( \lambda \). Compare and analyze your results with those from exercise 2. Study the dependence on \( \lambda \) while also varying the strength of the noise in your expression for \( y(x) \).
  2. 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 \).
  3. -
  4. 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.
  5. +
  6. 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 compute their 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.
  7. 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.
  8. 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
diff --git a/doc/Projects/2018/hw2/html/hw2.html b/doc/Projects/2018/hw2/html/hw2.html index 81b326f5d..e68f82db2 100644 --- a/doc/Projects/2018/hw2/html/hw2.html +++ b/doc/Projects/2018/hw2/html/hw2.html @@ -108,14 +108,9 @@ The following simple Python instructions define our \( x \) and \( y \) values ( y = 5*x*x+0.1*np.random.randn(100,1)
    -
  1. Write your own code for the Ridge method (see chapter 3.4 of Hastie et al., equations (3.43) and (3.44)) and compute the parametrization for different values of \( \lambda \).
  2. -
- -Compare and analyze your results with those from exercise 2. Study the dependence on \( \lambda \) while also varying the strength of the noise in your expression for \( y(x) \). - -
    +
  1. Write your own code for the Ridge method (see chapter 3.4 of Hastie et al., equations (3.43) and (3.44)) and compute the parametrization for different values of \( \lambda \). Compare and analyze your results with those from exercise 2. Study the dependence on \( \lambda \) while also varying the strength of the noise in your expression for \( y(x) \).
  2. 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 \).
  3. -
  4. 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.
  5. +
  6. 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 compute their 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.
  7. 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.
  8. 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
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 b45bada7796cbc362a3cd933ea09c659efdf149f..6bb2b7ebf214a27972f81ff43417b60f0a74f477 100644 GIT binary patch literal 207 zcmb2|=3p>)?~P_)etZ647L%dCvBL9qM{N#Hy4(ADX8^w(i(tIMri;GO!oEto^6!T( zw7oie%BBDBKN%i2II|{Ae|>l4ME%MyCSEJuvUfh)GV@MQ==WdCbhI^JM_r$~uGCo6 zR7BWT=JFMsZ(JgCF>s5Ry2h$etX_G>#%`9+ru@rU6zd#>tC(mKB?60q`9}DXKK{Xi9wzVzrM}3 zzOd#}tj5y!%@2~>9M9}oBOmVn+NO5d(YqQ;XYHD%IsNS6Iji55gmw2m*I zwrJU+xQ<=-y~3Z*D3J(%S$@p*ao)M!Q}Bm;NBQJ=f4`|RAcGJ4YZ$p!PG8NS H!N33jOh#n7 diff --git a/doc/Projects/2018/hw2/pdf/hw2.p.tex b/doc/Projects/2018/hw2/pdf/hw2.p.tex index dd6529e49..03165d7b8 100644 --- a/doc/Projects/2018/hw2/pdf/hw2.p.tex +++ b/doc/Projects/2018/hw2/pdf/hw2.p.tex @@ -182,16 +182,11 @@ y = 5*x*x+0.1*np.random.randn(100,1) \epycod \begin{enumerate} -\item Write your own code for the Ridge method (see chapter 3.4 of Hastie \emph{et al.}, equations (3.43) and (3.44)) and compute the parametrization for different values of $\lambda$. -\end{enumerate} +\item Write your own code for the Ridge method (see chapter 3.4 of Hastie \emph{et al.}, equations (3.43) and (3.44)) and compute the parametrization for different values of $\lambda$. Compare and analyze your results with those from exercise 2. Study the dependence on $\lambda$ while also varying the strength of the noise in your expression for $y(x)$. -\noindent -Compare and analyze your results with those from exercise 2. Study the dependence on $\lambda$ while also varying the strength of the noise in your expression for $y(x)$. - -\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. 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. +\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 compute their 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. \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}. diff --git a/doc/Projects/2018/hw2/pdf/hw2.pdf b/doc/Projects/2018/hw2/pdf/hw2.pdf index 1fbd9008a8809cc4a45df345fdfaacc176a0408a..c4daaa3b4d26c7d804f368618a6fa4fcc3091d9c 100644 GIT binary patch delta 9811 zcmaiZRZyJ`uq5stBuJ2hySuvtcTXU=yTgaOySqEV-GaNjbI=g%070|=y;Zxf`!qdW z^E%bt)r~P|^D$_NAUIAoUY-;+R5~C}-@x^<4Le}2VLq3ZK{z;ym~{d|G1F?FZ8qyn zJ41DjMmfksivv#7WIA1YGGLO!ZlP-bB8&yqG+^5FdKIQX@D$^A3r0L=oa^5XaJv7G z;2==YZ|>+dpsNX;Tn063f7W7h;Ef?mX?PTTYFXykXzypy5onLn|L}Wl2RJVeX{U?J zSa|pR)9+ zr^a+Y^4ho6X;s?UcD;@v+igf^%S@ z^{YWuUYp+MBXc>dW;{s-#z-+iX{$r!*&F`Xq)k1mQ2|pbX_LYDr?zRuE!s`UwNw% zj-TuPHtk9ldM~b_PwcBca3j1CvsM!vN0V}N+Gfmme(@yj!3oYy!)h+otw%F^eaAt; zqAR$#N;ilwY5Evkm?(@lS5ur#wj3D}n`!0n%dFq@P6l-fa$N?EfzF@adOW{ZINPs8 zSiee6#i84>>gQeV0pZ$Yx(>@nOQV`jAV1Ivxk zB>+Va{miysJbA%5oF>^E9&brAE9tD8>Xw7lBCVcHhZ*(D=dZiX69pn?}yt ziysMoMjVL`c^1LxQ8u%=;3PI@cX7vzb@b3R-}bho02leoyMuwFA%TgPsuR1M3VQeO z7+9Uz&3a>E{?7oTw9a=s{F}-3T$b?0rlZ@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H(0K8$Gu$&G@lQ$qnA1&N*JWu<0_T}=``=Vf$(D}Kk@_~khZe^aa<@hS$nB~vZ zma45D8{hH>YE^Df`{=|m*JLN2XonX{je)J+>YvTrcHk((CfD|UtH&Qlj#C0H?`mFs zbEfTkc=HY&E+)G-g7o*?;JPzFjz~jnrYne}<&}Px(C}H!$~25+XB_??qRssIqO%w9 zEpUBTl_T%lgfxn;#{>X1F3)L`p2^#x}q8I05P?re)?F{zwsI+^95pkXhn?@@aG-v}VJ$&^I(5XGF0!!84^G667m?C+VzPhof4#J+CwG#}=uNTSEw3EB zlqb;c?^Z!x!B~K%=W}_!@!mA_{}TNRHb+4hoOT2aZKER2#w#JoE6T|s!NxAe#v#Tb z$t%gq#VX0g%kf`{iwThl{C`{Y|KDZJ&dx*jzYikf89s$TNc7OX*CS1IWk}`CVI0RD zyiGi7ES6pJi|}r|Tc}jMfj0G#p^XJgQ&Y}sPQ`7rNc*X&f16YC|F$?~cjHAmr<@!u z12nXP)YpPtrTbBd`k0H2kv7Pn!|EX49bi1iCK{UY&-@85L}^|6xxq#lfI8%@Iv9zQ z09ccg5F9#D(uY9^|^Ttt65ymOBIJ{m}cD{?-Dfi?J#o`U&D4*;lET!^n0sfjG8BHsL Sg(d}X@p1#GsU;L80sjXo-vU|y diff --git a/doc/Projects/2018/hw2/pdf/hw2.tex b/doc/Projects/2018/hw2/pdf/hw2.tex index 05027f064..99574c061 100644 --- a/doc/Projects/2018/hw2/pdf/hw2.tex +++ b/doc/Projects/2018/hw2/pdf/hw2.tex @@ -152,16 +152,11 @@ y = 5*x*x+0.1*np.random.randn(100,1) \end{print} \begin{enumerate} -\item Write your own code for the Ridge method (see chapter 3.4 of Hastie \emph{et al.}, equations (3.43) and (3.44)) and compute the parametrization for different values of $\lambda$. -\end{enumerate} +\item Write your own code for the Ridge method (see chapter 3.4 of Hastie \emph{et al.}, equations (3.43) and (3.44)) and compute the parametrization for different values of $\lambda$. Compare and analyze your results with those from exercise 2. Study the dependence on $\lambda$ while also varying the strength of the noise in your expression for $y(x)$. -\noindent -Compare and analyze your results with those from exercise 2. Study the dependence on $\lambda$ while also varying the strength of the noise in your expression for $y(x)$. - -\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. 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. +\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 compute their 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. \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}. diff --git a/doc/src/Projects/2018/Exercises/hw2.do.txt b/doc/src/Projects/2018/Exercises/hw2.do.txt index add3555f6..593182104 100644 --- a/doc/src/Projects/2018/Exercises/hw2.do.txt +++ b/doc/src/Projects/2018/Exercises/hw2.do.txt @@ -22,12 +22,11 @@ x = np.random.rand(100,1) y = 5*x*x+0.1*np.random.randn(100,1) !ec -o Write your own code for the Ridge method (see chapter 3.4 of Hastie *et al.*, equations (3.43) and (3.44)) and compute the parametrization for different values of $\lambda$. -Compare and analyze your results with those from exercise 2. Study the dependence on $\lambda$ while also varying the strength of the noise in your expression for $y(x)$. +o Write your own code for the Ridge method (see chapter 3.4 of Hastie *et al.*, equations (3.43) and (3.44)) and compute the parametrization for different values of $\lambda$. Compare and analyze your results with those from exercise 2. Study the dependence on $\lambda$ while also varying the strength of the noise in your expression for $y(x)$. 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 compute their 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_.