From 78e88f1f9a27c50eefeb3dfecf71ed96cd384cc2 Mon Sep 17 00:00:00 2001 From: Morten Hjorth-Jensen Date: Mon, 29 May 2023 22:03:48 +0200 Subject: [PATCH] update week 35 --- doc/pub/week35/html/._week35-bs000.html | 66 +- doc/pub/week35/html/._week35-bs001.html | 73 +- doc/pub/week35/html/._week35-bs002.html | 68 +- doc/pub/week35/html/._week35-bs003.html | 62 +- doc/pub/week35/html/._week35-bs004.html | 62 +- doc/pub/week35/html/._week35-bs005.html | 62 +- doc/pub/week35/html/._week35-bs006.html | 62 +- doc/pub/week35/html/._week35-bs007.html | 62 +- doc/pub/week35/html/._week35-bs008.html | 62 +- doc/pub/week35/html/._week35-bs009.html | 62 +- doc/pub/week35/html/._week35-bs010.html | 62 +- doc/pub/week35/html/._week35-bs011.html | 62 +- doc/pub/week35/html/._week35-bs012.html | 62 +- doc/pub/week35/html/._week35-bs013.html | 62 +- doc/pub/week35/html/._week35-bs014.html | 62 +- doc/pub/week35/html/._week35-bs015.html | 62 +- doc/pub/week35/html/._week35-bs016.html | 62 +- doc/pub/week35/html/._week35-bs017.html | 62 +- doc/pub/week35/html/._week35-bs018.html | 62 +- doc/pub/week35/html/._week35-bs019.html | 62 +- doc/pub/week35/html/._week35-bs020.html | 62 +- doc/pub/week35/html/._week35-bs021.html | 62 +- doc/pub/week35/html/._week35-bs022.html | 62 +- doc/pub/week35/html/._week35-bs023.html | 62 +- doc/pub/week35/html/._week35-bs024.html | 62 +- doc/pub/week35/html/._week35-bs025.html | 62 +- doc/pub/week35/html/._week35-bs026.html | 62 +- doc/pub/week35/html/._week35-bs027.html | 62 +- doc/pub/week35/html/._week35-bs028.html | 62 +- doc/pub/week35/html/._week35-bs029.html | 62 +- doc/pub/week35/html/._week35-bs030.html | 62 +- doc/pub/week35/html/._week35-bs031.html | 62 +- doc/pub/week35/html/._week35-bs032.html | 62 +- doc/pub/week35/html/._week35-bs033.html | 62 +- doc/pub/week35/html/._week35-bs034.html | 62 +- doc/pub/week35/html/._week35-bs035.html | 62 +- doc/pub/week35/html/._week35-bs036.html | 62 +- doc/pub/week35/html/._week35-bs037.html | 62 +- doc/pub/week35/html/._week35-bs038.html | 62 +- doc/pub/week35/html/._week35-bs039.html | 62 +- doc/pub/week35/html/._week35-bs040.html | 62 +- doc/pub/week35/html/._week35-bs041.html | 62 +- doc/pub/week35/html/._week35-bs042.html | 62 +- doc/pub/week35/html/._week35-bs043.html | 62 +- doc/pub/week35/html/._week35-bs044.html | 62 +- doc/pub/week35/html/._week35-bs045.html | 62 +- doc/pub/week35/html/._week35-bs046.html | 62 +- doc/pub/week35/html/._week35-bs047.html | 95 ++- doc/pub/week35/html/._week35-bs048.html | 140 +-- doc/pub/week35/html/._week35-bs049.html | 122 ++- doc/pub/week35/html/._week35-bs050.html | 115 +-- doc/pub/week35/html/._week35-bs051.html | 125 ++- doc/pub/week35/html/._week35-bs052.html | 109 +-- doc/pub/week35/html/._week35-bs053.html | 115 ++- doc/pub/week35/html/._week35-bs054.html | 125 ++- doc/pub/week35/html/._week35-bs055.html | 156 ++-- doc/pub/week35/html/._week35-bs056.html | 119 +-- doc/pub/week35/html/._week35-bs057.html | 108 +-- doc/pub/week35/html/._week35-bs058.html | 129 ++- doc/pub/week35/html/._week35-bs059.html | 162 ++-- doc/pub/week35/html/._week35-bs060.html | 99 +-- doc/pub/week35/html/._week35-bs061.html | 117 +-- doc/pub/week35/html/._week35-bs062.html | 115 ++- doc/pub/week35/html/._week35-bs063.html | 121 +-- doc/pub/week35/html/._week35-bs064.html | 135 +-- doc/pub/week35/html/._week35-bs065.html | 124 +-- doc/pub/week35/html/._week35-bs066.html | 92 +- doc/pub/week35/html/._week35-bs067.html | 89 +- doc/pub/week35/html/._week35-bs068.html | 666 ++++++++++++++- doc/pub/week35/html/week35-bs.html | 66 +- doc/pub/week35/html/week35-reveal.html | 29 +- doc/pub/week35/html/week35-solarized.html | 27 +- doc/pub/week35/html/week35.html | 27 +- doc/pub/week35/ipynb/ipynb-week35-src.tar.gz | Bin 191 -> 191 bytes doc/pub/week35/ipynb/week35.ipynb | 854 +++++++++---------- doc/src/week35/week35.do.txt | 18 +- 76 files changed, 3758 insertions(+), 3376 deletions(-) diff --git a/doc/pub/week35/html/._week35-bs000.html b/doc/pub/week35/html/._week35-bs000.html index 7a3b61340..f1a81b669 100644 --- a/doc/pub/week35/html/._week35-bs000.html +++ b/doc/pub/week35/html/._week35-bs000.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -404,7 +402,7 @@ MathJax.Hub.Config({
-

Sep 8, 2022

+

May 29, 2023


@@ -429,7 +427,7 @@ MathJax.Hub.Config({
  • 9
  • 10
  • ...
  • -
  • 70
  • +
  • 69
  • »
  • @@ -443,7 +441,7 @@ MathJax.Hub.Config({ -->
    - © 1999-2022, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license + © 1999-2023, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license
    diff --git a/doc/pub/week35/html/._week35-bs001.html b/doc/pub/week35/html/._week35-bs001.html index 95a91664a..e6c12bfb4 100644 --- a/doc/pub/week35/html/._week35-bs001.html +++ b/doc/pub/week35/html/._week35-bs001.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -389,15 +387,8 @@ MathJax.Hub.Config({

    Plans for week 35

    Reading recommendations:

      @@ -423,7 +414,7 @@ MathJax.Hub.Config({
    1. 10
    2. 11
    3. ...
    4. -
    5. 70
    6. +
    7. 69
    8. »
    9. diff --git a/doc/pub/week35/html/._week35-bs002.html b/doc/pub/week35/html/._week35-bs002.html index 53d9313cd..d8b4543c8 100644 --- a/doc/pub/week35/html/._week35-bs002.html +++ b/doc/pub/week35/html/._week35-bs002.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -386,15 +384,15 @@ MathJax.Hub.Config({

       

       

       

      -

      Thursday September 1

      +

      Topics of week 35

      -

      The main topics on Thursday are:

      +

      The main topics are:

      1. Repetition from last week on linear regression
      2. Reminder on statistics with quantities like mean values, variance abd covariance
      3. Discussion of how to prepare data and examples of applications of linear regression
      4. Mathematical interpretations of Linear Regression
      5. -
      6. Start discussing Ridge and Lasso regression and Singular Value Decomposition, to be continued Friday
      7. +
      8. Start discussing Ridge and Lasso regression and Singular Value Decomposition

      @@ -413,7 +411,7 @@ MathJax.Hub.Config({

    10. 11
    11. 12
    12. ...
    13. -
    14. 70
    15. +
    16. 69
    17. »
    18. diff --git a/doc/pub/week35/html/._week35-bs003.html b/doc/pub/week35/html/._week35-bs003.html index 7ee424d58..c9c25dd0b 100644 --- a/doc/pub/week35/html/._week35-bs003.html +++ b/doc/pub/week35/html/._week35-bs003.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -424,7 +422,7 @@ Similarly, Mehta et al
    19. 12
    20. 13
    21. ...
    22. -
    23. 70
    24. +
    25. 69
    26. »
    27. diff --git a/doc/pub/week35/html/._week35-bs004.html b/doc/pub/week35/html/._week35-bs004.html index 3f32e5034..61a8ddd8b 100644 --- a/doc/pub/week35/html/._week35-bs004.html +++ b/doc/pub/week35/html/._week35-bs004.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -425,7 +423,7 @@ The first variable is called the dependent, the outcome or the
    28. 13
    29. 14
    30. ...
    31. -
    32. 70
    33. +
    34. 69
    35. »
    36. diff --git a/doc/pub/week35/html/._week35-bs005.html b/doc/pub/week35/html/._week35-bs005.html index 3b94b3cd1..6f5d792f8 100644 --- a/doc/pub/week35/html/._week35-bs005.html +++ b/doc/pub/week35/html/._week35-bs005.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -434,7 +432,7 @@ the linear regression model where \( \boldsymbol{\beta} = [\beta_0, \ld
    37. 14
    38. 15
    39. ...
    40. -
    41. 70
    42. +
    43. 69
    44. »
    45. diff --git a/doc/pub/week35/html/._week35-bs006.html b/doc/pub/week35/html/._week35-bs006.html index 14b5eb092..5dcb354e6 100644 --- a/doc/pub/week35/html/._week35-bs006.html +++ b/doc/pub/week35/html/._week35-bs006.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -434,7 +432,7 @@ so-called 15
    46. 16
    47. ...
    48. -
    49. 70
    50. +
    51. 69
    52. »
    53. diff --git a/doc/pub/week35/html/._week35-bs007.html b/doc/pub/week35/html/._week35-bs007.html index 9e39f5ca8..8e7c3cbef 100644 --- a/doc/pub/week35/html/._week35-bs007.html +++ b/doc/pub/week35/html/._week35-bs007.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -424,7 +422,7 @@ $$
    54. 16
    55. 17
    56. ...
    57. -
    58. 70
    59. +
    60. 69
    61. »
    62. diff --git a/doc/pub/week35/html/._week35-bs008.html b/doc/pub/week35/html/._week35-bs008.html index 6aeef9813..0351c18fe 100644 --- a/doc/pub/week35/html/._week35-bs008.html +++ b/doc/pub/week35/html/._week35-bs008.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -427,7 +425,7 @@ $$
    63. 17
    64. 18
    65. ...
    66. -
    67. 70
    68. +
    69. 69
    70. »
    71. diff --git a/doc/pub/week35/html/._week35-bs009.html b/doc/pub/week35/html/._week35-bs009.html index 1e78943d1..68ffa7cc6 100644 --- a/doc/pub/week35/html/._week35-bs009.html +++ b/doc/pub/week35/html/._week35-bs009.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -451,7 +449,7 @@ $$
    72. 18
    73. 19
    74. ...
    75. -
    76. 70
    77. +
    78. 69
    79. »
    80. diff --git a/doc/pub/week35/html/._week35-bs010.html b/doc/pub/week35/html/._week35-bs010.html index f33ba8596..0260011bc 100644 --- a/doc/pub/week35/html/._week35-bs010.html +++ b/doc/pub/week35/html/._week35-bs010.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -441,7 +439,7 @@ $$
    81. 19
    82. 20
    83. ...
    84. -
    85. 70
    86. +
    87. 69
    88. »
    89. diff --git a/doc/pub/week35/html/._week35-bs011.html b/doc/pub/week35/html/._week35-bs011.html index 125f862e2..f31e17159 100644 --- a/doc/pub/week35/html/._week35-bs011.html +++ b/doc/pub/week35/html/._week35-bs011.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -437,7 +435,7 @@ $$
    90. 20
    91. 21
    92. ...
    93. -
    94. 70
    95. +
    96. 69
    97. »
    98. diff --git a/doc/pub/week35/html/._week35-bs012.html b/doc/pub/week35/html/._week35-bs012.html index 64d1f1f73..726d9e950 100644 --- a/doc/pub/week35/html/._week35-bs012.html +++ b/doc/pub/week35/html/._week35-bs012.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -436,7 +434,7 @@ our matrix as \( \boldsymbol{X}\in {\mathbb{R}}^{n\times p} \), with the predict
    99. 21
    100. 22
    101. ...
    102. -
    103. 70
    104. +
    105. 69
    106. »
    107. diff --git a/doc/pub/week35/html/._week35-bs013.html b/doc/pub/week35/html/._week35-bs013.html index 688ebcc0f..5ecfeba4f 100644 --- a/doc/pub/week35/html/._week35-bs013.html +++ b/doc/pub/week35/html/._week35-bs013.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -514,7 +512,7 @@ $$
    108. 22
    109. 23
    110. ...
    111. -
    112. 70
    113. +
    114. 69
    115. »
    116. diff --git a/doc/pub/week35/html/._week35-bs014.html b/doc/pub/week35/html/._week35-bs014.html index 75b237e62..69638e430 100644 --- a/doc/pub/week35/html/._week35-bs014.html +++ b/doc/pub/week35/html/._week35-bs014.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -445,7 +443,7 @@ $$
    117. 23
    118. 24
    119. ...
    120. -
    121. 70
    122. +
    123. 69
    124. »
    125. diff --git a/doc/pub/week35/html/._week35-bs015.html b/doc/pub/week35/html/._week35-bs015.html index 1f887b4d1..abc16f46d 100644 --- a/doc/pub/week35/html/._week35-bs015.html +++ b/doc/pub/week35/html/._week35-bs015.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -462,7 +460,7 @@ $$
    126. 24
    127. 25
    128. ...
    129. -
    130. 70
    131. +
    132. 69
    133. »
    134. diff --git a/doc/pub/week35/html/._week35-bs016.html b/doc/pub/week35/html/._week35-bs016.html index b1033ab7c..5e0e10cb7 100644 --- a/doc/pub/week35/html/._week35-bs016.html +++ b/doc/pub/week35/html/._week35-bs016.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -453,7 +451,7 @@ allow for the usage of direct linear algebra methods such as LU decomposi
    135. 25
    136. 26
    137. ...
    138. -
    139. 70
    140. +
    141. 69
    142. »
    143. diff --git a/doc/pub/week35/html/._week35-bs017.html b/doc/pub/week35/html/._week35-bs017.html index f993b8ef4..54923b104 100644 --- a/doc/pub/week35/html/._week35-bs017.html +++ b/doc/pub/week35/html/._week35-bs017.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -435,7 +433,7 @@ $$
    144. 26
    145. 27
    146. ...
    147. -
    148. 70
    149. +
    150. 69
    151. »
    152. diff --git a/doc/pub/week35/html/._week35-bs018.html b/doc/pub/week35/html/._week35-bs018.html index 54f0644cd..11df12099 100644 --- a/doc/pub/week35/html/._week35-bs018.html +++ b/doc/pub/week35/html/._week35-bs018.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -441,7 +439,7 @@ problem.
    153. 27
    154. 28
    155. ...
    156. -
    157. 70
    158. +
    159. 69
    160. »
    161. diff --git a/doc/pub/week35/html/._week35-bs019.html b/doc/pub/week35/html/._week35-bs019.html index e9e01b629..26c6889eb 100644 --- a/doc/pub/week35/html/._week35-bs019.html +++ b/doc/pub/week35/html/._week35-bs019.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -435,7 +433,7 @@ $$
    162. 28
    163. 29
    164. ...
    165. -
    166. 70
    167. +
    168. 69
    169. »
    170. diff --git a/doc/pub/week35/html/._week35-bs020.html b/doc/pub/week35/html/._week35-bs020.html index b67a55047..b8b7ca4cd 100644 --- a/doc/pub/week35/html/._week35-bs020.html +++ b/doc/pub/week35/html/._week35-bs020.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -503,7 +501,7 @@ plt.show()
    171. 29
    172. 30
    173. ...
    174. -
    175. 70
    176. +
    177. 69
    178. »
    179. diff --git a/doc/pub/week35/html/._week35-bs021.html b/doc/pub/week35/html/._week35-bs021.html index 266f879ea..6e1fde160 100644 --- a/doc/pub/week35/html/._week35-bs021.html +++ b/doc/pub/week35/html/._week35-bs021.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -519,7 +517,7 @@ Since we are not using Scikit-Learn here we can define our own \( R2 \) f
    180. 30
    181. 31
    182. ...
    183. -
    184. 70
    185. +
    186. 69
    187. »
    188. diff --git a/doc/pub/week35/html/._week35-bs022.html b/doc/pub/week35/html/._week35-bs022.html index 6f8345e97..b8ba72e6a 100644 --- a/doc/pub/week35/html/._week35-bs022.html +++ b/doc/pub/week35/html/._week35-bs022.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -432,7 +430,7 @@ but now splitting the data into a training set and a test set.
    189. 31
    190. 32
    191. ...
    192. -
    193. 70
    194. +
    195. 69
    196. »
    197. diff --git a/doc/pub/week35/html/._week35-bs023.html b/doc/pub/week35/html/._week35-bs023.html index 6cd283ebf..ae375502a 100644 --- a/doc/pub/week35/html/._week35-bs023.html +++ b/doc/pub/week35/html/._week35-bs023.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -474,7 +472,7 @@ ypredict = X_test 32
    198. 33
    199. ...
    200. -
    201. 70
    202. +
    203. 69
    204. »
    205. diff --git a/doc/pub/week35/html/._week35-bs024.html b/doc/pub/week35/html/._week35-bs024.html index e955dd36a..d16c5842b 100644 --- a/doc/pub/week35/html/._week35-bs024.html +++ b/doc/pub/week35/html/._week35-bs024.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -454,7 +452,7 @@ normally recommend using the latter functionality.
    206. 33
    207. 34
    208. ...
    209. -
    210. 70
    211. +
    212. 69
    213. »
    214. diff --git a/doc/pub/week35/html/._week35-bs025.html b/doc/pub/week35/html/._week35-bs025.html index 2c2bc339d..11cac818b 100644 --- a/doc/pub/week35/html/._week35-bs025.html +++ b/doc/pub/week35/html/._week35-bs025.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -437,7 +435,7 @@ the house using the features (predictors) listed here.
    215. 34
    216. 35
    217. ...
    218. -
    219. 70
    220. +
    221. 69
    222. »
    223. diff --git a/doc/pub/week35/html/._week35-bs026.html b/doc/pub/week35/html/._week35-bs026.html index f5f3c0418..f1fd59b6c 100644 --- a/doc/pub/week35/html/._week35-bs026.html +++ b/doc/pub/week35/html/._week35-bs026.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -752,7 +750,7 @@ plt.show()
    224. 35
    225. 36
    226. ...
    227. -
    228. 70
    229. +
    230. 69
    231. »
    232. diff --git a/doc/pub/week35/html/._week35-bs027.html b/doc/pub/week35/html/._week35-bs027.html index 259eaecd1..bb00cb200 100644 --- a/doc/pub/week35/html/._week35-bs027.html +++ b/doc/pub/week35/html/._week35-bs027.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -441,7 +439,7 @@ visualization.
    233. 36
    234. 37
    235. ...
    236. -
    237. 70
    238. +
    239. 69
    240. »
    241. diff --git a/doc/pub/week35/html/._week35-bs028.html b/doc/pub/week35/html/._week35-bs028.html index e2ce6e47a..5c0afbcbe 100644 --- a/doc/pub/week35/html/._week35-bs028.html +++ b/doc/pub/week35/html/._week35-bs028.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -436,7 +434,7 @@ the features in a way to avoid such outlier values.
    242. 37
    243. 38
    244. ...
    245. -
    246. 70
    247. +
    248. 69
    249. »
    250. diff --git a/doc/pub/week35/html/._week35-bs029.html b/doc/pub/week35/html/._week35-bs029.html index c7d5f87b8..cd5ea9507 100644 --- a/doc/pub/week35/html/._week35-bs029.html +++ b/doc/pub/week35/html/._week35-bs029.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -424,7 +422,7 @@ ensures that all features are exactly between \( 0 \) and \( 1 \). The
    251. 38
    252. 39
    253. ...
    254. -
    255. 70
    256. +
    257. 69
    258. »
    259. diff --git a/doc/pub/week35/html/._week35-bs030.html b/doc/pub/week35/html/._week35-bs030.html index be6154485..91533c617 100644 --- a/doc/pub/week35/html/._week35-bs030.html +++ b/doc/pub/week35/html/._week35-bs030.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -438,7 +436,7 @@ techniques.
    260. 39
    261. 40
    262. ...
    263. -
    264. 70
    265. +
    266. 69
    267. »
    268. diff --git a/doc/pub/week35/html/._week35-bs031.html b/doc/pub/week35/html/._week35-bs031.html index 341ca524d..34a7fbf22 100644 --- a/doc/pub/week35/html/._week35-bs031.html +++ b/doc/pub/week35/html/._week35-bs031.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -425,7 +423,7 @@ This ensures that each feature has zero mean and unit standard deviation. For d
    269. 40
    270. 41
    271. ...
    272. -
    273. 70
    274. +
    275. 69
    276. »
    277. diff --git a/doc/pub/week35/html/._week35-bs032.html b/doc/pub/week35/html/._week35-bs032.html index 3058fd63b..0a7a4685f 100644 --- a/doc/pub/week35/html/._week35-bs032.html +++ b/doc/pub/week35/html/._week35-bs032.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -466,7 +464,7 @@ display(XPandas-Xscaled)
    278. 41
    279. 42
    280. ...
    281. -
    282. 70
    283. +
    284. 69
    285. »
    286. diff --git a/doc/pub/week35/html/._week35-bs033.html b/doc/pub/week35/html/._week35-bs033.html index fd8548485..823f51a5f 100644 --- a/doc/pub/week35/html/._week35-bs033.html +++ b/doc/pub/week35/html/._week35-bs033.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -425,7 +423,7 @@ $$
    287. 42
    288. 43
    289. ...
    290. -
    291. 70
    292. +
    293. 69
    294. »
    295. diff --git a/doc/pub/week35/html/._week35-bs034.html b/doc/pub/week35/html/._week35-bs034.html index 94c2acef2..06c42defd 100644 --- a/doc/pub/week35/html/._week35-bs034.html +++ b/doc/pub/week35/html/._week35-bs034.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -508,7 +506,7 @@ plt.show()
    296. 43
    297. 44
    298. ...
    299. -
    300. 70
    301. +
    302. 69
    303. »
    304. diff --git a/doc/pub/week35/html/._week35-bs035.html b/doc/pub/week35/html/._week35-bs035.html index 6fcebdfb7..4111a749f 100644 --- a/doc/pub/week35/html/._week35-bs035.html +++ b/doc/pub/week35/html/._week35-bs035.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -528,7 +526,7 @@ clf = skl.44
    305. 45
    306. ...
    307. -
    308. 70
    309. +
    310. 69
    311. »
    312. diff --git a/doc/pub/week35/html/._week35-bs036.html b/doc/pub/week35/html/._week35-bs036.html index 8f6b000ec..cdadc7649 100644 --- a/doc/pub/week35/html/._week35-bs036.html +++ b/doc/pub/week35/html/._week35-bs036.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -443,7 +441,7 @@ We can then interpret our optimal model \( \tilde{\boldsymbol{y}} \) as being re
    313. 45
    314. 46
    315. ...
    316. -
    317. 70
    318. +
    319. 69
    320. »
    321. diff --git a/doc/pub/week35/html/._week35-bs037.html b/doc/pub/week35/html/._week35-bs037.html index 58448d18a..307f5e687 100644 --- a/doc/pub/week35/html/._week35-bs037.html +++ b/doc/pub/week35/html/._week35-bs037.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -420,7 +418,7 @@ $$
    322. 46
    323. 47
    324. ...
    325. -
    326. 70
    327. +
    328. 69
    329. »
    330. diff --git a/doc/pub/week35/html/._week35-bs038.html b/doc/pub/week35/html/._week35-bs038.html index 95c1ea294..c87eeb8c0 100644 --- a/doc/pub/week35/html/._week35-bs038.html +++ b/doc/pub/week35/html/._week35-bs038.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -431,7 +429,7 @@ $$
    331. 47
    332. 48
    333. ...
    334. -
    335. 70
    336. +
    337. 69
    338. »
    339. diff --git a/doc/pub/week35/html/._week35-bs039.html b/doc/pub/week35/html/._week35-bs039.html index 176431b9d..d25d527fd 100644 --- a/doc/pub/week35/html/._week35-bs039.html +++ b/doc/pub/week35/html/._week35-bs039.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -455,7 +453,7 @@ reduced to the statistically relevant features.
    340. 48
    341. 49
    342. ...
    343. -
    344. 70
    345. +
    346. 69
    347. »
    348. diff --git a/doc/pub/week35/html/._week35-bs040.html b/doc/pub/week35/html/._week35-bs040.html index 7cc650fe3..2a5cfad5c 100644 --- a/doc/pub/week35/html/._week35-bs040.html +++ b/doc/pub/week35/html/._week35-bs040.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -460,7 +458,7 @@ This is equivalent to saying that the matrix \( \boldsymbol{X} \) has at least a
    349. 49
    350. 50
    351. ...
    352. -
    353. 70
    354. +
    355. 69
    356. »
    357. diff --git a/doc/pub/week35/html/._week35-bs041.html b/doc/pub/week35/html/._week35-bs041.html index 7561c0a5e..1e6e2c14b 100644 --- a/doc/pub/week35/html/._week35-bs041.html +++ b/doc/pub/week35/html/._week35-bs041.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -435,7 +433,7 @@ $$
    358. 50
    359. 51
    360. ...
    361. -
    362. 70
    363. +
    364. 69
    365. »
    366. diff --git a/doc/pub/week35/html/._week35-bs042.html b/doc/pub/week35/html/._week35-bs042.html index e2fa59084..de0f4492f 100644 --- a/doc/pub/week35/html/._week35-bs042.html +++ b/doc/pub/week35/html/._week35-bs042.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -447,7 +445,7 @@ $$
    367. 51
    368. 52
    369. ...
    370. -
    371. 70
    372. +
    373. 69
    374. »
    375. diff --git a/doc/pub/week35/html/._week35-bs043.html b/doc/pub/week35/html/._week35-bs043.html index b3d5c52df..0c01daa79 100644 --- a/doc/pub/week35/html/._week35-bs043.html +++ b/doc/pub/week35/html/._week35-bs043.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -458,7 +456,7 @@ near singular or singular matrices.
    376. 52
    377. 53
    378. ...
    379. -
    380. 70
    381. +
    382. 69
    383. »
    384. diff --git a/doc/pub/week35/html/._week35-bs044.html b/doc/pub/week35/html/._week35-bs044.html index 258a2b6f0..02e5f002f 100644 --- a/doc/pub/week35/html/._week35-bs044.html +++ b/doc/pub/week35/html/._week35-bs044.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -433,7 +431,7 @@ In general the economy-size SVD leads to less FLOPS and still conserving the des
    385. 53
    386. 54
    387. ...
    388. -
    389. 70
    390. +
    391. 69
    392. »
    393. diff --git a/doc/pub/week35/html/._week35-bs045.html b/doc/pub/week35/html/._week35-bs045.html index a2b622763..e56c72218 100644 --- a/doc/pub/week35/html/._week35-bs045.html +++ b/doc/pub/week35/html/._week35-bs045.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -474,7 +472,7 @@ in the program terminating due to a singular matrix.
    394. 54
    395. 55
    396. ...
    397. -
    398. 70
    399. +
    400. 69
    401. »
    402. diff --git a/doc/pub/week35/html/._week35-bs046.html b/doc/pub/week35/html/._week35-bs046.html index ceea54733..a93a9a37d 100644 --- a/doc/pub/week35/html/._week35-bs046.html +++ b/doc/pub/week35/html/._week35-bs046.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -429,7 +427,7 @@ example
    403. 55
    404. 56
    405. ...
    406. -
    407. 70
    408. +
    409. 69
    410. »
    411. diff --git a/doc/pub/week35/html/._week35-bs047.html b/doc/pub/week35/html/._week35-bs047.html index 121b0d5ea..e313461d7 100644 --- a/doc/pub/week35/html/._week35-bs047.html +++ b/doc/pub/week35/html/._week35-bs047.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -386,7 +384,38 @@ MathJax.Hub.Config({

       

       

       

      -

      Friday September 2

      +

      Mathematics of the SVD and implications

      + +

      Let us take a closer look at the mathematics of the SVD and the various implications for machine learning studies.

      + +

      Our starting point is our design matrix \( \boldsymbol{X} \) of dimension \( n\times p \)

      +$$ +\boldsymbol{X}=\begin{bmatrix} +x_{0,0} & x_{0,1} & x_{0,2}& \dots & \dots x_{0,p-1}\\ +x_{1,0} & x_{1,1} & x_{1,2}& \dots & \dots x_{1,p-1}\\ +x_{2,0} & x_{2,1} & x_{2,2}& \dots & \dots x_{2,p-1}\\ +\dots & \dots & \dots & \dots \dots & \dots \\ +x_{n-2,0} & x_{n-2,1} & x_{n-2,2}& \dots & \dots x_{n-2,p-1}\\ +x_{n-1,0} & x_{n-1,1} & x_{n-1,2}& \dots & \dots x_{n-1,p-1}\\ +\end{bmatrix}. +$$ + +

      We can SVD decompose our matrix as

      +$$ +\boldsymbol{X}=\boldsymbol{U}\boldsymbol{\Sigma}\boldsymbol{V}^T, +$$ + +

      where \( \boldsymbol{U} \) is an orthogonal matrix of dimension \( n\times n \), meaning that \( \boldsymbol{U}\boldsymbol{U}^T=\boldsymbol{U}^T\boldsymbol{U}=\boldsymbol{I}_n \). Here \( \boldsymbol{I}_n \) is the unit matrix of dimension \( n \times n \).

      + +

      Similarly, \( \boldsymbol{V} \) is an orthogonal matrix of dimension \( p\times p \), meaning that \( \boldsymbol{V}\boldsymbol{V}^T=\boldsymbol{V}^T\boldsymbol{V}=\boldsymbol{I}_p \). Here \( \boldsymbol{I}_n \) is the unit matrix of dimension \( p \times p \).

      + +

      Finally \( \boldsymbol{\Sigma} \) contains the singular values \( \sigma_i \). This matrix has dimension \( n\times p \) and the singular values \( \sigma_i \) are all positive. The non-zero values are ordered in descending order, that is

      + +$$ +\sigma_0 > \sigma_1 > \sigma_2 > \dots > \sigma_{p-1} > 0. +$$ + +

      All values beyond \( p-1 \) are all zero.

      @@ -413,7 +442,7 @@ MathJax.Hub.Config({

    412. 56
    413. 57
    414. ...
    415. -
    416. 70
    417. +
    418. 69
    419. »
    420. diff --git a/doc/pub/week35/html/._week35-bs048.html b/doc/pub/week35/html/._week35-bs048.html index 23f90c2a3..4cf0eed5f 100644 --- a/doc/pub/week35/html/._week35-bs048.html +++ b/doc/pub/week35/html/._week35-bs048.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -386,38 +384,62 @@ MathJax.Hub.Config({

       

       

       

      -

      Mathematics of the SVD and implications

      +

      Example Matrix

      -

      Let us take a closer look at the mathematics of the SVD and the various implications for machine learning studies.

      - -

      Our starting point is our design matrix \( \boldsymbol{X} \) of dimension \( n\times p \)

      -$$ -\boldsymbol{X}=\begin{bmatrix} -x_{0,0} & x_{0,1} & x_{0,2}& \dots & \dots x_{0,p-1}\\ -x_{1,0} & x_{1,1} & x_{1,2}& \dots & \dots x_{1,p-1}\\ -x_{2,0} & x_{2,1} & x_{2,2}& \dots & \dots x_{2,p-1}\\ -\dots & \dots & \dots & \dots \dots & \dots \\ -x_{n-2,0} & x_{n-2,1} & x_{n-2,2}& \dots & \dots x_{n-2,p-1}\\ -x_{n-1,0} & x_{n-1,1} & x_{n-1,2}& \dots & \dots x_{n-1,p-1}\\ -\end{bmatrix}. -$$ - -

      We can SVD decompose our matrix as

      -$$ -\boldsymbol{X}=\boldsymbol{U}\boldsymbol{\Sigma}\boldsymbol{V}^T, -$$ - -

      where \( \boldsymbol{U} \) is an orthogonal matrix of dimension \( n\times n \), meaning that \( \boldsymbol{U}\boldsymbol{U}^T=\boldsymbol{U}^T\boldsymbol{U}=\boldsymbol{I}_n \). Here \( \boldsymbol{I}_n \) is the unit matrix of dimension \( n \times n \).

      - -

      Similarly, \( \boldsymbol{V} \) is an orthogonal matrix of dimension \( p\times p \), meaning that \( \boldsymbol{V}\boldsymbol{V}^T=\boldsymbol{V}^T\boldsymbol{V}=\boldsymbol{I}_p \). Here \( \boldsymbol{I}_n \) is the unit matrix of dimension \( p \times p \).

      - -

      Finally \( \boldsymbol{\Sigma} \) contains the singular values \( \sigma_i \). This matrix has dimension \( n\times p \) and the singular values \( \sigma_i \) are all positive. The non-zero values are ordered in descending order, that is

      +

      As an example, consider the following \( 3\times 2 \) example for the matrix \( \boldsymbol{\Sigma} \)

      $$ -\sigma_0 > \sigma_1 > \sigma_2 > \dots > \sigma_{p-1} > 0. +\boldsymbol{\Sigma}= +\begin{bmatrix} +2& 0 \\ +0 & 1 \\ +0 & 0 \\ +\end{bmatrix} $$ -

      All values beyond \( p-1 \) are all zero.

      +

      The singular values are \( \sigma_0=2 \) and \( \sigma_1=1 \). It is common to rewrite the matrix \( \boldsymbol{\Sigma} \) as

      + +$$ +\boldsymbol{\Sigma}= +\begin{bmatrix} +\boldsymbol{\tilde{\Sigma}}\\ +\boldsymbol{0}\\ +\end{bmatrix}, +$$ + +

      where

      +$$ +\boldsymbol{\tilde{\Sigma}}= +\begin{bmatrix} +2& 0 \\ +0 & 1 \\ +\end{bmatrix}, +$$ + +

      contains only the singular values. Note also (and we will use this below) that

      + +$$ +\boldsymbol{\Sigma}^T\boldsymbol{\Sigma}= +\begin{bmatrix} +4& 0 \\ +0 & 1 \\ +\end{bmatrix}, +$$ + +

      which is a \( 2\times 2 \) matrix while

      +$$ +\boldsymbol{\Sigma}\boldsymbol{\Sigma}^T= +\begin{bmatrix} +4& 0 & 0\\ +0 & 1 & 0\\ +0 & 0 & 0\\ +\end{bmatrix}, +$$ + +

      is a \( 3\times 3 \) matrix. The last row and column of this last matrix +contain only zeros. This will have important consequences for our SVD +decomposition of the design matrix. +

      @@ -444,7 +466,7 @@ $$

    421. 57
    422. 58
    423. ...
    424. -
    425. 70
    426. +
    427. 69
    428. »
    429. diff --git a/doc/pub/week35/html/._week35-bs049.html b/doc/pub/week35/html/._week35-bs049.html index 715cd5f97..b8c605c6c 100644 --- a/doc/pub/week35/html/._week35-bs049.html +++ b/doc/pub/week35/html/._week35-bs049.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -386,61 +384,45 @@ MathJax.Hub.Config({

       

       

       

      -

      Example Matrix

      +

      Setting up the Matrix to be inverted

      -

      As an example, consider the following \( 3\times 2 \) example for the matrix \( \boldsymbol{\Sigma} \)

      +

      The matrix that may cause problems for us is \( \boldsymbol{X}^T\boldsymbol{X} \). Using the SVD we can rewrite this matrix as

      $$ -\boldsymbol{\Sigma}= -\begin{bmatrix} -2& 0 \\ -0 & 1 \\ -0 & 0 \\ -\end{bmatrix} +\boldsymbol{X}^T\boldsymbol{X}=\boldsymbol{V}\boldsymbol{\Sigma}^T\boldsymbol{U}^T\boldsymbol{U}\boldsymbol{\Sigma}\boldsymbol{V}^T, $$ -

      The singular values are \( \sigma_0=2 \) and \( \sigma_1=1 \). It is common to rewrite the matrix \( \boldsymbol{\Sigma} \) as

      +

      and using the orthogonality of the matrix \( \boldsymbol{U} \) we have

      $$ -\boldsymbol{\Sigma}= -\begin{bmatrix} -\boldsymbol{\tilde{\Sigma}}\\ -\boldsymbol{0}\\ -\end{bmatrix}, +\boldsymbol{X}^T\boldsymbol{X}=\boldsymbol{V}\boldsymbol{\Sigma}^T\boldsymbol{\Sigma}\boldsymbol{V}^T. $$ -

      where

      -$$ -\boldsymbol{\tilde{\Sigma}}= -\begin{bmatrix} -2& 0 \\ -0 & 1 \\ -\end{bmatrix}, -$$ +

      We define \( \boldsymbol{\Sigma}^T\boldsymbol{\Sigma}=\tilde{\boldsymbol{\Sigma}}^2 \) which is a diagonal matrix containing only the singular values squared. It has dimensionality \( p \times p \).

      -

      contains only the singular values. Note also (and we will use this below) that

      +

      We can now insert the result for the matrix \( \boldsymbol{X}^T\boldsymbol{X} \) into our equation for ordinary least squares where

      $$ -\boldsymbol{\Sigma}^T\boldsymbol{\Sigma}= -\begin{bmatrix} -4& 0 \\ -0 & 1 \\ -\end{bmatrix}, +\tilde{y}_{\mathrm{OLS}}=\boldsymbol{X}\left(\boldsymbol{X}^T\boldsymbol{X}\right)^{-1}\boldsymbol{X}^T\boldsymbol{y}, $$ -

      which is a \( 2\times 2 \) matrix while

      +

      and using our SVD decomposition of \( \boldsymbol{X} \) we have

      + $$ -\boldsymbol{\Sigma}\boldsymbol{\Sigma}^T= -\begin{bmatrix} -4& 0 & 0\\ -0 & 1 & 0\\ -0 & 0 & 0\\ -\end{bmatrix}, +\tilde{y}_{\mathrm{OLS}}=\boldsymbol{U}\boldsymbol{\Sigma}\boldsymbol{V}^T\left(\boldsymbol{V}\tilde{\boldsymbol{\Sigma}}^{2}(\boldsymbol{V}^T\right)^{-1}\boldsymbol{V}\boldsymbol{\Sigma}^T\boldsymbol{U}^T\boldsymbol{y}, $$ -

      is a \( 3\times 3 \) matrix. The last row and column of this last matrix -contain only zeros. This will have important consequences for our SVD -decomposition of the design matrix. +

      which gives us, using the orthogonality of the matrices \( \boldsymbol{U} \) and \( \boldsymbol{V} \),

      + +$$ +\tilde{y}_{\mathrm{OLS}}=\boldsymbol{U}\boldsymbol{U}^T\boldsymbol{y}=\sum_{i=0}^{p-1}\boldsymbol{u}_i\boldsymbol{u}^T_i\boldsymbol{y}, +$$ + +

      It means that the ordinary least square model (with the optimal +parameters) \( \boldsymbol{\tilde{y}} \), corresponds to an orthogonal +transformation of the output (or target) vector \( \boldsymbol{y} \) by the +vectors of the matrix \( \boldsymbol{U} \). Note that the summation ends at \( p-1 \), +that is \( \boldsymbol{\tilde{y}}\ne \boldsymbol{y} \).

      @@ -468,7 +450,7 @@ decomposition of the design matrix.

    430. 58
    431. 59
    432. ...
    433. -
    434. 70
    435. +
    436. 69
    437. »
    438. diff --git a/doc/pub/week35/html/._week35-bs050.html b/doc/pub/week35/html/._week35-bs050.html index 141a731cd..66add929b 100644 --- a/doc/pub/week35/html/._week35-bs050.html +++ b/doc/pub/week35/html/._week35-bs050.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -386,45 +384,52 @@ MathJax.Hub.Config({

       

       

       

      -

      Setting up the Matrix to be inverted

      - -

      The matrix that may cause problems for us is \( \boldsymbol{X}^T\boldsymbol{X} \). Using the SVD we can rewrite this matrix as

      +

      Further properties (important for our analyses later)

      +

      Let us study again \( \boldsymbol{X}^T\boldsymbol{X} \) in terms of our SVD,

      $$ -\boldsymbol{X}^T\boldsymbol{X}=\boldsymbol{V}\boldsymbol{\Sigma}^T\boldsymbol{U}^T\boldsymbol{U}\boldsymbol{\Sigma}\boldsymbol{V}^T, +\boldsymbol{X}^T\boldsymbol{X}=\boldsymbol{V}\boldsymbol{\Sigma}^T\boldsymbol{U}^T\boldsymbol{U}\boldsymbol{\Sigma}\boldsymbol{V}^T=\boldsymbol{V}\boldsymbol{\Sigma}^T\boldsymbol{\Sigma}\boldsymbol{V}^T. $$ -

      and using the orthogonality of the matrix \( \boldsymbol{U} \) we have

      - +

      If we now multiply from the right with \( \boldsymbol{V} \) (using the orthogonality of \( \boldsymbol{V} \)) we get

      $$ -\boldsymbol{X}^T\boldsymbol{X}=\boldsymbol{V}\boldsymbol{\Sigma}^T\boldsymbol{\Sigma}\boldsymbol{V}^T. +\left(\boldsymbol{X}^T\boldsymbol{X}\right)\boldsymbol{V}=\boldsymbol{V}\boldsymbol{\Sigma}^T\boldsymbol{\Sigma}. $$ -

      We define \( \boldsymbol{\Sigma}^T\boldsymbol{\Sigma}=\tilde{\boldsymbol{\Sigma}}^2 \) which is a diagonal matrix containing only the singular values squared. It has dimensionality \( p \times p \).

      - -

      We can now insert the result for the matrix \( \boldsymbol{X}^T\boldsymbol{X} \) into our equation for ordinary least squares where

      - +

      This means the vectors \( \boldsymbol{v}_i \) of the orthogonal matrix \( \boldsymbol{V} \) are the eigenvectors of the matrix \( \boldsymbol{X}^T\boldsymbol{X} \) +with eigenvalues given by the singular values squared, that is +

      $$ -\tilde{y}_{\mathrm{OLS}}=\boldsymbol{X}\left(\boldsymbol{X}^T\boldsymbol{X}\right)^{-1}\boldsymbol{X}^T\boldsymbol{y}, +\left(\boldsymbol{X}^T\boldsymbol{X}\right)\boldsymbol{v}_i=\boldsymbol{v}_i\sigma_i^2. $$ -

      and using our SVD decomposition of \( \boldsymbol{X} \) we have

      - +

      Similarly, if we use the SVD decomposition for the matrix \( \boldsymbol{X}\boldsymbol{X}^T \), we have

      $$ -\tilde{y}_{\mathrm{OLS}}=\boldsymbol{U}\boldsymbol{\Sigma}\boldsymbol{V}^T\left(\boldsymbol{V}\tilde{\boldsymbol{\Sigma}}^{2}(\boldsymbol{V}^T\right)^{-1}\boldsymbol{V}\boldsymbol{\Sigma}^T\boldsymbol{U}^T\boldsymbol{y}, +\boldsymbol{X}\boldsymbol{X}^T=\boldsymbol{U}\boldsymbol{\Sigma}\boldsymbol{V}^T\boldsymbol{V}\boldsymbol{\Sigma}^T\boldsymbol{U}^T=\boldsymbol{U}\boldsymbol{\Sigma}\boldsymbol{\Sigma}^T\boldsymbol{U}^T. $$ -

      which gives us, using the orthogonality of the matrices \( \boldsymbol{U} \) and \( \boldsymbol{V} \),

      - +

      If we now multiply from the right with \( \boldsymbol{U} \) (using the orthogonality of \( \boldsymbol{U} \)) we get

      $$ -\tilde{y}_{\mathrm{OLS}}=\boldsymbol{U}\boldsymbol{U}^T\boldsymbol{y}=\sum_{i=0}^{p-1}\boldsymbol{u}_i\boldsymbol{u}^T_i\boldsymbol{y}, +\left(\boldsymbol{X}\boldsymbol{X}^T\right)\boldsymbol{U}=\boldsymbol{U}\boldsymbol{\Sigma}\boldsymbol{\Sigma}^T. $$ -

      It means that the ordinary least square model (with the optimal -parameters) \( \boldsymbol{\tilde{y}} \), corresponds to an orthogonal -transformation of the output (or target) vector \( \boldsymbol{y} \) by the -vectors of the matrix \( \boldsymbol{U} \). Note that the summation ends at \( p-1 \), -that is \( \boldsymbol{\tilde{y}}\ne \boldsymbol{y} \). +

      This means the vectors \( \boldsymbol{u}_i \) of the orthogonal matrix \( \boldsymbol{U} \) are the eigenvectors of the matrix \( \boldsymbol{X}\boldsymbol{X}^T \) +with eigenvalues given by the singular values squared, that is +

      +$$ +\left(\boldsymbol{X}\boldsymbol{X}^T\right)\boldsymbol{u}_i=\boldsymbol{u}_i\sigma_i^2. +$$ + +

      Important note: we have defined our design matrix \( \boldsymbol{X} \) to be an +\( n\times p \) matrix. In most supervised learning cases we have that \( n +\ge p \), and quite often we have \( n >> p \). For linear algebra based methods like ordinary least squares or Ridge regression, this leads to a matrix \( \boldsymbol{X}^T\boldsymbol{X} \) which is small and thereby easier to handle from a computational point of view (in terms of number of floating point operations). +

      + +

      In our lectures, the number of columns will +always refer to the number of features in our data set, while the +number of rows represents the number of data inputs. Note that in +other texts you may find the opposite notation. This has consequences +for the definition of for example the covariance matrix and its relation to the SVD.

      @@ -452,7 +457,7 @@ that is \( \boldsymbol{\tilde{y}}\ne \boldsymbol{y} \).

    439. 59
    440. 60
    441. ...
    442. -
    443. 70
    444. +
    445. 69
    446. »
    447. diff --git a/doc/pub/week35/html/._week35-bs051.html b/doc/pub/week35/html/._week35-bs051.html index 53ab92816..0a5131325 100644 --- a/doc/pub/week35/html/._week35-bs051.html +++ b/doc/pub/week35/html/._week35-bs051.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -386,52 +384,31 @@ MathJax.Hub.Config({

       

       

       

      -

      Further properties (important for our analyses later)

      +

      Meet the Covariance Matrix

      -

      Let us study again \( \boldsymbol{X}^T\boldsymbol{X} \) in terms of our SVD,

      -$$ -\boldsymbol{X}^T\boldsymbol{X}=\boldsymbol{V}\boldsymbol{\Sigma}^T\boldsymbol{U}^T\boldsymbol{U}\boldsymbol{\Sigma}\boldsymbol{V}^T=\boldsymbol{V}\boldsymbol{\Sigma}^T\boldsymbol{\Sigma}\boldsymbol{V}^T. -$$ +

      Before we move on to a discussion of Ridge and Lasso regression, we want to show an important example of the above.

      -

      If we now multiply from the right with \( \boldsymbol{V} \) (using the orthogonality of \( \boldsymbol{V} \)) we get

      -$$ -\left(\boldsymbol{X}^T\boldsymbol{X}\right)\boldsymbol{V}=\boldsymbol{V}\boldsymbol{\Sigma}^T\boldsymbol{\Sigma}. -$$ - -

      This means the vectors \( \boldsymbol{v}_i \) of the orthogonal matrix \( \boldsymbol{V} \) are the eigenvectors of the matrix \( \boldsymbol{X}^T\boldsymbol{X} \) -with eigenvalues given by the singular values squared, that is -

      -$$ -\left(\boldsymbol{X}^T\boldsymbol{X}\right)\boldsymbol{v}_i=\boldsymbol{v}_i\sigma_i^2. -$$ - -

      Similarly, if we use the SVD decomposition for the matrix \( \boldsymbol{X}\boldsymbol{X}^T \), we have

      -$$ -\boldsymbol{X}\boldsymbol{X}^T=\boldsymbol{U}\boldsymbol{\Sigma}\boldsymbol{V}^T\boldsymbol{V}\boldsymbol{\Sigma}^T\boldsymbol{U}^T=\boldsymbol{U}\boldsymbol{\Sigma}\boldsymbol{\Sigma}^T\boldsymbol{U}^T. -$$ - -

      If we now multiply from the right with \( \boldsymbol{U} \) (using the orthogonality of \( \boldsymbol{U} \)) we get

      -$$ -\left(\boldsymbol{X}\boldsymbol{X}^T\right)\boldsymbol{U}=\boldsymbol{U}\boldsymbol{\Sigma}\boldsymbol{\Sigma}^T. -$$ - -

      This means the vectors \( \boldsymbol{u}_i \) of the orthogonal matrix \( \boldsymbol{U} \) are the eigenvectors of the matrix \( \boldsymbol{X}\boldsymbol{X}^T \) -with eigenvalues given by the singular values squared, that is -

      -$$ -\left(\boldsymbol{X}\boldsymbol{X}^T\right)\boldsymbol{u}_i=\boldsymbol{u}_i\sigma_i^2. -$$ - -

      Important note: we have defined our design matrix \( \boldsymbol{X} \) to be an -\( n\times p \) matrix. In most supervised learning cases we have that \( n -\ge p \), and quite often we have \( n >> p \). For linear algebra based methods like ordinary least squares or Ridge regression, this leads to a matrix \( \boldsymbol{X}^T\boldsymbol{X} \) which is small and thereby easier to handle from a computational point of view (in terms of number of floating point operations). +

      We have already noted that the matrix \( \boldsymbol{X}^T\boldsymbol{X} \) in ordinary +least squares is proportional to the second derivative of the cost +function, that is we have

      -

      In our lectures, the number of columns will -always refer to the number of features in our data set, while the -number of rows represents the number of data inputs. Note that in -other texts you may find the opposite notation. This has consequences -for the definition of for example the covariance matrix and its relation to the SVD. +$$ +\frac{\partial^2 C(\boldsymbol{\beta})}{\partial \boldsymbol{\beta}^T\partial \boldsymbol{\beta}} =\frac{2}{n}\boldsymbol{X}^T\boldsymbol{X}. +$$ + +

      This quantity defines was what is called the Hessian matrix (the second derivative of a function we want to optimize).

      + +

      The Hessian matrix plays an important role and is defined in this course as

      + +$$ +\boldsymbol{H}=\boldsymbol{X}^T\boldsymbol{X}. +$$ + +

      The Hessian matrix for ordinary least squares is also proportional to +the covariance matrix. This means also that we can use the SVD to find +the eigenvalues of the covariance matrix and the Hessian matrix in +terms of the singular values. Let us develop these arguments, as they will play an important role in our machine learning studies.

      @@ -459,7 +436,7 @@ for the definition of for example the covariance matrix and its relation to the

    448. 60
    449. 61
    450. ...
    451. -
    452. 70
    453. +
    454. 69
    455. »
    456. diff --git a/doc/pub/week35/html/._week35-bs052.html b/doc/pub/week35/html/._week35-bs052.html index f46219fd3..6d9ee9e8b 100644 --- a/doc/pub/week35/html/._week35-bs052.html +++ b/doc/pub/week35/html/._week35-bs052.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -386,31 +384,46 @@ MathJax.Hub.Config({

       

       

       

      -

      Meet the Covariance Matrix

      +

      Introducing the Covariance and Correlation functions

      -

      Before we move on to a discussion of Ridge and Lasso regression, we want to show an important example of the above.

      - -

      We have already noted that the matrix \( \boldsymbol{X}^T\boldsymbol{X} \) in ordinary -least squares is proportional to the second derivative of the cost -function, that is we have +

      Before we discuss the link between for example Ridge regression and the singular value decomposition, we need to remind ourselves about +the definition of the covariance and the correlation function. These are quantities that play a central role in machine learning methods.

      +

      Suppose we have defined two vectors +\( \hat{x} \) and \( \hat{y} \) with \( n \) elements each. The covariance matrix \( \boldsymbol{C} \) is defined as +

      $$ -\frac{\partial^2 C(\boldsymbol{\beta})}{\partial \boldsymbol{\beta}^T\partial \boldsymbol{\beta}} =\frac{2}{n}\boldsymbol{X}^T\boldsymbol{X}. +\boldsymbol{C}[\boldsymbol{x},\boldsymbol{y}] = \begin{bmatrix} \mathrm{cov}[\boldsymbol{x},\boldsymbol{x}] & \mathrm{cov}[\boldsymbol{x},\boldsymbol{y}] \\ + \mathrm{cov}[\boldsymbol{y},\boldsymbol{x}] & \mathrm{cov}[\boldsymbol{y},\boldsymbol{y}] \\ + \end{bmatrix}, $$ -

      This quantity defines was what is called the Hessian matrix (the second derivative of a function we want to optimize).

      - -

      The Hessian matrix plays an important role and is defined in this course as

      - +

      where for example

      $$ -\boldsymbol{H}=\boldsymbol{X}^T\boldsymbol{X}. +\mathrm{cov}[\boldsymbol{x},\boldsymbol{y}] =\frac{1}{n} \sum_{i=0}^{n-1}(x_i- \overline{x})(y_i- \overline{y}). $$ -

      The Hessian matrix for ordinary least squares is also proportional to -the covariance matrix. This means also that we can use the SVD to find -the eigenvalues of the covariance matrix and the Hessian matrix in -terms of the singular values. Let us develop these arguments, as they will play an important role in our machine learning studies. +

      With this definition and recalling that the variance is defined as

      +$$ +\mathrm{var}[\boldsymbol{x}]=\frac{1}{n} \sum_{i=0}^{n-1}(x_i- \overline{x})^2, +$$ + +

      we can rewrite the covariance matrix as

      +$$ +\boldsymbol{C}[\boldsymbol{x},\boldsymbol{y}] = \begin{bmatrix} \mathrm{var}[\boldsymbol{x}] & \mathrm{cov}[\boldsymbol{x},\boldsymbol{y}] \\ + \mathrm{cov}[\boldsymbol{x},\boldsymbol{y}] & \mathrm{var}[\boldsymbol{y}] \\ + \end{bmatrix}. +$$ + +

      Note: we have used \( 1/n \) in the above definitions of the sample variance and covariance. We assume then that we can calculate the exact mean value. +What you will find in essentially all statistics texts are equations +with a factor \( 1/(n-1) \). This is called Bessel's correction. This +method corrects the bias in the estimation of the population variance +and covariance. It also partially corrects the bias in the estimation +of the population standard deviation. If you use a library like +Scikit-Learn or nunmpy's function calculate the covariance, this +quantity will be computed with a factor \( 1/(n-1) \).

      @@ -438,7 +451,7 @@ terms of the singular values. Let us develop these arguments, as they will pla

    457. 61
    458. 62
    459. ...
    460. -
    461. 70
    462. +
    463. 69
    464. »
    465. diff --git a/doc/pub/week35/html/._week35-bs053.html b/doc/pub/week35/html/._week35-bs053.html index 34f8fb769..cad21d5b3 100644 --- a/doc/pub/week35/html/._week35-bs053.html +++ b/doc/pub/week35/html/._week35-bs053.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -386,47 +384,32 @@ MathJax.Hub.Config({

       

       

       

      -

      Introducing the Covariance and Correlation functions

      +

      Covariance and Correlation Matrix

      -

      Before we discuss the link between for example Ridge regression and the singular value decomposition, we need to remind ourselves about -the definition of the covariance and the correlation function. These are quantities that play a central role in machine learning methods. +

      The covariance takes values between zero and infinity and may thus +lead to problems with loss of numerical precision for particularly +large values. It is common to scale the covariance matrix by +introducing instead the correlation matrix defined via the so-called +correlation function

      -

      Suppose we have defined two vectors -\( \hat{x} \) and \( \hat{y} \) with \( n \) elements each. The covariance matrix \( \boldsymbol{C} \) is defined as -

      $$ -\boldsymbol{C}[\boldsymbol{x},\boldsymbol{y}] = \begin{bmatrix} \mathrm{cov}[\boldsymbol{x},\boldsymbol{x}] & \mathrm{cov}[\boldsymbol{x},\boldsymbol{y}] \\ - \mathrm{cov}[\boldsymbol{y},\boldsymbol{x}] & \mathrm{cov}[\boldsymbol{y},\boldsymbol{y}] \\ +\mathrm{corr}[\boldsymbol{x},\boldsymbol{y}]=\frac{\mathrm{cov}[\boldsymbol{x},\boldsymbol{y}]}{\sqrt{\mathrm{var}[\boldsymbol{x}] \mathrm{var}[\boldsymbol{y}]}}. +$$ + +

      The correlation function is then given by values \( \mathrm{corr}[\boldsymbol{x},\boldsymbol{y}] +\in [-1,1] \). This avoids eventual problems with too large values. We +can then define the correlation matrix for the two vectors \( \boldsymbol{x} \) +and \( \boldsymbol{y} \) as +

      + +$$ +\boldsymbol{K}[\boldsymbol{x},\boldsymbol{y}] = \begin{bmatrix} 1 & \mathrm{corr}[\boldsymbol{x},\boldsymbol{y}] \\ + \mathrm{corr}[\boldsymbol{y},\boldsymbol{x}] & 1 \\ \end{bmatrix}, $$ -

      where for example

      -$$ -\mathrm{cov}[\boldsymbol{x},\boldsymbol{y}] =\frac{1}{n} \sum_{i=0}^{n-1}(x_i- \overline{x})(y_i- \overline{y}). -$$ - -

      With this definition and recalling that the variance is defined as

      -$$ -\mathrm{var}[\boldsymbol{x}]=\frac{1}{n} \sum_{i=0}^{n-1}(x_i- \overline{x})^2, -$$ - -

      we can rewrite the covariance matrix as

      -$$ -\boldsymbol{C}[\boldsymbol{x},\boldsymbol{y}] = \begin{bmatrix} \mathrm{var}[\boldsymbol{x}] & \mathrm{cov}[\boldsymbol{x},\boldsymbol{y}] \\ - \mathrm{cov}[\boldsymbol{x},\boldsymbol{y}] & \mathrm{var}[\boldsymbol{y}] \\ - \end{bmatrix}. -$$ - -

      Note: we have used \( 1/n \) in the above definitions of the sample variance and covariance. We assume then that we can calculate the exact mean value. -What you will find in essentially all statistics texts are equations -with a factor \( 1/(n-1) \). This is called Bessel's correction. This -method corrects the bias in the estimation of the population variance -and covariance. It also partially corrects the bias in the estimation -of the population standard deviation. If you use a library like -Scikit-Learn or nunmpy's function calculate the covariance, this -quantity will be computed with a factor \( 1/(n-1) \). -

      +

      In the above example this is the function we constructed using pandas.

      @@ -453,7 +436,7 @@ quantity will be computed with a factor \( 1/(n-1) \).

    466. 62
    467. 63
    468. ...
    469. -
    470. 70
    471. +
    472. 69
    473. »
    474. diff --git a/doc/pub/week35/html/._week35-bs054.html b/doc/pub/week35/html/._week35-bs054.html index 921bf87cd..274c95e41 100644 --- a/doc/pub/week35/html/._week35-bs054.html +++ b/doc/pub/week35/html/._week35-bs054.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -386,32 +384,65 @@ MathJax.Hub.Config({

       

       

       

      -

      Covariance and Correlation Matrix

      +

      Correlation Function and Design/Feature Matrix

      -

      The covariance takes values between zero and infinity and may thus -lead to problems with loss of numerical precision for particularly -large values. It is common to scale the covariance matrix by -introducing instead the correlation matrix defined via the so-called -correlation function +

      In our derivation of the various regression algorithms like Ordinary Least Squares or Ridge regression +we defined the design/feature matrix \( \boldsymbol{X} \) as

      $$ -\mathrm{corr}[\boldsymbol{x},\boldsymbol{y}]=\frac{\mathrm{cov}[\boldsymbol{x},\boldsymbol{y}]}{\sqrt{\mathrm{var}[\boldsymbol{x}] \mathrm{var}[\boldsymbol{y}]}}. +\boldsymbol{X}=\begin{bmatrix} +x_{0,0} & x_{0,1} & x_{0,2}& \dots & \dots x_{0,p-1}\\ +x_{1,0} & x_{1,1} & x_{1,2}& \dots & \dots x_{1,p-1}\\ +x_{2,0} & x_{2,1} & x_{2,2}& \dots & \dots x_{2,p-1}\\ +\dots & \dots & \dots & \dots \dots & \dots \\ +x_{n-2,0} & x_{n-2,1} & x_{n-2,2}& \dots & \dots x_{n-2,p-1}\\ +x_{n-1,0} & x_{n-1,1} & x_{n-1,2}& \dots & \dots x_{n-1,p-1}\\ +\end{bmatrix}, $$ -

      The correlation function is then given by values \( \mathrm{corr}[\boldsymbol{x},\boldsymbol{y}] -\in [-1,1] \). This avoids eventual problems with too large values. We -can then define the correlation matrix for the two vectors \( \boldsymbol{x} \) -and \( \boldsymbol{y} \) as +

      with \( \boldsymbol{X}\in {\mathbb{R}}^{n\times p} \), with the predictors/features \( p \) refering to the column numbers and the +entries \( n \) being the row elements. +We can rewrite the design/feature matrix in terms of its column vectors as +

      +$$ +\boldsymbol{X}=\begin{bmatrix} \boldsymbol{x}_0 & \boldsymbol{x}_1 & \boldsymbol{x}_2 & \dots & \dots & \boldsymbol{x}_{p-1}\end{bmatrix}, +$$ + +

      with a given vector

      +$$ +\boldsymbol{x}_i^T = \begin{bmatrix}x_{0,i} & x_{1,i} & x_{2,i}& \dots & \dots x_{n-1,i}\end{bmatrix}. +$$ + +

      With these definitions, we can now rewrite our \( 2\times 2 \) +correlation/covariance matrix in terms of a moe general design/feature +matrix \( \boldsymbol{X}\in {\mathbb{R}}^{n\times p} \). This leads to a \( p\times p \) +covariance matrix for the vectors \( \boldsymbol{x}_i \) with \( i=0,1,\dots,p-1 \)

      $$ -\boldsymbol{K}[\boldsymbol{x},\boldsymbol{y}] = \begin{bmatrix} 1 & \mathrm{corr}[\boldsymbol{x},\boldsymbol{y}] \\ - \mathrm{corr}[\boldsymbol{y},\boldsymbol{x}] & 1 \\ - \end{bmatrix}, +\boldsymbol{C}[\boldsymbol{x}] = \begin{bmatrix} +\mathrm{var}[\boldsymbol{x}_0] & \mathrm{cov}[\boldsymbol{x}_0,\boldsymbol{x}_1] & \mathrm{cov}[\boldsymbol{x}_0,\boldsymbol{x}_2] & \dots & \dots & \mathrm{cov}[\boldsymbol{x}_0,\boldsymbol{x}_{p-1}]\\ +\mathrm{cov}[\boldsymbol{x}_1,\boldsymbol{x}_0] & \mathrm{var}[\boldsymbol{x}_1] & \mathrm{cov}[\boldsymbol{x}_1,\boldsymbol{x}_2] & \dots & \dots & \mathrm{cov}[\boldsymbol{x}_1,\boldsymbol{x}_{p-1}]\\ +\mathrm{cov}[\boldsymbol{x}_2,\boldsymbol{x}_0] & \mathrm{cov}[\boldsymbol{x}_2,\boldsymbol{x}_1] & \mathrm{var}[\boldsymbol{x}_2] & \dots & \dots & \mathrm{cov}[\boldsymbol{x}_2,\boldsymbol{x}_{p-1}]\\ +\dots & \dots & \dots & \dots & \dots & \dots \\ +\dots & \dots & \dots & \dots & \dots & \dots \\ +\mathrm{cov}[\boldsymbol{x}_{p-1},\boldsymbol{x}_0] & \mathrm{cov}[\boldsymbol{x}_{p-1},\boldsymbol{x}_1] & \mathrm{cov}[\boldsymbol{x}_{p-1},\boldsymbol{x}_{2}] & \dots & \dots & \mathrm{var}[\boldsymbol{x}_{p-1}]\\ +\end{bmatrix}, +$$ + +

      and the correlation matrix

      +$$ +\boldsymbol{K}[\boldsymbol{x}] = \begin{bmatrix} +1 & \mathrm{corr}[\boldsymbol{x}_0,\boldsymbol{x}_1] & \mathrm{corr}[\boldsymbol{x}_0,\boldsymbol{x}_2] & \dots & \dots & \mathrm{corr}[\boldsymbol{x}_0,\boldsymbol{x}_{p-1}]\\ +\mathrm{corr}[\boldsymbol{x}_1,\boldsymbol{x}_0] & 1 & \mathrm{corr}[\boldsymbol{x}_1,\boldsymbol{x}_2] & \dots & \dots & \mathrm{corr}[\boldsymbol{x}_1,\boldsymbol{x}_{p-1}]\\ +\mathrm{corr}[\boldsymbol{x}_2,\boldsymbol{x}_0] & \mathrm{corr}[\boldsymbol{x}_2,\boldsymbol{x}_1] & 1 & \dots & \dots & \mathrm{corr}[\boldsymbol{x}_2,\boldsymbol{x}_{p-1}]\\ +\dots & \dots & \dots & \dots & \dots & \dots \\ +\dots & \dots & \dots & \dots & \dots & \dots \\ +\mathrm{corr}[\boldsymbol{x}_{p-1},\boldsymbol{x}_0] & \mathrm{corr}[\boldsymbol{x}_{p-1},\boldsymbol{x}_1] & \mathrm{corr}[\boldsymbol{x}_{p-1},\boldsymbol{x}_{2}] & \dots & \dots & 1\\ +\end{bmatrix}, $$ -

      In the above example this is the function we constructed using pandas.

      @@ -438,7 +469,7 @@ $$

    475. 63
    476. 64
    477. ...
    478. -
    479. 70
    480. +
    481. 69
    482. »
    483. diff --git a/doc/pub/week35/html/._week35-bs055.html b/doc/pub/week35/html/._week35-bs055.html index 6490140af..93aaaeb24 100644 --- a/doc/pub/week35/html/._week35-bs055.html +++ b/doc/pub/week35/html/._week35-bs055.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -386,64 +384,60 @@ MathJax.Hub.Config({

       

       

       

      -

      Correlation Function and Design/Feature Matrix

      +

      Covariance Matrix Examples

      -

      In our derivation of the various regression algorithms like Ordinary Least Squares or Ridge regression -we defined the design/feature matrix \( \boldsymbol{X} \) as +

      The Numpy function np.cov calculates the covariance elements using +the factor \( 1/(n-1) \) instead of \( 1/n \) since it assumes we do not have +the exact mean values. The following simple function uses the +np.vstack function which takes each vector of dimension \( 1\times n \) +and produces a \( 2\times n \) matrix \( \boldsymbol{W} \)

      +

      Note that this assumes you have the features as the rows, and the inputs as columns, that is

      $$ -\boldsymbol{X}=\begin{bmatrix} -x_{0,0} & x_{0,1} & x_{0,2}& \dots & \dots x_{0,p-1}\\ -x_{1,0} & x_{1,1} & x_{1,2}& \dots & \dots x_{1,p-1}\\ -x_{2,0} & x_{2,1} & x_{2,2}& \dots & \dots x_{2,p-1}\\ -\dots & \dots & \dots & \dots \dots & \dots \\ -x_{n-2,0} & x_{n-2,1} & x_{n-2,2}& \dots & \dots x_{n-2,p-1}\\ -x_{n-1,0} & x_{n-1,1} & x_{n-1,2}& \dots & \dots x_{n-1,p-1}\\ -\end{bmatrix}, +\boldsymbol{W} = \begin{bmatrix} x_0 & x_1 & x_2 & \dots & x_{n-2} & x_{n-1} \\ + y_0 & y_1 & y_2 & \dots & y_{n-2} & y_{n-1} \\ + \end{bmatrix}, $$ -

      with \( \boldsymbol{X}\in {\mathbb{R}}^{n\times p} \), with the predictors/features \( p \) refering to the column numbers and the -entries \( n \) being the row elements. -We can rewrite the design/feature matrix in terms of its column vectors as -

      -$$ -\boldsymbol{X}=\begin{bmatrix} \boldsymbol{x}_0 & \boldsymbol{x}_1 & \boldsymbol{x}_2 & \dots & \dots & \boldsymbol{x}_{p-1}\end{bmatrix}, -$$ - -

      with a given vector

      -$$ -\boldsymbol{x}_i^T = \begin{bmatrix}x_{0,i} & x_{1,i} & x_{2,i}& \dots & \dots x_{n-1,i}\end{bmatrix}. -$$ - -

      With these definitions, we can now rewrite our \( 2\times 2 \) -correlation/covariance matrix in terms of a moe general design/feature -matrix \( \boldsymbol{X}\in {\mathbb{R}}^{n\times p} \). This leads to a \( p\times p \) -covariance matrix for the vectors \( \boldsymbol{x}_i \) with \( i=0,1,\dots,p-1 \) +

      which in turn is converted into into the \( 2\times 2 \) covariance matrix +\( \boldsymbol{C} \) via the Numpy function np.cov(). We note that we can also calculate +the mean value of each set of samples \( \boldsymbol{x} \) etc using the Numpy +function np.mean(x). We can also extract the eigenvalues of the +covariance matrix through the np.linalg.eig() function.

      -$$ -\boldsymbol{C}[\boldsymbol{x}] = \begin{bmatrix} -\mathrm{var}[\boldsymbol{x}_0] & \mathrm{cov}[\boldsymbol{x}_0,\boldsymbol{x}_1] & \mathrm{cov}[\boldsymbol{x}_0,\boldsymbol{x}_2] & \dots & \dots & \mathrm{cov}[\boldsymbol{x}_0,\boldsymbol{x}_{p-1}]\\ -\mathrm{cov}[\boldsymbol{x}_1,\boldsymbol{x}_0] & \mathrm{var}[\boldsymbol{x}_1] & \mathrm{cov}[\boldsymbol{x}_1,\boldsymbol{x}_2] & \dots & \dots & \mathrm{cov}[\boldsymbol{x}_1,\boldsymbol{x}_{p-1}]\\ -\mathrm{cov}[\boldsymbol{x}_2,\boldsymbol{x}_0] & \mathrm{cov}[\boldsymbol{x}_2,\boldsymbol{x}_1] & \mathrm{var}[\boldsymbol{x}_2] & \dots & \dots & \mathrm{cov}[\boldsymbol{x}_2,\boldsymbol{x}_{p-1}]\\ -\dots & \dots & \dots & \dots & \dots & \dots \\ -\dots & \dots & \dots & \dots & \dots & \dots \\ -\mathrm{cov}[\boldsymbol{x}_{p-1},\boldsymbol{x}_0] & \mathrm{cov}[\boldsymbol{x}_{p-1},\boldsymbol{x}_1] & \mathrm{cov}[\boldsymbol{x}_{p-1},\boldsymbol{x}_{2}] & \dots & \dots & \mathrm{var}[\boldsymbol{x}_{p-1}]\\ -\end{bmatrix}, -$$ -

      and the correlation matrix

      -$$ -\boldsymbol{K}[\boldsymbol{x}] = \begin{bmatrix} -1 & \mathrm{corr}[\boldsymbol{x}_0,\boldsymbol{x}_1] & \mathrm{corr}[\boldsymbol{x}_0,\boldsymbol{x}_2] & \dots & \dots & \mathrm{corr}[\boldsymbol{x}_0,\boldsymbol{x}_{p-1}]\\ -\mathrm{corr}[\boldsymbol{x}_1,\boldsymbol{x}_0] & 1 & \mathrm{corr}[\boldsymbol{x}_1,\boldsymbol{x}_2] & \dots & \dots & \mathrm{corr}[\boldsymbol{x}_1,\boldsymbol{x}_{p-1}]\\ -\mathrm{corr}[\boldsymbol{x}_2,\boldsymbol{x}_0] & \mathrm{corr}[\boldsymbol{x}_2,\boldsymbol{x}_1] & 1 & \dots & \dots & \mathrm{corr}[\boldsymbol{x}_2,\boldsymbol{x}_{p-1}]\\ -\dots & \dots & \dots & \dots & \dots & \dots \\ -\dots & \dots & \dots & \dots & \dots & \dots \\ -\mathrm{corr}[\boldsymbol{x}_{p-1},\boldsymbol{x}_0] & \mathrm{corr}[\boldsymbol{x}_{p-1},\boldsymbol{x}_1] & \mathrm{corr}[\boldsymbol{x}_{p-1},\boldsymbol{x}_{2}] & \dots & \dots & 1\\ -\end{bmatrix}, -$$ + +
      +
      +
      +
      +
      +
      # Importing various packages
      +import numpy as np
      +n = 100
      +x = np.random.normal(size=n)
      +print(np.mean(x))
      +y = 4+3*x+np.random.normal(size=n)
      +print(np.mean(y))
      +W = np.vstack((x, y))
      +C = np.cov(W)
      +print(C)
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +

      @@ -471,7 +465,7 @@ $$

    484. 64
    485. 65
    486. ...
    487. -
    488. 70
    489. +
    490. 69
    491. »
    492. diff --git a/doc/pub/week35/html/._week35-bs056.html b/doc/pub/week35/html/._week35-bs056.html index ec3940f20..c0fc630df 100644 --- a/doc/pub/week35/html/._week35-bs056.html +++ b/doc/pub/week35/html/._week35-bs056.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -386,27 +384,13 @@ MathJax.Hub.Config({

       

       

       

      -

      Covariance Matrix Examples

      +

      Correlation Matrix

      -

      The Numpy function np.cov calculates the covariance elements using -the factor \( 1/(n-1) \) instead of \( 1/n \) since it assumes we do not have -the exact mean values. The following simple function uses the -np.vstack function which takes each vector of dimension \( 1\times n \) -and produces a \( 2\times n \) matrix \( \boldsymbol{W} \) -

      - -

      Note that this assumes you have the features as the rows, and the inputs as columns, that is

      -$$ -\boldsymbol{W} = \begin{bmatrix} x_0 & x_1 & x_2 & \dots & x_{n-2} & x_{n-1} \\ - y_0 & y_1 & y_2 & \dots & y_{n-2} & y_{n-1} \\ - \end{bmatrix}, -$$ - -

      which in turn is converted into into the \( 2\times 2 \) covariance matrix -\( \boldsymbol{C} \) via the Numpy function np.cov(). We note that we can also calculate -the mean value of each set of samples \( \boldsymbol{x} \) etc using the Numpy -function np.mean(x). We can also extract the eigenvalues of the -covariance matrix through the np.linalg.eig() function. +

      The previous example can be converted into the correlation matrix by +simply scaling the matrix elements with the variances. We should also +subtract the mean values for each column. This leads to the following +code which sets up the correlations matrix for the previous example in +a more brute force way. Here we scale the mean values for each column of the design matrix, calculate the relevant mean values and variances and then finally set up the \( 2\times 2 \) correlation matrix (since we have only two vectors).

      @@ -416,15 +400,26 @@ covariance matrix through the np.linalg.eig() function.
      -
      # Importing various packages
      -import numpy as np
      +  
      import numpy as np
       n = 100
      -x = np.random.normal(size=n)
      -print(np.mean(x))
      +# define two vectors                                                                                           
      +x = np.random.random(size=n)
       y = 4+3*x+np.random.normal(size=n)
      -print(np.mean(y))
      -W = np.vstack((x, y))
      -C = np.cov(W)
      +#scaling the x and y vectors                                                                                   
      +x = x - np.mean(x)
      +y = y - np.mean(y)
      +variance_x = np.sum(x@x)/n
      +variance_y = np.sum(y@y)/n
      +print(variance_x)
      +print(variance_y)
      +cov_xy = np.sum(x@y)/n
      +cov_xx = np.sum(x@x)/n
      +cov_yy = np.sum(y@y)/n
      +C = np.zeros((2,2))
      +C[0,0]= cov_xx/variance_x
      +C[1,1]= cov_yy/variance_y
      +C[0,1]= cov_xy/np.sqrt(variance_y*variance_x)
      +C[1,0]= C[0,1]
       print(C)
       
      @@ -441,6 +436,12 @@ C = np.c
      +

      We see that the matrix elements along the diagonal are one as they +should be and that the matrix is symmetric. Furthermore, diagonalizing +this matrix we easily see that it is a positive definite matrix. +

      + +

      The above procedure with numpy can be made more compact if we use pandas.

      @@ -467,7 +468,7 @@ C = np.c

    493. 65
    494. 66
    495. ...
    496. -
    497. 70
    498. +
    499. 69
    500. »
    501. diff --git a/doc/pub/week35/html/._week35-bs057.html b/doc/pub/week35/html/._week35-bs057.html index ccde149d7..ad4cb064e 100644 --- a/doc/pub/week35/html/._week35-bs057.html +++ b/doc/pub/week35/html/._week35-bs057.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -386,15 +384,9 @@ MathJax.Hub.Config({

       

       

       

      -

      Correlation Matrix

      - -

      The previous example can be converted into the correlation matrix by -simply scaling the matrix elements with the variances. We should also -subtract the mean values for each column. This leads to the following -code which sets up the correlations matrix for the previous example in -a more brute force way. Here we scale the mean values for each column of the design matrix, calculate the relevant mean values and variances and then finally set up the \( 2\times 2 \) correlation matrix (since we have only two vectors). -

      +

      Correlation Matrix with Pandas

      +

      We whow here how we can set up the correlation matrix using pandas, as done in this simple code

      @@ -403,26 +395,19 @@ a more brute force way. Here we scale the mean values for each column of the des
      import numpy as np
      -n = 100
      -# define two vectors                                                                                           
      -x = np.random.random(size=n)
      -y = 4+3*x+np.random.normal(size=n)
      -#scaling the x and y vectors                                                                                   
      +import pandas as pd
      +n = 10
      +x = np.random.normal(size=n)
       x = x - np.mean(x)
      +y = 4+3*x+np.random.normal(size=n)
       y = y - np.mean(y)
      -variance_x = np.sum(x@x)/n
      -variance_y = np.sum(y@y)/n
      -print(variance_x)
      -print(variance_y)
      -cov_xy = np.sum(x@y)/n
      -cov_xx = np.sum(x@x)/n
      -cov_yy = np.sum(y@y)/n
      -C = np.zeros((2,2))
      -C[0,0]= cov_xx/variance_x
      -C[1,1]= cov_yy/variance_y
      -C[0,1]= cov_xy/np.sqrt(variance_y*variance_x)
      -C[1,0]= C[0,1]
      -print(C)
      +# Note that we transpose the matrix in order to stay with our ordering n x p
      +X = (np.vstack((x, y))).T
      +print(X)
      +Xpd = pd.DataFrame(X)
      +print(Xpd)
      +correlation_matrix = Xpd.corr()
      +print(correlation_matrix)
       
      @@ -438,12 +423,7 @@ C[1,0]
      -

      We see that the matrix elements along the diagonal are one as they -should be and that the matrix is symmetric. Furthermore, diagonalizing -this matrix we easily see that it is a positive definite matrix. -

      - -

      The above procedure with numpy can be made more compact if we use pandas.

      +

      We expand this model to the Franke function discussed above.

      @@ -470,7 +450,7 @@ this matrix we easily see that it is a positive definite matrix.

    502. 66
    503. 67
    504. ...
    505. -
    506. 70
    507. +
    508. 69
    509. »
    510. diff --git a/doc/pub/week35/html/._week35-bs058.html b/doc/pub/week35/html/._week35-bs058.html index f5f5d37ec..073ab3249 100644 --- a/doc/pub/week35/html/._week35-bs058.html +++ b/doc/pub/week35/html/._week35-bs058.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -386,9 +384,8 @@ MathJax.Hub.Config({

       

       

       

      -

      Correlation Matrix with Pandas

      +

      Correlation Matrix with Pandas and the Franke function

      -

      We whow here how we can set up the correlation matrix using pandas, as done in this simple code

      @@ -396,20 +393,49 @@ MathJax.Hub.Config({
      -
      import numpy as np
      +  
      # Common imports
      +import numpy as np
       import pandas as pd
      -n = 10
      -x = np.random.normal(size=n)
      -x = x - np.mean(x)
      -y = 4+3*x+np.random.normal(size=n)
      -y = y - np.mean(y)
      -# Note that we transpose the matrix in order to stay with our ordering n x p
      -X = (np.vstack((x, y))).T
      -print(X)
      +
      +
      +def FrankeFunction(x,y):
      +	term1 = 0.75*np.exp(-(0.25*(9*x-2)**2) - 0.25*((9*y-2)**2))
      +	term2 = 0.75*np.exp(-((9*x+1)**2)/49.0 - 0.1*(9*y+1))
      +	term3 = 0.5*np.exp(-(9*x-7)**2/4.0 - 0.25*((9*y-3)**2))
      +	term4 = -0.2*np.exp(-(9*x-4)**2 - (9*y-7)**2)
      +	return term1 + term2 + term3 + term4
      +
      +
      +def create_X(x, y, n ):
      +	if len(x.shape) > 1:
      +		x = np.ravel(x)
      +		y = np.ravel(y)
      +
      +	N = len(x)
      +	l = int((n+1)*(n+2)/2)		# Number of elements in beta
      +	X = np.ones((N,l))
      +
      +	for i in range(1,n+1):
      +		q = int((i)*(i+1)/2)
      +		for k in range(i+1):
      +			X[:,q+k] = (x**(i-k))*(y**k)
      +
      +	return X
      +
      +
      +# Making meshgrid of datapoints and compute Franke's function
      +n = 4
      +N = 100
      +x = np.sort(np.random.uniform(0, 1, N))
      +y = np.sort(np.random.uniform(0, 1, N))
      +z = FrankeFunction(x, y)
      +X = create_X(x, y, n=n)    
      +
       Xpd = pd.DataFrame(X)
      -print(Xpd)
      -correlation_matrix = Xpd.corr()
      -print(correlation_matrix)
      +# subtract the mean values and set up the covariance matrix
      +Xpd = Xpd - Xpd.mean()
      +covariance_matrix = Xpd.cov()
      +print(covariance_matrix)
       
      @@ -425,7 +451,16 @@ correlation_matrix = Xpd= Xpd67
    511. 68
    512. ...
    513. -
    514. 70
    515. +
    516. 69
    517. »
    518. diff --git a/doc/pub/week35/html/._week35-bs059.html b/doc/pub/week35/html/._week35-bs059.html index f6c48c491..517e970f2 100644 --- a/doc/pub/week35/html/._week35-bs059.html +++ b/doc/pub/week35/html/._week35-bs059.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -386,83 +384,41 @@ MathJax.Hub.Config({

       

       

       

      -

      Correlation Matrix with Pandas and the Franke function

      +

      Rewriting the Covariance and/or Correlation Matrix

      +

      We can rewrite the covariance matrix in a more compact form in terms of the design/feature matrix \( \boldsymbol{X} \) as

      +$$ +\boldsymbol{C}[\boldsymbol{x}] = \frac{1}{n}\boldsymbol{X}^T\boldsymbol{X}= \mathbb{E}[\boldsymbol{X}^T\boldsymbol{X}]. +$$ - -
      -
      -
      -
      -
      -
      # Common imports
      -import numpy as np
      -import pandas as pd
      +

      To see this let us simply look at a design matrix \( \boldsymbol{X}\in {\mathbb{R}}^{2\times 2} \)

      +$$ +\boldsymbol{X}=\begin{bmatrix} +x_{00} & x_{01}\\ +x_{10} & x_{11}\\ +\end{bmatrix}=\begin{bmatrix} +\boldsymbol{x}_{0} & \boldsymbol{x}_{1}\\ +\end{bmatrix}. +$$ +

      If we then compute the expectation value (note the \( 1/n \) factor instead of \( 1/(n-1) \))

      +$$ +\mathbb{E}[\boldsymbol{X}^T\boldsymbol{X}] = \frac{1}{n}\boldsymbol{X}^T\boldsymbol{X}=\frac{1}{n}\begin{bmatrix} +x_{00}^2+x_{10}^2 & x_{00}x_{01}+x_{10}x_{11}\\ +x_{01}x_{00}+x_{11}x_{10} & x_{01}^2+x_{11}^2\\ +\end{bmatrix}, +$$ -def FrankeFunction(x,y): - term1 = 0.75*np.exp(-(0.25*(9*x-2)**2) - 0.25*((9*y-2)**2)) - term2 = 0.75*np.exp(-((9*x+1)**2)/49.0 - 0.1*(9*y+1)) - term3 = 0.5*np.exp(-(9*x-7)**2/4.0 - 0.25*((9*y-3)**2)) - term4 = -0.2*np.exp(-(9*x-4)**2 - (9*y-7)**2) - return term1 + term2 + term3 + term4 +

      which is just

      +$$ +\boldsymbol{C}[\boldsymbol{x}_0,\boldsymbol{x}_1] = \boldsymbol{C}[\boldsymbol{x}]=\begin{bmatrix} \mathrm{var}[\boldsymbol{x}_0] & \mathrm{cov}[\boldsymbol{x}_0,\boldsymbol{x}_1] \\ + \mathrm{cov}[\boldsymbol{x}_1,\boldsymbol{x}_0] & \mathrm{var}[\boldsymbol{x}_1] \\ + \end{bmatrix}, +$$ +

      where we wrote $$\boldsymbol{C}[\boldsymbol{x}_0,\boldsymbol{x}_1] = \boldsymbol{C}[\boldsymbol{x}]$$ to indicate that this is the covariance of the vectors \( \boldsymbol{x} \) of the design/feature matrix \( \boldsymbol{X} \).

      -def create_X(x, y, n ): - if len(x.shape) > 1: - x = np.ravel(x) - y = np.ravel(y) - - N = len(x) - l = int((n+1)*(n+2)/2) # Number of elements in beta - X = np.ones((N,l)) - - for i in range(1,n+1): - q = int((i)*(i+1)/2) - for k in range(i+1): - X[:,q+k] = (x**(i-k))*(y**k) - - return X - - -# Making meshgrid of datapoints and compute Franke's function -n = 4 -N = 100 -x = np.sort(np.random.uniform(0, 1, N)) -y = np.sort(np.random.uniform(0, 1, N)) -z = FrankeFunction(x, y) -X = create_X(x, y, n=n) - -Xpd = pd.DataFrame(X) -# subtract the mean values and set up the covariance matrix -Xpd = Xpd - Xpd.mean() -covariance_matrix = Xpd.cov() -print(covariance_matrix) -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      - -

      We note here that the covariance is zero for the first rows and -columns since all matrix elements in the design matrix were set to one -(we are fitting the function in terms of a polynomial of degree \( n \)). -

      - -

      This means that the variance for these elements will be zero and will -cause problems when we set up the correlation matrix. We can simply -drop these elements and construct a correlation -matrix without these elements. -

      +

      It is easy to generalize this to a matrix \( \boldsymbol{X}\in {\mathbb{R}}^{n\times p} \).

      @@ -488,8 +444,6 @@ matrix without these elements.

    519. 67
    520. 68
    521. 69
    522. -
    523. ...
    524. -
    525. 70
    526. »
    527. diff --git a/doc/pub/week35/html/._week35-bs060.html b/doc/pub/week35/html/._week35-bs060.html index bbfc551eb..a2ef024ba 100644 --- a/doc/pub/week35/html/._week35-bs060.html +++ b/doc/pub/week35/html/._week35-bs060.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -386,41 +384,39 @@ MathJax.Hub.Config({

       

       

       

      -

      Rewriting the Covariance and/or Correlation Matrix

      +

      Linking with the SVD

      -

      We can rewrite the covariance matrix in a more compact form in terms of the design/feature matrix \( \boldsymbol{X} \) as

      +

      We saw earlier that

      $$ -\boldsymbol{C}[\boldsymbol{x}] = \frac{1}{n}\boldsymbol{X}^T\boldsymbol{X}= \mathbb{E}[\boldsymbol{X}^T\boldsymbol{X}]. +\boldsymbol{X}^T\boldsymbol{X}=\boldsymbol{V}\boldsymbol{\Sigma}^T\boldsymbol{U}^T\boldsymbol{U}\boldsymbol{\Sigma}\boldsymbol{V}^T=\boldsymbol{V}\boldsymbol{\Sigma}^T\boldsymbol{\Sigma}\boldsymbol{V}^T. $$ -

      To see this let us simply look at a design matrix \( \boldsymbol{X}\in {\mathbb{R}}^{2\times 2} \)

      +

      Since the matrices here have dimension \( p\times p \), with \( p \) corresponding to the singular values, we defined earlier the matrix

      $$ -\boldsymbol{X}=\begin{bmatrix} -x_{00} & x_{01}\\ -x_{10} & x_{11}\\ -\end{bmatrix}=\begin{bmatrix} -\boldsymbol{x}_{0} & \boldsymbol{x}_{1}\\ -\end{bmatrix}. +\boldsymbol{\Sigma}^T\boldsymbol{\Sigma} = \begin{bmatrix} \tilde{\boldsymbol{\Sigma}} & \boldsymbol{0}\\ \end{bmatrix}\begin{bmatrix} \tilde{\boldsymbol{\Sigma}} \\ \boldsymbol{0}\\ \end{bmatrix}, $$ -

      If we then compute the expectation value (note the \( 1/n \) factor instead of \( 1/(n-1) \))

      +

      where the tilde-matrix \( \tilde{\boldsymbol{\Sigma}} \) is a matrix of dimension \( p\times p \) containing only the singular values \( \sigma_i \), that is

      + $$ -\mathbb{E}[\boldsymbol{X}^T\boldsymbol{X}] = \frac{1}{n}\boldsymbol{X}^T\boldsymbol{X}=\frac{1}{n}\begin{bmatrix} -x_{00}^2+x_{10}^2 & x_{00}x_{01}+x_{10}x_{11}\\ -x_{01}x_{00}+x_{11}x_{10} & x_{01}^2+x_{11}^2\\ +\tilde{\boldsymbol{\Sigma}}=\begin{bmatrix} \sigma_0 & 0 & 0 & \dots & 0 & 0 \\ + 0 & \sigma_1 & 0 & \dots & 0 & 0 \\ + 0 & 0 & \sigma_2 & \dots & 0 & 0 \\ + 0 & 0 & 0 & \dots & \sigma_{p-2} & 0 \\ + 0 & 0 & 0 & \dots & 0 & \sigma_{p-1} \\ \end{bmatrix}, $$ -

      which is just

      +

      meaning we can write

      $$ -\boldsymbol{C}[\boldsymbol{x}_0,\boldsymbol{x}_1] = \boldsymbol{C}[\boldsymbol{x}]=\begin{bmatrix} \mathrm{var}[\boldsymbol{x}_0] & \mathrm{cov}[\boldsymbol{x}_0,\boldsymbol{x}_1] \\ - \mathrm{cov}[\boldsymbol{x}_1,\boldsymbol{x}_0] & \mathrm{var}[\boldsymbol{x}_1] \\ - \end{bmatrix}, +\boldsymbol{X}^T\boldsymbol{X}=\boldsymbol{V}\tilde{\boldsymbol{\Sigma}}^2\boldsymbol{V}^T. $$ -

      where we wrote $$\boldsymbol{C}[\boldsymbol{x}_0,\boldsymbol{x}_1] = \boldsymbol{C}[\boldsymbol{x}]$$ to indicate that this is the covariance of the vectors \( \boldsymbol{x} \) of the design/feature matrix \( \boldsymbol{X} \).

      +

      Multiplying from the right with \( \boldsymbol{V} \) (using the orthogonality of \( \boldsymbol{V} \)) we get

      +$$ +\left(\boldsymbol{X}^T\boldsymbol{X}\right)\boldsymbol{V}=\boldsymbol{V}\tilde{\boldsymbol{\Sigma}}^2. +$$ -

      It is easy to generalize this to a matrix \( \boldsymbol{X}\in {\mathbb{R}}^{n\times p} \).

      @@ -445,7 +441,6 @@ $$

    528. 67
    529. 68
    530. 69
    531. -
    532. 70
    533. »
    534. diff --git a/doc/pub/week35/html/._week35-bs061.html b/doc/pub/week35/html/._week35-bs061.html index d56a89d60..e46aea8a9 100644 --- a/doc/pub/week35/html/._week35-bs061.html +++ b/doc/pub/week35/html/._week35-bs061.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -386,39 +384,45 @@ MathJax.Hub.Config({

       

       

       

      -

      Linking with the SVD

      +

      What does it mean?

      -

      We saw earlier that

      -$$ -\boldsymbol{X}^T\boldsymbol{X}=\boldsymbol{V}\boldsymbol{\Sigma}^T\boldsymbol{U}^T\boldsymbol{U}\boldsymbol{\Sigma}\boldsymbol{V}^T=\boldsymbol{V}\boldsymbol{\Sigma}^T\boldsymbol{\Sigma}\boldsymbol{V}^T. -$$ - -

      Since the matrices here have dimension \( p\times p \), with \( p \) corresponding to the singular values, we defined earlier the matrix

      -$$ -\boldsymbol{\Sigma}^T\boldsymbol{\Sigma} = \begin{bmatrix} \tilde{\boldsymbol{\Sigma}} & \boldsymbol{0}\\ \end{bmatrix}\begin{bmatrix} \tilde{\boldsymbol{\Sigma}} \\ \boldsymbol{0}\\ \end{bmatrix}, -$$ - -

      where the tilde-matrix \( \tilde{\boldsymbol{\Sigma}} \) is a matrix of dimension \( p\times p \) containing only the singular values \( \sigma_i \), that is

      +

      This means the vectors \( \boldsymbol{v}_i \) of the orthogonal matrix \( \boldsymbol{V} \) +are the eigenvectors of the matrix \( \boldsymbol{X}^T\boldsymbol{X} \) with eigenvalues +given by the singular values squared, that is +

      $$ -\tilde{\boldsymbol{\Sigma}}=\begin{bmatrix} \sigma_0 & 0 & 0 & \dots & 0 & 0 \\ - 0 & \sigma_1 & 0 & \dots & 0 & 0 \\ - 0 & 0 & \sigma_2 & \dots & 0 & 0 \\ - 0 & 0 & 0 & \dots & \sigma_{p-2} & 0 \\ - 0 & 0 & 0 & \dots & 0 & \sigma_{p-1} \\ -\end{bmatrix}, +\left(\boldsymbol{X}^T\boldsymbol{X}\right)\boldsymbol{v}_i=\boldsymbol{v}_i\sigma_i^2. $$ -

      meaning we can write

      +

      In other words, each non-zero singular value of \( \boldsymbol{X} \) is a positive +square root of an eigenvalue of \( \boldsymbol{X}^T\boldsymbol{X} \). It means also that +the columns of \( \boldsymbol{V} \) are the eigenvectors of +\( \boldsymbol{X}^T\boldsymbol{X} \). Since we have ordered the singular values of +\( \boldsymbol{X} \) in a descending order, it means that the column vectors +\( \boldsymbol{v}_i \) are hierarchically ordered by how much correlation they +encode from the columns of \( \boldsymbol{X} \). +

      + +

      Note that these are also the eigenvectors and eigenvalues of the +Hessian matrix. +

      + +

      If we now recall the definition of the covariance matrix (not using +Bessel's correction) we have +

      + $$ -\boldsymbol{X}^T\boldsymbol{X}=\boldsymbol{V}\tilde{\boldsymbol{\Sigma}}^2\boldsymbol{V}^T. -$$ - -

      Multiplying from the right with \( \boldsymbol{V} \) (using the orthogonality of \( \boldsymbol{V} \)) we get

      -$$ -\left(\boldsymbol{X}^T\boldsymbol{X}\right)\boldsymbol{V}=\boldsymbol{V}\tilde{\boldsymbol{\Sigma}}^2. +\boldsymbol{C}[\boldsymbol{X}]=\frac{1}{n}\boldsymbol{X}^T\boldsymbol{X}, $$ +

      meaning that every squared non-singular value of \( \boldsymbol{X} \) divided by \( n \) ( +the number of samples) are the eigenvalues of the covariance +matrix. Every singular value of \( \boldsymbol{X} \) is thus a positive square +root of an eigenvalue of \( \boldsymbol{X}^T\boldsymbol{X} \). If the matrix \( \boldsymbol{X} \) is +self-adjoint, the singular values of \( \boldsymbol{X} \) are equal to the +absolute value of the eigenvalues of \( \boldsymbol{X} \). +

      @@ -442,7 +446,6 @@ $$

    535. 67
    536. 68
    537. 69
    538. -
    539. 70
    540. »
    541. diff --git a/doc/pub/week35/html/._week35-bs062.html b/doc/pub/week35/html/._week35-bs062.html index c1ad8acbf..8072dfad4 100644 --- a/doc/pub/week35/html/._week35-bs062.html +++ b/doc/pub/week35/html/._week35-bs062.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -386,44 +384,38 @@ MathJax.Hub.Config({

       

       

       

      -

      What does it mean?

      +

      And finally \( \boldsymbol{X}\boldsymbol{X}^T \)

      -

      This means the vectors \( \boldsymbol{v}_i \) of the orthogonal matrix \( \boldsymbol{V} \) -are the eigenvectors of the matrix \( \boldsymbol{X}^T\boldsymbol{X} \) with eigenvalues -given by the singular values squared, that is -

      +

      For \( \boldsymbol{X}\boldsymbol{X}^T \) we found

      $$ -\left(\boldsymbol{X}^T\boldsymbol{X}\right)\boldsymbol{v}_i=\boldsymbol{v}_i\sigma_i^2. +\boldsymbol{X}\boldsymbol{X}^T=\boldsymbol{U}\boldsymbol{\Sigma}\boldsymbol{V}^T\boldsymbol{V}\boldsymbol{\Sigma}^T\boldsymbol{U}^T=\boldsymbol{U}\boldsymbol{\Sigma}^T\boldsymbol{\Sigma}\boldsymbol{U}^T. $$ -

      In other words, each non-zero singular value of \( \boldsymbol{X} \) is a positive -square root of an eigenvalue of \( \boldsymbol{X}^T\boldsymbol{X} \). It means also that -the columns of \( \boldsymbol{V} \) are the eigenvectors of -\( \boldsymbol{X}^T\boldsymbol{X} \). Since we have ordered the singular values of -\( \boldsymbol{X} \) in a descending order, it means that the column vectors -\( \boldsymbol{v}_i \) are hierarchically ordered by how much correlation they -encode from the columns of \( \boldsymbol{X} \). -

      - -

      Note that these are also the eigenvectors and eigenvalues of the -Hessian matrix. -

      - -

      If we now recall the definition of the covariance matrix (not using -Bessel's correction) we have -

      - +

      Since the matrices here have dimension \( n\times n \), we have

      $$ -\boldsymbol{C}[\boldsymbol{X}]=\frac{1}{n}\boldsymbol{X}^T\boldsymbol{X}, +\boldsymbol{\Sigma}\boldsymbol{\Sigma}^T = \begin{bmatrix} \tilde{\boldsymbol{\Sigma}} \\ \boldsymbol{0}\\ \end{bmatrix}\begin{bmatrix} \tilde{\boldsymbol{\Sigma}} \boldsymbol{0}\\ \end{bmatrix}=\begin{bmatrix} \tilde{\boldsymbol{\Sigma}} & \boldsymbol{0} \\ \boldsymbol{0} & \boldsymbol{0}\\ \end{bmatrix}, $$ -

      meaning that every squared non-singular value of \( \boldsymbol{X} \) divided by \( n \) ( -the number of samples) are the eigenvalues of the covariance -matrix. Every singular value of \( \boldsymbol{X} \) is thus a positive square -root of an eigenvalue of \( \boldsymbol{X}^T\boldsymbol{X} \). If the matrix \( \boldsymbol{X} \) is -self-adjoint, the singular values of \( \boldsymbol{X} \) are equal to the -absolute value of the eigenvalues of \( \boldsymbol{X} \). +

      leading to

      +$$ +\boldsymbol{X}\boldsymbol{X}^T=\boldsymbol{U}\begin{bmatrix} \tilde{\boldsymbol{\Sigma}} & \boldsymbol{0} \\ \boldsymbol{0} & \boldsymbol{0}\\ \end{bmatrix}\boldsymbol{U}^T. +$$ + +

      Multiplying with \( \boldsymbol{U} \) from the right gives us the eigenvalue problem

      +$$ +(\boldsymbol{X}\boldsymbol{X}^T)\boldsymbol{U}=\boldsymbol{U}\begin{bmatrix} \tilde{\boldsymbol{\Sigma}} & \boldsymbol{0} \\ \boldsymbol{0} & \boldsymbol{0}\\ \end{bmatrix}. +$$ + +

      It means that the eigenvalues of \( \boldsymbol{X}\boldsymbol{X}^T \) are again given by +the non-zero singular values plus now a series of zeros. The column +vectors of \( \boldsymbol{U} \) are the eigenvectors of \( \boldsymbol{X}\boldsymbol{X}^T \) and +measure how much correlations are contained in the rows of \( \boldsymbol{X} \). +

      + +

      Since we will mainly be interested in the correlations among the features +of our data (the columns of \( \boldsymbol{X} \), the quantity of interest for us are the non-zero singular +values and the column vectors of \( \boldsymbol{V} \).

      @@ -447,7 +439,6 @@ absolute value of the eigenvalues of \( \boldsymbol{X} \).

    542. 67
    543. 68
    544. 69
    545. -
    546. 70
    547. »
    548. diff --git a/doc/pub/week35/html/._week35-bs063.html b/doc/pub/week35/html/._week35-bs063.html index 0b3b94698..5866d0cfb 100644 --- a/doc/pub/week35/html/._week35-bs063.html +++ b/doc/pub/week35/html/._week35-bs063.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -386,40 +384,60 @@ MathJax.Hub.Config({

       

       

       

      -

      And finally \( \boldsymbol{X}\boldsymbol{X}^T \)

      - -

      For \( \boldsymbol{X}\boldsymbol{X}^T \) we found

      +

      Ridge and LASSO Regression

      +

      Let us remind ourselves about the expression for the standard Mean Squared Error (MSE) which we used to define our cost function and the equations for the ordinary least squares (OLS) method, that is +our optimization problem is +

      $$ -\boldsymbol{X}\boldsymbol{X}^T=\boldsymbol{U}\boldsymbol{\Sigma}\boldsymbol{V}^T\boldsymbol{V}\boldsymbol{\Sigma}^T\boldsymbol{U}^T=\boldsymbol{U}\boldsymbol{\Sigma}^T\boldsymbol{\Sigma}\boldsymbol{U}^T. +{\displaystyle \min_{\boldsymbol{\beta}\in {\mathbb{R}}^{p}}}\frac{1}{n}\left\{\left(\boldsymbol{y}-\boldsymbol{X}\boldsymbol{\beta}\right)^T\left(\boldsymbol{y}-\boldsymbol{X}\boldsymbol{\beta}\right)\right\}. $$ -

      Since the matrices here have dimension \( n\times n \), we have

      +

      or we can state it as

      $$ -\boldsymbol{\Sigma}\boldsymbol{\Sigma}^T = \begin{bmatrix} \tilde{\boldsymbol{\Sigma}} \\ \boldsymbol{0}\\ \end{bmatrix}\begin{bmatrix} \tilde{\boldsymbol{\Sigma}} \boldsymbol{0}\\ \end{bmatrix}=\begin{bmatrix} \tilde{\boldsymbol{\Sigma}} & \boldsymbol{0} \\ \boldsymbol{0} & \boldsymbol{0}\\ \end{bmatrix}, +{\displaystyle \min_{\boldsymbol{\beta}\in +{\mathbb{R}}^{p}}}\frac{1}{n}\sum_{i=0}^{n-1}\left(y_i-\tilde{y}_i\right)^2=\frac{1}{n}\vert\vert \boldsymbol{y}-\boldsymbol{X}\boldsymbol{\beta}\vert\vert_2^2, $$ -

      leading to

      +

      where we have used the definition of a norm-2 vector, that is

      $$ -\boldsymbol{X}\boldsymbol{X}^T=\boldsymbol{U}\begin{bmatrix} \tilde{\boldsymbol{\Sigma}} & \boldsymbol{0} \\ \boldsymbol{0} & \boldsymbol{0}\\ \end{bmatrix}\boldsymbol{U}^T. +\vert\vert \boldsymbol{x}\vert\vert_2 = \sqrt{\sum_i x_i^2}. $$ -

      Multiplying with \( \boldsymbol{U} \) from the right gives us the eigenvalue problem

      -$$ -(\boldsymbol{X}\boldsymbol{X}^T)\boldsymbol{U}=\boldsymbol{U}\begin{bmatrix} \tilde{\boldsymbol{\Sigma}} & \boldsymbol{0} \\ \boldsymbol{0} & \boldsymbol{0}\\ \end{bmatrix}. -$$ - -

      It means that the eigenvalues of \( \boldsymbol{X}\boldsymbol{X}^T \) are again given by -the non-zero singular values plus now a series of zeros. The column -vectors of \( \boldsymbol{U} \) are the eigenvectors of \( \boldsymbol{X}\boldsymbol{X}^T \) and -measure how much correlations are contained in the rows of \( \boldsymbol{X} \). +

      By minimizing the above equation with respect to the parameters +\( \boldsymbol{\beta} \) we could then obtain an analytical expression for the +parameters \( \boldsymbol{\beta} \). We can add a regularization parameter \( \lambda \) by +defining a new cost function to be optimized, that is

      -

      Since we will mainly be interested in the correlations among the features -of our data (the columns of \( \boldsymbol{X} \), the quantity of interest for us are the non-zero singular -values and the column vectors of \( \boldsymbol{V} \). +$$ +{\displaystyle \min_{\boldsymbol{\beta}\in +{\mathbb{R}}^{p}}}\frac{1}{n}\vert\vert \boldsymbol{y}-\boldsymbol{X}\boldsymbol{\beta}\vert\vert_2^2+\lambda\vert\vert \boldsymbol{\beta}\vert\vert_2^2 +$$ + +

      which leads to the Ridge regression minimization problem where we +require that \( \vert\vert \boldsymbol{\beta}\vert\vert_2^2\le t \), where \( t \) is +a finite number larger than zero. By defining

      +$$ +C(\boldsymbol{X},\boldsymbol{\beta})=\frac{1}{n}\vert\vert \boldsymbol{y}-\boldsymbol{X}\boldsymbol{\beta}\vert\vert_2^2+\lambda\vert\vert \boldsymbol{\beta}\vert\vert_1, +$$ + +

      we have a new optimization equation

      +$$ +{\displaystyle \min_{\boldsymbol{\beta}\in +{\mathbb{R}}^{p}}}\frac{1}{n}\vert\vert \boldsymbol{y}-\boldsymbol{X}\boldsymbol{\beta}\vert\vert_2^2+\lambda\vert\vert \boldsymbol{\beta}\vert\vert_1 +$$ + +

      which leads to Lasso regression. Lasso stands for least absolute shrinkage and selection operator.

      + +

      Here we have defined the norm-1 as

      +$$ +\vert\vert \boldsymbol{x}\vert\vert_1 = \sum_i \vert x_i\vert. +$$ + +

        @@ -440,7 +458,6 @@ values and the column vectors of \( \boldsymbol{V} \).
      • 67
      • 68
      • 69
      • -
      • 70
      • »
      diff --git a/doc/pub/week35/html/._week35-bs064.html b/doc/pub/week35/html/._week35-bs064.html index 15c66cae4..95311150d 100644 --- a/doc/pub/week35/html/._week35-bs064.html +++ b/doc/pub/week35/html/._week35-bs064.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -386,59 +384,67 @@ MathJax.Hub.Config({

       

       

       

      -

      Ridge and LASSO Regression

      +

      Deriving the Ridge Regression Equations

      -

      Let us remind ourselves about the expression for the standard Mean Squared Error (MSE) which we used to define our cost function and the equations for the ordinary least squares (OLS) method, that is -our optimization problem is +

      Using the matrix-vector expression for Ridge regression and dropping the parameter \( 1/n \) in front of the standard means squared error equation, we have

      + +$$ +C(\boldsymbol{X},\boldsymbol{\beta})=\left\{(\boldsymbol{y}-\boldsymbol{X}\boldsymbol{\beta})^T(\boldsymbol{y}-\boldsymbol{X}\boldsymbol{\beta})\right\}+\lambda\boldsymbol{\beta}^T\boldsymbol{\beta}, +$$ + +

      and +taking the derivatives with respect to \( \boldsymbol{\beta} \) we obtain then +a slightly modified matrix inversion problem which for finite values +of \( \lambda \) does not suffer from singularity problems. We obtain +the optimal parameters

      $$ -{\displaystyle \min_{\boldsymbol{\beta}\in {\mathbb{R}}^{p}}}\frac{1}{n}\left\{\left(\boldsymbol{y}-\boldsymbol{X}\boldsymbol{\beta}\right)^T\left(\boldsymbol{y}-\boldsymbol{X}\boldsymbol{\beta}\right)\right\}. +\hat{\boldsymbol{\beta}}_{\mathrm{Ridge}} = \left(\boldsymbol{X}^T\boldsymbol{X}+\lambda\boldsymbol{I}\right)^{-1}\boldsymbol{X}^T\boldsymbol{y}, $$ -

      or we can state it as

      +

      with \( \boldsymbol{I} \) being a \( p\times p \) identity matrix with the constraint that

      + $$ -{\displaystyle \min_{\boldsymbol{\beta}\in -{\mathbb{R}}^{p}}}\frac{1}{n}\sum_{i=0}^{n-1}\left(y_i-\tilde{y}_i\right)^2=\frac{1}{n}\vert\vert \boldsymbol{y}-\boldsymbol{X}\boldsymbol{\beta}\vert\vert_2^2, +\sum_{i=0}^{p-1} \beta_i^2 \leq t, $$ -

      where we have used the definition of a norm-2 vector, that is

      +

      with \( t \) a finite positive number.

      + +

      If we keep the \( 1/n \) factor, the equation for the optimal \( \beta \) changes to

      $$ -\vert\vert \boldsymbol{x}\vert\vert_2 = \sqrt{\sum_i x_i^2}. +\hat{\boldsymbol{\beta}}_{\mathrm{Ridge}} = \left(\boldsymbol{X}^T\boldsymbol{X}+n\lambda\boldsymbol{I}\right)^{-1}\boldsymbol{X}^T\boldsymbol{y}. $$ -

      By minimizing the above equation with respect to the parameters -\( \boldsymbol{\beta} \) we could then obtain an analytical expression for the -parameters \( \boldsymbol{\beta} \). We can add a regularization parameter \( \lambda \) by -defining a new cost function to be optimized, that is +

      In many textbooks the \( 1/n \) term is often omitted. Note that a library like Scikit-Learn does not include the \( 1/n \) factor in the setup of the cost function.

      + +

      When we compare this with the ordinary least squares result we have

      +$$ +\hat{\boldsymbol{\beta}}_{\mathrm{OLS}} = \left(\boldsymbol{X}^T\boldsymbol{X}\right)^{-1}\boldsymbol{X}^T\boldsymbol{y}, +$$ + +

      which can lead to singular matrices. However, with the SVD, we can always compute the inverse of the matrix \( \boldsymbol{X}^T\boldsymbol{X} \).

      + +

      We see that Ridge regression is nothing but the standard OLS with a +modified diagonal term added to \( \boldsymbol{X}^T\boldsymbol{X} \). The consequences, in +particular for our discussion of the bias-variance tradeoff are rather +interesting. We will see that for specific values of \( \lambda \), we may +even reduce the variance of the optimal parameters \( \boldsymbol{\beta} \). These topics and other related ones, will be discussed after the more linear algebra oriented analysis here.

      -$$ -{\displaystyle \min_{\boldsymbol{\beta}\in -{\mathbb{R}}^{p}}}\frac{1}{n}\vert\vert \boldsymbol{y}-\boldsymbol{X}\boldsymbol{\beta}\vert\vert_2^2+\lambda\vert\vert \boldsymbol{\beta}\vert\vert_2^2 -$$ - -

      which leads to the Ridge regression minimization problem where we -require that \( \vert\vert \boldsymbol{\beta}\vert\vert_2^2\le t \), where \( t \) is -a finite number larger than zero. By defining +

      Using our insights about the SVD of the design matrix \( \boldsymbol{X} \) +We have already analyzed the OLS solutions in terms of the eigenvectors (the columns) of the right singular value matrix \( \boldsymbol{U} \) as

      - $$ -C(\boldsymbol{X},\boldsymbol{\beta})=\frac{1}{n}\vert\vert \boldsymbol{y}-\boldsymbol{X}\boldsymbol{\beta}\vert\vert_2^2+\lambda\vert\vert \boldsymbol{\beta}\vert\vert_1, +\tilde{\boldsymbol{y}}_{\mathrm{OLS}}=\boldsymbol{X}\boldsymbol{\beta} =\boldsymbol{U}\boldsymbol{U}^T\boldsymbol{y}. $$ -

      we have a new optimization equation

      +

      For Ridge regression this becomes

      + $$ -{\displaystyle \min_{\boldsymbol{\beta}\in -{\mathbb{R}}^{p}}}\frac{1}{n}\vert\vert \boldsymbol{y}-\boldsymbol{X}\boldsymbol{\beta}\vert\vert_2^2+\lambda\vert\vert \boldsymbol{\beta}\vert\vert_1 -$$ - -

      which leads to Lasso regression. Lasso stands for least absolute shrinkage and selection operator.

      - -

      Here we have defined the norm-1 as

      -$$ -\vert\vert \boldsymbol{x}\vert\vert_1 = \sum_i \vert x_i\vert. +\tilde{\boldsymbol{y}}_{\mathrm{Ridge}}=\boldsymbol{X}\boldsymbol{\beta}_{\mathrm{Ridge}} = \boldsymbol{U\Sigma V^T}\left(\boldsymbol{V}\boldsymbol{\Sigma}^2\boldsymbol{V}^T+\lambda\boldsymbol{I} \right)^{-1}(\boldsymbol{U\Sigma V^T})^T\boldsymbol{y}=\sum_{j=0}^{p-1}\boldsymbol{u}_j\boldsymbol{u}_j^T\frac{\sigma_j^2}{\sigma_j^2+\lambda}\boldsymbol{y}, $$ +

      with the vectors \( \boldsymbol{u}_j \) being the columns of \( \boldsymbol{U} \) from the SVD of the matrix \( \boldsymbol{X} \).

      @@ -459,7 +465,6 @@ $$

    549. 67
    550. 68
    551. 69
    552. -
    553. 70
    554. »
    555. diff --git a/doc/pub/week35/html/._week35-bs065.html b/doc/pub/week35/html/._week35-bs065.html index 7beeed95e..372e31f82 100644 --- a/doc/pub/week35/html/._week35-bs065.html +++ b/doc/pub/week35/html/._week35-bs065.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -386,67 +384,22 @@ MathJax.Hub.Config({

       

       

       

      -

      Deriving the Ridge Regression Equations

      +

      Interpreting the Ridge results

      -

      Using the matrix-vector expression for Ridge regression and dropping the parameter \( 1/n \) in front of the standard means squared error equation, we have

      +

      Since \( \lambda \geq 0 \), it means that compared to OLS, we have

      $$ -C(\boldsymbol{X},\boldsymbol{\beta})=\left\{(\boldsymbol{y}-\boldsymbol{X}\boldsymbol{\beta})^T(\boldsymbol{y}-\boldsymbol{X}\boldsymbol{\beta})\right\}+\lambda\boldsymbol{\beta}^T\boldsymbol{\beta}, +\frac{\sigma_j^2}{\sigma_j^2+\lambda} \leq 1. $$ -

      and -taking the derivatives with respect to \( \boldsymbol{\beta} \) we obtain then -a slightly modified matrix inversion problem which for finite values -of \( \lambda \) does not suffer from singularity problems. We obtain -the optimal parameters -

      -$$ -\hat{\boldsymbol{\beta}}_{\mathrm{Ridge}} = \left(\boldsymbol{X}^T\boldsymbol{X}+\lambda\boldsymbol{I}\right)^{-1}\boldsymbol{X}^T\boldsymbol{y}, -$$ - -

      with \( \boldsymbol{I} \) being a \( p\times p \) identity matrix with the constraint that

      - -$$ -\sum_{i=0}^{p-1} \beta_i^2 \leq t, -$$ - -

      with \( t \) a finite positive number.

      - -

      If we keep the \( 1/n \) factor, the equation for the optimal \( \beta \) changes to

      -$$ -\hat{\boldsymbol{\beta}}_{\mathrm{Ridge}} = \left(\boldsymbol{X}^T\boldsymbol{X}+n\lambda\boldsymbol{I}\right)^{-1}\boldsymbol{X}^T\boldsymbol{y}. -$$ - -

      In many textbooks the \( 1/n \) term is often omitted. Note that a library like Scikit-Learn does not include the \( 1/n \) factor in the setup of the cost function.

      - -

      When we compare this with the ordinary least squares result we have

      -$$ -\hat{\boldsymbol{\beta}}_{\mathrm{OLS}} = \left(\boldsymbol{X}^T\boldsymbol{X}\right)^{-1}\boldsymbol{X}^T\boldsymbol{y}, -$$ - -

      which can lead to singular matrices. However, with the SVD, we can always compute the inverse of the matrix \( \boldsymbol{X}^T\boldsymbol{X} \).

      - -

      We see that Ridge regression is nothing but the standard OLS with a -modified diagonal term added to \( \boldsymbol{X}^T\boldsymbol{X} \). The consequences, in -particular for our discussion of the bias-variance tradeoff are rather -interesting. We will see that for specific values of \( \lambda \), we may -even reduce the variance of the optimal parameters \( \boldsymbol{\beta} \). These topics and other related ones, will be discussed after the more linear algebra oriented analysis here. +

      Ridge regression finds the coordinates of \( \boldsymbol{y} \) with respect to the +orthonormal basis \( \boldsymbol{U} \), it then shrinks the coordinates by +\( \frac{\sigma_j^2}{\sigma_j^2+\lambda} \). Recall that the SVD has +eigenvalues ordered in a descending way, that is \( \sigma_i \geq +\sigma_{i+1} \).

      -

      Using our insights about the SVD of the design matrix \( \boldsymbol{X} \) -We have already analyzed the OLS solutions in terms of the eigenvectors (the columns) of the right singular value matrix \( \boldsymbol{U} \) as -

      -$$ -\tilde{\boldsymbol{y}}_{\mathrm{OLS}}=\boldsymbol{X}\boldsymbol{\beta} =\boldsymbol{U}\boldsymbol{U}^T\boldsymbol{y}. -$$ - -

      For Ridge regression this becomes

      - -$$ -\tilde{\boldsymbol{y}}_{\mathrm{Ridge}}=\boldsymbol{X}\boldsymbol{\beta}_{\mathrm{Ridge}} = \boldsymbol{U\Sigma V^T}\left(\boldsymbol{V}\boldsymbol{\Sigma}^2\boldsymbol{V}^T+\lambda\boldsymbol{I} \right)^{-1}(\boldsymbol{U\Sigma V^T})^T\boldsymbol{y}=\sum_{j=0}^{p-1}\boldsymbol{u}_j\boldsymbol{u}_j^T\frac{\sigma_j^2}{\sigma_j^2+\lambda}\boldsymbol{y}, -$$ - -

      with the vectors \( \boldsymbol{u}_j \) being the columns of \( \boldsymbol{U} \) from the SVD of the matrix \( \boldsymbol{X} \).

      +

      For small eigenvalues \( \sigma_i \) it means that their contributions become less important, a fact which can be used to reduce the number of degrees of freedom. More about this when we have covered the material on a statistical interpretation of various linear regression methods.

      @@ -466,7 +419,6 @@ $$

    556. 67
    557. 68
    558. 69
    559. -
    560. 70
    561. »
    562. diff --git a/doc/pub/week35/html/._week35-bs066.html b/doc/pub/week35/html/._week35-bs066.html index 7763701c6..c084647bb 100644 --- a/doc/pub/week35/html/._week35-bs066.html +++ b/doc/pub/week35/html/._week35-bs066.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -386,22 +384,35 @@ MathJax.Hub.Config({

       

       

       

      -

      Interpreting the Ridge results

      +

      More interpretations

      -

      Since \( \lambda \geq 0 \), it means that compared to OLS, we have

      +

      For the sake of simplicity, let us assume that the design matrix is orthonormal, that is

      $$ -\frac{\sigma_j^2}{\sigma_j^2+\lambda} \leq 1. +\boldsymbol{X}^T\boldsymbol{X}=(\boldsymbol{X}^T\boldsymbol{X})^{-1} =\boldsymbol{I}. $$ -

      Ridge regression finds the coordinates of \( \boldsymbol{y} \) with respect to the -orthonormal basis \( \boldsymbol{U} \), it then shrinks the coordinates by -\( \frac{\sigma_j^2}{\sigma_j^2+\lambda} \). Recall that the SVD has -eigenvalues ordered in a descending way, that is \( \sigma_i \geq -\sigma_{i+1} \). +

      In this case the standard OLS results in

      +$$ +\boldsymbol{\beta}^{\mathrm{OLS}} = \boldsymbol{X}^T\boldsymbol{y}=\sum_{i=0}^{n-1}\boldsymbol{u}_i\boldsymbol{u}_i^T\boldsymbol{y}, +$$ + +

      and

      + +$$ +\boldsymbol{\beta}^{\mathrm{Ridge}} = \left(\boldsymbol{I}+\lambda\boldsymbol{I}\right)^{-1}\boldsymbol{X}^T\boldsymbol{y}=\left(1+\lambda\right)^{-1}\boldsymbol{\beta}^{\mathrm{OLS}}, +$$ + +

      that is the Ridge estimator scales the OLS estimator by the inverse of a factor \( 1+\lambda \), and +the Ridge estimator converges to zero when the hyperparameter goes to +infinity.

      -

      For small eigenvalues \( \sigma_i \) it means that their contributions become less important, a fact which can be used to reduce the number of degrees of freedom. More about this when we have covered the material on a statistical interpretation of various linear regression methods.

      +

      We will come back to more interpreations after we have gone through some of the statistical analysis part.

      + +

      For more discussions of Ridge and Lasso regression, Wessel van Wieringen's article is highly recommended. +Similarly, Mehta et al's article is also recommended. +

      @@ -420,7 +431,6 @@ eigenvalues ordered in a descending way, that is \( \sigma_i \geq

    563. 67
    564. 68
    565. 69
    566. -
    567. 70
    568. »
    569. diff --git a/doc/pub/week35/html/._week35-bs067.html b/doc/pub/week35/html/._week35-bs067.html index fb76cd7a2..37654e43c 100644 --- a/doc/pub/week35/html/._week35-bs067.html +++ b/doc/pub/week35/html/._week35-bs067.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -386,35 +384,31 @@ MathJax.Hub.Config({

       

       

       

      -

      More interpretations

      +

      Deriving the Lasso Regression Equations

      -

      For the sake of simplicity, let us assume that the design matrix is orthonormal, that is

      +

      Using the matrix-vector expression for Lasso regression and dropping the parameter \( 1/n \) in front of the standard means squared error equation, we have the following cost function

      $$ -\boldsymbol{X}^T\boldsymbol{X}=(\boldsymbol{X}^T\boldsymbol{X})^{-1} =\boldsymbol{I}. +C(\boldsymbol{X},\boldsymbol{\beta})=\left\{(\boldsymbol{y}-\boldsymbol{X}\boldsymbol{\beta})^T(\boldsymbol{y}-\boldsymbol{X}\boldsymbol{\beta})\right\}+\lambda\vert\vert\boldsymbol{\beta}\vert\vert_1, $$ -

      In this case the standard OLS results in

      +

      Taking the derivative with respect to \( \boldsymbol{\beta} \) and recalling that the derivative of the absolute value is (we drop the boldfaced vector symbol for simplicty)

      $$ -\boldsymbol{\beta}^{\mathrm{OLS}} = \boldsymbol{X}^T\boldsymbol{y}=\sum_{i=0}^{n-1}\boldsymbol{u}_i\boldsymbol{u}_i^T\boldsymbol{y}, +\frac{d \vert \beta\vert}{d \boldsymbol{\beta}}=\mathrm{sgn}(\boldsymbol{\beta})=\left\{\begin{array}{cc} 1 & \beta > 0 \\-1 & \beta < 0, \end{array}\right. $$ -

      and

      +

      we have that the derivative of the cost function is

      $$ -\boldsymbol{\beta}^{\mathrm{Ridge}} = \left(\boldsymbol{I}+\lambda\boldsymbol{I}\right)^{-1}\boldsymbol{X}^T\boldsymbol{y}=\left(1+\lambda\right)^{-1}\boldsymbol{\beta}^{\mathrm{OLS}}, +\frac{\partial C(\boldsymbol{X},\boldsymbol{\beta})}{\partial \boldsymbol{\beta}}=-2\boldsymbol{X}^T(\boldsymbol{y}-\boldsymbol{X}\boldsymbol{\beta})+\lambda sgn(\boldsymbol{\beta})=0, $$ -

      that is the Ridge estimator scales the OLS estimator by the inverse of a factor \( 1+\lambda \), and -the Ridge estimator converges to zero when the hyperparameter goes to -infinity. -

      +

      and reordering we have

      +$$ +\boldsymbol{X}^T\boldsymbol{X}\boldsymbol{\beta}+\lambda sgn(\boldsymbol{\beta})=2\boldsymbol{X}^T\boldsymbol{y}. +$$ -

      We will come back to more interpreations after we have gone through some of the statistical analysis part.

      - -

      For more discussions of Ridge and Lasso regression, Wessel van Wieringen's article is highly recommended. -Similarly, Mehta et al's article is also recommended. -

      +

      This equation does not lead to a nice analytical equation as in either Ridge regression or ordinary least squares. This equation can however be solved by using standard convex optimization algorithms using for example the Python package CVXOPT. We will discuss this later.

      @@ -432,7 +426,6 @@ Similarly, Mehta et al

    570. 67
    571. 68
    572. 69
    573. -
    574. 70
    575. »
    576. diff --git a/doc/pub/week35/html/._week35-bs068.html b/doc/pub/week35/html/._week35-bs068.html index 68233bab0..ab06f4a48 100644 --- a/doc/pub/week35/html/._week35-bs068.html +++ b/doc/pub/week35/html/._week35-bs068.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -386,32 +384,610 @@ MathJax.Hub.Config({

       

       

       

      -

      Deriving the Lasso Regression Equations

      +

      Exercises for week 35

      -

      Using the matrix-vector expression for Lasso regression and dropping the parameter \( 1/n \) in front of the standard means squared error equation, we have the following cost function

      +

      The exercises here are meant to prepare you for work with project 1. The first exercise is a follow-up of exercise 2 from week 35 August 30-September 3).

      -$$ -C(\boldsymbol{X},\boldsymbol{\beta})=\left\{(\boldsymbol{y}-\boldsymbol{X}\boldsymbol{\beta})^T(\boldsymbol{y}-\boldsymbol{X}\boldsymbol{\beta})\right\}+\lambda\vert\vert\boldsymbol{\beta}\vert\vert_1, + +

      Exercise 1: Setting up various Python environments

      + +

      The first exercise here is of a mere technical art. We want you to have

      +
        +
      • git as a version control software and to establish a user account on a provider like GitHub. Other providers like GitLab etc are equally fine. You can also use the University of Oslo GitHub facilities.
      • +
      • Install various Python packages
      • +
      +

      We will make extensive use of Python as programming language and its +myriad of available libraries. You will find +IPython/Jupyter notebooks invaluable in your work. You can run R +codes in the Jupyter/IPython notebooks, with the immediate benefit of +visualizing your data. You can also use compiled languages like C++, +Rust, Fortran etc if you prefer. The focus in these lectures will be +on Python. +

      + +

      If you have Python installed (we recommend Python3) and you feel +pretty familiar with installing different packages, we recommend that +you install the following Python packages via pip as +

      + +
        +
      1. pip install numpy scipy matplotlib ipython scikit-learn sympy pandas pillow
      2. +
      +

      For Tensorflow, we recommend following the instructions in the text of +Aurelien Geron, Hands‑On Machine Learning with Scikit‑Learn and TensorFlow, O'Reilly +

      + +

      We will come back to tensorflow later.

      + +

      For Python3, replace pip with pip3.

      + +

      For OSX users we recommend, after having installed Xcode, to +install brew. Brew allows for a seamless installation of additional +software via for example +

      + +
        +
      1. brew install python3
      2. +
      +

      For Linux users, with its variety of distributions like for example the widely popular Ubuntu distribution, +you can use pip as well and simply install Python as +

      + +
        +
      1. sudo apt-get install python3 (or python for Python2.7)
      2. +
      +

      If you don't want to perform these operations separately and venture +into the hassle of exploring how to set up dependencies and paths, we +recommend two widely used distrubutions which set up all relevant +dependencies for Python, namely +

      + + +

      which is an open source +distribution of the Python and R programming languages for large-scale +data processing, predictive analytics, and scientific computing, that +aims to simplify package management and deployment. Package versions +are managed by the package management system conda. +

      + + +

      is a Python +distribution for scientific and analytic computing distribution and +analysis environment, available for free and under a commercial +license. +

      + +

      We recommend using Anaconda if you are not too familiar with setting paths in a terminal environment.

      + + + + +

      Exercise 2: making your own data and exploring scikit-learn

      + +

      We will generate our own dataset for a function \( y(x) \) where \( x \in [0,1] \) and defined by random numbers computed with the uniform distribution. The function \( y \) is a quadratic polynomial in \( x \) with added stochastic noise according to the normal distribution \( \cal {N}(0,1) \). +The following simple Python instructions define our \( x \) and \( y \) values (with 100 data points). +

      + + +
      +
      +
      +
      +
      +
      x = np.random.rand(100,1)
      +y = 2.0+5*x*x+0.1*np.random.randn(100,1)
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      + + +
        +
      1. Write your own code (following the examples under the regression notes) for computing the parametrization of the data set fitting a second-order polynomial.
      2. +
      3. Use thereafter scikit-learn (see again the examples in the regression slides) and compare with your own code. When compairing with _scikit_learn_, make sure you set the option for the intercept to FALSE, see https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LinearRegression.html. This feature will be explained in more detail during the lectures of week 35 and week 36. You can find more in https://compphysics.github.io/MachineLearning/doc/LectureNotes/_build/html/chapter3.html#more-on-rescaling-data.
      4. +
      5. Using scikit-learn, compute also the mean square error, a risk metric corresponding to the expected value of the squared (quadratic) error defined as
      6. +
      +$$ MSE(\boldsymbol{y},\boldsymbol{\tilde{y}}) = \frac{1}{n} +\sum_{i=0}^{n-1}(y_i-\tilde{y}_i)^2, $$ -

      Taking the derivative with respect to \( \boldsymbol{\beta} \) and recalling that the derivative of the absolute value is (we drop the boldfaced vector symbol for simplicty)

      +

      and the \( R^2 \) score function. +If \( \tilde{\boldsymbol{y}}_i \) is the predicted value of the \( i-th \) sample and \( y_i \) is the corresponding true value, then the score \( R^2 \) is defined as +

      $$ -\frac{d \vert \beta\vert}{d \boldsymbol{\beta}}=\mathrm{sgn}(\boldsymbol{\beta})=\left\{\begin{array}{cc} 1 & \beta > 0 \\-1 & \beta < 0, \end{array}\right. +R^2(\boldsymbol{y}, \tilde{\boldsymbol{y}}) = 1 - \frac{\sum_{i=0}^{n - 1} (y_i - \tilde{y}_i)^2}{\sum_{i=0}^{n - 1} (y_i - \bar{y})^2}, $$ -

      we have that the derivative of the cost function is

      - +

      where we have defined the mean value of \( \boldsymbol{y} \) as

      $$ -\frac{\partial C(\boldsymbol{X},\boldsymbol{\beta})}{\partial \boldsymbol{\beta}}=-2\boldsymbol{X}^T(\boldsymbol{y}-\boldsymbol{X}\boldsymbol{\beta})+\lambda sgn(\boldsymbol{\beta})=0, +\bar{y} = \frac{1}{n} \sum_{i=0}^{n - 1} y_i. $$ -

      and reordering we have

      -$$ -\boldsymbol{X}^T\boldsymbol{X}\boldsymbol{\beta}+\lambda sgn(\boldsymbol{\beta})=2\boldsymbol{X}^T\boldsymbol{y}. +

      You can use the functionality included in scikit-learn. If you feel for it, you can use your own program and define functions which compute the above two functions. +Discuss the meaning of these results. Try also to vary the coefficient in front of the added stochastic noise term and discuss the quality of the fits. +

      + + + +

      +

      +

      + +

      +Solution. +

      +
      +
      +

      + +

      The code here is an example of where we define our own design matrix and fit parameters \( \beta \).

      + + +
      +
      +
      +
      +
      +
      import os
      +import numpy as np
      +import pandas as pd
      +import matplotlib.pyplot as plt
      +from sklearn.model_selection import train_test_split
      +
      +def save_fig(fig_id):
      +    plt.savefig(image_path(fig_id) + ".png", format='png')
      +
      +def R2(y_data, y_model):
      +    return 1 - np.sum((y_data - y_model) ** 2) / np.sum((y_data - np.mean(y_data)) ** 2)
      +def MSE(y_data,y_model):
      +    n = np.size(y_model)
      +    return np.sum((y_data-y_model)**2)/n
      +
      +x = np.random.rand(100)
      +y = 2.0+5*x*x+0.1*np.random.randn(100)
      +
      +
      +#  The design matrix now as function of a given polynomial
      +X = np.zeros((len(x),3))
      +X[:,0] = 1.0
      +X[:,1] = x
      +X[:,2] = x**2
      +# We split the data in test and training data
      +X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)
      +# matrix inversion to find beta
      +beta = np.linalg.inv(X_train.T @ X_train) @ X_train.T @ y_train
      +print(beta)
      +# and then make the prediction
      +ytilde = X_train @ beta
      +print("Training R2")
      +print(R2(y_train,ytilde))
      +print("Training MSE")
      +print(MSE(y_train,ytilde))
      +ypredict = X_test @ beta
      +print("Test R2")
      +print(R2(y_test,ypredict))
      +print("Test MSE")
      +print(MSE(y_test,ypredict))
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      + + +

      +
      +

      + + + + + + +

      Exercise 3: Normalizing our data

      + +

      A much used approach before starting to train the data is to preprocess our +data. Normally the data may need a rescaling and/or may be sensitive +to extreme values. Scaling the data renders our inputs much more +suitable for the algorithms we want to employ. +

      + +

      Scikit-Learn has several functions which allow us to rescale the +data, normally resulting in much better results in terms of various +accuracy scores. The StandardScaler function in Scikit-Learn +ensures that for each feature/predictor we study the mean value is +zero and the variance is one (every column in the design/feature +matrix). This scaling has the drawback that it does not ensure that +we have a particular maximum or minimum in our data set. Another +function included in Scikit-Learn is the MinMaxScaler which +ensures that all features are exactly between \( 0 \) and \( 1 \). The +

      + +

      The Normalizer scales each data +point such that the feature vector has a euclidean length of one. In other words, it +projects a data point on the circle (or sphere in the case of higher dimensions) with a +radius of 1. This means every data point is scaled by a different number (by the +inverse of it’s length). +This normalization is often used when only the direction (or angle) of the data matters, +not the length of the feature vector. +

      + +

      The RobustScaler works similarly to the StandardScaler in that it +ensures statistical properties for each feature that guarantee that +they are on the same scale. However, the RobustScaler uses the median +and quartiles, instead of mean and variance. This makes the +RobustScaler ignore data points that are very different from the rest +(like measurement errors). These odd data points are also called +outliers, and might often lead to trouble for other scaling +techniques. +

      + +

      It also common to split the data in a training set and a testing set. A typical split is to use \( 80\% \) of the data for training and the rest +for testing. This can be done as follows with our design matrix \( \boldsymbol{X} \) and data \( \boldsymbol{y} \) (remember to import scikit-learn) +

      + + +
      +
      +
      +
      +
      +
      # split in training and test data
      +X_train, X_test, y_train, y_test = train_test_split(X,y,test_size=0.2)
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      + +

      Then we can use the standard scaler to scale our data as

      + + +
      +
      +
      +
      +
      +
      scaler = StandardScaler()
      +scaler.fit(X_train)
      +X_train_scaled = scaler.transform(X_train)
      +X_test_scaled = scaler.transform(X_test)
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      + +

      In this exercise we want you to to compute the MSE for the training +data and the test data as function of the complexity of a polynomial, +that is the degree of a given polynomial. We want you also to compute the \( R2 \) score as function of the complexity of the model for both training data and test data. You should also run the calculation with and without scaling. +

      + +

      One of +the aims is to reproduce Figure 2.11 of Hastie et al. +

      + +

      Our data is defined by \( x\in [-3,3] \) with a total of for example \( 100 \) data points.

      + + +
      +
      +
      +
      +
      +
      np.random.seed()
      +n = 100
      +maxdegree = 14
      +# Make data set.
      +x = np.linspace(-3, 3, n).reshape(-1, 1)
      +y = np.exp(-x**2) + 1.5 * np.exp(-(x-2)**2)+ np.random.normal(0, 0.1, x.shape)
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      + +

      where \( y \) is the function we want to fit with a given polynomial.

      + + +

      +a) +Write a first code which sets up a design matrix \( X \) defined by a fifth-order polynomial. Scale your data and split it in training and test data. +

      + + + + +

      +b) +Perform an ordinary least squares and compute the means squared error and the \( R2 \) factor for the training data and the test data, with and without scaling. +

      + + + + +

      +c) +Add now a model which allows you to make polynomials up to degree \( 15 \). Perform a standard OLS fitting of the training data and compute the MSE and \( R2 \) for the training and test data and plot both test and training data MSE and \( R2 \) as functions of the polynomial degree. Compare what you see with Figure 2.11 of Hastie et al. Comment your results. For which polynomial degree do you find an optimal MSE (smallest value)? +

      + + + + + + +

      Exercise 4: Adding Ridge Regression

      + +

      This exercise is a continuation of exercise 2. We will use the same function to +generate our data set, still staying with a simple function \( y(x) \) +which we want to fit using linear regression, but now extending the +analysis to include the Ridge regression method. +

      + +

      We will thus again generate our own dataset for a function \( y(x) \) where +\( x \in [0,1] \) and defined by random numbers computed with the uniform +distribution. The function \( y \) is a quadratic polynomial in \( x \) with +added stochastic noise according to the normal distribution \( \cal{N}(0,1) \). +

      + +

      The following simple Python instructions define our \( x \) and \( y \) values (with 100 data points).

      + + +
      +
      +
      +
      +
      +
      x = np.random.rand(100)
      +y = 2.0+5*x*x+0.1*np.random.randn(100)
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      + +

      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 3. Study the dependence on \( \lambda \) while also varying the strength of the noise in your expression for \( y(x) \).

      + +

      The code here allows you to perform your own Ridge calculation and +perform calculations for various values of the regularization +parameter \( \lambda \). This program can easily be extended upon. +

      + + + +
      +
      +
      +
      +
      +
      import os
      +import numpy as np
      +import pandas as pd
      +import matplotlib.pyplot as plt
      +from sklearn.model_selection import train_test_split
      +from sklearn.preprocessing import StandardScaler
      +
      +def R2(y_data, y_model):
      +    return 1 - np.sum((y_data - y_model) ** 2) / np.sum((y_data - np.mean(y_data)) ** 2)
      +def MSE(y_data,y_model):
      +    n = np.size(y_model)
      +    return np.sum((y_data-y_model)**2)/n
      +
      +
      +# A seed just to ensure that the random numbers are the same for every run.
      +# Useful for eventual debugging.
      +np.random.seed(3155)
      +
      +x = np.random.rand(100)
      +y = 2.0+5*x*x+0.1*np.random.randn(100)
      +
      +# number of features p (here degree of polynomial
      +p = 3
      +#  The design matrix now as function of a given polynomial
      +X = np.zeros((len(x),p))
      +X[:,0] = 1.0
      +X[:,1] = x
      +X[:,2] = x*x
      +# We split the data in test and training data
      +X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)
      +
      +# matrix inversion to find beta
      +OLSbeta = np.linalg.inv(X_train.T @ X_train) @ X_train.T @ y_train
      +print(OLSbeta)
      +# and then make the prediction
      +ytildeOLS = X_train @ OLSbeta
      +print("Training R2 for OLS")
      +print(R2(y_train,ytildeOLS))
      +print("Training MSE for OLS")
      +print(MSE(y_train,ytildeOLS))
      +ypredictOLS = X_test @ OLSbeta
      +print("Test R2 for OLS")
      +print(R2(y_test,ypredictOLS))
      +print("Test MSE OLS")
      +print(MSE(y_test,ypredictOLS))
      +
      +# Repeat now for Ridge regression and various values of the regularization parameter
      +I = np.eye(p,p)
      +# Decide which values of lambda to use
      +nlambdas = 20
      +MSEPredict = np.zeros(nlambdas)
      +MSETrain = np.zeros(nlambdas)
      +lambdas = np.logspace(-4, 1, nlambdas)
      +for i in range(nlambdas):
      +    lmb = lambdas[i]
      +    Ridgebeta = np.linalg.inv(X_train.T @ X_train+lmb*I) @ X_train.T @ y_train
      +    # and then make the prediction
      +    ytildeRidge = X_train @ Ridgebeta
      +    ypredictRidge = X_test @ Ridgebeta
      +    MSEPredict[i] = MSE(y_test,ypredictRidge)
      +    MSETrain[i] = MSE(y_train,ytildeRidge)
      +# Now plot the results
      +plt.figure()
      +plt.plot(np.log10(lambdas), MSETrain, label = 'MSE Ridge train')
      +plt.plot(np.log10(lambdas), MSEPredict, 'r--', label = 'MSE Ridge Test')
      +plt.xlabel('log10(lambda)')
      +plt.ylabel('MSE')
      +plt.legend()
      +plt.show()
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      + +

      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 \). Observe also that when you compare with Scikit-Learn, you need to pay attention to how the intercept is dealt with. +

      + +

      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

      +$$ MSE(\hat{y},\hat{\tilde{y}}) = \frac{1}{n} +\sum_{i=0}^{n-1}(y_i-\tilde{y}_i)^2, $$ -

      This equation does not lead to a nice analytical equation as in either Ridge regression or ordinary least squares. This equation can however be solved by using standard convex optimization algorithms using for example the Python package CVXOPT. We will discuss this later.

      +

      and the \( R^2 \) score function. +If \( \tilde{\hat{y}}_i \) is the predicted value of the \( i-th \) sample and \( y_i \) is the corresponding true value, then the score \( R^2 \) is defined as +

      +$$ +R^2(\hat{y}, \tilde{\hat{y}}) = 1 - \frac{\sum_{i=0}^{n - 1} (y_i - \tilde{y}_i)^2}{\sum_{i=0}^{n - 1} (y_i - \bar{y})^2}, +$$ +

      where we have defined the mean value of \( \hat{y} \) as

      +$$ +\bar{y} = \frac{1}{n} \sum_{i=0}^{n - 1} y_i. +$$ + +

      Discuss these quantities as functions of the variable \( \lambda \) in Ridge regression.

      + + + + +

      Exercise 5: Analytical exercises

      + +

      In this exercise we derive the expressions for various derivatives of +products of vectors and matrices. Such derivatives are central to the +optimization of various cost functions. Although we will often use +automatic differentiation in actual calculations, to be able to have +analytical expressions is extremely helpful in case we have simpler +derivatives as well as when we analyze various properties (like second +derivatives) of the chosen cost functions. Vectors are always written +as boldfaced lower case letters and matrices as upper case boldfaced +letters. +

      + +

      Show that

      +$$ +\frac{\partial (\boldsymbol{b}^T\boldsymbol{a})}{\partial \boldsymbol{a}} = \boldsymbol{b}, +$$ + +

      and

      +$$ +\frac{\partial (\boldsymbol{a}^T\boldsymbol{A}\boldsymbol{a})}{\partial \boldsymbol{a}} = \boldsymbol{a}^T(\boldsymbol{A}+\boldsymbol{A}^T), +$$ + +

      and

      +$$ +\frac{\partial \left(\boldsymbol{x}-\boldsymbol{A}\boldsymbol{s}\right)^T\left(\boldsymbol{x}-\boldsymbol{A}\boldsymbol{s}\right)}{\partial \boldsymbol{s}} = -2\left(\boldsymbol{x}-\boldsymbol{A}\boldsymbol{s}\right)^T\boldsymbol{A}, +$$ + +

      and finally find the second derivative of this function with respect to the vector \( \boldsymbol{s} \).

      + +

      Hint: In these exercises it is always useful to write out with summation indices the various quantities. +As an example, consider the function +

      + +$$ +f(\boldsymbol{x}) =\boldsymbol{A}\boldsymbol{x}, +$$ + +

      which reads for a specific component \( f_i \) (we define the matrix \( \boldsymbol{A} \) to have dimension \( n\times n \) and the vector $\boldsymbol{x} to have length \( n \))

      + +$$ +f_i =\sum_{j=0}^{n-1}a_{ij}x_j, +$$ + +

      which leads to

      +$$ +\frac{\partial f_i}{\partial x_j}= a_{ij}, +$$ + +

      and written out in terms of the vector \( \boldsymbol{x} \) we have

      +$$ +\frac{\partial f(\boldsymbol{x})}{\partial \boldsymbol{x}}= \boldsymbol{A}. +$$ + + +

      diff --git a/doc/pub/week35/html/week35-bs.html b/doc/pub/week35/html/week35-bs.html index 7a3b61340..f1a81b669 100644 --- a/doc/pub/week35/html/week35-bs.html +++ b/doc/pub/week35/html/week35-bs.html @@ -38,7 +38,7 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -175,7 +175,6 @@ doconce format html week35.do.txt --html_style=bootstrap --pygments_html_style=d 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -302,7 +301,7 @@ MathJax.Hub.Config({ @@ -404,7 +402,7 @@ MathJax.Hub.Config({
      -

      Sep 8, 2022

      +

      May 29, 2023


      @@ -429,7 +427,7 @@ MathJax.Hub.Config({
    577. 9
    578. 10
    579. ...
    580. -
    581. 70
    582. +
    583. 69
    584. »
    585. @@ -443,7 +441,7 @@ MathJax.Hub.Config({ -->
      - © 1999-2022, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license + © 1999-2023, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license
      diff --git a/doc/pub/week35/html/week35-reveal.html b/doc/pub/week35/html/week35-reveal.html index 1cc8d935f..d42af93e6 100644 --- a/doc/pub/week35/html/week35-reveal.html +++ b/doc/pub/week35/html/week35-reveal.html @@ -184,13 +184,13 @@ MathJax.Hub.Config({
      -

      Sep 8, 2022

      +

      May 29, 2023


      - © 1999-2022, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license + © 1999-2023, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license
      @@ -198,19 +198,8 @@ MathJax.Hub.Config({

      Plans for week 35

        -

      • Lab Wednesday: Work on exercises 1-5 for week 35, see end of these slides for the exercises.
      • -

      • Thursday: Review of ordinary Least Squares with applications, reminder on statistics and start discussion of Ridge Regression and Singular Value Decomposition
      • - -

        -

      • Friday: Discussion of Ridge and Lasso Regression and links with Singular Value Decomposition
      • - -

        +

      • Review of ordinary Least Squares with applications. Discussion of Ridge and Lasso Regression and links with Singular Value Decomposition
      • +

      • Exercises and hands-on demonstrations

      Reading recommendations:

      @@ -224,15 +213,15 @@ MathJax.Hub.Config({
      -

      Thursday September 1

      +

      Topics of week 35

      -

      The main topics on Thursday are:

      +

      The main topics are:

      1. Repetition from last week on linear regression
      2. Reminder on statistics with quantities like mean values, variance abd covariance
      3. Discussion of how to prepare data and examples of applications of linear regression
      4. Mathematical interpretations of Linear Regression
      5. -

      6. Start discussing Ridge and Lasso regression and Singular Value Decomposition, to be continued Friday
      7. +

      8. Start discussing Ridge and Lasso regression and Singular Value Decomposition
      @@ -2403,10 +2392,6 @@ example

      -
      -

      Friday September 2

      -
      -

      Mathematics of the SVD and implications

      diff --git a/doc/pub/week35/html/week35-solarized.html b/doc/pub/week35/html/week35-solarized.html index d7b0659e3..a31c0dff4 100644 --- a/doc/pub/week35/html/week35-solarized.html +++ b/doc/pub/week35/html/week35-solarized.html @@ -65,7 +65,7 @@ div.toc p,a { {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -202,7 +202,6 @@ div.toc p,a { 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -330,7 +329,7 @@ MathJax.Hub.Config({
      -

      Sep 8, 2022

      +

      May 29, 2023


      @@ -338,15 +337,8 @@ MathJax.Hub.Config({

      Plans for week 35

        -
      • Lab Wednesday: Work on exercises 1-5 for week 35, see end of these slides for the exercises.
      • -
      • Thursday: Review of ordinary Least Squares with applications, reminder on statistics and start discussion of Ridge Regression and Singular Value Decomposition
      • - -
      • Friday: Discussion of Ridge and Lasso Regression and links with Singular Value Decomposition
      • - +
      • Review of ordinary Least Squares with applications. Discussion of Ridge and Lasso Regression and links with Singular Value Decomposition
      • +
      • Exercises and hands-on demonstrations

      Reading recommendations:

        @@ -357,15 +349,15 @@ MathJax.Hub.Config({
      1. A good review on statistics is given by Murphy's text, chapter 2, see https://github.com/CompPhysics/MachineLearning/blob/master/doc/Textbooks/MachineLearningMurphy.pdf










      -

      Thursday September 1

      +

      Topics of week 35

      -

      The main topics on Thursday are:

      +

      The main topics are:

      1. Repetition from last week on linear regression
      2. Reminder on statistics with quantities like mean values, variance abd covariance
      3. Discussion of how to prepare data and examples of applications of linear regression
      4. Mathematical interpretations of Linear Regression
      5. -
      6. Start discussing Ridge and Lasso regression and Singular Value Decomposition, to be continued Friday
      7. +
      8. Start discussing Ridge and Lasso regression and Singular Value Decomposition










      Why Linear Regression (aka Ordinary Least Squares and family), repeat from last week

      @@ -2401,9 +2393,6 @@ resize the matrices and set up a diagonal matrix as done in the above example

      -









      -

      Friday September 2

      -









      Mathematics of the SVD and implications

      @@ -3920,7 +3909,7 @@ $$
      - © 1999-2022, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license + © 1999-2023, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license
      diff --git a/doc/pub/week35/html/week35.html b/doc/pub/week35/html/week35.html index 8bff74da3..aea9dfa9f 100644 --- a/doc/pub/week35/html/week35.html +++ b/doc/pub/week35/html/week35.html @@ -142,7 +142,7 @@ div.toc p,a { {'highest level': 2, 'sections': [('Plans for week 35', 2, None, 'plans-for-week-35'), ('Reading recommendations:', 3, None, 'reading-recommendations'), - ('Thursday September 1', 2, None, 'thursday-september-1'), + ('Topics of week 35', 2, None, 'topics-of-week-35'), ('Why Linear Regression (aka Ordinary Least Squares and family), ' 'repeat from last week', 2, @@ -279,7 +279,6 @@ div.toc p,a { 2, None, 'note-about-svd-calculations'), - ('Friday September 2', 2, None, 'friday-september-2'), ('Mathematics of the SVD and implications', 2, None, @@ -407,7 +406,7 @@ MathJax.Hub.Config({
      -

      Sep 8, 2022

      +

      May 29, 2023


      @@ -415,15 +414,8 @@ MathJax.Hub.Config({

      Plans for week 35

        -
      • Lab Wednesday: Work on exercises 1-5 for week 35, see end of these slides for the exercises.
      • -
      • Thursday: Review of ordinary Least Squares with applications, reminder on statistics and start discussion of Ridge Regression and Singular Value Decomposition
      • - -
      • Friday: Discussion of Ridge and Lasso Regression and links with Singular Value Decomposition
      • - +
      • Review of ordinary Least Squares with applications. Discussion of Ridge and Lasso Regression and links with Singular Value Decomposition
      • +
      • Exercises and hands-on demonstrations

      Reading recommendations:

        @@ -434,15 +426,15 @@ MathJax.Hub.Config({
      1. A good review on statistics is given by Murphy's text, chapter 2, see https://github.com/CompPhysics/MachineLearning/blob/master/doc/Textbooks/MachineLearningMurphy.pdf










      -

      Thursday September 1

      +

      Topics of week 35

      -

      The main topics on Thursday are:

      +

      The main topics are:

      1. Repetition from last week on linear regression
      2. Reminder on statistics with quantities like mean values, variance abd covariance
      3. Discussion of how to prepare data and examples of applications of linear regression
      4. Mathematical interpretations of Linear Regression
      5. -
      6. Start discussing Ridge and Lasso regression and Singular Value Decomposition, to be continued Friday
      7. +
      8. Start discussing Ridge and Lasso regression and Singular Value Decomposition










      Why Linear Regression (aka Ordinary Least Squares and family), repeat from last week

      @@ -2478,9 +2470,6 @@ resize the matrices and set up a diagonal matrix as done in the above example

      -









      -

      Friday September 2

      -









      Mathematics of the SVD and implications

      @@ -3997,7 +3986,7 @@ $$
      - © 1999-2022, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license + © 1999-2023, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license
      diff --git a/doc/pub/week35/ipynb/ipynb-week35-src.tar.gz b/doc/pub/week35/ipynb/ipynb-week35-src.tar.gz index 7189a1e412a97a69358978b69a72acbe0390a47c..24c4e9559e1c55a273d688aa29ad782de1ce95d9 100644 GIT binary patch literal 191 zcmV;w06_mAiwFP@1$ATq1MSaC4uUWc24L2lVopF>X<=<53l}EFc!3fIsYr`$iE?{+ zB)ZbLA;zTN=I>)NnK@+Z%`S`F-35ywgd~i?m}$bNB&+#8p_BtnWjMKaO44y z+IYaS2qe4+pd003=2Rb&7F literal 191 zcmV;w06_mAiwFP|2O47l1MSbz3W6{c24Js!it_}rxy`PFyyzl`=mjRuT;^umq\n", - "\n", - "* Friday: Discussion of Ridge and Lasso Regression and links with Singular Value Decomposition\n", - "\n", - " * Video of lecture at " + "* Exercises and hands-on demonstrations" ] }, { "cell_type": "markdown", - "id": "afb12e70", + "id": "51853e51", "metadata": { "editable": true }, @@ -69,14 +63,14 @@ }, { "cell_type": "markdown", - "id": "c01b6753", + "id": "15a7304c", "metadata": { "editable": true }, "source": [ - "## Thursday September 1\n", + "## Topics of week 35\n", "\n", - "The main topics on Thursday are:\n", + "The main topics are:\n", "1. Repetition from last week on linear regression\n", "\n", "2. Reminder on statistics with quantities like mean values, variance abd covariance\n", @@ -85,12 +79,12 @@ "\n", "4. Mathematical interpretations of Linear Regression\n", "\n", - "5. Start discussing Ridge and Lasso regression and Singular Value Decomposition, to be continued Friday" + "5. Start discussing Ridge and Lasso regression and Singular Value Decomposition" ] }, { "cell_type": "markdown", - "id": "344c28c6", + "id": "25d2e250", "metadata": { "editable": true }, @@ -124,7 +118,7 @@ }, { "cell_type": "markdown", - "id": "4de5ee10", + "id": "0fe94f81", "metadata": { "editable": true }, @@ -146,7 +140,7 @@ }, { "cell_type": "markdown", - "id": "a3e2980a", + "id": "10ac1bae", "metadata": { "editable": true }, @@ -174,7 +168,7 @@ }, { "cell_type": "markdown", - "id": "b133402f", + "id": "96defb48", "metadata": { "editable": true }, @@ -189,7 +183,7 @@ }, { "cell_type": "markdown", - "id": "265e13d1", + "id": "cc47c67f", "metadata": { "editable": true }, @@ -201,7 +195,7 @@ }, { "cell_type": "markdown", - "id": "c95932ec", + "id": "fe2d745c", "metadata": { "editable": true }, @@ -216,7 +210,7 @@ }, { "cell_type": "markdown", - "id": "c30962fb", + "id": "f3b3694c", "metadata": { "editable": true }, @@ -229,7 +223,7 @@ }, { "cell_type": "markdown", - "id": "5969ac32", + "id": "aad24c77", "metadata": { "editable": true }, @@ -241,7 +235,7 @@ }, { "cell_type": "markdown", - "id": "b2d55e3a", + "id": "be082b82", "metadata": { "editable": true }, @@ -251,7 +245,7 @@ }, { "cell_type": "markdown", - "id": "3cce331f", + "id": "df9c4a6b", "metadata": { "editable": true }, @@ -262,7 +256,7 @@ }, { "cell_type": "markdown", - "id": "3718ac2b", + "id": "410e5b62", "metadata": { "editable": true }, @@ -280,7 +274,7 @@ }, { "cell_type": "markdown", - "id": "d85d5203", + "id": "df9fe0d2", "metadata": { "editable": true }, @@ -291,7 +285,7 @@ }, { "cell_type": "markdown", - "id": "839aeed3", + "id": "cbd065b6", "metadata": { "editable": true }, @@ -303,7 +297,7 @@ }, { "cell_type": "markdown", - "id": "04bbf2c1", + "id": "c0282a14", "metadata": { "editable": true }, @@ -313,7 +307,7 @@ }, { "cell_type": "markdown", - "id": "d71ec234", + "id": "433cd901", "metadata": { "editable": true }, @@ -325,7 +319,7 @@ }, { "cell_type": "markdown", - "id": "401eb649", + "id": "38a0fff8", "metadata": { "editable": true }, @@ -335,7 +329,7 @@ }, { "cell_type": "markdown", - "id": "17e9799f", + "id": "1d164c9e", "metadata": { "editable": true }, @@ -347,7 +341,7 @@ }, { "cell_type": "markdown", - "id": "2934b6fa", + "id": "f4e7a7d1", "metadata": { "editable": true }, @@ -357,7 +351,7 @@ }, { "cell_type": "markdown", - "id": "29469f49", + "id": "a36a262d", "metadata": { "editable": true }, @@ -376,7 +370,7 @@ }, { "cell_type": "markdown", - "id": "de268425", + "id": "dd4a11de", "metadata": { "editable": true }, @@ -386,7 +380,7 @@ }, { "cell_type": "markdown", - "id": "a85f9bd4", + "id": "3dc4b052", "metadata": { "editable": true }, @@ -398,7 +392,7 @@ }, { "cell_type": "markdown", - "id": "eafbc40b", + "id": "91bb8b5e", "metadata": { "editable": true }, @@ -408,7 +402,7 @@ }, { "cell_type": "markdown", - "id": "4a5e899e", + "id": "9324fa90", "metadata": { "editable": true }, @@ -424,7 +418,7 @@ }, { "cell_type": "markdown", - "id": "fd6d7f47", + "id": "119f08fa", "metadata": { "editable": true }, @@ -444,7 +438,7 @@ }, { "cell_type": "markdown", - "id": "58fff416", + "id": "d398d0c3", "metadata": { "editable": true }, @@ -454,7 +448,7 @@ }, { "cell_type": "markdown", - "id": "e119ed18", + "id": "d06b2bdc", "metadata": { "editable": true }, @@ -465,7 +459,7 @@ }, { "cell_type": "markdown", - "id": "5a9a997b", + "id": "85b598cf", "metadata": { "editable": true }, @@ -484,7 +478,7 @@ }, { "cell_type": "markdown", - "id": "864347ad", + "id": "0b244390", "metadata": { "editable": true }, @@ -494,7 +488,7 @@ }, { "cell_type": "markdown", - "id": "4558e163", + "id": "f71d82cb", "metadata": { "editable": true }, @@ -506,7 +500,7 @@ }, { "cell_type": "markdown", - "id": "abe98dc6", + "id": "d9b51cb9", "metadata": { "editable": true }, @@ -516,7 +510,7 @@ }, { "cell_type": "markdown", - "id": "5f6123f4", + "id": "62e3140a", "metadata": { "editable": true }, @@ -527,7 +521,7 @@ }, { "cell_type": "markdown", - "id": "1b477e67", + "id": "d8af9400", "metadata": { "editable": true }, @@ -547,7 +541,7 @@ }, { "cell_type": "markdown", - "id": "5c5ee949", + "id": "cd4daf2c", "metadata": { "editable": true }, @@ -559,7 +553,7 @@ }, { "cell_type": "markdown", - "id": "1d6d84b4", + "id": "fe963463", "metadata": { "editable": true }, @@ -574,7 +568,7 @@ { "cell_type": "code", "execution_count": 1, - "id": "70830741", + "id": "ede9110f", "metadata": { "collapsed": false, "editable": true @@ -656,7 +650,7 @@ }, { "cell_type": "markdown", - "id": "c8a0d399", + "id": "1135bdee", "metadata": { "editable": true }, @@ -666,7 +660,7 @@ }, { "cell_type": "markdown", - "id": "6083b179", + "id": "48a99e12", "metadata": { "editable": true }, @@ -678,7 +672,7 @@ }, { "cell_type": "markdown", - "id": "54ccb757", + "id": "f9401b16", "metadata": { "editable": true }, @@ -688,7 +682,7 @@ }, { "cell_type": "markdown", - "id": "d506184f", + "id": "86264b86", "metadata": { "editable": true }, @@ -699,7 +693,7 @@ }, { "cell_type": "markdown", - "id": "6adddffe", + "id": "048e5c38", "metadata": { "editable": true }, @@ -711,7 +705,7 @@ }, { "cell_type": "markdown", - "id": "2de2b4dc", + "id": "b1bba499", "metadata": { "editable": true }, @@ -721,7 +715,7 @@ }, { "cell_type": "markdown", - "id": "cb326e1d", + "id": "ec938825", "metadata": { "editable": true }, @@ -733,7 +727,7 @@ }, { "cell_type": "markdown", - "id": "e6549ddb", + "id": "bdee42b9", "metadata": { "editable": true }, @@ -743,7 +737,7 @@ }, { "cell_type": "markdown", - "id": "7d92332f", + "id": "4fd26888", "metadata": { "editable": true }, @@ -755,7 +749,7 @@ }, { "cell_type": "markdown", - "id": "4816a4cd", + "id": "87132dfb", "metadata": { "editable": true }, @@ -768,7 +762,7 @@ }, { "cell_type": "markdown", - "id": "74cd1824", + "id": "c825532a", "metadata": { "editable": true }, @@ -780,7 +774,7 @@ }, { "cell_type": "markdown", - "id": "66b6c873", + "id": "50ee906e", "metadata": { "editable": true }, @@ -790,7 +784,7 @@ }, { "cell_type": "markdown", - "id": "608006a5", + "id": "4adf10aa", "metadata": { "editable": true }, @@ -802,7 +796,7 @@ }, { "cell_type": "markdown", - "id": "15c80ed3", + "id": "eb827c9a", "metadata": { "editable": true }, @@ -814,7 +808,7 @@ }, { "cell_type": "markdown", - "id": "9a525861", + "id": "02ae6d08", "metadata": { "editable": true }, @@ -825,7 +819,7 @@ }, { "cell_type": "markdown", - "id": "e8153233", + "id": "23470b49", "metadata": { "editable": true }, @@ -837,7 +831,7 @@ }, { "cell_type": "markdown", - "id": "e02d1cf4", + "id": "abd20c9a", "metadata": { "editable": true }, @@ -856,7 +850,7 @@ }, { "cell_type": "markdown", - "id": "7a8a273b", + "id": "5e8e9d7a", "metadata": { "editable": true }, @@ -869,7 +863,7 @@ }, { "cell_type": "markdown", - "id": "263efee0", + "id": "09e979d5", "metadata": { "editable": true }, @@ -879,7 +873,7 @@ }, { "cell_type": "markdown", - "id": "6eadb437", + "id": "bc7717a8", "metadata": { "editable": true }, @@ -891,7 +885,7 @@ }, { "cell_type": "markdown", - "id": "f681fd1b", + "id": "6455db02", "metadata": { "editable": true }, @@ -901,7 +895,7 @@ }, { "cell_type": "markdown", - "id": "34b7e0df", + "id": "6c982663", "metadata": { "editable": true }, @@ -913,7 +907,7 @@ }, { "cell_type": "markdown", - "id": "3c152d6e", + "id": "6c9f78c6", "metadata": { "editable": true }, @@ -923,7 +917,7 @@ }, { "cell_type": "markdown", - "id": "86ed659e", + "id": "eda01a85", "metadata": { "editable": true }, @@ -935,7 +929,7 @@ }, { "cell_type": "markdown", - "id": "1fa648ad", + "id": "098a6d51", "metadata": { "editable": true }, @@ -946,7 +940,7 @@ }, { "cell_type": "markdown", - "id": "f8b6f215", + "id": "1a26f29b", "metadata": { "editable": true }, @@ -958,7 +952,7 @@ }, { "cell_type": "markdown", - "id": "3e097ad4", + "id": "d12e614f", "metadata": { "editable": true }, @@ -968,7 +962,7 @@ }, { "cell_type": "markdown", - "id": "2e77e9dc", + "id": "11eaab60", "metadata": { "editable": true }, @@ -980,7 +974,7 @@ }, { "cell_type": "markdown", - "id": "349b95fc", + "id": "95d04ecc", "metadata": { "editable": true }, @@ -990,7 +984,7 @@ }, { "cell_type": "markdown", - "id": "c3089f1d", + "id": "6ea996a9", "metadata": { "editable": true }, @@ -1002,7 +996,7 @@ }, { "cell_type": "markdown", - "id": "8095529c", + "id": "1477d180", "metadata": { "editable": true }, @@ -1023,7 +1017,7 @@ }, { "cell_type": "markdown", - "id": "0817d1ec", + "id": "4eb7760c", "metadata": { "editable": true }, @@ -1036,7 +1030,7 @@ }, { "cell_type": "markdown", - "id": "7c556704", + "id": "9d3dc897", "metadata": { "editable": true }, @@ -1048,7 +1042,7 @@ }, { "cell_type": "markdown", - "id": "3a2efc32", + "id": "9e2258ba", "metadata": { "editable": true }, @@ -1060,7 +1054,7 @@ }, { "cell_type": "markdown", - "id": "e22de532", + "id": "77c5a42a", "metadata": { "editable": true }, @@ -1072,7 +1066,7 @@ }, { "cell_type": "markdown", - "id": "b8fc7fc6", + "id": "fab919c0", "metadata": { "editable": true }, @@ -1084,7 +1078,7 @@ }, { "cell_type": "markdown", - "id": "2b356c96", + "id": "482be0d1", "metadata": { "editable": true }, @@ -1094,7 +1088,7 @@ }, { "cell_type": "markdown", - "id": "f8a9e3f5", + "id": "7f3b9e0e", "metadata": { "editable": true }, @@ -1110,7 +1104,7 @@ }, { "cell_type": "markdown", - "id": "18a3c690", + "id": "d56125e2", "metadata": { "editable": true }, @@ -1122,7 +1116,7 @@ }, { "cell_type": "markdown", - "id": "062c6a4b", + "id": "e557e6fb", "metadata": { "editable": true }, @@ -1132,7 +1126,7 @@ }, { "cell_type": "markdown", - "id": "a2b7ec97", + "id": "59a4e5bf", "metadata": { "editable": true }, @@ -1144,7 +1138,7 @@ }, { "cell_type": "markdown", - "id": "45d18875", + "id": "5dc1fec2", "metadata": { "editable": true }, @@ -1162,7 +1156,7 @@ }, { "cell_type": "markdown", - "id": "9fda9db8", + "id": "7d4277fb", "metadata": { "editable": true }, @@ -1173,7 +1167,7 @@ }, { "cell_type": "markdown", - "id": "48e2b716", + "id": "4cfa7978", "metadata": { "editable": true }, @@ -1185,7 +1179,7 @@ }, { "cell_type": "markdown", - "id": "3204e24c", + "id": "794b6ae9", "metadata": { "editable": true }, @@ -1195,7 +1189,7 @@ }, { "cell_type": "markdown", - "id": "5e1478cd", + "id": "e8723581", "metadata": { "editable": true }, @@ -1207,7 +1201,7 @@ }, { "cell_type": "markdown", - "id": "82c2bf8f", + "id": "79013d19", "metadata": { "editable": true }, @@ -1217,7 +1211,7 @@ }, { "cell_type": "markdown", - "id": "641a7108", + "id": "6e8bee84", "metadata": { "editable": true }, @@ -1229,7 +1223,7 @@ }, { "cell_type": "markdown", - "id": "53b1a131", + "id": "ccc81be9", "metadata": { "editable": true }, @@ -1239,7 +1233,7 @@ }, { "cell_type": "markdown", - "id": "ac9e0e1a", + "id": "63eb9970", "metadata": { "editable": true }, @@ -1253,7 +1247,7 @@ { "cell_type": "code", "execution_count": 2, - "id": "005c70a6", + "id": "53c8a84b", "metadata": { "collapsed": false, "editable": true @@ -1268,7 +1262,7 @@ }, { "cell_type": "markdown", - "id": "19ca94e1", + "id": "a4072ebf", "metadata": { "editable": true }, @@ -1279,7 +1273,7 @@ { "cell_type": "code", "execution_count": 3, - "id": "06e9f9d6", + "id": "38bc494a", "metadata": { "collapsed": false, "editable": true @@ -1292,7 +1286,7 @@ }, { "cell_type": "markdown", - "id": "225e30e8", + "id": "d96d92db", "metadata": { "editable": true }, @@ -1303,7 +1297,7 @@ { "cell_type": "code", "execution_count": 4, - "id": "2723ae09", + "id": "d0844e9c", "metadata": { "collapsed": false, "editable": true @@ -1326,7 +1320,7 @@ }, { "cell_type": "markdown", - "id": "bf4d0fb5", + "id": "2fc6ded6", "metadata": { "editable": true }, @@ -1340,7 +1334,7 @@ { "cell_type": "code", "execution_count": 5, - "id": "ae340371", + "id": "6c3d09f7", "metadata": { "collapsed": false, "editable": true @@ -1353,7 +1347,7 @@ }, { "cell_type": "markdown", - "id": "5ebe9806", + "id": "37f5ce39", "metadata": { "editable": true }, @@ -1364,7 +1358,7 @@ { "cell_type": "code", "execution_count": 6, - "id": "196d1394", + "id": "5925bd56", "metadata": { "collapsed": false, "editable": true @@ -1376,7 +1370,7 @@ }, { "cell_type": "markdown", - "id": "187eb8c6", + "id": "daa51e3a", "metadata": { "editable": true }, @@ -1387,7 +1381,7 @@ { "cell_type": "code", "execution_count": 7, - "id": "9d640531", + "id": "3e803617", "metadata": { "collapsed": false, "editable": true @@ -1403,7 +1397,7 @@ }, { "cell_type": "markdown", - "id": "f7fe1150", + "id": "87c8440d", "metadata": { "editable": true }, @@ -1414,7 +1408,7 @@ { "cell_type": "code", "execution_count": 8, - "id": "e5238508", + "id": "ec4cc7ad", "metadata": { "collapsed": false, "editable": true @@ -1428,7 +1422,7 @@ }, { "cell_type": "markdown", - "id": "2d336646", + "id": "641a6d52", "metadata": { "editable": true }, @@ -1449,7 +1443,7 @@ }, { "cell_type": "markdown", - "id": "4e5c60bc", + "id": "758d4c2e", "metadata": { "editable": true }, @@ -1460,7 +1454,7 @@ { "cell_type": "code", "execution_count": 9, - "id": "7d75ee00", + "id": "f1339bc4", "metadata": { "collapsed": false, "editable": true @@ -1509,7 +1503,7 @@ }, { "cell_type": "markdown", - "id": "c6527e89", + "id": "9fa72f3c", "metadata": { "editable": true }, @@ -1520,7 +1514,7 @@ { "cell_type": "code", "execution_count": 10, - "id": "4c7cdfd7", + "id": "5386450d", "metadata": { "collapsed": false, "editable": true @@ -1545,7 +1539,7 @@ }, { "cell_type": "markdown", - "id": "276a2c92", + "id": "91fd6a2a", "metadata": { "editable": true }, @@ -1557,7 +1551,7 @@ }, { "cell_type": "markdown", - "id": "8b221a10", + "id": "2867c932", "metadata": { "editable": true }, @@ -1601,7 +1595,7 @@ }, { "cell_type": "markdown", - "id": "4c7d7400", + "id": "6019d1cd", "metadata": { "editable": true }, @@ -1613,7 +1607,7 @@ { "cell_type": "code", "execution_count": 11, - "id": "627e2bbd", + "id": "dc5f50f7", "metadata": { "collapsed": false, "editable": true @@ -1629,7 +1623,7 @@ }, { "cell_type": "markdown", - "id": "29aa56fd", + "id": "d840f15f", "metadata": { "editable": true }, @@ -1640,7 +1634,7 @@ { "cell_type": "code", "execution_count": 12, - "id": "9dcb6cd5", + "id": "63a64fbb", "metadata": { "collapsed": false, "editable": true @@ -1658,7 +1652,7 @@ }, { "cell_type": "markdown", - "id": "a0958562", + "id": "eb869dd7", "metadata": { "editable": true }, @@ -1669,7 +1663,7 @@ { "cell_type": "code", "execution_count": 13, - "id": "c71ddc96", + "id": "1f5322ec", "metadata": { "collapsed": false, "editable": true @@ -1683,7 +1677,7 @@ }, { "cell_type": "markdown", - "id": "91996273", + "id": "51f33235", "metadata": { "editable": true }, @@ -1694,7 +1688,7 @@ { "cell_type": "code", "execution_count": 14, - "id": "ec36d352", + "id": "ef32dd15", "metadata": { "collapsed": false, "editable": true @@ -1707,7 +1701,7 @@ }, { "cell_type": "markdown", - "id": "4c333d53", + "id": "60da4baa", "metadata": { "editable": true }, @@ -1718,7 +1712,7 @@ { "cell_type": "code", "execution_count": 15, - "id": "7e04490a", + "id": "a1349f06", "metadata": { "collapsed": false, "editable": true @@ -1735,7 +1729,7 @@ }, { "cell_type": "markdown", - "id": "2767a311", + "id": "3b5ca502", "metadata": { "editable": true }, @@ -1746,7 +1740,7 @@ { "cell_type": "code", "execution_count": 16, - "id": "4457edf6", + "id": "c5acfacc", "metadata": { "collapsed": false, "editable": true @@ -1762,7 +1756,7 @@ }, { "cell_type": "markdown", - "id": "2afe8df3", + "id": "09f8fb1d", "metadata": { "editable": true }, @@ -1773,7 +1767,7 @@ { "cell_type": "code", "execution_count": 17, - "id": "de7af0e6", + "id": "ae1b3447", "metadata": { "collapsed": false, "editable": true @@ -1797,7 +1791,7 @@ }, { "cell_type": "markdown", - "id": "8d5dd8ae", + "id": "9ee582dd", "metadata": { "editable": true }, @@ -1808,7 +1802,7 @@ { "cell_type": "code", "execution_count": 18, - "id": "5cd5ed31", + "id": "29e7f3a6", "metadata": { "collapsed": false, "editable": true @@ -1821,7 +1815,7 @@ }, { "cell_type": "markdown", - "id": "a867e5c1", + "id": "6fd3b0c6", "metadata": { "editable": true }, @@ -1832,7 +1826,7 @@ { "cell_type": "code", "execution_count": 19, - "id": "4a3a1967", + "id": "b4346c58", "metadata": { "collapsed": false, "editable": true @@ -1852,7 +1846,7 @@ }, { "cell_type": "markdown", - "id": "db01b5c9", + "id": "79132cb6", "metadata": { "editable": true }, @@ -1863,7 +1857,7 @@ { "cell_type": "code", "execution_count": 20, - "id": "d295f324", + "id": "f1231ed3", "metadata": { "collapsed": false, "editable": true @@ -1906,7 +1900,7 @@ { "cell_type": "code", "execution_count": 21, - "id": "6b3161b9", + "id": "15b7c753", "metadata": { "collapsed": false, "editable": true @@ -1921,7 +1915,7 @@ }, { "cell_type": "markdown", - "id": "7b94a2e4", + "id": "29c95749", "metadata": { "editable": true }, @@ -1950,7 +1944,7 @@ }, { "cell_type": "markdown", - "id": "a8466272", + "id": "de725212", "metadata": { "editable": true }, @@ -1975,7 +1969,7 @@ }, { "cell_type": "markdown", - "id": "eabc76cc", + "id": "a696ae7e", "metadata": { "editable": true }, @@ -1995,7 +1989,7 @@ }, { "cell_type": "markdown", - "id": "4a81cac1", + "id": "104b40dd", "metadata": { "editable": true }, @@ -2022,7 +2016,7 @@ }, { "cell_type": "markdown", - "id": "10394148", + "id": "4e915a2e", "metadata": { "editable": true }, @@ -2035,7 +2029,7 @@ }, { "cell_type": "markdown", - "id": "341143df", + "id": "80ce850f", "metadata": { "editable": true }, @@ -2047,7 +2041,7 @@ }, { "cell_type": "markdown", - "id": "dcab7db3", + "id": "a18b212a", "metadata": { "editable": true }, @@ -2058,7 +2052,7 @@ }, { "cell_type": "markdown", - "id": "75dd4280", + "id": "6c6cba47", "metadata": { "editable": true }, @@ -2074,7 +2068,7 @@ { "cell_type": "code", "execution_count": 22, - "id": "66e55e6c", + "id": "f936cb45", "metadata": { "collapsed": false, "editable": true @@ -2108,7 +2102,7 @@ }, { "cell_type": "markdown", - "id": "16222dd8", + "id": "78ee572c", "metadata": { "editable": true }, @@ -2118,7 +2112,7 @@ }, { "cell_type": "markdown", - "id": "059340d6", + "id": "f0637d69", "metadata": { "editable": true }, @@ -2133,7 +2127,7 @@ }, { "cell_type": "markdown", - "id": "4cc0b74f", + "id": "368385c7", "metadata": { "editable": true }, @@ -2145,7 +2139,7 @@ }, { "cell_type": "markdown", - "id": "a393ed5c", + "id": "6bf8f4fe", "metadata": { "editable": true }, @@ -2155,7 +2149,7 @@ }, { "cell_type": "markdown", - "id": "0040cb45", + "id": "e8d46ebb", "metadata": { "editable": true }, @@ -2171,7 +2165,7 @@ { "cell_type": "code", "execution_count": 23, - "id": "ed777b36", + "id": "fb4286ec", "metadata": { "collapsed": false, "editable": true @@ -2188,7 +2182,7 @@ }, { "cell_type": "markdown", - "id": "ab257c69", + "id": "45ea44ea", "metadata": { "editable": true }, @@ -2201,7 +2195,7 @@ { "cell_type": "code", "execution_count": 24, - "id": "9fd5d42e", + "id": "4ab144ff", "metadata": { "collapsed": false, "editable": true @@ -2248,7 +2242,7 @@ }, { "cell_type": "markdown", - "id": "431fdd46", + "id": "6b8d977a", "metadata": { "editable": true }, @@ -2259,7 +2253,7 @@ { "cell_type": "code", "execution_count": 25, - "id": "b613c168", + "id": "fb8683a0", "metadata": { "collapsed": false, "editable": true @@ -2362,7 +2356,7 @@ }, { "cell_type": "markdown", - "id": "fc68615b", + "id": "056725ae", "metadata": { "editable": true }, @@ -2376,7 +2370,7 @@ }, { "cell_type": "markdown", - "id": "34604c66", + "id": "4aac1b5d", "metadata": { "editable": true }, @@ -2388,7 +2382,7 @@ }, { "cell_type": "markdown", - "id": "35ad88cb", + "id": "15cb88f8", "metadata": { "editable": true }, @@ -2400,7 +2394,7 @@ }, { "cell_type": "markdown", - "id": "0c24eef1", + "id": "2ddee2cf", "metadata": { "editable": true }, @@ -2412,7 +2406,7 @@ }, { "cell_type": "markdown", - "id": "5c8e4928", + "id": "d4ea9f1d", "metadata": { "editable": true }, @@ -2422,7 +2416,7 @@ }, { "cell_type": "markdown", - "id": "056fb98e", + "id": "a0bc1d2c", "metadata": { "editable": true }, @@ -2434,7 +2428,7 @@ }, { "cell_type": "markdown", - "id": "4602c6b6", + "id": "55cf148d", "metadata": { "editable": true }, @@ -2444,7 +2438,7 @@ }, { "cell_type": "markdown", - "id": "92f03755", + "id": "6542b462", "metadata": { "editable": true }, @@ -2456,7 +2450,7 @@ }, { "cell_type": "markdown", - "id": "b040aeac", + "id": "b6873bf9", "metadata": { "editable": true }, @@ -2467,7 +2461,7 @@ }, { "cell_type": "markdown", - "id": "4eed573b", + "id": "ec5e544e", "metadata": { "editable": true }, @@ -2479,7 +2473,7 @@ }, { "cell_type": "markdown", - "id": "1a4aced9", + "id": "40a925fc", "metadata": { "editable": true }, @@ -2491,7 +2485,7 @@ }, { "cell_type": "markdown", - "id": "0d2a451b", + "id": "500e941a", "metadata": { "editable": true }, @@ -2501,7 +2495,7 @@ }, { "cell_type": "markdown", - "id": "79d7f091", + "id": "d5a76ef3", "metadata": { "editable": true }, @@ -2513,7 +2507,7 @@ }, { "cell_type": "markdown", - "id": "8eb00b9e", + "id": "86a4a773", "metadata": { "editable": true }, @@ -2525,7 +2519,7 @@ }, { "cell_type": "markdown", - "id": "9d828f1a", + "id": "26b6895c", "metadata": { "editable": true }, @@ -2535,7 +2529,7 @@ }, { "cell_type": "markdown", - "id": "2fb280d3", + "id": "a5bf8e8c", "metadata": { "editable": true }, @@ -2547,7 +2541,7 @@ }, { "cell_type": "markdown", - "id": "c6f0f523", + "id": "4b5a72ad", "metadata": { "editable": true }, @@ -2557,7 +2551,7 @@ }, { "cell_type": "markdown", - "id": "30cdb890", + "id": "93c5da3f", "metadata": { "editable": true }, @@ -2569,7 +2563,7 @@ }, { "cell_type": "markdown", - "id": "0115201a", + "id": "4dc7035e", "metadata": { "editable": true }, @@ -2579,7 +2573,7 @@ }, { "cell_type": "markdown", - "id": "e17989df", + "id": "c1b8a4f3", "metadata": { "editable": true }, @@ -2619,7 +2613,7 @@ }, { "cell_type": "markdown", - "id": "b7f56787", + "id": "0426f44f", "metadata": { "editable": true }, @@ -2636,7 +2630,7 @@ }, { "cell_type": "markdown", - "id": "e9e11294", + "id": "40532b9b", "metadata": { "editable": true }, @@ -2659,7 +2653,7 @@ }, { "cell_type": "markdown", - "id": "02611b2a", + "id": "8529a875", "metadata": { "editable": true }, @@ -2676,7 +2670,7 @@ }, { "cell_type": "markdown", - "id": "27876f6a", + "id": "33f2fe2d", "metadata": { "editable": true }, @@ -2695,7 +2689,7 @@ }, { "cell_type": "markdown", - "id": "2071a50e", + "id": "b8803cd0", "metadata": { "editable": true }, @@ -2706,7 +2700,7 @@ }, { "cell_type": "markdown", - "id": "51792542", + "id": "532710d8", "metadata": { "editable": true }, @@ -2718,7 +2712,7 @@ }, { "cell_type": "markdown", - "id": "efcc6fed", + "id": "feeee6da", "metadata": { "editable": true }, @@ -2736,7 +2730,7 @@ }, { "cell_type": "markdown", - "id": "5426bbde", + "id": "606151fd", "metadata": { "editable": true }, @@ -2752,7 +2746,7 @@ }, { "cell_type": "markdown", - "id": "2ae7e43e", + "id": "9431290c", "metadata": { "editable": true }, @@ -2764,7 +2758,7 @@ }, { "cell_type": "markdown", - "id": "1dccbc25", + "id": "817c92eb", "metadata": { "editable": true }, @@ -2774,7 +2768,7 @@ }, { "cell_type": "markdown", - "id": "e4f93d65", + "id": "ff7809c6", "metadata": { "editable": true }, @@ -2789,7 +2783,7 @@ }, { "cell_type": "markdown", - "id": "173e5272", + "id": "c8b60474", "metadata": { "editable": true }, @@ -2801,7 +2795,7 @@ }, { "cell_type": "markdown", - "id": "0eab93b3", + "id": "1b0cf41c", "metadata": { "editable": true }, @@ -2811,7 +2805,7 @@ }, { "cell_type": "markdown", - "id": "9b1edc60", + "id": "84596440", "metadata": { "editable": true }, @@ -2823,7 +2817,7 @@ }, { "cell_type": "markdown", - "id": "35d0f4e5", + "id": "3651c4b2", "metadata": { "editable": true }, @@ -2833,7 +2827,7 @@ }, { "cell_type": "markdown", - "id": "1c9611f1", + "id": "340923c0", "metadata": { "editable": true }, @@ -2845,7 +2839,7 @@ }, { "cell_type": "markdown", - "id": "7418dd52", + "id": "2951f8cf", "metadata": { "editable": true }, @@ -2857,7 +2851,7 @@ }, { "cell_type": "markdown", - "id": "95059b6d", + "id": "eed2368e", "metadata": { "editable": true }, @@ -2872,7 +2866,7 @@ }, { "cell_type": "markdown", - "id": "16995ea0", + "id": "bdbd7653", "metadata": { "editable": true }, @@ -2883,7 +2877,7 @@ }, { "cell_type": "markdown", - "id": "ec59c141", + "id": "123e2787", "metadata": { "editable": true }, @@ -2903,7 +2897,7 @@ }, { "cell_type": "markdown", - "id": "488199c7", + "id": "5f77a47e", "metadata": { "editable": true }, @@ -2915,7 +2909,7 @@ }, { "cell_type": "markdown", - "id": "2e722f02", + "id": "4fa7c9b0", "metadata": { "editable": true }, @@ -2925,7 +2919,7 @@ }, { "cell_type": "markdown", - "id": "72807a09", + "id": "ac15c1af", "metadata": { "editable": true }, @@ -2937,7 +2931,7 @@ }, { "cell_type": "markdown", - "id": "5821af87", + "id": "73fd82c2", "metadata": { "editable": true }, @@ -2966,7 +2960,7 @@ }, { "cell_type": "markdown", - "id": "8b1b5cee", + "id": "a0ca7478", "metadata": { "editable": true }, @@ -2993,7 +2987,7 @@ }, { "cell_type": "markdown", - "id": "c06c226a", + "id": "f5f824e4", "metadata": { "editable": true }, @@ -3004,7 +2998,7 @@ { "cell_type": "code", "execution_count": 26, - "id": "b8133c39", + "id": "38251168", "metadata": { "collapsed": false, "editable": true @@ -3044,7 +3038,7 @@ }, { "cell_type": "markdown", - "id": "26641ff1", + "id": "d0dad300", "metadata": { "editable": true }, @@ -3061,7 +3055,7 @@ }, { "cell_type": "markdown", - "id": "08d6874c", + "id": "e7d5d587", "metadata": { "editable": true }, @@ -3084,17 +3078,7 @@ }, { "cell_type": "markdown", - "id": "728693b0", - "metadata": { - "editable": true - }, - "source": [ - "## Friday September 2" - ] - }, - { - "cell_type": "markdown", - "id": "327b6be9", + "id": "86e39f46", "metadata": { "editable": true }, @@ -3108,7 +3092,7 @@ }, { "cell_type": "markdown", - "id": "3dcfaf49", + "id": "fc865bda", "metadata": { "editable": true }, @@ -3127,7 +3111,7 @@ }, { "cell_type": "markdown", - "id": "27faee36", + "id": "34ac7dbe", "metadata": { "editable": true }, @@ -3137,7 +3121,7 @@ }, { "cell_type": "markdown", - "id": "9a7b4d04", + "id": "ce9ed40b", "metadata": { "editable": true }, @@ -3149,7 +3133,7 @@ }, { "cell_type": "markdown", - "id": "b5146828", + "id": "e0c1753f", "metadata": { "editable": true }, @@ -3163,7 +3147,7 @@ }, { "cell_type": "markdown", - "id": "5ca53039", + "id": "b2f55210", "metadata": { "editable": true }, @@ -3175,7 +3159,7 @@ }, { "cell_type": "markdown", - "id": "320effb1", + "id": "993d236a", "metadata": { "editable": true }, @@ -3185,7 +3169,7 @@ }, { "cell_type": "markdown", - "id": "b32d01e1", + "id": "0d00c733", "metadata": { "editable": true }, @@ -3197,7 +3181,7 @@ }, { "cell_type": "markdown", - "id": "c457d788", + "id": "0065169f", "metadata": { "editable": true }, @@ -3214,7 +3198,7 @@ }, { "cell_type": "markdown", - "id": "3d2c2a89", + "id": "17559f8b", "metadata": { "editable": true }, @@ -3224,7 +3208,7 @@ }, { "cell_type": "markdown", - "id": "b233bc62", + "id": "bb8f29a5", "metadata": { "editable": true }, @@ -3240,7 +3224,7 @@ }, { "cell_type": "markdown", - "id": "a033fbf1", + "id": "a06d444d", "metadata": { "editable": true }, @@ -3250,7 +3234,7 @@ }, { "cell_type": "markdown", - "id": "9ab1fb1e", + "id": "d540ec4b", "metadata": { "editable": true }, @@ -3266,7 +3250,7 @@ }, { "cell_type": "markdown", - "id": "02fa2780", + "id": "b1a6615b", "metadata": { "editable": true }, @@ -3276,7 +3260,7 @@ }, { "cell_type": "markdown", - "id": "a906c4d0", + "id": "51a48167", "metadata": { "editable": true }, @@ -3292,7 +3276,7 @@ }, { "cell_type": "markdown", - "id": "0d4b799a", + "id": "1b7f0fed", "metadata": { "editable": true }, @@ -3302,7 +3286,7 @@ }, { "cell_type": "markdown", - "id": "cd32fb22", + "id": "9abf9e55", "metadata": { "editable": true }, @@ -3319,7 +3303,7 @@ }, { "cell_type": "markdown", - "id": "f2b8f570", + "id": "32d9652b", "metadata": { "editable": true }, @@ -3331,7 +3315,7 @@ }, { "cell_type": "markdown", - "id": "0d082bfd", + "id": "2a465226", "metadata": { "editable": true }, @@ -3343,7 +3327,7 @@ }, { "cell_type": "markdown", - "id": "be003593", + "id": "8ac566da", "metadata": { "editable": true }, @@ -3355,7 +3339,7 @@ }, { "cell_type": "markdown", - "id": "1f4ac14b", + "id": "9f92ca58", "metadata": { "editable": true }, @@ -3365,7 +3349,7 @@ }, { "cell_type": "markdown", - "id": "cc1fd807", + "id": "2e4790c8", "metadata": { "editable": true }, @@ -3377,7 +3361,7 @@ }, { "cell_type": "markdown", - "id": "9db7d157", + "id": "2b0a1201", "metadata": { "editable": true }, @@ -3389,7 +3373,7 @@ }, { "cell_type": "markdown", - "id": "304c9f77", + "id": "1d856b1e", "metadata": { "editable": true }, @@ -3401,7 +3385,7 @@ }, { "cell_type": "markdown", - "id": "8ec2a9aa", + "id": "7d734884", "metadata": { "editable": true }, @@ -3411,7 +3395,7 @@ }, { "cell_type": "markdown", - "id": "958601fe", + "id": "282f629e", "metadata": { "editable": true }, @@ -3423,7 +3407,7 @@ }, { "cell_type": "markdown", - "id": "c9e5d9ad", + "id": "1c92b30f", "metadata": { "editable": true }, @@ -3433,7 +3417,7 @@ }, { "cell_type": "markdown", - "id": "d9e351e3", + "id": "823f783c", "metadata": { "editable": true }, @@ -3445,7 +3429,7 @@ }, { "cell_type": "markdown", - "id": "569081ef", + "id": "4be0525b", "metadata": { "editable": true }, @@ -3459,7 +3443,7 @@ }, { "cell_type": "markdown", - "id": "e4313bc6", + "id": "6c460cbb", "metadata": { "editable": true }, @@ -3471,7 +3455,7 @@ }, { "cell_type": "markdown", - "id": "220cd3a4", + "id": "6e876e2b", "metadata": { "editable": true }, @@ -3483,7 +3467,7 @@ }, { "cell_type": "markdown", - "id": "b863f02b", + "id": "dd35e114", "metadata": { "editable": true }, @@ -3493,7 +3477,7 @@ }, { "cell_type": "markdown", - "id": "52eaa377", + "id": "e41e4b24", "metadata": { "editable": true }, @@ -3505,7 +3489,7 @@ }, { "cell_type": "markdown", - "id": "45aff57d", + "id": "a660f050", "metadata": { "editable": true }, @@ -3516,7 +3500,7 @@ }, { "cell_type": "markdown", - "id": "a1048705", + "id": "1bfed6c0", "metadata": { "editable": true }, @@ -3528,7 +3512,7 @@ }, { "cell_type": "markdown", - "id": "c5709e0b", + "id": "079641aa", "metadata": { "editable": true }, @@ -3538,7 +3522,7 @@ }, { "cell_type": "markdown", - "id": "9723e261", + "id": "1c2ba9ba", "metadata": { "editable": true }, @@ -3550,7 +3534,7 @@ }, { "cell_type": "markdown", - "id": "a31c99c6", + "id": "c90c925b", "metadata": { "editable": true }, @@ -3560,7 +3544,7 @@ }, { "cell_type": "markdown", - "id": "4f7a7d03", + "id": "096d7272", "metadata": { "editable": true }, @@ -3572,7 +3556,7 @@ }, { "cell_type": "markdown", - "id": "b78f9ce6", + "id": "ab428dfa", "metadata": { "editable": true }, @@ -3583,7 +3567,7 @@ }, { "cell_type": "markdown", - "id": "690dffcf", + "id": "32676667", "metadata": { "editable": true }, @@ -3595,7 +3579,7 @@ }, { "cell_type": "markdown", - "id": "68b2ba88", + "id": "ff6a8c71", "metadata": { "editable": true }, @@ -3613,7 +3597,7 @@ }, { "cell_type": "markdown", - "id": "1c2fb31e", + "id": "23c0d9f1", "metadata": { "editable": true }, @@ -3629,7 +3613,7 @@ }, { "cell_type": "markdown", - "id": "899e7047", + "id": "32aa4f0c", "metadata": { "editable": true }, @@ -3641,7 +3625,7 @@ }, { "cell_type": "markdown", - "id": "39c8f4d7", + "id": "2dad0497", "metadata": { "editable": true }, @@ -3653,7 +3637,7 @@ }, { "cell_type": "markdown", - "id": "a51fc573", + "id": "2dc59fbf", "metadata": { "editable": true }, @@ -3665,7 +3649,7 @@ }, { "cell_type": "markdown", - "id": "14d19e2c", + "id": "7cdbf049", "metadata": { "editable": true }, @@ -3678,7 +3662,7 @@ }, { "cell_type": "markdown", - "id": "886ac2bd", + "id": "59a9818e", "metadata": { "editable": true }, @@ -3694,7 +3678,7 @@ }, { "cell_type": "markdown", - "id": "ce461bbe", + "id": "02c8612d", "metadata": { "editable": true }, @@ -3708,7 +3692,7 @@ }, { "cell_type": "markdown", - "id": "e3f78807", + "id": "e3918f3a", "metadata": { "editable": true }, @@ -3718,7 +3702,7 @@ }, { "cell_type": "markdown", - "id": "ed89142d", + "id": "7c12adaa", "metadata": { "editable": true }, @@ -3730,7 +3714,7 @@ }, { "cell_type": "markdown", - "id": "613cb721", + "id": "a90918b1", "metadata": { "editable": true }, @@ -3740,7 +3724,7 @@ }, { "cell_type": "markdown", - "id": "f53d8a46", + "id": "b98d4711", "metadata": { "editable": true }, @@ -3752,7 +3736,7 @@ }, { "cell_type": "markdown", - "id": "28e646b9", + "id": "909544f4", "metadata": { "editable": true }, @@ -3762,7 +3746,7 @@ }, { "cell_type": "markdown", - "id": "1939bb39", + "id": "eda7c78a", "metadata": { "editable": true }, @@ -3776,7 +3760,7 @@ }, { "cell_type": "markdown", - "id": "0564e36d", + "id": "97f43eaf", "metadata": { "editable": true }, @@ -3793,7 +3777,7 @@ }, { "cell_type": "markdown", - "id": "fa599d54", + "id": "151a02db", "metadata": { "editable": true }, @@ -3809,7 +3793,7 @@ }, { "cell_type": "markdown", - "id": "e9f3bcf2", + "id": "e50cecd3", "metadata": { "editable": true }, @@ -3821,7 +3805,7 @@ }, { "cell_type": "markdown", - "id": "f22bd154", + "id": "5fff7114", "metadata": { "editable": true }, @@ -3834,7 +3818,7 @@ }, { "cell_type": "markdown", - "id": "bce3481e", + "id": "36ea2210", "metadata": { "editable": true }, @@ -3848,7 +3832,7 @@ }, { "cell_type": "markdown", - "id": "fe6288a9", + "id": "5ad8fe9e", "metadata": { "editable": true }, @@ -3858,7 +3842,7 @@ }, { "cell_type": "markdown", - "id": "95aadf73", + "id": "bebd7b45", "metadata": { "editable": true }, @@ -3871,7 +3855,7 @@ }, { "cell_type": "markdown", - "id": "74163755", + "id": "053d3619", "metadata": { "editable": true }, @@ -3890,7 +3874,7 @@ }, { "cell_type": "markdown", - "id": "5aed6cd0", + "id": "596c0971", "metadata": { "editable": true }, @@ -3902,7 +3886,7 @@ }, { "cell_type": "markdown", - "id": "e830b87e", + "id": "d17344e3", "metadata": { "editable": true }, @@ -3914,7 +3898,7 @@ }, { "cell_type": "markdown", - "id": "b5d1a1f2", + "id": "b241bb6c", "metadata": { "editable": true }, @@ -3924,7 +3908,7 @@ }, { "cell_type": "markdown", - "id": "e96384d5", + "id": "21fc65b4", "metadata": { "editable": true }, @@ -3936,7 +3920,7 @@ }, { "cell_type": "markdown", - "id": "93eaaa51", + "id": "9ce3fb65", "metadata": { "editable": true }, @@ -3949,7 +3933,7 @@ }, { "cell_type": "markdown", - "id": "7fb8df97", + "id": "52ccc9a5", "metadata": { "editable": true }, @@ -3968,7 +3952,7 @@ }, { "cell_type": "markdown", - "id": "f1fb889f", + "id": "38fda0bc", "metadata": { "editable": true }, @@ -3978,7 +3962,7 @@ }, { "cell_type": "markdown", - "id": "07c4c8b2", + "id": "9150dc48", "metadata": { "editable": true }, @@ -3997,7 +3981,7 @@ }, { "cell_type": "markdown", - "id": "c1ce3c7c", + "id": "01af4a7f", "metadata": { "editable": true }, @@ -4015,7 +3999,7 @@ }, { "cell_type": "markdown", - "id": "4ee38b63", + "id": "13471a6a", "metadata": { "editable": true }, @@ -4029,7 +4013,7 @@ }, { "cell_type": "markdown", - "id": "6c6682a0", + "id": "2af3e8fc", "metadata": { "editable": true }, @@ -4044,7 +4028,7 @@ { "cell_type": "code", "execution_count": 27, - "id": "9b5bd4e7", + "id": "3ab62cb4", "metadata": { "collapsed": false, "editable": true @@ -4065,7 +4049,7 @@ }, { "cell_type": "markdown", - "id": "7a715ced", + "id": "bdb2cb62", "metadata": { "editable": true }, @@ -4082,7 +4066,7 @@ { "cell_type": "code", "execution_count": 28, - "id": "6a5c069c", + "id": "47e08b89", "metadata": { "collapsed": false, "editable": true @@ -4114,7 +4098,7 @@ }, { "cell_type": "markdown", - "id": "a2ce7796", + "id": "fdd0f33e", "metadata": { "editable": true }, @@ -4128,7 +4112,7 @@ }, { "cell_type": "markdown", - "id": "29b1ff78", + "id": "a6146784", "metadata": { "editable": true }, @@ -4141,7 +4125,7 @@ { "cell_type": "code", "execution_count": 29, - "id": "2cab6f56", + "id": "a53c5cc6", "metadata": { "collapsed": false, "editable": true @@ -4166,7 +4150,7 @@ }, { "cell_type": "markdown", - "id": "74403a80", + "id": "4ede1141", "metadata": { "editable": true }, @@ -4176,7 +4160,7 @@ }, { "cell_type": "markdown", - "id": "a0fd3238", + "id": "4ae526bb", "metadata": { "editable": true }, @@ -4187,7 +4171,7 @@ { "cell_type": "code", "execution_count": 30, - "id": "27c64fb4", + "id": "33cad860", "metadata": { "collapsed": false, "editable": true @@ -4241,7 +4225,7 @@ }, { "cell_type": "markdown", - "id": "63ed542e", + "id": "b406a48a", "metadata": { "editable": true }, @@ -4258,7 +4242,7 @@ }, { "cell_type": "markdown", - "id": "e445f58f", + "id": "149b55a8", "metadata": { "editable": true }, @@ -4270,7 +4254,7 @@ }, { "cell_type": "markdown", - "id": "f8eee01f", + "id": "fcfb2992", "metadata": { "editable": true }, @@ -4282,7 +4266,7 @@ }, { "cell_type": "markdown", - "id": "03957968", + "id": "a0863a01", "metadata": { "editable": true }, @@ -4292,7 +4276,7 @@ }, { "cell_type": "markdown", - "id": "26bf4477", + "id": "a1e44c03", "metadata": { "editable": true }, @@ -4309,7 +4293,7 @@ }, { "cell_type": "markdown", - "id": "3840ab06", + "id": "57feea7c", "metadata": { "editable": true }, @@ -4319,7 +4303,7 @@ }, { "cell_type": "markdown", - "id": "bc0b5a9a", + "id": "1b862ff7", "metadata": { "editable": true }, @@ -4334,7 +4318,7 @@ }, { "cell_type": "markdown", - "id": "9d9ff747", + "id": "0f8fe30e", "metadata": { "editable": true }, @@ -4344,7 +4328,7 @@ }, { "cell_type": "markdown", - "id": "5c599c2f", + "id": "64b5ac2a", "metadata": { "editable": true }, @@ -4358,7 +4342,7 @@ }, { "cell_type": "markdown", - "id": "0b02a1c5", + "id": "657466bd", "metadata": { "editable": true }, @@ -4370,7 +4354,7 @@ }, { "cell_type": "markdown", - "id": "82a59c88", + "id": "98fc3a82", "metadata": { "editable": true }, @@ -4382,7 +4366,7 @@ }, { "cell_type": "markdown", - "id": "423b2e92", + "id": "5a70feef", "metadata": { "editable": true }, @@ -4394,7 +4378,7 @@ }, { "cell_type": "markdown", - "id": "095e0d8f", + "id": "aefc9f52", "metadata": { "editable": true }, @@ -4404,7 +4388,7 @@ }, { "cell_type": "markdown", - "id": "fd9654a8", + "id": "227adc50", "metadata": { "editable": true }, @@ -4416,7 +4400,7 @@ }, { "cell_type": "markdown", - "id": "750b953c", + "id": "535fe860", "metadata": { "editable": true }, @@ -4426,7 +4410,7 @@ }, { "cell_type": "markdown", - "id": "0bd48391", + "id": "115d3697", "metadata": { "editable": true }, @@ -4443,7 +4427,7 @@ }, { "cell_type": "markdown", - "id": "3d505f8f", + "id": "89838d8d", "metadata": { "editable": true }, @@ -4453,7 +4437,7 @@ }, { "cell_type": "markdown", - "id": "e51d0795", + "id": "46d327c2", "metadata": { "editable": true }, @@ -4465,7 +4449,7 @@ }, { "cell_type": "markdown", - "id": "fde4a00e", + "id": "06339014", "metadata": { "editable": true }, @@ -4475,7 +4459,7 @@ }, { "cell_type": "markdown", - "id": "91d32bc3", + "id": "4e0d3fd1", "metadata": { "editable": true }, @@ -4487,7 +4471,7 @@ }, { "cell_type": "markdown", - "id": "c2da93dd", + "id": "056f9d49", "metadata": { "editable": true }, @@ -4501,7 +4485,7 @@ }, { "cell_type": "markdown", - "id": "4897b875", + "id": "d3a482c9", "metadata": { "editable": true }, @@ -4513,7 +4497,7 @@ }, { "cell_type": "markdown", - "id": "f806bedb", + "id": "784798c7", "metadata": { "editable": true }, @@ -4535,7 +4519,7 @@ }, { "cell_type": "markdown", - "id": "33753a0c", + "id": "55d2d9e5", "metadata": { "editable": true }, @@ -4547,7 +4531,7 @@ }, { "cell_type": "markdown", - "id": "34ec61e0", + "id": "ea49bdbd", "metadata": { "editable": true }, @@ -4562,7 +4546,7 @@ }, { "cell_type": "markdown", - "id": "6e7d50a6", + "id": "010830dd", "metadata": { "editable": true }, @@ -4574,7 +4558,7 @@ }, { "cell_type": "markdown", - "id": "a08b3652", + "id": "0753e93e", "metadata": { "editable": true }, @@ -4586,7 +4570,7 @@ }, { "cell_type": "markdown", - "id": "033d1b3f", + "id": "5acfe108", "metadata": { "editable": true }, @@ -4596,7 +4580,7 @@ }, { "cell_type": "markdown", - "id": "d9c4d7ff", + "id": "0d558c44", "metadata": { "editable": true }, @@ -4608,7 +4592,7 @@ }, { "cell_type": "markdown", - "id": "07a49d53", + "id": "032564e7", "metadata": { "editable": true }, @@ -4618,7 +4602,7 @@ }, { "cell_type": "markdown", - "id": "8e568354", + "id": "4de10b38", "metadata": { "editable": true }, @@ -4630,7 +4614,7 @@ }, { "cell_type": "markdown", - "id": "3aaa231b", + "id": "8dc9e551", "metadata": { "editable": true }, @@ -4640,7 +4624,7 @@ }, { "cell_type": "markdown", - "id": "82a08a58", + "id": "98241069", "metadata": { "editable": true }, @@ -4652,7 +4636,7 @@ }, { "cell_type": "markdown", - "id": "c1b6bc65", + "id": "ca757ff9", "metadata": { "editable": true }, @@ -4669,7 +4653,7 @@ }, { "cell_type": "markdown", - "id": "a15c5e8a", + "id": "0f04b41a", "metadata": { "editable": true }, @@ -4682,7 +4666,7 @@ }, { "cell_type": "markdown", - "id": "4514f7df", + "id": "d2f050a3", "metadata": { "editable": true }, @@ -4694,7 +4678,7 @@ }, { "cell_type": "markdown", - "id": "5b753882", + "id": "bc3ff38a", "metadata": { "editable": true }, @@ -4704,7 +4688,7 @@ }, { "cell_type": "markdown", - "id": "dca68839", + "id": "b82b46ba", "metadata": { "editable": true }, @@ -4717,7 +4701,7 @@ }, { "cell_type": "markdown", - "id": "f611841c", + "id": "160ce640", "metadata": { "editable": true }, @@ -4727,7 +4711,7 @@ }, { "cell_type": "markdown", - "id": "f5d7ac03", + "id": "19b97ea4", "metadata": { "editable": true }, @@ -4739,7 +4723,7 @@ }, { "cell_type": "markdown", - "id": "d4f93a2e", + "id": "8219c09a", "metadata": { "editable": true }, @@ -4752,7 +4736,7 @@ }, { "cell_type": "markdown", - "id": "c52dba07", + "id": "4607e793", "metadata": { "editable": true }, @@ -4765,7 +4749,7 @@ }, { "cell_type": "markdown", - "id": "5edcdc9f", + "id": "fccab9af", "metadata": { "editable": true }, @@ -4777,7 +4761,7 @@ }, { "cell_type": "markdown", - "id": "2341f4fc", + "id": "0c4dbdcd", "metadata": { "editable": true }, @@ -4789,7 +4773,7 @@ }, { "cell_type": "markdown", - "id": "4972a7a7", + "id": "944d1a58", "metadata": { "editable": true }, @@ -4799,7 +4783,7 @@ }, { "cell_type": "markdown", - "id": "c7c127ae", + "id": "acf74694", "metadata": { "editable": true }, @@ -4812,7 +4796,7 @@ }, { "cell_type": "markdown", - "id": "fc68f490", + "id": "e2b50541", "metadata": { "editable": true }, @@ -4824,7 +4808,7 @@ }, { "cell_type": "markdown", - "id": "6aed486a", + "id": "416bc2b7", "metadata": { "editable": true }, @@ -4836,7 +4820,7 @@ }, { "cell_type": "markdown", - "id": "6692bab1", + "id": "21ee3cee", "metadata": { "editable": true }, @@ -4848,7 +4832,7 @@ }, { "cell_type": "markdown", - "id": "4c97143a", + "id": "6e906d12", "metadata": { "editable": true }, @@ -4860,7 +4844,7 @@ }, { "cell_type": "markdown", - "id": "f689d0df", + "id": "8548aa98", "metadata": { "editable": true }, @@ -4874,7 +4858,7 @@ }, { "cell_type": "markdown", - "id": "3e4e8a10", + "id": "214d7c50", "metadata": { "editable": true }, @@ -4886,7 +4870,7 @@ }, { "cell_type": "markdown", - "id": "3376fa99", + "id": "70ecc6ae", "metadata": { "editable": true }, @@ -4896,7 +4880,7 @@ }, { "cell_type": "markdown", - "id": "c52f1371", + "id": "8234faa0", "metadata": { "editable": true }, @@ -4908,7 +4892,7 @@ }, { "cell_type": "markdown", - "id": "3295be72", + "id": "bfe1b41a", "metadata": { "editable": true }, @@ -4920,7 +4904,7 @@ }, { "cell_type": "markdown", - "id": "a3e880aa", + "id": "5cc43268", "metadata": { "editable": true }, @@ -4932,7 +4916,7 @@ }, { "cell_type": "markdown", - "id": "1ab9fd04", + "id": "dc2612b3", "metadata": { "editable": true }, @@ -4944,7 +4928,7 @@ }, { "cell_type": "markdown", - "id": "a201f59f", + "id": "657c789e", "metadata": { "editable": true }, @@ -4956,7 +4940,7 @@ }, { "cell_type": "markdown", - "id": "e7903160", + "id": "a3bad5d2", "metadata": { "editable": true }, @@ -4975,7 +4959,7 @@ }, { "cell_type": "markdown", - "id": "4537e5fb", + "id": "e2e2fc68", "metadata": { "editable": true }, @@ -4987,7 +4971,7 @@ }, { "cell_type": "markdown", - "id": "673786e2", + "id": "374ff20e", "metadata": { "editable": true }, @@ -4997,7 +4981,7 @@ }, { "cell_type": "markdown", - "id": "6da61668", + "id": "da09d41e", "metadata": { "editable": true }, @@ -5009,7 +4993,7 @@ }, { "cell_type": "markdown", - "id": "d0966284", + "id": "a73ae19a", "metadata": { "editable": true }, @@ -5019,7 +5003,7 @@ }, { "cell_type": "markdown", - "id": "1a7843be", + "id": "bbb0e3c0", "metadata": { "editable": true }, @@ -5031,7 +5015,7 @@ }, { "cell_type": "markdown", - "id": "adfa15d4", + "id": "51489d15", "metadata": { "editable": true }, @@ -5043,7 +5027,7 @@ }, { "cell_type": "markdown", - "id": "fb15d1dc", + "id": "7e1c308b", "metadata": { "editable": true }, @@ -5059,7 +5043,7 @@ }, { "cell_type": "markdown", - "id": "e4b5661c", + "id": "f8de0f57", "metadata": { "editable": true }, @@ -5071,7 +5055,7 @@ }, { "cell_type": "markdown", - "id": "b7570129", + "id": "d2cb6d29", "metadata": { "editable": true }, @@ -5083,7 +5067,7 @@ }, { "cell_type": "markdown", - "id": "3e7bf848", + "id": "1687106e", "metadata": { "editable": true }, @@ -5093,7 +5077,7 @@ }, { "cell_type": "markdown", - "id": "c0cae388", + "id": "84ae6921", "metadata": { "editable": true }, @@ -5105,7 +5089,7 @@ }, { "cell_type": "markdown", - "id": "c31d2ec1", + "id": "a18bbb0b", "metadata": { "editable": true }, @@ -5115,7 +5099,7 @@ }, { "cell_type": "markdown", - "id": "8a042114", + "id": "5cd013a1", "metadata": { "editable": true }, @@ -5127,7 +5111,7 @@ }, { "cell_type": "markdown", - "id": "c8dd1f43", + "id": "f369ea50", "metadata": { "editable": true }, @@ -5144,7 +5128,7 @@ }, { "cell_type": "markdown", - "id": "9b3f8065", + "id": "dbc46dac", "metadata": { "editable": true }, @@ -5156,7 +5140,7 @@ }, { "cell_type": "markdown", - "id": "ef612450", + "id": "67c74718", "metadata": { "editable": true }, @@ -5168,7 +5152,7 @@ }, { "cell_type": "markdown", - "id": "7c26f84c", + "id": "4c03c75b", "metadata": { "editable": true }, @@ -5178,7 +5162,7 @@ }, { "cell_type": "markdown", - "id": "deb5efc8", + "id": "d51e1346", "metadata": { "editable": true }, @@ -5190,7 +5174,7 @@ }, { "cell_type": "markdown", - "id": "59fc5b8c", + "id": "3e83948b", "metadata": { "editable": true }, @@ -5200,7 +5184,7 @@ }, { "cell_type": "markdown", - "id": "de086bdf", + "id": "0dd2fc65", "metadata": { "editable": true }, @@ -5212,7 +5196,7 @@ }, { "cell_type": "markdown", - "id": "76ab083a", + "id": "ff8fbae7", "metadata": { "editable": true }, @@ -5222,7 +5206,7 @@ }, { "cell_type": "markdown", - "id": "2ef9639e", + "id": "bc8ce3ca", "metadata": { "editable": true }, @@ -5234,7 +5218,7 @@ }, { "cell_type": "markdown", - "id": "8f738ddd", + "id": "f0b4e0cc", "metadata": { "editable": true }, @@ -5244,7 +5228,7 @@ }, { "cell_type": "markdown", - "id": "cdd885c7", + "id": "f51a973b", "metadata": { "editable": true }, @@ -5256,7 +5240,7 @@ }, { "cell_type": "markdown", - "id": "9c83d2d2", + "id": "63682d83", "metadata": { "editable": true }, @@ -5325,7 +5309,7 @@ }, { "cell_type": "markdown", - "id": "a3f63706", + "id": "44645870", "metadata": { "editable": true }, @@ -5339,7 +5323,7 @@ { "cell_type": "code", "execution_count": 31, - "id": "8421f9d3", + "id": "419d6ce7", "metadata": { "collapsed": false, "editable": true @@ -5352,7 +5336,7 @@ }, { "cell_type": "markdown", - "id": "0c699dd6", + "id": "5a2ff45c", "metadata": { "editable": true }, @@ -5366,7 +5350,7 @@ }, { "cell_type": "markdown", - "id": "e20cd123", + "id": "cfdb14a7", "metadata": { "editable": true }, @@ -5379,7 +5363,7 @@ }, { "cell_type": "markdown", - "id": "0e1369e7", + "id": "6589944b", "metadata": { "editable": true }, @@ -5390,7 +5374,7 @@ }, { "cell_type": "markdown", - "id": "ddfa367f", + "id": "2fe64c31", "metadata": { "editable": true }, @@ -5402,7 +5386,7 @@ }, { "cell_type": "markdown", - "id": "8bc8d7fd", + "id": "7aa7b27a", "metadata": { "editable": true }, @@ -5412,7 +5396,7 @@ }, { "cell_type": "markdown", - "id": "24172917", + "id": "af75a4c6", "metadata": { "editable": true }, @@ -5424,7 +5408,7 @@ }, { "cell_type": "markdown", - "id": "f608ae38", + "id": "5eb599ea", "metadata": { "editable": true }, @@ -5440,7 +5424,7 @@ { "cell_type": "code", "execution_count": 32, - "id": "81910be1", + "id": "4ed9167a", "metadata": { "collapsed": false, "editable": true @@ -5491,7 +5475,7 @@ }, { "cell_type": "markdown", - "id": "1d82d859", + "id": "28e4a11c", "metadata": { "editable": true }, @@ -5501,7 +5485,7 @@ }, { "cell_type": "markdown", - "id": "5a3b1e5f", + "id": "1ac51d89", "metadata": { "editable": true }, @@ -5547,7 +5531,7 @@ { "cell_type": "code", "execution_count": 33, - "id": "2b448f0a", + "id": "9d7a34d3", "metadata": { "collapsed": false, "editable": true @@ -5560,7 +5544,7 @@ }, { "cell_type": "markdown", - "id": "b1254a82", + "id": "32f9f5ab", "metadata": { "editable": true }, @@ -5571,7 +5555,7 @@ { "cell_type": "code", "execution_count": 34, - "id": "5b9a4e29", + "id": "9bc9826c", "metadata": { "collapsed": false, "editable": true @@ -5586,7 +5570,7 @@ }, { "cell_type": "markdown", - "id": "19bea021", + "id": "23ec3500", "metadata": { "editable": true }, @@ -5604,7 +5588,7 @@ { "cell_type": "code", "execution_count": 35, - "id": "6805f59c", + "id": "9de87124", "metadata": { "collapsed": false, "editable": true @@ -5621,7 +5605,7 @@ }, { "cell_type": "markdown", - "id": "ce5c4c36", + "id": "b879c3e8", "metadata": { "editable": true }, @@ -5631,7 +5615,7 @@ }, { "cell_type": "markdown", - "id": "84f668a3", + "id": "86795200", "metadata": { "editable": true }, @@ -5642,7 +5626,7 @@ }, { "cell_type": "markdown", - "id": "03471e71", + "id": "5ef7cd1a", "metadata": { "editable": true }, @@ -5653,7 +5637,7 @@ }, { "cell_type": "markdown", - "id": "e38cffc4", + "id": "5a607c80", "metadata": { "editable": true }, @@ -5664,7 +5648,7 @@ }, { "cell_type": "markdown", - "id": "90a28f19", + "id": "f01bfffb", "metadata": { "editable": true }, @@ -5687,7 +5671,7 @@ { "cell_type": "code", "execution_count": 36, - "id": "93442470", + "id": "a10a0c7b", "metadata": { "collapsed": false, "editable": true @@ -5700,7 +5684,7 @@ }, { "cell_type": "markdown", - "id": "58a899a4", + "id": "5a3f95a5", "metadata": { "editable": true }, @@ -5715,7 +5699,7 @@ { "cell_type": "code", "execution_count": 37, - "id": "8fac469f", + "id": "ae42653e", "metadata": { "collapsed": false, "editable": true @@ -5795,7 +5779,7 @@ }, { "cell_type": "markdown", - "id": "996d0dea", + "id": "15088d89", "metadata": { "editable": true }, @@ -5810,7 +5794,7 @@ }, { "cell_type": "markdown", - "id": "a0386617", + "id": "bd5959cb", "metadata": { "editable": true }, @@ -5823,7 +5807,7 @@ }, { "cell_type": "markdown", - "id": "2775a9e2", + "id": "673ce1ea", "metadata": { "editable": true }, @@ -5834,7 +5818,7 @@ }, { "cell_type": "markdown", - "id": "3815c458", + "id": "65a5f4fb", "metadata": { "editable": true }, @@ -5846,7 +5830,7 @@ }, { "cell_type": "markdown", - "id": "43e9577c", + "id": "ddca5918", "metadata": { "editable": true }, @@ -5856,7 +5840,7 @@ }, { "cell_type": "markdown", - "id": "abb9f550", + "id": "d225bbe1", "metadata": { "editable": true }, @@ -5868,7 +5852,7 @@ }, { "cell_type": "markdown", - "id": "9846ae04", + "id": "f00b2ce8", "metadata": { "editable": true }, @@ -5878,7 +5862,7 @@ }, { "cell_type": "markdown", - "id": "6e96d363", + "id": "c1adf677", "metadata": { "editable": true }, @@ -5900,7 +5884,7 @@ }, { "cell_type": "markdown", - "id": "8f5c0d85", + "id": "14b346d4", "metadata": { "editable": true }, @@ -5912,7 +5896,7 @@ }, { "cell_type": "markdown", - "id": "54208ff2", + "id": "17e71493", "metadata": { "editable": true }, @@ -5922,7 +5906,7 @@ }, { "cell_type": "markdown", - "id": "d39a279c", + "id": "86e987b5", "metadata": { "editable": true }, @@ -5934,7 +5918,7 @@ }, { "cell_type": "markdown", - "id": "af3be252", + "id": "17de1b27", "metadata": { "editable": true }, @@ -5944,7 +5928,7 @@ }, { "cell_type": "markdown", - "id": "fb8e3e2e", + "id": "f563e336", "metadata": { "editable": true }, @@ -5956,7 +5940,7 @@ }, { "cell_type": "markdown", - "id": "e668e9d3", + "id": "412c7346", "metadata": { "editable": true }, @@ -5969,7 +5953,7 @@ }, { "cell_type": "markdown", - "id": "58d71bb9", + "id": "2f1679ed", "metadata": { "editable": true }, @@ -5981,7 +5965,7 @@ }, { "cell_type": "markdown", - "id": "d88d6562", + "id": "7c8da0b5", "metadata": { "editable": true }, @@ -5991,7 +5975,7 @@ }, { "cell_type": "markdown", - "id": "1be31271", + "id": "d054a2b4", "metadata": { "editable": true }, @@ -6003,7 +5987,7 @@ }, { "cell_type": "markdown", - "id": "0e59c516", + "id": "beafad7d", "metadata": { "editable": true }, @@ -6013,7 +5997,7 @@ }, { "cell_type": "markdown", - "id": "50006207", + "id": "e64d5113", "metadata": { "editable": true }, @@ -6025,7 +6009,7 @@ }, { "cell_type": "markdown", - "id": "0909166d", + "id": "2434c10a", "metadata": { "editable": true }, @@ -6035,7 +6019,7 @@ }, { "cell_type": "markdown", - "id": "5c03ab70", + "id": "ae7de129", "metadata": { "editable": true }, diff --git a/doc/src/week35/week35.do.txt b/doc/src/week35/week35.do.txt index bccdd2ccc..a99e49d4f 100644 --- a/doc/src/week35/week35.do.txt +++ b/doc/src/week35/week35.do.txt @@ -6,11 +6,8 @@ DATE: today !split ===== Plans for week 35 ===== -* Lab Wednesday: Work on exercises 1-5 for week 35, see end of these slides for the exercises. -* Thursday: Review of ordinary Least Squares with applications, reminder on statistics and start discussion of Ridge Regression and Singular Value Decomposition - * Video of lecture at URL:"https://youtu.be/jYdg2xzKa5E" -* Friday: Discussion of Ridge and Lasso Regression and links with Singular Value Decomposition - * Video of lecture at URL:"https://youtu.be/07e-SUYRzM0" +* Review of ordinary Least Squares with applications. Discussion of Ridge and Lasso Regression and links with Singular Value Decomposition +* Exercises and hands-on demonstrations === Reading recommendations: === o See lecture notes for week 35 at URL:"https://compphysics.github.io/MachineLearning/doc/web/course.html" o For a review on statistics see jupyter-book URL:"https://compphysics.github.io/MachineLearning/doc/LectureNotes/_build/html/statistics.html", the most relevant parts are covered by sections 1.1.1-1.1.5 @@ -22,14 +19,14 @@ DATE: today !split -===== Thursday September 1 ===== +===== Topics of week 35 ===== -The main topics on Thursday are: +The main topics are: o Repetition from last week on linear regression o Reminder on statistics with quantities like mean values, variance abd covariance o Discussion of how to prepare data and examples of applications of linear regression o Mathematical interpretations of Linear Regression -o Start discussing Ridge and Lasso regression and Singular Value Decomposition, to be continued Friday +o Start discussing Ridge and Lasso regression and Singular Value Decomposition @@ -1577,11 +1574,6 @@ example -!split -===== Friday September 2 ===== - - - !split ===== Mathematics of the SVD and implications =====