diff --git a/doc/pub/week36/html/week36-bs.html b/doc/pub/week36/html/week36-bs.html index 61a1699bc..826a56659 100644 --- a/doc/pub/week36/html/week36-bs.html +++ b/doc/pub/week36/html/week36-bs.html @@ -85,6 +85,8 @@ Automatically generated HTML file from DocOnce source 'simple-example-to-illustrate-ordinary-least-squares-ridge-and-lasso-regression'), ('Ridge Regression', 2, None, 'ridge-regression'), ('Lasso Regression', 2, None, 'lasso-regression'), + ('Yet another Example', 2, None, 'yet-another-example'), + ('The OLS case', 2, None, 'the-ols-case'), ('Linking the regression analysis with a statistical ' 'interpretation', 2, @@ -241,38 +243,40 @@ MathJax.Hub.Config({
  • Simple example to illustrate Ordinary Least Squares, Ridge and Lasso Regression
  • Ridge Regression
  • Lasso Regression
  • -
  • Linking the regression analysis with a statistical interpretation
  • -
  • Assumptions made
  • -
  • Expectation value and variance
  • -
  • Expectation value and variance for \( \boldsymbol{\beta} \)
  • -
  • Friday September 10
  • -
  • Why resampling methods
  • -
  • Resampling methods
  • -
  • Resampling approaches can be computationally expensive
  • -
  • Why resampling methods ?
  • -
  • Statistical analysis
  • -
  • Resampling methods
  • -
  • Resampling methods: Jackknife and Bootstrap
  • -
  • Resampling methods: Jackknife
  • -
  • Jackknife code example
  • -
  • Resampling methods: Bootstrap
  • -
  • Resampling methods: Bootstrap background
  • -
  • Resampling methods: More Bootstrap background
  • -
  • Resampling methods: Bootstrap approach
  • -
  • Resampling methods: Bootstrap steps
  • -
  • Code example for the Bootstrap method
  • -
  • Various steps in cross-validation
  • -
  • How to set up the cross-validation for Ridge and/or Lasso
  • -
  • Cross-validation in brief
  • -
  • Code Example for Cross-validation and \( k \)-fold Cross-validation
  • -
  • The bias-variance tradeoff
  • -
  • Example code for Bias-Variance tradeoff
  • -
  • Understanding what happens
  • -
  • Summing up
  • -
  • Another Example from Scikit-Learn's Repository
  • -
  • More examples on bootstrap and cross-validation and errors
  • -
  • The same example but now with cross-validation
  • -
  • Cross-validation with Ridge
  • +
  • Yet another Example
  • +
  • The OLS case
  • +
  • Linking the regression analysis with a statistical interpretation
  • +
  • Assumptions made
  • +
  • Expectation value and variance
  • +
  • Expectation value and variance for \( \boldsymbol{\beta} \)
  • +
  • Friday September 10
  • +
  • Why resampling methods
  • +
  • Resampling methods
  • +
  • Resampling approaches can be computationally expensive
  • +
  • Why resampling methods ?
  • +
  • Statistical analysis
  • +
  • Resampling methods
  • +
  • Resampling methods: Jackknife and Bootstrap
  • +
  • Resampling methods: Jackknife
  • +
  • Jackknife code example
  • +
  • Resampling methods: Bootstrap
  • +
  • Resampling methods: Bootstrap background
  • +
  • Resampling methods: More Bootstrap background
  • +
  • Resampling methods: Bootstrap approach
  • +
  • Resampling methods: Bootstrap steps
  • +
  • Code example for the Bootstrap method
  • +
  • Various steps in cross-validation
  • +
  • How to set up the cross-validation for Ridge and/or Lasso
  • +
  • Cross-validation in brief
  • +
  • Code Example for Cross-validation and \( k \)-fold Cross-validation
  • +
  • The bias-variance tradeoff
  • +
  • Example code for Bias-Variance tradeoff
  • +
  • Understanding what happens
  • +
  • Summing up
  • +
  • Another Example from Scikit-Learn's Repository
  • +
  • More examples on bootstrap and cross-validation and errors
  • +
  • The same example but now with cross-validation
  • +
  • Cross-validation with Ridge
  • @@ -331,7 +335,7 @@ MathJax.Hub.Config({
  • 9
  • 10
  • ...
  • -
  • 49
  • +
  • 51
  • »
  • diff --git a/doc/pub/week36/html/week36-reveal.html b/doc/pub/week36/html/week36-reveal.html index 001cedbbd..f15f9c0a5 100644 --- a/doc/pub/week36/html/week36-reveal.html +++ b/doc/pub/week36/html/week36-reveal.html @@ -662,6 +662,51 @@ We will amongst other things show that the regularization parameter can reduce c +
    +

    Yet another Example

    + +

    +Let us assume we have a data set with outputs/targets given by the vector + +

     
    +$$ +\boldsymbol{y}=\begin{matrix}4 \\ 2 \\3\end{bmatrix}, +$$ +

     
    + +and our inputs as a \( 3\times 2 \) design matrix +

     
    +$$ +\boldsymbol{X}=\begin{matrix}2 & 0\\ 0 & 1 \\ 1 & 0\end{bmatrix}, +$$ +

     
    + +meaning that we have two features and two unknown parameters \( \beta_0 \) and \( \beta_1 \) to be determined either by ordinary least squares, Ridge or Lasso regression. +

    + + +
    +

    The OLS case

    + +

    +For ordinary least squares (OLS) we know that the optimal solution is + +

     
    +$$ +\hat{\boldsymbol{\beta}}=\left( \boldsymbol{X}^T\boldsymbol{X}\right)^{-1}\boldsymbol{X}^T\boldsymbol{y}. +$$ +

     
    + +Inserting the above values we obtain that + +

     
    +$$ +\hat{\boldsymbol{\beta}}=\begin{matrix}\frac{11}{5} \\ 2\end{bmatrix}, +$$ +

     
    +

    + +

    Linking the regression analysis with a statistical interpretation

    diff --git a/doc/pub/week36/html/week36-solarized.html b/doc/pub/week36/html/week36-solarized.html index acdeaa242..9647f1dc4 100644 --- a/doc/pub/week36/html/week36-solarized.html +++ b/doc/pub/week36/html/week36-solarized.html @@ -105,6 +105,8 @@ div { text-align: justify; text-justify: inter-word; } 'simple-example-to-illustrate-ordinary-least-squares-ridge-and-lasso-regression'), ('Ridge Regression', 2, None, 'ridge-regression'), ('Lasso Regression', 2, None, 'lasso-regression'), + ('Yet another Example', 2, None, 'yet-another-example'), + ('The OLS case', 2, None, 'the-ols-case'), ('Linking the regression analysis with a statistical ' 'interpretation', 2, @@ -676,6 +678,43 @@ Plotting these results (figure to come) shows clearly that Lasso regression supp We will now couple the discussions of ordinary least squares, Ridge and Lasso regression with a statistical interpretation, that is we move from a linear algebra analysis to a statistical analysis. In particular, we will focus on what the regularization terms can result in. We will amongst other things show that the regularization parameter can reduce considerably the variance of the parameters \( \beta \). +

    +









    + +

    Yet another Example

    + +

    +Let us assume we have a data set with outputs/targets given by the vector + +$$ +\boldsymbol{y}=\begin{matrix}4 \\ 2 \\3\end{bmatrix}, +$$ + +and our inputs as a \( 3\times 2 \) design matrix +$$ +\boldsymbol{X}=\begin{matrix}2 & 0\\ 0 & 1 \\ 1 & 0\end{bmatrix}, +$$ + +meaning that we have two features and two unknown parameters \( \beta_0 \) and \( \beta_1 \) to be determined either by ordinary least squares, Ridge or Lasso regression. + +

    +









    + +

    The OLS case

    + +

    +For ordinary least squares (OLS) we know that the optimal solution is + +$$ +\hat{\boldsymbol{\beta}}=\left( \boldsymbol{X}^T\boldsymbol{X}\right)^{-1}\boldsymbol{X}^T\boldsymbol{y}. +$$ + +Inserting the above values we obtain that + +$$ +\hat{\boldsymbol{\beta}}=\begin{matrix}\frac{11}{5} \\ 2\end{bmatrix}, +$$ +

    diff --git a/doc/pub/week36/html/week36.html b/doc/pub/week36/html/week36.html index 6c4b38b04..981ad013e 100644 --- a/doc/pub/week36/html/week36.html +++ b/doc/pub/week36/html/week36.html @@ -110,6 +110,8 @@ div { text-align: justify; text-justify: inter-word; } 'simple-example-to-illustrate-ordinary-least-squares-ridge-and-lasso-regression'), ('Ridge Regression', 2, None, 'ridge-regression'), ('Lasso Regression', 2, None, 'lasso-regression'), + ('Yet another Example', 2, None, 'yet-another-example'), + ('The OLS case', 2, None, 'the-ols-case'), ('Linking the regression analysis with a statistical ' 'interpretation', 2, @@ -681,6 +683,43 @@ Plotting these results (figure to come) shows clearly that Lasso regression supp We will now couple the discussions of ordinary least squares, Ridge and Lasso regression with a statistical interpretation, that is we move from a linear algebra analysis to a statistical analysis. In particular, we will focus on what the regularization terms can result in. We will amongst other things show that the regularization parameter can reduce considerably the variance of the parameters \( \beta \). +

    +









    + +

    Yet another Example

    + +

    +Let us assume we have a data set with outputs/targets given by the vector + +$$ +\boldsymbol{y}=\begin{matrix}4 \\ 2 \\3\end{bmatrix}, +$$ + +and our inputs as a \( 3\times 2 \) design matrix +$$ +\boldsymbol{X}=\begin{matrix}2 & 0\\ 0 & 1 \\ 1 & 0\end{bmatrix}, +$$ + +meaning that we have two features and two unknown parameters \( \beta_0 \) and \( \beta_1 \) to be determined either by ordinary least squares, Ridge or Lasso regression. + +

    +









    + +

    The OLS case

    + +

    +For ordinary least squares (OLS) we know that the optimal solution is + +$$ +\hat{\boldsymbol{\beta}}=\left( \boldsymbol{X}^T\boldsymbol{X}\right)^{-1}\boldsymbol{X}^T\boldsymbol{y}. +$$ + +Inserting the above values we obtain that + +$$ +\hat{\boldsymbol{\beta}}=\begin{matrix}\frac{11}{5} \\ 2\end{bmatrix}, +$$ +

    diff --git a/doc/pub/week36/ipynb/ipynb-week36-src.tar.gz b/doc/pub/week36/ipynb/ipynb-week36-src.tar.gz index 0fb55f793..18bebd87b 100644 Binary files a/doc/pub/week36/ipynb/ipynb-week36-src.tar.gz and b/doc/pub/week36/ipynb/ipynb-week36-src.tar.gz differ diff --git a/doc/pub/week36/ipynb/week36.ipynb b/doc/pub/week36/ipynb/week36.ipynb index 1b762c8ae..771d553ac 100644 --- a/doc/pub/week36/ipynb/week36.ipynb +++ b/doc/pub/week36/ipynb/week36.ipynb @@ -778,7 +778,76 @@ "We will amongst other things show that the regularization parameter can reduce considerably the variance of the parameters $\\beta$.\n", "\n", "\n", + "## Yet another Example\n", "\n", + "Let us assume we have a data set with outputs/targets given by the vector" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "$$\n", + "\\boldsymbol{y}=\\begin{matrix}4 \\\\ 2 \\\\3\\end{bmatrix},\n", + "$$" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "and our inputs as a $3\\times 2$ design matrix" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "$$\n", + "\\boldsymbol{X}=\\begin{matrix}2 & 0\\\\ 0 & 1 \\\\ 1 & 0\\end{bmatrix},\n", + "$$" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "meaning that we have two features and two unknown parameters $\\beta_0$ and $\\beta_1$ to be determined either by ordinary least squares, Ridge or Lasso regression.\n", + "\n", + "## The OLS case\n", + "\n", + "For ordinary least squares (OLS) we know that the optimal solution is" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "$$\n", + "\\hat{\\boldsymbol{\\beta}}=\\left( \\boldsymbol{X}^T\\boldsymbol{X}\\right)^{-1}\\boldsymbol{X}^T\\boldsymbol{y}.\n", + "$$" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Inserting the above values we obtain that" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "$$\n", + "\\hat{\\boldsymbol{\\beta}}=\\begin{matrix}\\frac{11}{5} \\\\ 2\\end{bmatrix},\n", + "$$" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ "\n", "## Linking the regression analysis with a statistical interpretation\n", "\n", diff --git a/doc/src/week36/week36.do.txt b/doc/src/week36/week36.do.txt index da229351c..0e3896a03 100644 --- a/doc/src/week36/week36.do.txt +++ b/doc/src/week36/week36.do.txt @@ -429,6 +429,43 @@ We will now couple the discussions of ordinary least squares, Ridge and Lasso re We will amongst other things show that the regularization parameter can reduce considerably the variance of the parameters $\beta$. +!split +===== Yet another Example ===== + +Let us assume we have a data set with outputs/targets given by the vector + +!bt +\[ +\bm{y}=\begin{matrix}4 \\ 2 \\3\end{bmatrix}, +\] +!et +and our inputs as a $3\times 2$ design matrix +!bt +\[ +\bm{X}=\begin{matrix}2 & 0\\ 0 & 1 \\ 1 & 0\end{bmatrix}, +\] +!et +meaning that we have two features and two unknown parameters $\beta_0$ and $\beta_1$ to be determined either by ordinary least squares, Ridge or Lasso regression. + +!split +===== The OLS case ===== + +For ordinary least squares (OLS) we know that the optimal solution is + +!bt +\[ +\hat{\bm{\beta}}=\left( \bm{X}^T\bm{X}\right)^{-1}\bm{X}^T\bm{y}. +\] +!et +Inserting the above values we obtain that + +!bt +\[ +\hat{\bm{\beta}}=\begin{matrix}\frac{11}{5} \\ 2\end{bmatrix}, +\] +!et + + !split ===== Linking the regression analysis with a statistical interpretation =====