From ae5eef060d7a17417088897751e634d6d6e6c0f8 Mon Sep 17 00:00:00 2001 From: Morten Hjorth-Jensen Date: Fri, 3 Sep 2021 08:01:53 +0200 Subject: [PATCH] update week 35 --- doc/pub/week35/html/week35-bs.html | 2 +- doc/pub/week35/html/week35-reveal.html | 8 +- doc/pub/week35/html/week35-solarized.html | 8 +- doc/pub/week35/html/week35.html | 8 +- doc/pub/week35/ipynb/ipynb-week35-src.tar.gz | Bin 190 -> 190 bytes doc/pub/week35/ipynb/week35.ipynb | 720 ++++--------------- doc/src/week35/week35.do.txt | 6 +- 7 files changed, 167 insertions(+), 585 deletions(-) diff --git a/doc/pub/week35/html/week35-bs.html b/doc/pub/week35/html/week35-bs.html index d51303b66..e9bf66d4e 100644 --- a/doc/pub/week35/html/week35-bs.html +++ b/doc/pub/week35/html/week35-bs.html @@ -374,7 +374,7 @@ MathJax.Hub.Config({
[2] Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory, Michigan State University

-

Sep 2, 2021

+

Sep 3, 2021


diff --git a/doc/pub/week35/html/week35-reveal.html b/doc/pub/week35/html/week35-reveal.html index 6dac064c5..b73fa4832 100644 --- a/doc/pub/week35/html/week35-reveal.html +++ b/doc/pub/week35/html/week35-reveal.html @@ -148,7 +148,7 @@ MathJax.Hub.Config({

[2] Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory, Michigan State University

 
-

Sep 2, 2021

+

Sep 3, 2021


@@ -162,9 +162,9 @@ MathJax.Hub.Config({

Plans for week 35, August 30 -September 3

@@ -1972,7 +1972,7 @@ If you wish to include the zero singular values, you will need to resize the mat Video of Lecture from 2020 and handwritten notes

-More material will be added here, see handwritten notes also. +More material will be added here, see handwritten notes also. Note that this material will be cleaned up after the lecture of Friday September 3. See the handwritten notes from Friday's lecture at https://github.com/CompPhysics/MachineLearning/tree/master/doc/HandWrittenNotes/2021. diff --git a/doc/pub/week35/html/week35-solarized.html b/doc/pub/week35/html/week35-solarized.html index a73ad2ca8..1c55e0e31 100644 --- a/doc/pub/week35/html/week35-solarized.html +++ b/doc/pub/week35/html/week35-solarized.html @@ -300,7 +300,7 @@ MathJax.Hub.Config({

[2] Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory, Michigan State University

-

Sep 2, 2021

+

Sep 3, 2021












@@ -308,9 +308,9 @@ MathJax.Hub.Config({

Plans for week 35, August 30 -September 3











@@ -2032,7 +2032,7 @@ If you wish to include the zero singular values, you will need to resize the mat Video of Lecture from 2020 and handwritten notes

-More material will be added here, see handwritten notes also. +More material will be added here, see handwritten notes also. Note that this material will be cleaned up after the lecture of Friday September 3. See the handwritten notes from Friday's lecture at https://github.com/CompPhysics/MachineLearning/tree/master/doc/HandWrittenNotes/2021.











diff --git a/doc/pub/week35/html/week35.html b/doc/pub/week35/html/week35.html index d238835b5..3b8ae81f9 100644 --- a/doc/pub/week35/html/week35.html +++ b/doc/pub/week35/html/week35.html @@ -305,7 +305,7 @@ MathJax.Hub.Config({

[2] Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory, Michigan State University

-

Sep 2, 2021

+

Sep 3, 2021












@@ -313,9 +313,9 @@ MathJax.Hub.Config({

Plans for week 35, August 30 -September 3











@@ -2037,7 +2037,7 @@ If you wish to include the zero singular values, you will need to resize the mat Video of Lecture from 2020 and handwritten notes

-More material will be added here, see handwritten notes also. +More material will be added here, see handwritten notes also. Note that this material will be cleaned up after the lecture of Friday September 3. See the handwritten notes from Friday's lecture at https://github.com/CompPhysics/MachineLearning/tree/master/doc/HandWrittenNotes/2021.











diff --git a/doc/pub/week35/ipynb/ipynb-week35-src.tar.gz b/doc/pub/week35/ipynb/ipynb-week35-src.tar.gz index 112a269889c0415936ca5bcfa93735bfea0d0883..c6218905a2404e4aed5eb85bf91418fa0cd7f25f 100644 GIT binary patch literal 190 zcmV;v073sBiwFQgx-nq@1MSbv3c@f92k@Qu6nTQtxNe>WJ$MjAe1VQ-uFkcy?a;lw z`v5&DUWN$$UH*iGkQ_Fv^==cny9;K+7)v>aA(v?~CRhx zPI_sr6Q)0OkbVbW$sE2^*tNM$|S6fBlT-d7k&R2V#NN>i`G<0OX!kYybcN literal 190 zcmV;v073sBiwFSf;4onT1MSbz3W6{c24Js!it_}rsk7@KFS-aKdVz_@T;^umq*P`;~kWmWZ|&%6pe^G_UWVPLx-Y^@|nWwB7Ifg56zut;=+ETB|q s#xKx#?S)3*asXbI!U`q%CG501Y2KPB{Pi-P=Xu`O9{>M>Qve760Fw1s*8l(j diff --git a/doc/pub/week35/ipynb/week35.ipynb b/doc/pub/week35/ipynb/week35.ipynb index de001d307..1ea40642f 100644 --- a/doc/pub/week35/ipynb/week35.ipynb +++ b/doc/pub/week35/ipynb/week35.ipynb @@ -10,7 +10,7 @@ " \n", "**Morten Hjorth-Jensen**, Department of Physics, University of Oslo and Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory, Michigan State University\n", "\n", - "Date: **Sep 2, 2021**\n", + "Date: **Sep 3, 2021**\n", "\n", "Copyright 1999-2021, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license\n", "\n", @@ -19,11 +19,11 @@ "\n", "## Plans for week 35, August 30 -September 3\n", "\n", - "* Thursday: Review of ordinary Least Squares with applications and discussion of Ridge Regression\n", + "* Thursday: Review of ordinary Least Squares with applications and discussion of Ridge Regression and Singular Value Decomposition\n", "\n", "* [Video of lecture Thursday](https://www.uio.no/studier/emner/matnat/fys/FYS-STK3155/h21/forelesningsvideoer/LectureSeptember2.mp4?vrtx=view-as-webpage).\n", "\n", - "* Friday: Analysis of Ridge and Lasso Regression\n", + "* Friday: Analysis of Ridge and Lasso Regression and links with Singular Value Decomposition\n", "\n", "## Thursday September 2\n", "\n", @@ -400,7 +400,10 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": false, + "editable": true + }, "outputs": [], "source": [ "%matplotlib inline\n", @@ -943,7 +946,10 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": false, + "editable": true + }, "outputs": [], "source": [ "# matrix inversion to find beta\n", @@ -962,7 +968,10 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": false, + "editable": true + }, "outputs": [], "source": [ "fit = np.linalg.lstsq(X, Energies, rcond =None)[0]\n", @@ -979,7 +988,10 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": false, + "editable": true + }, "outputs": [], "source": [ "Masses['Eapprox'] = ytilde\n", @@ -1009,7 +1021,10 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": false, + "editable": true + }, "outputs": [], "source": [ "def R2(y_data, y_model):\n", @@ -1026,7 +1041,10 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": false, + "editable": true + }, "outputs": [], "source": [ "print(R2(Energies,ytilde))" @@ -1042,7 +1060,10 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": false, + "editable": true + }, "outputs": [], "source": [ "def MSE(y_data,y_model):\n", @@ -1062,7 +1083,10 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": false, + "editable": true + }, "outputs": [], "source": [ "def RelativeError(y_data,y_model):\n", @@ -1097,7 +1121,10 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": false, + "editable": true + }, "outputs": [], "source": [ "import os\n", @@ -1150,7 +1177,10 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": false, + "editable": true + }, "outputs": [], "source": [ "# equivalently in numpy\n", @@ -1222,7 +1252,10 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": false, + "editable": true + }, "outputs": [], "source": [ "import numpy as np\n", @@ -1242,7 +1275,10 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": false, + "editable": true + }, "outputs": [], "source": [ "from sklearn.datasets import load_boston\n", @@ -1264,7 +1300,10 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": false, + "editable": true + }, "outputs": [], "source": [ "boston = pd.DataFrame(boston_dataset.data, columns=boston_dataset.feature_names)\n", @@ -1282,7 +1321,10 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": false, + "editable": true + }, "outputs": [], "source": [ "# check for missing values in all the columns\n", @@ -1299,7 +1341,10 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": false, + "editable": true + }, "outputs": [], "source": [ "# set the size of the figure\n", @@ -1320,7 +1365,10 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": false, + "editable": true + }, "outputs": [], "source": [ "# compute the pair wise correlation for all columns \n", @@ -1340,7 +1388,10 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": false, + "editable": true + }, "outputs": [], "source": [ "plt.figure(figsize=(20, 5))\n", @@ -1368,7 +1419,10 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": false, + "editable": true + }, "outputs": [], "source": [ "X = pd.DataFrame(np.c_[boston['LSTAT'], boston['RM']], columns = ['LSTAT','RM'])\n", @@ -1385,7 +1439,10 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": false, + "editable": true + }, "outputs": [], "source": [ "from sklearn.model_selection import train_test_split\n", @@ -1409,7 +1466,10 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": false, + "editable": true + }, "outputs": [], "source": [ "from sklearn.linear_model import LinearRegression\n", @@ -1448,7 +1508,10 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": false, + "editable": true + }, "outputs": [], "source": [ "# plotting the y_test vs y_pred\n", @@ -1575,418 +1638,12 @@ }, { "cell_type": "code", - "execution_count": 25, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "

\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
01234
0-1.7497650.3426801.153036-0.2524360.981321
10.5142190.221180-1.070043-0.1894960.255001
2-0.4580270.435163-0.5835950.8168470.672721
3-0.104411-0.5312801.029733-0.438136-1.118318
41.6189821.541605-0.251879-0.8424360.184519
50.9370820.7310001.361556-0.3262380.055676
60.222400-1.443217-0.7563520.8164540.750445
7-0.4559471.189622-1.690617-1.356399-1.232435
8-0.544439-0.6681720.007315-0.6129391.299748
9-1.733096-0.9833100.357508-1.6135791.470714
\n", - "
" - ], - "text/plain": [ - " 0 1 2 3 4\n", - "0 -1.749765 0.342680 1.153036 -0.252436 0.981321\n", - "1 0.514219 0.221180 -1.070043 -0.189496 0.255001\n", - "2 -0.458027 0.435163 -0.583595 0.816847 0.672721\n", - "3 -0.104411 -0.531280 1.029733 -0.438136 -1.118318\n", - "4 1.618982 1.541605 -0.251879 -0.842436 0.184519\n", - "5 0.937082 0.731000 1.361556 -0.326238 0.055676\n", - "6 0.222400 -1.443217 -0.756352 0.816454 0.750445\n", - "7 -0.455947 1.189622 -1.690617 -1.356399 -1.232435\n", - "8 -0.544439 -0.668172 0.007315 -0.612939 1.299748\n", - "9 -1.733096 -0.983310 0.357508 -1.613579 1.470714" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0 -0.175300\n", - "1 0.083527\n", - "2 -0.044334\n", - "3 -0.399836\n", - "4 0.331939\n", - "dtype: float64\n", - "0 1.069584\n", - "1 0.965548\n", - "2 1.018232\n", - "3 0.793167\n", - "4 0.918992\n", - "dtype: float64\n" - ] - }, - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
01234
0-1.5744650.2591531.1973700.1474000.649382
10.6895190.137652-1.0257090.210340-0.076938
2-0.2827270.351636-0.5392611.2166830.340782
30.070889-0.6148081.074067-0.038300-1.450257
41.7942821.458078-0.207545-0.442600-0.147420
51.1123830.6474731.4058900.073598-0.276263
60.397700-1.526744-0.7120181.2162900.418506
7-0.2806471.106095-1.646283-0.956563-1.564374
8-0.369139-0.7516990.051649-0.2131030.967809
9-1.557795-1.0668370.401842-1.2137431.138775
\n", - "
" - ], - "text/plain": [ - " 0 1 2 3 4\n", - "0 -1.574465 0.259153 1.197370 0.147400 0.649382\n", - "1 0.689519 0.137652 -1.025709 0.210340 -0.076938\n", - "2 -0.282727 0.351636 -0.539261 1.216683 0.340782\n", - "3 0.070889 -0.614808 1.074067 -0.038300 -1.450257\n", - "4 1.794282 1.458078 -0.207545 -0.442600 -0.147420\n", - "5 1.112383 0.647473 1.405890 0.073598 -0.276263\n", - "6 0.397700 -1.526744 -0.712018 1.216290 0.418506\n", - "7 -0.280647 1.106095 -1.646283 -0.956563 -1.564374\n", - "8 -0.369139 -0.751699 0.051649 -0.213103 0.967809\n", - "9 -1.557795 -1.066837 0.401842 -1.213743 1.138775" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
01234
00.00.00.00.00.0
10.00.00.00.00.0
20.00.00.00.00.0
30.00.00.00.00.0
40.00.00.00.00.0
50.00.00.00.00.0
60.00.00.00.00.0
70.00.00.00.00.0
80.00.00.00.00.0
90.00.00.00.00.0
\n", - "
" - ], - "text/plain": [ - " 0 1 2 3 4\n", - "0 0.0 0.0 0.0 0.0 0.0\n", - "1 0.0 0.0 0.0 0.0 0.0\n", - "2 0.0 0.0 0.0 0.0 0.0\n", - "3 0.0 0.0 0.0 0.0 0.0\n", - "4 0.0 0.0 0.0 0.0 0.0\n", - "5 0.0 0.0 0.0 0.0 0.0\n", - "6 0.0 0.0 0.0 0.0 0.0\n", - "7 0.0 0.0 0.0 0.0 0.0\n", - "8 0.0 0.0 0.0 0.0 0.0\n", - "9 0.0 0.0 0.0 0.0 0.0" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "execution_count": null, + "metadata": { + "collapsed": false, + "editable": true + }, + "outputs": [], "source": [ "import sklearn.linear_model as skl\n", "from sklearn.metrics import mean_squared_error\n", @@ -2055,7 +1712,10 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": false, + "editable": true + }, "outputs": [], "source": [ "np.random.seed()\n", @@ -2078,7 +1738,10 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": false, + "editable": true + }, "outputs": [], "source": [ "import matplotlib.pyplot as plt\n", @@ -2129,7 +1792,10 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": false, + "editable": true + }, "outputs": [], "source": [ "# Common imports\n", @@ -2692,7 +2358,10 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": false, + "editable": true + }, "outputs": [], "source": [ "import numpy as np\n", @@ -2762,7 +2431,7 @@ "\n", "[Video of Lecture from 2020](https://www.uio.no/studier/emner/matnat/fys/FYS-STK4155/h20/forelesningsvideoer/LectureSeptember11.mp4?vrtx=view-as-webpage) and [handwritten notes](https://github.com/CompPhysics/MachineLearning/blob/master/doc/HandWrittenNotes/NotesSeptember11.pdf)\n", "\n", - "More material will be added here, see handwritten notes also.\n", + "More material will be added here, see handwritten notes also. Note that this material will be cleaned up after the lecture of Friday September 3. See the handwritten notes from Friday's lecture at .\n", "\n", "\n", "## Ridge and LASSO Regression\n", @@ -3393,20 +3062,12 @@ }, { "cell_type": "code", - "execution_count": 26, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "-0.22501987939529708\n", - "3.4265364730355325\n", - "[[1.06251574 3.06513214]\n", - " [3.06513214 9.90295583]]\n" - ] - } - ], + "execution_count": null, + "metadata": { + "collapsed": false, + "editable": true + }, + "outputs": [], "source": [ "# Importing various packages\n", "import numpy as np\n", @@ -3435,20 +3096,12 @@ }, { "cell_type": "code", - "execution_count": 27, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0.080263294546264\n", - "2.011002230765845\n", - "[[1. 0.7136592]\n", - " [0.7136592 1. ]]\n" - ] - } - ], + "execution_count": null, + "metadata": { + "collapsed": false, + "editable": true + }, + "outputs": [], "source": [ "import numpy as np\n", "n = 100\n", @@ -3490,40 +3143,12 @@ }, { "cell_type": "code", - "execution_count": 28, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "[[-0.31787985 -1.14338084]\n", - " [ 0.04529807 -0.18207237]\n", - " [ 1.11176315 3.45031813]\n", - " [-1.91097714 -5.2907413 ]\n", - " [-0.19918861 1.18654759]\n", - " [ 0.84454053 2.34712647]\n", - " [ 0.82299467 1.93582947]\n", - " [-1.64434822 -5.13289015]\n", - " [ 1.10923753 3.75337971]\n", - " [ 0.13855987 -0.92411672]]\n", - " 0 1\n", - "0 -0.317880 -1.143381\n", - "1 0.045298 -0.182072\n", - "2 1.111763 3.450318\n", - "3 -1.910977 -5.290741\n", - "4 -0.199189 1.186548\n", - "5 0.844541 2.347126\n", - "6 0.822995 1.935829\n", - "7 -1.644348 -5.132890\n", - "8 1.109238 3.753380\n", - "9 0.138560 -0.924117\n", - " 0 1\n", - "0 1.000000 0.968568\n", - "1 0.968568 1.000000\n" - ] - } - ], + "execution_count": null, + "metadata": { + "collapsed": false, + "editable": true + }, + "outputs": [], "source": [ "import numpy as np\n", "import pandas as pd\n", @@ -3551,49 +3176,12 @@ }, { "cell_type": "code", - "execution_count": 29, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - " 0 1 2 3 4 5 6 7 \\\n", - "0 0.0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 \n", - "1 0.0 0.063613 0.068251 0.071169 0.070546 0.069425 0.067581 0.065899 \n", - "2 0.0 0.068251 0.073991 0.077286 0.077098 0.076290 0.073977 0.072493 \n", - "3 0.0 0.071169 0.077286 0.083456 0.083469 0.082851 0.081789 0.080312 \n", - "4 0.0 0.070546 0.077098 0.083469 0.083869 0.083597 0.082364 0.081188 \n", - "5 0.0 0.069425 0.076290 0.082851 0.083597 0.083643 0.082304 0.081413 \n", - "6 0.0 0.067581 0.073977 0.081789 0.082364 0.082304 0.082005 0.080988 \n", - "7 0.0 0.065899 0.072493 0.080312 0.081188 0.081413 0.080988 0.080245 \n", - "8 0.0 0.064203 0.070945 0.078766 0.079908 0.080389 0.079865 0.079371 \n", - "9 0.0 0.062545 0.069397 0.077214 0.078591 0.079301 0.078699 0.078431 \n", - "10 0.0 0.061809 0.068087 0.076517 0.077496 0.077870 0.078063 0.077474 \n", - "11 0.0 0.060077 0.066459 0.074794 0.076005 0.076605 0.076675 0.076314 \n", - "12 0.0 0.058442 0.064904 0.073149 0.074564 0.075366 0.075332 0.075177 \n", - "13 0.0 0.056909 0.063432 0.071590 0.073188 0.074169 0.074047 0.074077 \n", - "14 0.0 0.055478 0.062046 0.070123 0.071881 0.073022 0.072826 0.073022 \n", - "\n", - " 8 9 10 11 12 13 14 \n", - "0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 \n", - "1 0.064203 0.062545 0.061809 0.060077 0.058442 0.056909 0.055478 \n", - "2 0.070945 0.069397 0.068087 0.066459 0.064904 0.063432 0.062046 \n", - "3 0.078766 0.077214 0.076517 0.074794 0.073149 0.071590 0.070123 \n", - "4 0.079908 0.078591 0.077496 0.076005 0.074564 0.073188 0.071881 \n", - "5 0.080389 0.079301 0.077870 0.076605 0.075366 0.074169 0.073022 \n", - "6 0.079865 0.078699 0.078063 0.076675 0.075332 0.074047 0.072826 \n", - "7 0.079371 0.078431 0.077474 0.076314 0.075177 0.074077 0.073022 \n", - "8 0.078726 0.077994 0.076758 0.075809 0.074861 0.073933 0.073033 \n", - "9 0.077994 0.077452 0.075974 0.075216 0.074443 0.073672 0.072915 \n", - "10 0.076758 0.075974 0.075342 0.074315 0.073305 0.072325 0.071384 \n", - "11 0.075809 0.075216 0.074315 0.073486 0.072655 0.071838 0.071044 \n", - "12 0.074861 0.074443 0.073305 0.072655 0.071987 0.071318 0.070658 \n", - "13 0.073933 0.073672 0.072325 0.071838 0.071318 0.070783 0.070245 \n", - "14 0.073033 0.072915 0.071384 0.071044 0.070658 0.070245 0.069818 \n" - ] - } - ], + "execution_count": null, + "metadata": { + "collapsed": false, + "editable": true + }, + "outputs": [], "source": [ "# Common imports\n", "import numpy as np\n", @@ -3883,7 +3471,10 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": false, + "editable": true + }, "outputs": [], "source": [ "x = np.random.rand(100)\n", @@ -3905,7 +3496,10 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": false, + "editable": true + }, "outputs": [], "source": [ "import os\n", @@ -4100,7 +3694,10 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": false, + "editable": true + }, "outputs": [], "source": [ "from mpl_toolkits.mplot3d import Axes3D\n", @@ -4218,7 +3815,10 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": false, + "editable": true + }, "outputs": [], "source": [ "def FrankeFunction(x,y):\n", @@ -4276,25 +3876,7 @@ ] } ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.8.5" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 4 } diff --git a/doc/src/week35/week35.do.txt b/doc/src/week35/week35.do.txt index 16b47061b..13bb7abf1 100644 --- a/doc/src/week35/week35.do.txt +++ b/doc/src/week35/week35.do.txt @@ -6,10 +6,10 @@ DATE: today !split ===== Plans for week 35, August 30 -September 3 ===== -* Thursday: Review of ordinary Least Squares with applications and discussion of Ridge Regression +* Thursday: Review of ordinary Least Squares with applications and discussion of Ridge Regression and Singular Value Decomposition * "Video of lecture Thursday":"https://www.uio.no/studier/emner/matnat/fys/FYS-STK3155/h21/forelesningsvideoer/LectureSeptember2.mp4?vrtx=view-as-webpage". -* Friday: Analysis of Ridge and Lasso Regression +* Friday: Analysis of Ridge and Lasso Regression and links with Singular Value Decomposition @@ -1544,7 +1544,7 @@ If you wish to include the zero singular values, you will need to resize the mat "Video of Lecture from 2020":"https://www.uio.no/studier/emner/matnat/fys/FYS-STK4155/h20/forelesningsvideoer/LectureSeptember11.mp4?vrtx=view-as-webpage" and "handwritten notes":"https://github.com/CompPhysics/MachineLearning/blob/master/doc/HandWrittenNotes/NotesSeptember11.pdf" -More material will be added here, see handwritten notes also. +More material will be added here, see handwritten notes also. Note that this material will be cleaned up after the lecture of Friday September 3. See the handwritten notes from Friday's lecture at URL:"https://github.com/CompPhysics/MachineLearning/tree/master/doc/HandWrittenNotes/2021". !split