diff --git a/doc/pub/week34/html/._week34-bs004.html b/doc/pub/week34/html/._week34-bs004.html
index 0c5e407f3..c00fd6297 100644
--- a/doc/pub/week34/html/._week34-bs004.html
+++ b/doc/pub/week34/html/._week34-bs004.html
@@ -363,7 +363,7 @@ MathJax.Hub.Config({
diff --git a/doc/pub/week34/html/week34-reveal.html b/doc/pub/week34/html/week34-reveal.html
index cdedc490b..cf5266a0d 100644
--- a/doc/pub/week34/html/week34-reveal.html
+++ b/doc/pub/week34/html/week34-reveal.html
@@ -266,7 +266,7 @@ MathJax.Hub.Config({
diff --git a/doc/pub/week34/html/week34-solarized.html b/doc/pub/week34/html/week34-solarized.html
index fe1baaee7..ae165af13 100644
--- a/doc/pub/week34/html/week34-solarized.html
+++ b/doc/pub/week34/html/week34-solarized.html
@@ -364,7 +364,7 @@ MathJax.Hub.Config({
diff --git a/doc/pub/week34/html/week34.html b/doc/pub/week34/html/week34.html
index 032efe5e9..7464e7368 100644
--- a/doc/pub/week34/html/week34.html
+++ b/doc/pub/week34/html/week34.html
@@ -441,7 +441,7 @@ MathJax.Hub.Config({
diff --git a/doc/pub/week34/ipynb/ipynb-week34-src.tar.gz b/doc/pub/week34/ipynb/ipynb-week34-src.tar.gz
index 15fe95bbb..1e9c95a60 100644
Binary files a/doc/pub/week34/ipynb/ipynb-week34-src.tar.gz and b/doc/pub/week34/ipynb/ipynb-week34-src.tar.gz differ
diff --git a/doc/pub/week34/ipynb/week34.ipynb b/doc/pub/week34/ipynb/week34.ipynb
index 4707ced88..d83dee88c 100644
--- a/doc/pub/week34/ipynb/week34.ipynb
+++ b/doc/pub/week34/ipynb/week34.ipynb
@@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "markdown",
- "id": "d8570482",
+ "id": "48c00eab",
"metadata": {
"editable": true
},
@@ -14,7 +14,7 @@
},
{
"cell_type": "markdown",
- "id": "ddaa57ec",
+ "id": "db1b1a24",
"metadata": {
"editable": true
},
@@ -27,7 +27,7 @@
},
{
"cell_type": "markdown",
- "id": "577d7041",
+ "id": "d19efc98",
"metadata": {
"editable": true
},
@@ -53,7 +53,7 @@
},
{
"cell_type": "markdown",
- "id": "a840ab67",
+ "id": "d189597f",
"metadata": {
"editable": true
},
@@ -69,7 +69,7 @@
},
{
"cell_type": "markdown",
- "id": "27de713f",
+ "id": "825a4ec7",
"metadata": {
"editable": true
},
@@ -93,7 +93,7 @@
},
{
"cell_type": "markdown",
- "id": "55ae3ac8",
+ "id": "876b5efa",
"metadata": {
"editable": true
},
@@ -102,12 +102,12 @@
"\n",
"* Chat and communications via \n",
"\n",
- "* **Discord** channel at "
+ "* **Discord** channel at "
]
},
{
"cell_type": "markdown",
- "id": "4a623c32",
+ "id": "c50a335d",
"metadata": {
"editable": true
},
@@ -129,7 +129,7 @@
},
{
"cell_type": "markdown",
- "id": "d9da51d7",
+ "id": "a376673a",
"metadata": {
"editable": true
},
@@ -159,7 +159,7 @@
},
{
"cell_type": "markdown",
- "id": "8728c705",
+ "id": "3b67d87b",
"metadata": {
"editable": true
},
@@ -177,7 +177,7 @@
},
{
"cell_type": "markdown",
- "id": "3d9ec708",
+ "id": "e7d3853f",
"metadata": {
"editable": true
},
@@ -205,7 +205,7 @@
},
{
"cell_type": "markdown",
- "id": "871480bb",
+ "id": "850c7caf",
"metadata": {
"editable": true
},
@@ -219,7 +219,7 @@
},
{
"cell_type": "markdown",
- "id": "a8c87243",
+ "id": "a891b041",
"metadata": {
"editable": true
},
@@ -239,7 +239,7 @@
},
{
"cell_type": "markdown",
- "id": "2f11b237",
+ "id": "c5a99082",
"metadata": {
"editable": true
},
@@ -251,7 +251,7 @@
},
{
"cell_type": "markdown",
- "id": "395f3f21",
+ "id": "aae8d51d",
"metadata": {
"editable": true
},
@@ -271,7 +271,7 @@
},
{
"cell_type": "markdown",
- "id": "61492124",
+ "id": "975f1816",
"metadata": {
"editable": true
},
@@ -289,7 +289,7 @@
},
{
"cell_type": "markdown",
- "id": "812029e1",
+ "id": "b5b66391",
"metadata": {
"editable": true
},
@@ -314,7 +314,7 @@
},
{
"cell_type": "markdown",
- "id": "c3f34ebc",
+ "id": "1090bd94",
"metadata": {
"editable": true
},
@@ -350,7 +350,7 @@
},
{
"cell_type": "markdown",
- "id": "ad9be72b",
+ "id": "b15a0a8c",
"metadata": {
"editable": true
},
@@ -366,7 +366,7 @@
},
{
"cell_type": "markdown",
- "id": "d5223803",
+ "id": "c36ae57e",
"metadata": {
"editable": true
},
@@ -388,7 +388,7 @@
},
{
"cell_type": "markdown",
- "id": "7aec73a0",
+ "id": "1ddfaf11",
"metadata": {
"editable": true
},
@@ -406,7 +406,7 @@
},
{
"cell_type": "markdown",
- "id": "0bbc79ec",
+ "id": "35e73ec2",
"metadata": {
"editable": true
},
@@ -450,7 +450,7 @@
},
{
"cell_type": "markdown",
- "id": "a00be925",
+ "id": "8143a2ec",
"metadata": {
"editable": true
},
@@ -493,7 +493,7 @@
},
{
"cell_type": "markdown",
- "id": "fc25df97",
+ "id": "19c7093e",
"metadata": {
"editable": true
},
@@ -513,7 +513,7 @@
},
{
"cell_type": "markdown",
- "id": "dbb9491c",
+ "id": "aac49134",
"metadata": {
"editable": true
},
@@ -586,7 +586,7 @@
},
{
"cell_type": "markdown",
- "id": "850c7101",
+ "id": "9961fbcc",
"metadata": {
"editable": true
},
@@ -615,7 +615,7 @@
},
{
"cell_type": "markdown",
- "id": "4a7cce84",
+ "id": "e1d33c9c",
"metadata": {
"editable": true
},
@@ -633,7 +633,7 @@
},
{
"cell_type": "markdown",
- "id": "99c1ce58",
+ "id": "2349a9f4",
"metadata": {
"editable": true
},
@@ -645,7 +645,7 @@
},
{
"cell_type": "markdown",
- "id": "2d710ff9",
+ "id": "9b27f25e",
"metadata": {
"editable": true
},
@@ -680,7 +680,7 @@
},
{
"cell_type": "markdown",
- "id": "88e20f3b",
+ "id": "520c8a79",
"metadata": {
"editable": true
},
@@ -710,7 +710,7 @@
},
{
"cell_type": "markdown",
- "id": "b6bfb7fc",
+ "id": "38676b60",
"metadata": {
"editable": true
},
@@ -741,7 +741,7 @@
},
{
"cell_type": "markdown",
- "id": "445fc332",
+ "id": "880b2074",
"metadata": {
"editable": true
},
@@ -780,7 +780,7 @@
},
{
"cell_type": "markdown",
- "id": "3b7f25d2",
+ "id": "4becf5c1",
"metadata": {
"editable": true
},
@@ -813,7 +813,7 @@
},
{
"cell_type": "markdown",
- "id": "115137de",
+ "id": "fc093d3f",
"metadata": {
"editable": true
},
@@ -848,7 +848,7 @@
},
{
"cell_type": "markdown",
- "id": "84433689",
+ "id": "3f400290",
"metadata": {
"editable": true
},
@@ -872,7 +872,7 @@
},
{
"cell_type": "markdown",
- "id": "3cf8f118",
+ "id": "3b28eeab",
"metadata": {
"editable": true
},
@@ -899,7 +899,7 @@
},
{
"cell_type": "markdown",
- "id": "0a34dc30",
+ "id": "b4cdbc3b",
"metadata": {
"editable": true
},
@@ -909,7 +909,7 @@
},
{
"cell_type": "markdown",
- "id": "61ccafd9",
+ "id": "1f4e2438",
"metadata": {
"editable": true
},
@@ -921,7 +921,7 @@
},
{
"cell_type": "markdown",
- "id": "16f3eb91",
+ "id": "3d131445",
"metadata": {
"editable": true
},
@@ -942,7 +942,7 @@
},
{
"cell_type": "markdown",
- "id": "39511f3a",
+ "id": "fbf87d17",
"metadata": {
"editable": true
},
@@ -954,7 +954,7 @@
{
"cell_type": "code",
"execution_count": 1,
- "id": "5650afbb",
+ "id": "887fac4a",
"metadata": {
"collapsed": false,
"editable": true
@@ -966,7 +966,7 @@
},
{
"cell_type": "markdown",
- "id": "5c08f01c",
+ "id": "3d5804e8",
"metadata": {
"editable": true
},
@@ -977,7 +977,7 @@
{
"cell_type": "code",
"execution_count": 2,
- "id": "2f0c6337",
+ "id": "5201c32f",
"metadata": {
"collapsed": false,
"editable": true
@@ -991,7 +991,7 @@
},
{
"cell_type": "markdown",
- "id": "aa201e35",
+ "id": "1f25c468",
"metadata": {
"editable": true
},
@@ -1003,7 +1003,7 @@
{
"cell_type": "code",
"execution_count": 3,
- "id": "67a23871",
+ "id": "6fd7c320",
"metadata": {
"collapsed": false,
"editable": true
@@ -1017,7 +1017,7 @@
},
{
"cell_type": "markdown",
- "id": "f89dc6b0",
+ "id": "c481cbcb",
"metadata": {
"editable": true
},
@@ -1029,7 +1029,7 @@
{
"cell_type": "code",
"execution_count": 4,
- "id": "4b360521",
+ "id": "2bc00cfd",
"metadata": {
"collapsed": false,
"editable": true
@@ -1043,7 +1043,7 @@
},
{
"cell_type": "markdown",
- "id": "80f2cf4d",
+ "id": "c1dfa2af",
"metadata": {
"editable": true
},
@@ -1060,7 +1060,7 @@
{
"cell_type": "code",
"execution_count": 5,
- "id": "17d46a18",
+ "id": "2567630a",
"metadata": {
"collapsed": false,
"editable": true
@@ -1077,7 +1077,7 @@
},
{
"cell_type": "markdown",
- "id": "cf0ce553",
+ "id": "130d91c2",
"metadata": {
"editable": true
},
@@ -1089,7 +1089,7 @@
{
"cell_type": "code",
"execution_count": 6,
- "id": "fdbf9b57",
+ "id": "6dcd78a7",
"metadata": {
"collapsed": false,
"editable": true
@@ -1103,7 +1103,7 @@
},
{
"cell_type": "markdown",
- "id": "1116b97e",
+ "id": "6a450783",
"metadata": {
"editable": true
},
@@ -1114,7 +1114,7 @@
{
"cell_type": "code",
"execution_count": 7,
- "id": "c0a3b6b4",
+ "id": "e3f1715b",
"metadata": {
"collapsed": false,
"editable": true
@@ -1128,7 +1128,7 @@
},
{
"cell_type": "markdown",
- "id": "87468918",
+ "id": "9cb3151a",
"metadata": {
"editable": true
},
@@ -1139,7 +1139,7 @@
{
"cell_type": "code",
"execution_count": 8,
- "id": "1c1325bc",
+ "id": "f3fd6e7c",
"metadata": {
"collapsed": false,
"editable": true
@@ -1153,7 +1153,7 @@
},
{
"cell_type": "markdown",
- "id": "49f86d59",
+ "id": "b08214cc",
"metadata": {
"editable": true
},
@@ -1168,7 +1168,7 @@
{
"cell_type": "code",
"execution_count": 9,
- "id": "100cecf7",
+ "id": "18bcb027",
"metadata": {
"collapsed": false,
"editable": true
@@ -1182,7 +1182,7 @@
},
{
"cell_type": "markdown",
- "id": "63628cdf",
+ "id": "55292410",
"metadata": {
"editable": true
},
@@ -1193,7 +1193,7 @@
{
"cell_type": "code",
"execution_count": 10,
- "id": "8c1fca82",
+ "id": "3ef1104a",
"metadata": {
"collapsed": false,
"editable": true
@@ -1208,7 +1208,7 @@
},
{
"cell_type": "markdown",
- "id": "a8aca20c",
+ "id": "415f7aff",
"metadata": {
"editable": true
},
@@ -1219,7 +1219,7 @@
{
"cell_type": "code",
"execution_count": 11,
- "id": "f73b51b0",
+ "id": "428f5058",
"metadata": {
"collapsed": false,
"editable": true
@@ -1234,7 +1234,7 @@
},
{
"cell_type": "markdown",
- "id": "2f2db83c",
+ "id": "1f017f8d",
"metadata": {
"editable": true
},
@@ -1245,7 +1245,7 @@
{
"cell_type": "code",
"execution_count": 12,
- "id": "7b908e17",
+ "id": "dac85861",
"metadata": {
"collapsed": false,
"editable": true
@@ -1261,7 +1261,7 @@
},
{
"cell_type": "markdown",
- "id": "be148c4c",
+ "id": "210950a3",
"metadata": {
"editable": true
},
@@ -1272,7 +1272,7 @@
{
"cell_type": "code",
"execution_count": 13,
- "id": "26f69648",
+ "id": "3fd17936",
"metadata": {
"collapsed": false,
"editable": true
@@ -1288,7 +1288,7 @@
},
{
"cell_type": "markdown",
- "id": "7c3fc4e5",
+ "id": "88198295",
"metadata": {
"editable": true
},
@@ -1299,7 +1299,7 @@
{
"cell_type": "code",
"execution_count": 14,
- "id": "1c92af53",
+ "id": "b7ef3efe",
"metadata": {
"collapsed": false,
"editable": true
@@ -1315,7 +1315,7 @@
},
{
"cell_type": "markdown",
- "id": "3a529225",
+ "id": "1e8f7095",
"metadata": {
"editable": true
},
@@ -1327,7 +1327,7 @@
},
{
"cell_type": "markdown",
- "id": "97411e9b",
+ "id": "129bcc48",
"metadata": {
"editable": true
},
@@ -1342,7 +1342,7 @@
},
{
"cell_type": "markdown",
- "id": "585bab0c",
+ "id": "3709cd07",
"metadata": {
"editable": true
},
@@ -1352,7 +1352,7 @@
},
{
"cell_type": "markdown",
- "id": "24b748a1",
+ "id": "9cc6b172",
"metadata": {
"editable": true
},
@@ -1364,7 +1364,7 @@
},
{
"cell_type": "markdown",
- "id": "441f4e4b",
+ "id": "07c8585e",
"metadata": {
"editable": true
},
@@ -1375,7 +1375,7 @@
},
{
"cell_type": "markdown",
- "id": "7f33df56",
+ "id": "89497f72",
"metadata": {
"editable": true
},
@@ -1390,7 +1390,7 @@
},
{
"cell_type": "markdown",
- "id": "37007ac9",
+ "id": "02bf8d81",
"metadata": {
"editable": true
},
@@ -1405,7 +1405,7 @@
{
"cell_type": "code",
"execution_count": 15,
- "id": "52253f39",
+ "id": "407cc1cf",
"metadata": {
"collapsed": false,
"editable": true
@@ -1432,7 +1432,7 @@
{
"cell_type": "code",
"execution_count": 16,
- "id": "91c49061",
+ "id": "d20570a5",
"metadata": {
"collapsed": false,
"editable": true
@@ -1456,7 +1456,7 @@
},
{
"cell_type": "markdown",
- "id": "88360ae4",
+ "id": "39947178",
"metadata": {
"editable": true
},
@@ -1482,7 +1482,7 @@
{
"cell_type": "code",
"execution_count": 17,
- "id": "c2a9ac30",
+ "id": "cb56f289",
"metadata": {
"collapsed": false,
"editable": true
@@ -1502,7 +1502,7 @@
},
{
"cell_type": "markdown",
- "id": "4691efcd",
+ "id": "2be05300",
"metadata": {
"editable": true
},
@@ -1516,7 +1516,7 @@
{
"cell_type": "code",
"execution_count": 18,
- "id": "efeb7a3d",
+ "id": "7b2ca6db",
"metadata": {
"collapsed": false,
"editable": true
@@ -1529,7 +1529,7 @@
},
{
"cell_type": "markdown",
- "id": "67737011",
+ "id": "5f56f916",
"metadata": {
"editable": true
},
@@ -1540,7 +1540,7 @@
{
"cell_type": "code",
"execution_count": 19,
- "id": "b53cfe84",
+ "id": "35a41c1f",
"metadata": {
"collapsed": false,
"editable": true
@@ -1552,7 +1552,7 @@
},
{
"cell_type": "markdown",
- "id": "b4ebce7c",
+ "id": "605b7bf2",
"metadata": {
"editable": true
},
@@ -1563,7 +1563,7 @@
{
"cell_type": "code",
"execution_count": 20,
- "id": "3ffb9cd7",
+ "id": "aae90d4c",
"metadata": {
"collapsed": false,
"editable": true
@@ -1581,7 +1581,7 @@
},
{
"cell_type": "markdown",
- "id": "86a8fce8",
+ "id": "84c7d5ef",
"metadata": {
"editable": true
},
@@ -1593,7 +1593,7 @@
{
"cell_type": "code",
"execution_count": 21,
- "id": "fbeacadd",
+ "id": "fbc033aa",
"metadata": {
"collapsed": false,
"editable": true
@@ -1617,7 +1617,7 @@
},
{
"cell_type": "markdown",
- "id": "0c878e86",
+ "id": "382347ae",
"metadata": {
"editable": true
},
@@ -1628,7 +1628,7 @@
{
"cell_type": "code",
"execution_count": 22,
- "id": "7b63dbdf",
+ "id": "bba42c57",
"metadata": {
"collapsed": false,
"editable": true
@@ -1657,7 +1657,7 @@
},
{
"cell_type": "markdown",
- "id": "ec83b7f5",
+ "id": "3082b0d1",
"metadata": {
"editable": true
},
@@ -1668,7 +1668,7 @@
{
"cell_type": "code",
"execution_count": 23,
- "id": "22e5029c",
+ "id": "734e800f",
"metadata": {
"collapsed": false,
"editable": true
@@ -1683,7 +1683,7 @@
},
{
"cell_type": "markdown",
- "id": "f2af186b",
+ "id": "9283fb5d",
"metadata": {
"editable": true
},
@@ -1700,7 +1700,7 @@
},
{
"cell_type": "markdown",
- "id": "1f92f0ea",
+ "id": "d76fa405",
"metadata": {
"editable": true
},
@@ -1731,7 +1731,7 @@
},
{
"cell_type": "markdown",
- "id": "24a9e306",
+ "id": "020551fd",
"metadata": {
"editable": true
},
@@ -1743,7 +1743,7 @@
},
{
"cell_type": "markdown",
- "id": "90d53f51",
+ "id": "0df4130b",
"metadata": {
"editable": true
},
@@ -1771,7 +1771,7 @@
{
"cell_type": "code",
"execution_count": 24,
- "id": "e213ee8c",
+ "id": "66546dbd",
"metadata": {
"collapsed": false,
"editable": true
@@ -1801,7 +1801,7 @@
},
{
"cell_type": "markdown",
- "id": "24c4b83a",
+ "id": "88369145",
"metadata": {
"editable": true
},
@@ -1818,7 +1818,7 @@
},
{
"cell_type": "markdown",
- "id": "05b5b692",
+ "id": "6c9dff61",
"metadata": {
"editable": true
},
@@ -1830,7 +1830,7 @@
},
{
"cell_type": "markdown",
- "id": "a7a4bf90",
+ "id": "77f3fee1",
"metadata": {
"editable": true
},
@@ -1851,7 +1851,7 @@
},
{
"cell_type": "markdown",
- "id": "4485138e",
+ "id": "ecd56b34",
"metadata": {
"editable": true
},
@@ -1864,7 +1864,7 @@
},
{
"cell_type": "markdown",
- "id": "3019d5b3",
+ "id": "bff6f85d",
"metadata": {
"editable": true
},
@@ -1895,7 +1895,7 @@
},
{
"cell_type": "markdown",
- "id": "75f6a273",
+ "id": "5eb96b78",
"metadata": {
"editable": true
},
@@ -1907,7 +1907,7 @@
},
{
"cell_type": "markdown",
- "id": "7f054a1f",
+ "id": "360cce53",
"metadata": {
"editable": true
},
@@ -1925,7 +1925,7 @@
{
"cell_type": "code",
"execution_count": 25,
- "id": "150ef999",
+ "id": "e917efa3",
"metadata": {
"collapsed": false,
"editable": true
@@ -1952,7 +1952,7 @@
},
{
"cell_type": "markdown",
- "id": "acb6c7fc",
+ "id": "d0a4406e",
"metadata": {
"editable": true
},
@@ -1974,7 +1974,7 @@
{
"cell_type": "code",
"execution_count": 26,
- "id": "e32362ae",
+ "id": "bf497897",
"metadata": {
"collapsed": false,
"editable": true
@@ -2012,7 +2012,7 @@
},
{
"cell_type": "markdown",
- "id": "1e62b573",
+ "id": "9f3777dd",
"metadata": {
"editable": true
},
@@ -2023,7 +2023,7 @@
},
{
"cell_type": "markdown",
- "id": "acbaf5c6",
+ "id": "1ceff109",
"metadata": {
"editable": true
},
@@ -2036,7 +2036,7 @@
},
{
"cell_type": "markdown",
- "id": "75ab6396",
+ "id": "a271bb6f",
"metadata": {
"editable": true
},
@@ -2057,7 +2057,7 @@
},
{
"cell_type": "markdown",
- "id": "aff2c6bc",
+ "id": "c3a95679",
"metadata": {
"editable": true
},
@@ -2069,7 +2069,7 @@
},
{
"cell_type": "markdown",
- "id": "db310fda",
+ "id": "bc3ff280",
"metadata": {
"editable": true
},
@@ -2079,7 +2079,7 @@
},
{
"cell_type": "markdown",
- "id": "38b1569c",
+ "id": "ab2dae05",
"metadata": {
"editable": true
},
@@ -2091,7 +2091,7 @@
},
{
"cell_type": "markdown",
- "id": "9c384626",
+ "id": "11fbf6a4",
"metadata": {
"editable": true
},
@@ -2103,7 +2103,7 @@
},
{
"cell_type": "markdown",
- "id": "24590145",
+ "id": "1a7ff113",
"metadata": {
"editable": true
},
@@ -2115,7 +2115,7 @@
},
{
"cell_type": "markdown",
- "id": "37952de8",
+ "id": "b4ae70fb",
"metadata": {
"editable": true
},
@@ -2126,7 +2126,7 @@
},
{
"cell_type": "markdown",
- "id": "6bdf632b",
+ "id": "2269eec7",
"metadata": {
"editable": true
},
@@ -2138,7 +2138,7 @@
},
{
"cell_type": "markdown",
- "id": "bf9bd95d",
+ "id": "1e262d8d",
"metadata": {
"editable": true
},
@@ -2160,7 +2160,7 @@
},
{
"cell_type": "markdown",
- "id": "1208fef7",
+ "id": "b8f2ca9a",
"metadata": {
"editable": true
},
@@ -2172,7 +2172,7 @@
},
{
"cell_type": "markdown",
- "id": "1558f65a",
+ "id": "467411a2",
"metadata": {
"editable": true
},
@@ -2185,7 +2185,7 @@
},
{
"cell_type": "markdown",
- "id": "f877bafe",
+ "id": "e2c55288",
"metadata": {
"editable": true
},
@@ -2202,7 +2202,7 @@
},
{
"cell_type": "markdown",
- "id": "7cdfc338",
+ "id": "df6edd96",
"metadata": {
"editable": true
},
@@ -2214,7 +2214,7 @@
},
{
"cell_type": "markdown",
- "id": "2147c066",
+ "id": "87de8880",
"metadata": {
"editable": true
},
@@ -2224,7 +2224,7 @@
},
{
"cell_type": "markdown",
- "id": "b5dfa4f9",
+ "id": "3b994755",
"metadata": {
"editable": true
},
@@ -2236,7 +2236,7 @@
},
{
"cell_type": "markdown",
- "id": "a5237367",
+ "id": "5b5d24fe",
"metadata": {
"editable": true
},
@@ -2246,7 +2246,7 @@
},
{
"cell_type": "markdown",
- "id": "abfe5bfa",
+ "id": "5ad2da10",
"metadata": {
"editable": true
},
@@ -2258,7 +2258,7 @@
},
{
"cell_type": "markdown",
- "id": "7bd69405",
+ "id": "7f821b81",
"metadata": {
"editable": true
},
@@ -2268,7 +2268,7 @@
},
{
"cell_type": "markdown",
- "id": "7c69d6e8",
+ "id": "9e7bf292",
"metadata": {
"editable": true
},
@@ -2280,7 +2280,7 @@
},
{
"cell_type": "markdown",
- "id": "e26c6a44",
+ "id": "5ff64112",
"metadata": {
"editable": true
},
@@ -2296,7 +2296,7 @@
},
{
"cell_type": "markdown",
- "id": "84efe5df",
+ "id": "156559a0",
"metadata": {
"editable": true
},
@@ -2308,7 +2308,7 @@
},
{
"cell_type": "markdown",
- "id": "97e2c47d",
+ "id": "dfc9bfdf",
"metadata": {
"editable": true
},
@@ -2319,7 +2319,7 @@
},
{
"cell_type": "markdown",
- "id": "eab51599",
+ "id": "a7f324ae",
"metadata": {
"editable": true
},
@@ -2331,7 +2331,7 @@
},
{
"cell_type": "markdown",
- "id": "d143fe69",
+ "id": "468912c0",
"metadata": {
"editable": true
},
@@ -2345,7 +2345,7 @@
},
{
"cell_type": "markdown",
- "id": "849112e7",
+ "id": "482ce78c",
"metadata": {
"editable": true
},
@@ -2357,7 +2357,7 @@
},
{
"cell_type": "markdown",
- "id": "10c438c2",
+ "id": "0e89a231",
"metadata": {
"editable": true
},
@@ -2382,7 +2382,7 @@
},
{
"cell_type": "markdown",
- "id": "c5584cdc",
+ "id": "64e13bcf",
"metadata": {
"editable": true
},
@@ -2399,7 +2399,7 @@
{
"cell_type": "code",
"execution_count": 27,
- "id": "90ff1c05",
+ "id": "e55b52b7",
"metadata": {
"collapsed": false,
"editable": true
@@ -2443,7 +2443,7 @@
},
{
"cell_type": "markdown",
- "id": "aa9609fa",
+ "id": "54d62b43",
"metadata": {
"editable": true
},
@@ -2454,7 +2454,7 @@
{
"cell_type": "code",
"execution_count": 28,
- "id": "df33d03d",
+ "id": "cd093fdd",
"metadata": {
"collapsed": false,
"editable": true
@@ -2476,7 +2476,7 @@
},
{
"cell_type": "markdown",
- "id": "2d7f79b3",
+ "id": "27003c06",
"metadata": {
"editable": true
},
@@ -2493,7 +2493,7 @@
{
"cell_type": "code",
"execution_count": 29,
- "id": "a1f54ecd",
+ "id": "fbd7f2c6",
"metadata": {
"collapsed": false,
"editable": true
@@ -2514,7 +2514,7 @@
},
{
"cell_type": "markdown",
- "id": "ad0ee0fd",
+ "id": "b29f39b8",
"metadata": {
"editable": true
},
@@ -2528,7 +2528,7 @@
{
"cell_type": "code",
"execution_count": 30,
- "id": "fbfeb155",
+ "id": "9b76e1c5",
"metadata": {
"collapsed": false,
"editable": true
@@ -2557,7 +2557,7 @@
},
{
"cell_type": "markdown",
- "id": "e9558349",
+ "id": "fa91bf1e",
"metadata": {
"editable": true
},
@@ -2577,7 +2577,7 @@
{
"cell_type": "code",
"execution_count": 31,
- "id": "a844e883",
+ "id": "b43280ec",
"metadata": {
"collapsed": false,
"editable": true
@@ -2594,7 +2594,7 @@
},
{
"cell_type": "markdown",
- "id": "e6f0f715",
+ "id": "04c5fd9f",
"metadata": {
"editable": true
},
@@ -2606,7 +2606,7 @@
{
"cell_type": "code",
"execution_count": 32,
- "id": "6070b38b",
+ "id": "b9ca2c81",
"metadata": {
"collapsed": false,
"editable": true
@@ -2624,7 +2624,7 @@
},
{
"cell_type": "markdown",
- "id": "97ccc83d",
+ "id": "2b74073b",
"metadata": {
"editable": true
},
@@ -2635,7 +2635,7 @@
{
"cell_type": "code",
"execution_count": 33,
- "id": "721f9722",
+ "id": "ad36c0f2",
"metadata": {
"collapsed": false,
"editable": true
@@ -2648,7 +2648,7 @@
},
{
"cell_type": "markdown",
- "id": "85dd20bf",
+ "id": "006bdaae",
"metadata": {
"editable": true
},
@@ -2660,7 +2660,7 @@
{
"cell_type": "code",
"execution_count": 34,
- "id": "03260a74",
+ "id": "57277a31",
"metadata": {
"collapsed": false,
"editable": true
@@ -2691,7 +2691,7 @@
},
{
"cell_type": "markdown",
- "id": "1116099c",
+ "id": "34d4e20e",
"metadata": {
"editable": true
},
@@ -2705,7 +2705,7 @@
{
"cell_type": "code",
"execution_count": 35,
- "id": "335776a2",
+ "id": "418f032d",
"metadata": {
"collapsed": false,
"editable": true
@@ -2745,7 +2745,7 @@
},
{
"cell_type": "markdown",
- "id": "9900501e",
+ "id": "a22b2d16",
"metadata": {
"editable": true
},
@@ -2765,7 +2765,7 @@
},
{
"cell_type": "markdown",
- "id": "c03ce179",
+ "id": "2d41936f",
"metadata": {
"editable": true
},
@@ -2797,7 +2797,7 @@
},
{
"cell_type": "markdown",
- "id": "f6ce82a0",
+ "id": "0fea3638",
"metadata": {
"editable": true
},
@@ -2819,7 +2819,7 @@
},
{
"cell_type": "markdown",
- "id": "86f56550",
+ "id": "f43b2fd3",
"metadata": {
"editable": true
},
@@ -2847,7 +2847,7 @@
},
{
"cell_type": "markdown",
- "id": "2502ba50",
+ "id": "e8d35825",
"metadata": {
"editable": true
},
@@ -2862,7 +2862,7 @@
},
{
"cell_type": "markdown",
- "id": "57d5f361",
+ "id": "786d5a39",
"metadata": {
"editable": true
},
@@ -2874,7 +2874,7 @@
},
{
"cell_type": "markdown",
- "id": "b4daeb40",
+ "id": "7d3dd06c",
"metadata": {
"editable": true
},
@@ -2889,7 +2889,7 @@
},
{
"cell_type": "markdown",
- "id": "7339a162",
+ "id": "a1fe4e84",
"metadata": {
"editable": true
},
@@ -2902,7 +2902,7 @@
},
{
"cell_type": "markdown",
- "id": "0a1463c5",
+ "id": "a9674226",
"metadata": {
"editable": true
},
@@ -2914,7 +2914,7 @@
},
{
"cell_type": "markdown",
- "id": "33a6f684",
+ "id": "8f532acc",
"metadata": {
"editable": true
},
@@ -2924,7 +2924,7 @@
},
{
"cell_type": "markdown",
- "id": "62c484dc",
+ "id": "64b30fa2",
"metadata": {
"editable": true
},
@@ -2935,7 +2935,7 @@
},
{
"cell_type": "markdown",
- "id": "b1677a0c",
+ "id": "ccf8b910",
"metadata": {
"editable": true
},
@@ -2953,7 +2953,7 @@
},
{
"cell_type": "markdown",
- "id": "3e78c53d",
+ "id": "65956161",
"metadata": {
"editable": true
},
@@ -2964,7 +2964,7 @@
},
{
"cell_type": "markdown",
- "id": "96de64f1",
+ "id": "5099e4a8",
"metadata": {
"editable": true
},
@@ -2976,7 +2976,7 @@
},
{
"cell_type": "markdown",
- "id": "b9935041",
+ "id": "7879eff7",
"metadata": {
"editable": true
},
@@ -2986,7 +2986,7 @@
},
{
"cell_type": "markdown",
- "id": "5c3d18ba",
+ "id": "a177406b",
"metadata": {
"editable": true
},
@@ -2998,7 +2998,7 @@
},
{
"cell_type": "markdown",
- "id": "888bd463",
+ "id": "4e36ed3a",
"metadata": {
"editable": true
},
@@ -3008,7 +3008,7 @@
},
{
"cell_type": "markdown",
- "id": "781e2ad1",
+ "id": "0d56ecd4",
"metadata": {
"editable": true
},
@@ -3020,7 +3020,7 @@
},
{
"cell_type": "markdown",
- "id": "1d92cead",
+ "id": "f47c9c3e",
"metadata": {
"editable": true
},
@@ -3030,7 +3030,7 @@
},
{
"cell_type": "markdown",
- "id": "f29293e3",
+ "id": "f8acc5c6",
"metadata": {
"editable": true
},
@@ -3049,7 +3049,7 @@
},
{
"cell_type": "markdown",
- "id": "8286bb4a",
+ "id": "fd6a5848",
"metadata": {
"editable": true
},
@@ -3059,7 +3059,7 @@
},
{
"cell_type": "markdown",
- "id": "93a67877",
+ "id": "78f867c3",
"metadata": {
"editable": true
},
@@ -3071,7 +3071,7 @@
},
{
"cell_type": "markdown",
- "id": "ad963c4c",
+ "id": "b19b87b1",
"metadata": {
"editable": true
},
@@ -3081,7 +3081,7 @@
},
{
"cell_type": "markdown",
- "id": "f19bdd4e",
+ "id": "8f1d2365",
"metadata": {
"editable": true
},
@@ -3097,7 +3097,7 @@
},
{
"cell_type": "markdown",
- "id": "b60da98a",
+ "id": "23a36c28",
"metadata": {
"editable": true
},
@@ -3117,7 +3117,7 @@
},
{
"cell_type": "markdown",
- "id": "db041a7d",
+ "id": "1f370592",
"metadata": {
"editable": true
},
@@ -3127,7 +3127,7 @@
},
{
"cell_type": "markdown",
- "id": "fcee31b8",
+ "id": "36e55592",
"metadata": {
"editable": true
},
@@ -3138,7 +3138,7 @@
},
{
"cell_type": "markdown",
- "id": "88e9c25d",
+ "id": "2c775539",
"metadata": {
"editable": true
},
@@ -3157,7 +3157,7 @@
},
{
"cell_type": "markdown",
- "id": "a027eaef",
+ "id": "402be814",
"metadata": {
"editable": true
},
@@ -3167,7 +3167,7 @@
},
{
"cell_type": "markdown",
- "id": "412582b1",
+ "id": "73ca50c1",
"metadata": {
"editable": true
},
@@ -3179,7 +3179,7 @@
},
{
"cell_type": "markdown",
- "id": "c8984b67",
+ "id": "2d28c712",
"metadata": {
"editable": true
},
@@ -3189,7 +3189,7 @@
},
{
"cell_type": "markdown",
- "id": "181cafa1",
+ "id": "74d5aeaa",
"metadata": {
"editable": true
},
@@ -3200,7 +3200,7 @@
},
{
"cell_type": "markdown",
- "id": "ae92fdd5",
+ "id": "e7e2631c",
"metadata": {
"editable": true
},
@@ -3220,7 +3220,7 @@
},
{
"cell_type": "markdown",
- "id": "6697b8e9",
+ "id": "1ee5846f",
"metadata": {
"editable": true
},
@@ -3232,7 +3232,7 @@
},
{
"cell_type": "markdown",
- "id": "9e738363",
+ "id": "28c73a8b",
"metadata": {
"editable": true
},
@@ -3247,7 +3247,7 @@
{
"cell_type": "code",
"execution_count": 36,
- "id": "2c45c511",
+ "id": "0dd3f2ac",
"metadata": {
"collapsed": false,
"editable": true
@@ -3327,7 +3327,7 @@
},
{
"cell_type": "markdown",
- "id": "2bad68b1",
+ "id": "72274410",
"metadata": {
"editable": true
},
@@ -3337,7 +3337,7 @@
},
{
"cell_type": "markdown",
- "id": "9552291d",
+ "id": "52151d0b",
"metadata": {
"editable": true
},
@@ -3349,7 +3349,7 @@
},
{
"cell_type": "markdown",
- "id": "6cdd6784",
+ "id": "cac3e240",
"metadata": {
"editable": true
},
@@ -3359,7 +3359,7 @@
},
{
"cell_type": "markdown",
- "id": "3a5af2d0",
+ "id": "c4b0829f",
"metadata": {
"editable": true
},
@@ -3370,7 +3370,7 @@
},
{
"cell_type": "markdown",
- "id": "3501ea51",
+ "id": "6372093e",
"metadata": {
"editable": true
},
@@ -3382,7 +3382,7 @@
},
{
"cell_type": "markdown",
- "id": "0ea74700",
+ "id": "a6c7fb1d",
"metadata": {
"editable": true
},
@@ -3392,7 +3392,7 @@
},
{
"cell_type": "markdown",
- "id": "2bfdccf1",
+ "id": "ea3c5acd",
"metadata": {
"editable": true
},
@@ -3404,7 +3404,7 @@
},
{
"cell_type": "markdown",
- "id": "dba890e4",
+ "id": "ecb3128c",
"metadata": {
"editable": true
},
@@ -3414,7 +3414,7 @@
},
{
"cell_type": "markdown",
- "id": "d8e3283d",
+ "id": "f4cbc1bc",
"metadata": {
"editable": true
},
@@ -3426,7 +3426,7 @@
},
{
"cell_type": "markdown",
- "id": "983fa258",
+ "id": "6ccbf848",
"metadata": {
"editable": true
},
@@ -3439,7 +3439,7 @@
},
{
"cell_type": "markdown",
- "id": "586cc200",
+ "id": "77402dc5",
"metadata": {
"editable": true
},
@@ -3451,7 +3451,7 @@
},
{
"cell_type": "markdown",
- "id": "7dd88361",
+ "id": "de6b5d44",
"metadata": {
"editable": true
},
@@ -3461,7 +3461,7 @@
},
{
"cell_type": "markdown",
- "id": "10ae17fd",
+ "id": "a44cdf71",
"metadata": {
"editable": true
},
@@ -3473,7 +3473,7 @@
},
{
"cell_type": "markdown",
- "id": "38a8850b",
+ "id": "cd5361e7",
"metadata": {
"editable": true
},
@@ -3485,7 +3485,7 @@
},
{
"cell_type": "markdown",
- "id": "966a68e2",
+ "id": "326cdf57",
"metadata": {
"editable": true
},
@@ -3496,7 +3496,7 @@
},
{
"cell_type": "markdown",
- "id": "d43d79d5",
+ "id": "e45e299c",
"metadata": {
"editable": true
},
@@ -3508,7 +3508,7 @@
},
{
"cell_type": "markdown",
- "id": "381f08fa",
+ "id": "500760da",
"metadata": {
"editable": true
},
@@ -3527,7 +3527,7 @@
},
{
"cell_type": "markdown",
- "id": "a1ee47d2",
+ "id": "14c6598c",
"metadata": {
"editable": true
},
@@ -3540,7 +3540,7 @@
},
{
"cell_type": "markdown",
- "id": "00b407d3",
+ "id": "dd61eff4",
"metadata": {
"editable": true
},
@@ -3550,7 +3550,7 @@
},
{
"cell_type": "markdown",
- "id": "92e608c7",
+ "id": "f9809a57",
"metadata": {
"editable": true
},
@@ -3562,7 +3562,7 @@
},
{
"cell_type": "markdown",
- "id": "b9269a7c",
+ "id": "3780719f",
"metadata": {
"editable": true
},
@@ -3572,7 +3572,7 @@
},
{
"cell_type": "markdown",
- "id": "9978f7dc",
+ "id": "719c3f45",
"metadata": {
"editable": true
},
@@ -3584,7 +3584,7 @@
},
{
"cell_type": "markdown",
- "id": "325e827e",
+ "id": "96016ede",
"metadata": {
"editable": true
},
@@ -3594,7 +3594,7 @@
},
{
"cell_type": "markdown",
- "id": "0c7a5575",
+ "id": "20551347",
"metadata": {
"editable": true
},
@@ -3606,7 +3606,7 @@
},
{
"cell_type": "markdown",
- "id": "372614ee",
+ "id": "5268e15e",
"metadata": {
"editable": true
},
@@ -3617,7 +3617,7 @@
},
{
"cell_type": "markdown",
- "id": "4c78f01c",
+ "id": "119b104e",
"metadata": {
"editable": true
},
@@ -3629,7 +3629,7 @@
},
{
"cell_type": "markdown",
- "id": "761b015a",
+ "id": "cff1c1f8",
"metadata": {
"editable": true
},
@@ -3639,7 +3639,7 @@
},
{
"cell_type": "markdown",
- "id": "33405808",
+ "id": "f320c0b3",
"metadata": {
"editable": true
},
@@ -3651,7 +3651,7 @@
},
{
"cell_type": "markdown",
- "id": "0ec2af93",
+ "id": "a8ba839e",
"metadata": {
"editable": true
},
@@ -3661,7 +3661,7 @@
},
{
"cell_type": "markdown",
- "id": "0fa818cb",
+ "id": "90be5e7e",
"metadata": {
"editable": true
},
@@ -3673,7 +3673,7 @@
},
{
"cell_type": "markdown",
- "id": "7776a06f",
+ "id": "a1afcaf0",
"metadata": {
"editable": true
},
@@ -3694,7 +3694,7 @@
},
{
"cell_type": "markdown",
- "id": "c8486fa2",
+ "id": "ccc68760",
"metadata": {
"editable": true
},
@@ -3708,7 +3708,7 @@
},
{
"cell_type": "markdown",
- "id": "88560171",
+ "id": "b607fcf4",
"metadata": {
"editable": true
},
@@ -3719,7 +3719,7 @@
},
{
"cell_type": "markdown",
- "id": "4c2381b1",
+ "id": "09de2082",
"metadata": {
"editable": true
},
@@ -3731,7 +3731,7 @@
},
{
"cell_type": "markdown",
- "id": "f8c0511a",
+ "id": "ba195c19",
"metadata": {
"editable": true
},
@@ -3741,7 +3741,7 @@
},
{
"cell_type": "markdown",
- "id": "f68b7193",
+ "id": "3aeb0e05",
"metadata": {
"editable": true
},
@@ -3753,7 +3753,7 @@
},
{
"cell_type": "markdown",
- "id": "dd1de710",
+ "id": "e76e08d7",
"metadata": {
"editable": true
},
@@ -3763,7 +3763,7 @@
},
{
"cell_type": "markdown",
- "id": "0c7d7741",
+ "id": "ccd8129b",
"metadata": {
"editable": true
},
@@ -3775,7 +3775,7 @@
},
{
"cell_type": "markdown",
- "id": "cccaf815",
+ "id": "143d2185",
"metadata": {
"editable": true
},
@@ -3787,7 +3787,7 @@
},
{
"cell_type": "markdown",
- "id": "b490b68c",
+ "id": "310f3d39",
"metadata": {
"editable": true
},
@@ -3801,7 +3801,7 @@
{
"cell_type": "code",
"execution_count": 37,
- "id": "7f74487d",
+ "id": "e0541d11",
"metadata": {
"collapsed": false,
"editable": true
@@ -3816,7 +3816,7 @@
},
{
"cell_type": "markdown",
- "id": "523bd8d0",
+ "id": "7148e6e9",
"metadata": {
"editable": true
},
@@ -3827,7 +3827,7 @@
{
"cell_type": "code",
"execution_count": 38,
- "id": "a4d7eedd",
+ "id": "d289b356",
"metadata": {
"collapsed": false,
"editable": true
@@ -3840,7 +3840,7 @@
},
{
"cell_type": "markdown",
- "id": "1655538a",
+ "id": "6ef4cefc",
"metadata": {
"editable": true
},
@@ -3851,7 +3851,7 @@
{
"cell_type": "code",
"execution_count": 39,
- "id": "85a500e6",
+ "id": "41ca4b7b",
"metadata": {
"collapsed": false,
"editable": true
@@ -3874,7 +3874,7 @@
},
{
"cell_type": "markdown",
- "id": "f6ad59d6",
+ "id": "3fb76ce8",
"metadata": {
"editable": true
},
@@ -3888,7 +3888,7 @@
{
"cell_type": "code",
"execution_count": 40,
- "id": "4ee168d2",
+ "id": "851247d0",
"metadata": {
"collapsed": false,
"editable": true
@@ -3901,7 +3901,7 @@
},
{
"cell_type": "markdown",
- "id": "ed6ec813",
+ "id": "58a747ce",
"metadata": {
"editable": true
},
@@ -3912,7 +3912,7 @@
{
"cell_type": "code",
"execution_count": 41,
- "id": "ff7101e3",
+ "id": "c503eb37",
"metadata": {
"collapsed": false,
"editable": true
@@ -3924,7 +3924,7 @@
},
{
"cell_type": "markdown",
- "id": "1654e703",
+ "id": "4e36645f",
"metadata": {
"editable": true
},
@@ -3935,7 +3935,7 @@
{
"cell_type": "code",
"execution_count": 42,
- "id": "7a71b2d7",
+ "id": "9e0d51bd",
"metadata": {
"collapsed": false,
"editable": true
@@ -3951,7 +3951,7 @@
},
{
"cell_type": "markdown",
- "id": "963be797",
+ "id": "ef1e78b7",
"metadata": {
"editable": true
},
@@ -3962,7 +3962,7 @@
{
"cell_type": "code",
"execution_count": 43,
- "id": "f6e90610",
+ "id": "6979c3f8",
"metadata": {
"collapsed": false,
"editable": true
@@ -3976,7 +3976,7 @@
},
{
"cell_type": "markdown",
- "id": "897bf983",
+ "id": "5a8caf43",
"metadata": {
"editable": true
},
@@ -3998,7 +3998,7 @@
},
{
"cell_type": "markdown",
- "id": "3972780e",
+ "id": "cf2b742e",
"metadata": {
"editable": true
},
@@ -4010,7 +4010,7 @@
},
{
"cell_type": "markdown",
- "id": "ddaf293e",
+ "id": "7b652644",
"metadata": {
"editable": true
},
@@ -4020,7 +4020,7 @@
},
{
"cell_type": "markdown",
- "id": "2ba1a0ac",
+ "id": "68eef44c",
"metadata": {
"editable": true
},
@@ -4032,7 +4032,7 @@
},
{
"cell_type": "markdown",
- "id": "52b3a243",
+ "id": "d4354161",
"metadata": {
"editable": true
},
@@ -4044,7 +4044,7 @@
},
{
"cell_type": "markdown",
- "id": "3084e52e",
+ "id": "4a9278ab",
"metadata": {
"editable": true
},
@@ -4054,7 +4054,7 @@
},
{
"cell_type": "markdown",
- "id": "e8b81bc2",
+ "id": "85dcc719",
"metadata": {
"editable": true
},
@@ -4066,7 +4066,7 @@
},
{
"cell_type": "markdown",
- "id": "606abbaf",
+ "id": "af633e0f",
"metadata": {
"editable": true
},
@@ -4076,7 +4076,7 @@
},
{
"cell_type": "markdown",
- "id": "0fc6a6fc",
+ "id": "abc9731a",
"metadata": {
"editable": true
},
@@ -4088,7 +4088,7 @@
},
{
"cell_type": "markdown",
- "id": "257ab024",
+ "id": "b98c9215",
"metadata": {
"editable": true
},
@@ -4098,7 +4098,7 @@
},
{
"cell_type": "markdown",
- "id": "ef10e546",
+ "id": "ef75f143",
"metadata": {
"editable": true
},
@@ -4110,7 +4110,7 @@
},
{
"cell_type": "markdown",
- "id": "711417a9",
+ "id": "018ae997",
"metadata": {
"editable": true
},
@@ -4122,7 +4122,7 @@
},
{
"cell_type": "markdown",
- "id": "bf7ef733",
+ "id": "2b484604",
"metadata": {
"editable": true
},
@@ -4132,7 +4132,7 @@
},
{
"cell_type": "markdown",
- "id": "480bcfb2",
+ "id": "b2d59b73",
"metadata": {
"editable": true
},
@@ -4144,7 +4144,7 @@
},
{
"cell_type": "markdown",
- "id": "e30125a8",
+ "id": "43af0c2c",
"metadata": {
"editable": true
},
@@ -4154,7 +4154,7 @@
},
{
"cell_type": "markdown",
- "id": "c8b55590",
+ "id": "9786e84c",
"metadata": {
"editable": true
},
@@ -4166,7 +4166,7 @@
},
{
"cell_type": "markdown",
- "id": "be1b8071",
+ "id": "699e2de9",
"metadata": {
"editable": true
},
@@ -4178,7 +4178,7 @@
},
{
"cell_type": "markdown",
- "id": "c5d84196",
+ "id": "95f061ba",
"metadata": {
"editable": true
},
@@ -4190,7 +4190,7 @@
},
{
"cell_type": "markdown",
- "id": "904ae1cf",
+ "id": "b47033f4",
"metadata": {
"editable": true
},
@@ -4200,7 +4200,7 @@
},
{
"cell_type": "markdown",
- "id": "43af5112",
+ "id": "cd936233",
"metadata": {
"editable": true
},
@@ -4212,7 +4212,7 @@
},
{
"cell_type": "markdown",
- "id": "6ece0163",
+ "id": "024ec512",
"metadata": {
"editable": true
},
@@ -4222,7 +4222,7 @@
},
{
"cell_type": "markdown",
- "id": "75240b86",
+ "id": "5f0fbdc7",
"metadata": {
"editable": true
},
@@ -4234,7 +4234,7 @@
},
{
"cell_type": "markdown",
- "id": "75ab537c",
+ "id": "c48c6461",
"metadata": {
"editable": true
},
@@ -4244,7 +4244,7 @@
},
{
"cell_type": "markdown",
- "id": "cf3be8df",
+ "id": "65334c5f",
"metadata": {
"editable": true
},
@@ -4256,7 +4256,7 @@
},
{
"cell_type": "markdown",
- "id": "1e323640",
+ "id": "98641b90",
"metadata": {
"editable": true
},
@@ -4267,7 +4267,7 @@
},
{
"cell_type": "markdown",
- "id": "b98ec1cd",
+ "id": "fd6c1d45",
"metadata": {
"editable": true
},
@@ -4279,7 +4279,7 @@
},
{
"cell_type": "markdown",
- "id": "5960f894",
+ "id": "4817bd05",
"metadata": {
"editable": true
},
@@ -4289,7 +4289,7 @@
},
{
"cell_type": "markdown",
- "id": "e12c2cd4",
+ "id": "312805de",
"metadata": {
"editable": true
},
@@ -4301,7 +4301,7 @@
},
{
"cell_type": "markdown",
- "id": "0669ce10",
+ "id": "c3c18f3d",
"metadata": {
"editable": true
},
@@ -4311,7 +4311,7 @@
},
{
"cell_type": "markdown",
- "id": "32b20573",
+ "id": "7d4ff47d",
"metadata": {
"editable": true
},
@@ -4323,7 +4323,7 @@
},
{
"cell_type": "markdown",
- "id": "ca4d3e37",
+ "id": "389b398a",
"metadata": {
"editable": true
},
@@ -4336,7 +4336,7 @@
},
{
"cell_type": "markdown",
- "id": "6b26c4e9",
+ "id": "6cafaa0a",
"metadata": {
"editable": true
},
@@ -4348,7 +4348,7 @@
},
{
"cell_type": "markdown",
- "id": "785c3035",
+ "id": "c2472e8d",
"metadata": {
"editable": true
},
@@ -4360,7 +4360,7 @@
},
{
"cell_type": "markdown",
- "id": "8557f71e",
+ "id": "9fca2f2a",
"metadata": {
"editable": true
},
@@ -4372,7 +4372,7 @@
},
{
"cell_type": "markdown",
- "id": "25a50c1c",
+ "id": "0b4b7322",
"metadata": {
"editable": true
},
@@ -4384,7 +4384,7 @@
},
{
"cell_type": "markdown",
- "id": "b76b6837",
+ "id": "81aa7109",
"metadata": {
"editable": true
},
@@ -4396,7 +4396,7 @@
},
{
"cell_type": "markdown",
- "id": "ec2bc31e",
+ "id": "d55ffc3b",
"metadata": {
"editable": true
},
@@ -4406,7 +4406,7 @@
},
{
"cell_type": "markdown",
- "id": "3bc1c2e3",
+ "id": "950b1dd1",
"metadata": {
"editable": true
},
@@ -4418,7 +4418,7 @@
},
{
"cell_type": "markdown",
- "id": "0354e692",
+ "id": "b9c8909c",
"metadata": {
"editable": true
},
@@ -4430,7 +4430,7 @@
},
{
"cell_type": "markdown",
- "id": "d65dd254",
+ "id": "e89e9876",
"metadata": {
"editable": true
},
@@ -4443,7 +4443,7 @@
},
{
"cell_type": "markdown",
- "id": "6574f03f",
+ "id": "2f677804",
"metadata": {
"editable": true
},
@@ -4470,7 +4470,7 @@
},
{
"cell_type": "markdown",
- "id": "19e3b7a0",
+ "id": "42d4d665",
"metadata": {
"editable": true
},
@@ -4481,7 +4481,7 @@
{
"cell_type": "code",
"execution_count": 44,
- "id": "9d354722",
+ "id": "e6057957",
"metadata": {
"collapsed": false,
"editable": true
@@ -4577,7 +4577,7 @@
},
{
"cell_type": "markdown",
- "id": "68a978aa",
+ "id": "03aaa217",
"metadata": {
"editable": true
},
@@ -4592,7 +4592,7 @@
},
{
"cell_type": "markdown",
- "id": "69bfb6ca",
+ "id": "fa5b22cd",
"metadata": {
"editable": true
},
@@ -4614,7 +4614,7 @@
{
"cell_type": "code",
"execution_count": 45,
- "id": "a8cf549e",
+ "id": "80b4e2fd",
"metadata": {
"collapsed": false,
"editable": true
@@ -4689,7 +4689,7 @@
},
{
"cell_type": "markdown",
- "id": "edd97676",
+ "id": "ef276791",
"metadata": {
"editable": true
},
@@ -4701,7 +4701,7 @@
},
{
"cell_type": "markdown",
- "id": "8b1a182a",
+ "id": "ecac9f49",
"metadata": {
"editable": true
},
@@ -4770,7 +4770,7 @@
},
{
"cell_type": "markdown",
- "id": "3a973417",
+ "id": "7394d9c5",
"metadata": {
"editable": true
},
@@ -4784,7 +4784,7 @@
{
"cell_type": "code",
"execution_count": 46,
- "id": "c3295eaa",
+ "id": "a65b2934",
"metadata": {
"collapsed": false,
"editable": true
@@ -4797,7 +4797,7 @@
},
{
"cell_type": "markdown",
- "id": "7a4fca8c",
+ "id": "82b37eaf",
"metadata": {
"editable": true
},
@@ -4811,7 +4811,7 @@
},
{
"cell_type": "markdown",
- "id": "13316f63",
+ "id": "85929fd6",
"metadata": {
"editable": true
},
@@ -4824,7 +4824,7 @@
},
{
"cell_type": "markdown",
- "id": "820a0264",
+ "id": "3c0ecece",
"metadata": {
"editable": true
},
@@ -4835,7 +4835,7 @@
},
{
"cell_type": "markdown",
- "id": "abfb8260",
+ "id": "8e30f349",
"metadata": {
"editable": true
},
@@ -4847,7 +4847,7 @@
},
{
"cell_type": "markdown",
- "id": "98edfb0f",
+ "id": "d61feb53",
"metadata": {
"editable": true
},
@@ -4857,7 +4857,7 @@
},
{
"cell_type": "markdown",
- "id": "40e5092f",
+ "id": "958c619a",
"metadata": {
"editable": true
},
@@ -4869,7 +4869,7 @@
},
{
"cell_type": "markdown",
- "id": "29f0cb53",
+ "id": "f1e51afb",
"metadata": {
"editable": true
},
@@ -4880,7 +4880,7 @@
},
{
"cell_type": "markdown",
- "id": "db5058c8",
+ "id": "5b7a1dd2",
"metadata": {
"editable": true
},
@@ -4899,7 +4899,7 @@
{
"cell_type": "code",
"execution_count": 47,
- "id": "38f7c5e6",
+ "id": "5a5612a3",
"metadata": {
"collapsed": false,
"editable": true
@@ -4915,7 +4915,7 @@
},
{
"cell_type": "markdown",
- "id": "31fd7bd4",
+ "id": "894f4f46",
"metadata": {
"editable": true
},
@@ -4925,7 +4925,7 @@
},
{
"cell_type": "markdown",
- "id": "c99adcd3",
+ "id": "fc7ca802",
"metadata": {
"editable": true
},
@@ -4936,7 +4936,7 @@
},
{
"cell_type": "markdown",
- "id": "d56769ba",
+ "id": "d1212a10",
"metadata": {
"editable": true
},
@@ -4948,7 +4948,7 @@
},
{
"cell_type": "markdown",
- "id": "9a4867aa",
+ "id": "c051f42f",
"metadata": {
"editable": true
},
diff --git a/doc/pub/week35/ipynb/week35.ipynb b/doc/pub/week35/ipynb/week35.ipynb
index c2d22256b..c981143f7 100644
--- a/doc/pub/week35/ipynb/week35.ipynb
+++ b/doc/pub/week35/ipynb/week35.ipynb
@@ -3,9 +3,7 @@
{
"cell_type": "markdown",
"id": "2070762b",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"\n",
@@ -15,9 +13,7 @@
{
"cell_type": "markdown",
"id": "3a35ce03",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"# Week 35: From Ordinary Linear Regression to Ridge and Lasso Regression\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",
@@ -28,9 +24,7 @@
{
"cell_type": "markdown",
"id": "f250b29c",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Plans for week 35\n",
"\n",
@@ -50,9 +44,7 @@
{
"cell_type": "markdown",
"id": "157d1840",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"### Reading recommendations:\n",
"\n",
@@ -66,9 +58,7 @@
{
"cell_type": "markdown",
"id": "1f0e5f64",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Why Linear Regression (aka Ordinary Least Squares and family), repeat from last week\n",
"\n",
@@ -100,9 +90,7 @@
{
"cell_type": "markdown",
"id": "e15c5dd7",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## The equations for ordinary least squares\n",
"\n",
@@ -116,9 +104,7 @@
{
"cell_type": "markdown",
"id": "7205f9ed",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"y_i=f(x_i)+\\epsilon_i,\n",
@@ -128,9 +114,7 @@
{
"cell_type": "markdown",
"id": "58035123",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"or in general"
]
@@ -138,9 +122,7 @@
{
"cell_type": "markdown",
"id": "5c054dc2",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\boldsymbol{y}=f(\\boldsymbol{x})+\\boldsymbol{\\epsilon},\n",
@@ -150,9 +132,7 @@
{
"cell_type": "markdown",
"id": "1ccbf405",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"where $\\boldsymbol{\\epsilon}$ represents some noise which is normally assumed to\n",
"be distributed via a normal probability distribution with zero mean\n",
@@ -171,9 +151,7 @@
{
"cell_type": "markdown",
"id": "4fc747be",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\boldsymbol{\\tilde{y}}= \\boldsymbol{X}\\boldsymbol{\\beta},\n",
@@ -183,9 +161,7 @@
{
"cell_type": "markdown",
"id": "324815b4",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"and in order to find the optimal parameters $\\beta_i$ we defined a function which\n",
"gives a measure of the spread between the values $y_i$ (which\n",
@@ -196,9 +172,7 @@
{
"cell_type": "markdown",
"id": "c31fc801",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## The cost/loss function\n",
"\n",
@@ -208,9 +182,7 @@
{
"cell_type": "markdown",
"id": "5f390ec4",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"C(\\boldsymbol{\\beta})=\\frac{1}{n}\\sum_{i=0}^{n-1}\\left(y_i-\\tilde{y}_i\\right)^2=\\frac{1}{n}\\left\\{\\left(\\boldsymbol{y}-\\boldsymbol{\\tilde{y}}\\right)^T\\left(\\boldsymbol{y}-\\boldsymbol{\\tilde{y}}\\right)\\right\\},\n",
@@ -220,9 +192,7 @@
{
"cell_type": "markdown",
"id": "a7b23937",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"or using the matrix $\\boldsymbol{X}$ and in a more compact matrix-vector notation as"
]
@@ -230,9 +200,7 @@
{
"cell_type": "markdown",
"id": "db0cea3d",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"C(\\boldsymbol{\\beta})=\\frac{1}{n}\\left\\{\\left(\\boldsymbol{y}-\\boldsymbol{X}\\boldsymbol{\\beta}\\right)^T\\left(\\boldsymbol{y}-\\boldsymbol{X}\\boldsymbol{\\beta}\\right)\\right\\}.\n",
@@ -242,9 +210,7 @@
{
"cell_type": "markdown",
"id": "936418d7",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"This function represents one of many possible ways to define the so-called cost function.\n",
"\n",
@@ -255,9 +221,7 @@
{
"cell_type": "markdown",
"id": "3b2a6714",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"C(\\boldsymbol{\\beta})=\\frac{1}{2n}\\sum_{i=0}^{n-1}\\left(y_i-\\tilde{y}_i\\right)^2,\n",
@@ -267,9 +231,7 @@
{
"cell_type": "markdown",
"id": "54120755",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"since when taking the first derivative with respect to the unknown parameters $\\beta$, the factor of $2$ cancels out."
]
@@ -277,9 +239,7 @@
{
"cell_type": "markdown",
"id": "f8854f6e",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Interpretations and optimizing our parameters\n",
"\n",
@@ -289,9 +249,7 @@
{
"cell_type": "markdown",
"id": "468fd216",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"C(\\boldsymbol{\\beta})=\\frac{1}{n}\\left\\{\\left(\\boldsymbol{y}-\\boldsymbol{X}\\boldsymbol{\\beta}\\right)^T\\left(\\boldsymbol{y}-\\boldsymbol{X}\\boldsymbol{\\beta}\\right)\\right\\},\n",
@@ -301,9 +259,7 @@
{
"cell_type": "markdown",
"id": "cd5e2caa",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"can be linked to the variance of the quantity $y_i$ if we interpret the latter as the mean value. \n",
"When linking (see the discussions next week) with the maximum likelihood approach below, we will indeed interpret $y_i$ as a mean value"
@@ -312,9 +268,7 @@
{
"cell_type": "markdown",
"id": "32e08e08",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"y_{i}=\\langle y_i \\rangle = \\beta_0x_{i,0}+\\beta_1x_{i,1}+\\beta_2x_{i,2}+\\dots+\\beta_{n-1}x_{i,n-1}+\\epsilon_i,\n",
@@ -324,9 +278,7 @@
{
"cell_type": "markdown",
"id": "af8df8e6",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"where $\\langle y_i \\rangle$ is the mean value. Keep in mind also that\n",
"till now we have treated $y_i$ as the exact value. Normally, the\n",
@@ -343,9 +295,7 @@
{
"cell_type": "markdown",
"id": "89f55eba",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"{\\displaystyle \\min_{\\boldsymbol{\\beta}\\in\n",
@@ -356,9 +306,7 @@
{
"cell_type": "markdown",
"id": "3594bcb9",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"In practical terms it means we will require"
]
@@ -366,9 +314,7 @@
{
"cell_type": "markdown",
"id": "1e45992c",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\frac{\\partial C(\\boldsymbol{\\beta})}{\\partial \\beta_j} = \\frac{\\partial }{\\partial \\beta_j}\\left[ \\frac{1}{n}\\sum_{i=0}^{n-1}\\left(y_i-\\beta_0x_{i,0}-\\beta_1x_{i,1}-\\beta_2x_{i,2}-\\dots-\\beta_{n-1}x_{i,n-1}\\right)^2\\right]=0,\n",
@@ -378,9 +324,7 @@
{
"cell_type": "markdown",
"id": "90198ba6",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"which results in"
]
@@ -388,9 +332,7 @@
{
"cell_type": "markdown",
"id": "78c4cc43",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\frac{\\partial C(\\boldsymbol{\\beta})}{\\partial \\beta_j} = -\\frac{2}{n}\\left[ \\sum_{i=0}^{n-1}x_{ij}\\left(y_i-\\beta_0x_{i,0}-\\beta_1x_{i,1}-\\beta_2x_{i,2}-\\dots-\\beta_{n-1}x_{i,n-1}\\right)\\right]=0,\n",
@@ -400,9 +342,7 @@
{
"cell_type": "markdown",
"id": "8d138d4c",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"or in a matrix-vector form as (multiplying away the factor $-2/n$, see derivation below)"
]
@@ -410,9 +350,7 @@
{
"cell_type": "markdown",
"id": "ba40b8d7",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\frac{\\partial C(\\boldsymbol{\\beta})}{\\partial \\boldsymbol{\\beta}^T} = 0 = \\boldsymbol{X}^T\\left( \\boldsymbol{y}-\\boldsymbol{X}\\boldsymbol{\\beta}\\right).\n",
@@ -422,9 +360,7 @@
{
"cell_type": "markdown",
"id": "e8f749fe",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Interpretations and optimizing our parameters\n",
"We can rewrite, see the derivations below,"
@@ -433,9 +369,7 @@
{
"cell_type": "markdown",
"id": "c679efad",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\frac{\\partial C(\\boldsymbol{\\beta})}{\\partial \\boldsymbol{\\beta}^T} = 0 = \\boldsymbol{X}^T\\left( \\boldsymbol{y}-\\boldsymbol{X}\\boldsymbol{\\beta}\\right),\n",
@@ -445,9 +379,7 @@
{
"cell_type": "markdown",
"id": "f1aaeaca",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"as"
]
@@ -455,9 +387,7 @@
{
"cell_type": "markdown",
"id": "fd4ae817",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\boldsymbol{X}^T\\boldsymbol{y} = \\boldsymbol{X}^T\\boldsymbol{X}\\boldsymbol{\\beta},\n",
@@ -467,9 +397,7 @@
{
"cell_type": "markdown",
"id": "d09f9a77",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"and if the matrix $\\boldsymbol{X}^T\\boldsymbol{X}$ is invertible we have the solution"
]
@@ -477,9 +405,7 @@
{
"cell_type": "markdown",
"id": "09ec2766",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\boldsymbol{\\beta} =\\left(\\boldsymbol{X}^T\\boldsymbol{X}\\right)^{-1}\\boldsymbol{X}^T\\boldsymbol{y}.\n",
@@ -489,9 +415,7 @@
{
"cell_type": "markdown",
"id": "ad758d65",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"We note also that since our design matrix is defined as $\\boldsymbol{X}\\in\n",
"{\\mathbb{R}}^{n\\times p}$, the product $\\boldsymbol{X}^T\\boldsymbol{X} \\in\n",
@@ -509,9 +433,7 @@
{
"cell_type": "markdown",
"id": "9d72460a",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Some useful matrix and vector expressions\n",
"\n",
@@ -536,9 +458,7 @@
{
"cell_type": "markdown",
"id": "318afac7",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\boldsymbol{y}=f(\\boldsymbol{x}).\n",
@@ -548,9 +468,7 @@
{
"cell_type": "markdown",
"id": "e885156f",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## The Jacobian\n",
"\n",
@@ -560,9 +478,7 @@
{
"cell_type": "markdown",
"id": "cd7e8abb",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\boldsymbol{J}=\\frac{\\partial \\boldsymbol{y}}{\\partial \\boldsymbol{x}}=\\begin{bmatrix} \\frac{\\partial y_0}{\\partial x_0} & \\frac{\\partial y_0}{\\partial x_1} & \\frac{\\partial y_0}{\\partial x_2} & \\dots & \\dots & \\frac{\\partial y_0}{\\partial x_{n-1}} \\\\ \\frac{\\partial y_0}{\\partial x_0} & \\frac{\\partial y_1}{\\partial x_1} & \\frac{\\partial y_1}{\\partial x_2} & \\dots & \\dots & \\frac{\\partial y_1}{\\partial x_{n-1}} \\\\\n",
@@ -576,9 +492,7 @@
{
"cell_type": "markdown",
"id": "6a7946a6",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"which is an $m\\times n$ matrix. If $\\boldsymbol{x}$ is a scalar, then the\n",
"Jacobian is only a single-column vector, or an $m\\times 1$ matrix. If\n",
@@ -594,9 +508,7 @@
{
"cell_type": "markdown",
"id": "bc7dac5b",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Derivatives, example 1\n",
"\n",
@@ -606,9 +518,7 @@
{
"cell_type": "markdown",
"id": "fb7b7c7a",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"y_i = \\sum_{j=0}^{n-1}a_{ij}x_j,\n",
@@ -618,9 +528,7 @@
{
"cell_type": "markdown",
"id": "fdab3f90",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"with $\\forall i=0,1,2,\\dots,m-1$. The individual matrix elements of $\\boldsymbol{A}$ are given by the symbol $a_{ij}$.\n",
"It follows that the partial derivatives of $y_i$ with respect to $x_k$"
@@ -629,9 +537,7 @@
{
"cell_type": "markdown",
"id": "d398d440",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\frac{\\partial y_i }{\\partial x_k}= a_{ik} \\forall i=0,1,2,\\dots,m-1.\n",
@@ -641,9 +547,7 @@
{
"cell_type": "markdown",
"id": "f90d2059",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"From this we have, using the definition of the Jacobian"
]
@@ -651,9 +555,7 @@
{
"cell_type": "markdown",
"id": "3872052b",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\frac{\\partial \\boldsymbol{y} }{\\partial \\boldsymbol{x}}= \\boldsymbol{A}.\n",
@@ -663,9 +565,7 @@
{
"cell_type": "markdown",
"id": "535cf990",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Example 2\n",
"\n",
@@ -677,9 +577,7 @@
{
"cell_type": "markdown",
"id": "197d3e9f",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\alpha = \\boldsymbol{y}^T\\boldsymbol{A}\\boldsymbol{x},\n",
@@ -689,9 +587,7 @@
{
"cell_type": "markdown",
"id": "e2c7a4f9",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"with $\\boldsymbol{y}$ a vector of length $m$, $\\boldsymbol{A}$ an $m\\times n$ matrix and $\\boldsymbol{x}$ a vector of length $n$. We assume also that $\\boldsymbol{A}$ does not depend on any of the two vectors.\n",
"In order to find the derivative of $\\alpha$ with respect to the two vectors, we define an intermediate vector $\\boldsymbol{z}$. We define first\n",
@@ -701,9 +597,7 @@
{
"cell_type": "markdown",
"id": "834ecb73",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\alpha = \\boldsymbol{z}^T\\boldsymbol{x},\n",
@@ -713,9 +607,7 @@
{
"cell_type": "markdown",
"id": "89e5b0d3",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"which means that (using our previous example) we have"
]
@@ -723,9 +615,7 @@
{
"cell_type": "markdown",
"id": "f7e022ca",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\frac{\\partial \\alpha}{\\partial \\boldsymbol{x}} = \\boldsymbol{z}=bm{A}^T\\boldsymbol{y}.\n",
@@ -735,9 +625,7 @@
{
"cell_type": "markdown",
"id": "0f9fa0cd",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"Note that the resulting vector elements are the same for $\\boldsymbol{z}^T$ and $\\boldsymbol{z}$, the only difference is that one if just the transpose of the other.\n",
"\n",
@@ -747,9 +635,7 @@
{
"cell_type": "markdown",
"id": "7207e78d",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\frac{\\partial \\alpha}{\\partial \\boldsymbol{y}} = \\boldsymbol{z}^T=\\boldsymbol{x}^T\\boldsymbol{A}^T.\n",
@@ -759,9 +645,7 @@
{
"cell_type": "markdown",
"id": "a58d233a",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Example 3\n",
"\n",
@@ -773,9 +657,7 @@
{
"cell_type": "markdown",
"id": "08676c15",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\alpha = \\boldsymbol{x}^T\\boldsymbol{A}\\boldsymbol{x},\n",
@@ -785,9 +667,7 @@
{
"cell_type": "markdown",
"id": "0c4417ed",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"with $\\boldsymbol{x}$ a vector of length $n$.\n",
"\n",
@@ -797,9 +677,7 @@
{
"cell_type": "markdown",
"id": "9f43d971",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\alpha = \\sum_{i=0}^{n-1}\\sum_{j=0}^{n-1}x_i a_{ij}x_j,\n",
@@ -809,9 +687,7 @@
{
"cell_type": "markdown",
"id": "b0fc3f13",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"taking the derivative of $\\alpha$ with respect to a given component $x_k$ we get the two sums"
]
@@ -819,9 +695,7 @@
{
"cell_type": "markdown",
"id": "105376e3",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\frac{\\partial \\alpha}{\\partial x_k} = \\sum_{i=0}^{n-1}a_{ik}x_i+\\sum_{j=0}^{n-1}a_{kj}x_j,\n",
@@ -831,9 +705,7 @@
{
"cell_type": "markdown",
"id": "6aa6fe7f",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"for $\\forall k =0,1,2,\\dots,n-1$. We identify these sums as"
]
@@ -841,9 +713,7 @@
{
"cell_type": "markdown",
"id": "7fecb158",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\frac{\\partial \\alpha}{\\partial \\boldsymbol{x}} = \\boldsymbol{x}^T\\left(\\boldsymbol{A}^T+\\boldsymbol{A}\\right).\n",
@@ -853,9 +723,7 @@
{
"cell_type": "markdown",
"id": "d0e52ab7",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"If the matrix $\\boldsymbol{A}$ is symmetric, that is $\\boldsymbol{A}=\\boldsymbol{A}^T$, we have"
]
@@ -863,9 +731,7 @@
{
"cell_type": "markdown",
"id": "12dd776d",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\frac{\\partial \\alpha}{\\partial \\boldsymbol{x}} = 2\\boldsymbol{x}^T\\boldsymbol{A}.\n",
@@ -875,9 +741,7 @@
{
"cell_type": "markdown",
"id": "78b3f176",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Example 4\n",
"\n",
@@ -887,9 +751,7 @@
{
"cell_type": "markdown",
"id": "6b03b52f",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\alpha = \\boldsymbol{y}^T\\boldsymbol{x},\n",
@@ -899,9 +761,7 @@
{
"cell_type": "markdown",
"id": "7e9addc3",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"where both $\\boldsymbol{y}$ and $\\boldsymbol{x}$ have the same length $n$, or if we\n",
"wish to think of them as column vectors, they have dimensions $n\\times\n",
@@ -914,9 +774,7 @@
{
"cell_type": "markdown",
"id": "6338444a",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\alpha = \\sum_{i=0}^{n-1}y_ix_i,\n",
@@ -926,9 +784,7 @@
{
"cell_type": "markdown",
"id": "415c5e3d",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"and the partial derivative"
]
@@ -936,9 +792,7 @@
{
"cell_type": "markdown",
"id": "a1cbb5b8",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\frac{\\partial \\alpha}{\\partial z_k} = \\sum_{i=0}^{n-1}\\left(x_i\\frac{\\partial y_i}{\\partial z_k}+y_i\\frac{\\partial x_i}{\\partial z_k}\\right),\n",
@@ -948,9 +802,7 @@
{
"cell_type": "markdown",
"id": "43d23259",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"for $\\forall k =0,1,2,\\dots,n-1$. We can rewrite the partial derivative in a more compact form as"
]
@@ -958,9 +810,7 @@
{
"cell_type": "markdown",
"id": "2171f18c",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\frac{\\partial \\alpha}{\\partial \\boldsymbol{z}} = \\boldsymbol{x}^T\\frac{\\partial \\boldsymbol{y}}{\\partial \\boldsymbol{z}}+\\boldsymbol{y}^T\\frac{\\partial \\boldsymbol{x}}{\\partial \\boldsymbol{z}},\n",
@@ -970,9 +820,7 @@
{
"cell_type": "markdown",
"id": "292802ce",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"and if $\\boldsymbol{y}=\\boldsymbol{x}$ we have"
]
@@ -980,9 +828,7 @@
{
"cell_type": "markdown",
"id": "b1fa893a",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\frac{\\partial \\alpha}{\\partial \\boldsymbol{z}} = 2\\boldsymbol{x}^T\\frac{\\partial \\boldsymbol{x}}{\\partial \\boldsymbol{z}}.\n",
@@ -992,9 +838,7 @@
{
"cell_type": "markdown",
"id": "d5a8e55b",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## The mean squared error and its derivative\n",
"\n",
@@ -1004,9 +848,7 @@
{
"cell_type": "markdown",
"id": "475b3f93",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"C(\\boldsymbol{\\beta})=\\frac{1}{n}\\sum_{i=0}^{n-1}\\left(y_i-\\tilde{y}_i\\right)^2=\\frac{1}{n}\\left\\{\\left(\\boldsymbol{y}-\\boldsymbol{\\tilde{y}}\\right)^T\\left(\\boldsymbol{y}-\\boldsymbol{\\tilde{y}}\\right)\\right\\},\n",
@@ -1016,9 +858,7 @@
{
"cell_type": "markdown",
"id": "aff37293",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"or using the design/feature matrix $\\boldsymbol{X}$ we have the more compact matrix-vector"
]
@@ -1026,9 +866,7 @@
{
"cell_type": "markdown",
"id": "4fbe21f5",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"C(\\boldsymbol{\\beta})=\\frac{1}{n}\\left\\{\\left(\\boldsymbol{y}-\\boldsymbol{X}\\boldsymbol{\\beta}\\right)^T\\left(\\boldsymbol{y}-\\boldsymbol{X}\\boldsymbol{\\beta}\\right)\\right\\}.\n",
@@ -1038,9 +876,7 @@
{
"cell_type": "markdown",
"id": "3febdaf6",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"We note that the design matrix $\\boldsymbol{X}$ does not depend on the unknown parameters defined by the vector $\\boldsymbol{\\beta}$.\n",
"We are now interested in minimizing the cost function with respect to the unknown parameters $\\boldsymbol{\\beta}$.\n",
@@ -1051,9 +887,7 @@
{
"cell_type": "markdown",
"id": "81b55f55",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\boldsymbol{w}=\\boldsymbol{y}-\\boldsymbol{X}\\boldsymbol{\\beta},\n",
@@ -1063,9 +897,7 @@
{
"cell_type": "markdown",
"id": "19b56c51",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"which depends on $\\boldsymbol{\\beta}$. We rewrite the cost function as"
]
@@ -1073,9 +905,7 @@
{
"cell_type": "markdown",
"id": "97f789ce",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"C(\\boldsymbol{\\beta})=\\frac{1}{n}\\boldsymbol{w}^T\\boldsymbol{w},\n",
@@ -1085,9 +915,7 @@
{
"cell_type": "markdown",
"id": "5a3a13b2",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"with partial derivative"
]
@@ -1095,9 +923,7 @@
{
"cell_type": "markdown",
"id": "94a125c0",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\frac{\\partial C(\\boldsymbol{\\beta})}{\\partial \\boldsymbol{\\beta}}=\\frac{2}{n}\\boldsymbol{w}^T\\frac{\\partial \\boldsymbol{w}}{\\partial \\boldsymbol{\\beta}},\n",
@@ -1107,9 +933,7 @@
{
"cell_type": "markdown",
"id": "91987be9",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"and using that"
]
@@ -1117,9 +941,7 @@
{
"cell_type": "markdown",
"id": "bf3d4757",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\frac{\\partial \\boldsymbol{w}}{\\partial \\boldsymbol{\\beta}}=-\\boldsymbol{X},\n",
@@ -1129,9 +951,7 @@
{
"cell_type": "markdown",
"id": "73a98618",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"where we used the result from example two above. Inserting the last expression we obtain"
]
@@ -1139,9 +959,7 @@
{
"cell_type": "markdown",
"id": "d45f357b",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\frac{\\partial C(\\boldsymbol{\\beta})}{\\partial \\boldsymbol{\\beta}}=-\\frac{2}{n}\\left(\\boldsymbol{y}-\\boldsymbol{X}\\boldsymbol{\\beta}\\right)^T\\boldsymbol{X},\n",
@@ -1151,9 +969,7 @@
{
"cell_type": "markdown",
"id": "4f286236",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"or as"
]
@@ -1161,9 +977,7 @@
{
"cell_type": "markdown",
"id": "8e44e034",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\frac{\\partial C(\\boldsymbol{\\beta})}{\\partial \\boldsymbol{\\beta}^T}=-\\frac{2}{n}\\boldsymbol{X}^T\\left(\\boldsymbol{y}-\\boldsymbol{X}\\boldsymbol{\\beta}\\right).\n",
@@ -1173,9 +987,7 @@
{
"cell_type": "markdown",
"id": "2b173bf4",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Other useful relations\n",
"\n",
@@ -1185,9 +997,7 @@
{
"cell_type": "markdown",
"id": "44c07349",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\frac{\\partial (\\boldsymbol{b}^T\\boldsymbol{a})}{\\partial \\boldsymbol{a}} = \\boldsymbol{b},\n",
@@ -1197,9 +1007,7 @@
{
"cell_type": "markdown",
"id": "9655d305",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\frac{\\partial tr(\\boldsymbol{B}\\boldsymbol{A})}{\\partial \\boldsymbol{A}} = \\boldsymbol{B}^T,\n",
@@ -1209,9 +1017,7 @@
{
"cell_type": "markdown",
"id": "c6f9029b",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\frac{\\partial \\log{\\vert\\boldsymbol{A}\\vert}}{\\partial \\boldsymbol{A}} = (\\boldsymbol{A}^{-1})^T.\n",
@@ -1221,9 +1027,7 @@
{
"cell_type": "markdown",
"id": "c9bdbee5",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Meet the Hessian Matrix\n",
"\n",
@@ -1237,9 +1041,7 @@
{
"cell_type": "markdown",
"id": "37e20b51",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\frac{\\partial}{\\partial \\boldsymbol{\\beta}}\\frac{\\partial C(\\boldsymbol{\\beta})}{\\partial \\boldsymbol{\\beta}^T} =\\frac{\\partial}{\\partial \\boldsymbol{\\beta}}\\left[-\\frac{2}{n}\\boldsymbol{X}^T\\left( \\boldsymbol{y}-\\boldsymbol{X}\\boldsymbol{\\beta}\\right)\\right]=\\frac{2}{n}\\boldsymbol{X}^T\\boldsymbol{X}.\n",
@@ -1249,9 +1051,7 @@
{
"cell_type": "markdown",
"id": "44d0f0c2",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"The Hessian matrix plays an important role and is defined here as"
]
@@ -1259,9 +1059,7 @@
{
"cell_type": "markdown",
"id": "f041c827",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\boldsymbol{H}=\\boldsymbol{X}^T\\boldsymbol{X}.\n",
@@ -1271,9 +1069,7 @@
{
"cell_type": "markdown",
"id": "b954f008",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"For ordinary least squares, it is inversely proportional (derivation\n",
"next week) with the variance of the optimal parameters\n",
@@ -1289,9 +1085,7 @@
{
"cell_type": "markdown",
"id": "123e7a0b",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Interpretations and optimizing our parameters\n",
"\n",
@@ -1301,9 +1095,7 @@
{
"cell_type": "markdown",
"id": "ff1d71b0",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\boldsymbol{\\epsilon} = \\boldsymbol{y}-\\boldsymbol{\\tilde{y}} = \\boldsymbol{y}-\\boldsymbol{X}\\boldsymbol{\\beta},\n",
@@ -1313,9 +1105,7 @@
{
"cell_type": "markdown",
"id": "d50b1eff",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"and with"
]
@@ -1323,9 +1113,7 @@
{
"cell_type": "markdown",
"id": "b653da9a",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\boldsymbol{X}^T\\left( \\boldsymbol{y}-\\boldsymbol{X}\\boldsymbol{\\beta}\\right)= 0,\n",
@@ -1335,9 +1123,7 @@
{
"cell_type": "markdown",
"id": "6763c705",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"we have"
]
@@ -1345,9 +1131,7 @@
{
"cell_type": "markdown",
"id": "4814c60a",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\boldsymbol{X}^T\\boldsymbol{\\epsilon}=\\boldsymbol{X}^T\\left( \\boldsymbol{y}-\\boldsymbol{X}\\boldsymbol{\\beta}\\right)= 0,\n",
@@ -1357,9 +1141,7 @@
{
"cell_type": "markdown",
"id": "b311b8f0",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"meaning that the solution for $\\boldsymbol{\\beta}$ is the one which minimizes the residuals."
]
@@ -1367,9 +1149,7 @@
{
"cell_type": "markdown",
"id": "024997c9",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Example relevant for the exercises\n",
"\n",
@@ -1381,9 +1161,7 @@
{
"cell_type": "markdown",
"id": "fd049343",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\tilde{y}_i = \\beta_0+\\beta_1x_i+\\beta_2x_i^2+\\beta_3x_i^3+\\beta_4x_i^4.\n",
@@ -1393,9 +1171,7 @@
{
"cell_type": "markdown",
"id": "2b2c756c",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"we have five predictors/features. The first is the intercept $\\beta_0$. The other terms are $\\beta_i$ with $i=1,2,3,4$. Furthermore we have $n$ entries for each predictor. It means that our design matrix is an \n",
"$n\\times p$ matrix $\\boldsymbol{X}$."
@@ -1404,9 +1180,7 @@
{
"cell_type": "markdown",
"id": "71e03c6e",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Own code for Ordinary Least Squares\n",
"\n",
@@ -1415,38 +1189,42 @@
},
{
"cell_type": "code",
- "execution_count": 1,
+ "execution_count": 21,
"id": "49ebb09f",
- "metadata": {
- "collapsed": false,
- "editable": true
- },
- "outputs": [],
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "[2.00000000e+00 5.08482145e-14 5.00000000e+00]\n"
+ ]
+ }
+ ],
"source": [
"# matrix inversion to find beta\n",
"# First we set up the data\n",
"import numpy as np\n",
"x = np.random.rand(100)\n",
- "y = 2.0+5*x*x+0.1*np.random.randn(100)\n",
+ "y = 2.0+5*x*x#+0.1*np.random.randn(100)\n",
"# and then the design matrix X including the intercept\n",
"# The design matrix now as function of a fourth-order polynomial\n",
- "X = np.zeros((len(x),5))\n",
+ "X = np.zeros((len(x),3))\n",
"X[:,0] = 1.0\n",
"X[:,1] = x\n",
"X[:,2] = x**2\n",
- "X[:,3] = x**3\n",
- "X[:,4] = x**4\n",
+ "#X[:,3] = x**3\n",
+ "#X[:,4] = x**4\n",
"beta = (np.linalg.inv(X.T @ X) @ X.T ) @ y\n",
"# and then make the prediction\n",
- "ytilde = X @ beta"
+ "ytilde = X @ beta\n",
+ "print(beta)"
]
},
{
"cell_type": "markdown",
"id": "015ed20b",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"Alternatively, you can use the least squares functionality in **Numpy** as"
]
@@ -1455,10 +1233,7 @@
"cell_type": "code",
"execution_count": 2,
"id": "7fcdbb07",
- "metadata": {
- "collapsed": false,
- "editable": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"fit = np.linalg.lstsq(X, y, rcond =None)[0]\n",
@@ -1468,9 +1243,7 @@
{
"cell_type": "markdown",
"id": "e4dc0c88",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Adding error analysis and training set up\n",
"\n",
@@ -1482,10 +1255,7 @@
"cell_type": "code",
"execution_count": 3,
"id": "4e8dd283",
- "metadata": {
- "collapsed": false,
- "editable": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"def R2(y_data, y_model):\n",
@@ -1495,9 +1265,7 @@
{
"cell_type": "markdown",
"id": "8e7038f4",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"and we would be using it as"
]
@@ -1506,10 +1274,7 @@
"cell_type": "code",
"execution_count": 4,
"id": "3c9ff2b4",
- "metadata": {
- "collapsed": false,
- "editable": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"print(R2(y,ytilde))"
@@ -1518,22 +1283,25 @@
{
"cell_type": "markdown",
"id": "b7d31cfc",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"We can easily add our **MSE** score as"
]
},
{
"cell_type": "code",
- "execution_count": 5,
+ "execution_count": 22,
"id": "56b5aa44",
- "metadata": {
- "collapsed": false,
- "editable": true
- },
- "outputs": [],
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "3.7981483218902363e-28\n"
+ ]
+ }
+ ],
"source": [
"def MSE(y_data,y_model):\n",
" n = np.size(y_model)\n",
@@ -1545,9 +1313,7 @@
{
"cell_type": "markdown",
"id": "418766ca",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"and finally the relative error as"
]
@@ -1556,10 +1322,7 @@
"cell_type": "code",
"execution_count": 6,
"id": "9ce8738f",
- "metadata": {
- "collapsed": false,
- "editable": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"def RelativeError(y_data,y_model):\n",
@@ -1570,9 +1333,7 @@
{
"cell_type": "markdown",
"id": "f70a5810",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Splitting our Data in Training and Test data\n",
"\n",
@@ -1591,22 +1352,33 @@
{
"cell_type": "markdown",
"id": "02999e0a",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## The complete code with a simple data set"
]
},
{
"cell_type": "code",
- "execution_count": 7,
+ "execution_count": 23,
"id": "44b7ab0c",
- "metadata": {
- "collapsed": false,
- "editable": true
- },
- "outputs": [],
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "[ 2.04266637 -0.12695475 4.66800499 1.30798223 -0.96738204]\n",
+ "Training R2\n",
+ "0.9956006550968114\n",
+ "Training MSE\n",
+ "0.009753726082528709\n",
+ "Test R2\n",
+ "0.9985674179471976\n",
+ "Test MSE\n",
+ "0.003282890787616731\n"
+ ]
+ }
+ ],
"source": [
"%matplotlib inline\n",
"\n",
@@ -1655,9 +1427,7 @@
{
"cell_type": "markdown",
"id": "8bf25c52",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Making your own test-train splitting"
]
@@ -1666,10 +1436,7 @@
"cell_type": "code",
"execution_count": 8,
"id": "f1617c0f",
- "metadata": {
- "collapsed": false,
- "editable": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"# equivalently in numpy\n",
@@ -1691,9 +1458,7 @@
{
"cell_type": "markdown",
"id": "b6cf3134",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"But since **scikit-learn** has its own function for doing this and since\n",
"it interfaces easily with **tensorflow** and other libraries, we\n",
@@ -1703,9 +1468,7 @@
{
"cell_type": "markdown",
"id": "62a7efa0",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Reducing the number of degrees of freedom, overarching view\n",
"\n",
@@ -1732,9 +1495,7 @@
{
"cell_type": "markdown",
"id": "705a9e78",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Preprocessing our data\n",
"\n",
@@ -1757,9 +1518,7 @@
{
"cell_type": "markdown",
"id": "a28e9f54",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Functionality in Scikit-Learn\n",
"\n",
@@ -1777,9 +1536,7 @@
{
"cell_type": "markdown",
"id": "4ef6e8e7",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## More preprocessing\n",
"\n",
@@ -1804,9 +1561,7 @@
{
"cell_type": "markdown",
"id": "792a7f87",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Frequently used scaling functions\n",
"\n",
@@ -1817,9 +1572,7 @@
{
"cell_type": "markdown",
"id": "be85a0d3",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"x_j^{(i)} \\rightarrow \\frac{x_j^{(i)} - \\overline{x}_j}{\\sigma(x_j)},\n",
@@ -1829,9 +1582,7 @@
{
"cell_type": "markdown",
"id": "dc73c283",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"where $\\overline{x}_j$ and $\\sigma(x_j)$ are the mean and standard deviation, respectively, of the feature $x_j$.\n",
"This ensures that each feature has zero mean and unit standard deviation. For data sets where we do not have the standard deviation or don't wish to calculate it, it is then common to simply set it to one."
@@ -1840,9 +1591,7 @@
{
"cell_type": "markdown",
"id": "0fc3e620",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Example of own Standard scaling\n",
"\n",
@@ -1854,13 +1603,419 @@
},
{
"cell_type": "code",
- "execution_count": 9,
+ "execution_count": 11,
"id": "8781e6d8",
- "metadata": {
- "collapsed": false,
- "editable": true
- },
- "outputs": [],
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " 0 | \n",
+ " 1 | \n",
+ " 2 | \n",
+ " 3 | \n",
+ " 4 | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " -1.749765 | \n",
+ " 0.342680 | \n",
+ " 1.153036 | \n",
+ " -0.252436 | \n",
+ " 0.981321 | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " 0.514219 | \n",
+ " 0.221180 | \n",
+ " -1.070043 | \n",
+ " -0.189496 | \n",
+ " 0.255001 | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " -0.458027 | \n",
+ " 0.435163 | \n",
+ " -0.583595 | \n",
+ " 0.816847 | \n",
+ " 0.672721 | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " -0.104411 | \n",
+ " -0.531280 | \n",
+ " 1.029733 | \n",
+ " -0.438136 | \n",
+ " -1.118318 | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " 1.618982 | \n",
+ " 1.541605 | \n",
+ " -0.251879 | \n",
+ " -0.842436 | \n",
+ " 0.184519 | \n",
+ "
\n",
+ " \n",
+ " | 5 | \n",
+ " 0.937082 | \n",
+ " 0.731000 | \n",
+ " 1.361556 | \n",
+ " -0.326238 | \n",
+ " 0.055676 | \n",
+ "
\n",
+ " \n",
+ " | 6 | \n",
+ " 0.222400 | \n",
+ " -1.443217 | \n",
+ " -0.756352 | \n",
+ " 0.816454 | \n",
+ " 0.750445 | \n",
+ "
\n",
+ " \n",
+ " | 7 | \n",
+ " -0.455947 | \n",
+ " 1.189622 | \n",
+ " -1.690617 | \n",
+ " -1.356399 | \n",
+ " -1.232435 | \n",
+ "
\n",
+ " \n",
+ " | 8 | \n",
+ " -0.544439 | \n",
+ " -0.668172 | \n",
+ " 0.007315 | \n",
+ " -0.612939 | \n",
+ " 1.299748 | \n",
+ "
\n",
+ " \n",
+ " | 9 | \n",
+ " -1.733096 | \n",
+ " -0.983310 | \n",
+ " 0.357508 | \n",
+ " -1.613579 | \n",
+ " 1.470714 | \n",
+ "
\n",
+ " \n",
+ "
\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",
+ " 0 | \n",
+ " 1 | \n",
+ " 2 | \n",
+ " 3 | \n",
+ " 4 | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " -1.574465 | \n",
+ " 0.259153 | \n",
+ " 1.197370 | \n",
+ " 0.147400 | \n",
+ " 0.649382 | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " 0.689519 | \n",
+ " 0.137652 | \n",
+ " -1.025709 | \n",
+ " 0.210340 | \n",
+ " -0.076938 | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " -0.282727 | \n",
+ " 0.351636 | \n",
+ " -0.539261 | \n",
+ " 1.216683 | \n",
+ " 0.340782 | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " 0.070889 | \n",
+ " -0.614808 | \n",
+ " 1.074067 | \n",
+ " -0.038300 | \n",
+ " -1.450257 | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " 1.794282 | \n",
+ " 1.458078 | \n",
+ " -0.207545 | \n",
+ " -0.442600 | \n",
+ " -0.147420 | \n",
+ "
\n",
+ " \n",
+ " | 5 | \n",
+ " 1.112383 | \n",
+ " 0.647473 | \n",
+ " 1.405890 | \n",
+ " 0.073598 | \n",
+ " -0.276263 | \n",
+ "
\n",
+ " \n",
+ " | 6 | \n",
+ " 0.397700 | \n",
+ " -1.526744 | \n",
+ " -0.712018 | \n",
+ " 1.216290 | \n",
+ " 0.418506 | \n",
+ "
\n",
+ " \n",
+ " | 7 | \n",
+ " -0.280647 | \n",
+ " 1.106095 | \n",
+ " -1.646283 | \n",
+ " -0.956563 | \n",
+ " -1.564374 | \n",
+ "
\n",
+ " \n",
+ " | 8 | \n",
+ " -0.369139 | \n",
+ " -0.751699 | \n",
+ " 0.051649 | \n",
+ " -0.213103 | \n",
+ " 0.967809 | \n",
+ "
\n",
+ " \n",
+ " | 9 | \n",
+ " -1.557795 | \n",
+ " -1.066837 | \n",
+ " 0.401842 | \n",
+ " -1.213743 | \n",
+ " 1.138775 | \n",
+ "
\n",
+ " \n",
+ "
\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",
+ " 0 | \n",
+ " 1 | \n",
+ " 2 | \n",
+ " 3 | \n",
+ " 4 | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ "
\n",
+ " \n",
+ " | 5 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ "
\n",
+ " \n",
+ " | 6 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ "
\n",
+ " \n",
+ " | 7 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ "
\n",
+ " \n",
+ " | 8 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ "
\n",
+ " \n",
+ " | 9 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ "
\n",
+ " \n",
+ "
\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"
+ }
+ ],
"source": [
"import sklearn.linear_model as skl\n",
"from sklearn.metrics import mean_squared_error\n",
@@ -1890,9 +2045,7 @@
{
"cell_type": "markdown",
"id": "ce174749",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"Small exercise: perform the standard scaling by including the standard deviation and compare with what Scikit-Learn gives."
]
@@ -1900,9 +2053,7 @@
{
"cell_type": "markdown",
"id": "5c5ec899",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Min-Max Scaling\n",
"\n",
@@ -1915,9 +2066,7 @@
{
"cell_type": "markdown",
"id": "1269be22",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"x_j^{(i)} \\rightarrow (b-a)\\frac{x_j^{(i)} - \\min(x_j)}{\\max(x_j) - \\min(x_j)} - a\n",
@@ -1927,9 +2076,7 @@
{
"cell_type": "markdown",
"id": "49bcecf2",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"where $\\min(x_j)$ and $\\max(x_j)$ return the minimum and maximum value of $x_j$ over the data set, respectively."
]
@@ -1937,9 +2084,7 @@
{
"cell_type": "markdown",
"id": "d4f129da",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Testing the Means Squared Error as function of Complexity\n",
"\n",
@@ -1953,10 +2098,7 @@
"cell_type": "code",
"execution_count": 10,
"id": "a1df1f09",
- "metadata": {
- "collapsed": false,
- "editable": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"np.random.seed()\n",
@@ -1970,9 +2112,7 @@
{
"cell_type": "markdown",
"id": "4c83bb83",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"where $y$ is the function we want to fit with a given polynomial.\n",
"\n",
@@ -1981,13 +2121,21 @@
},
{
"cell_type": "code",
- "execution_count": 11,
+ "execution_count": 30,
"id": "44657a42",
- "metadata": {
- "collapsed": false,
- "editable": true
- },
- "outputs": [],
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "image/png": "iVBORw0KGgoAAAANSUhEUgAAAjEAAAGhCAYAAACQ4eUqAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAA9hAAAPYQGoP6dpAABIDklEQVR4nO3df3xT9d3//8dJ2iRtaVNKoQUppaAMEEVpEQqD4b6K4Obwcp/RzVn1EueYPyZy7Zo6/IFsk23XVOYPcOyaMtwlVodO3VCscwIO/MUKuo0xnGARWksL9Cdt2uR8/0gaGlqgaZOc/njeb7dza/LOyckrITPPvc/7vN+GaZomIiIiIr2MzeoCRERERLpCIUZERER6JYUYERER6ZUUYkRERKRXUogRERGRXkkhRkRERHolhRgRERHplRRiREREpFdSiBEREZFeSSFGREREeqUuhZiVK1eSk5ODy+UiNzeXLVu2nHTft956i+nTpzNo0CASEhIYO3YsDz30ULv91q9fz/jx43E6nYwfP54XXnihK6WJiIhIPxF2iCkqKmLRokUsWbKEkpISZsyYwdy5cyktLe1w/6SkJG6++WY2b97Mrl27uOuuu7jrrrtYvXp1cJ9t27ZRUFBAYWEhO3fupLCwkPnz5/POO+90/Z2JiIhIn2aEuwDklClTmDRpEqtWrQq2jRs3jssvv5zly5d36hhXXHEFSUlJPPXUUwAUFBRQU1PDK6+8Etxnzpw5DBw4kHXr1nXqmD6fj4MHD5KcnIxhGGG8IxEREbGKaZrU1tYybNgwbLbw+lbiwtnZ4/Gwfft27rjjjpD22bNns3Xr1k4do6SkhK1bt/KjH/0o2LZt2zZuu+22kP0uueQSVqxYcdLjNDU10dTUFLx/4MABxo8f36kaREREpGfZv38/w4cPD+s5YYWYyspKvF4vGRkZIe0ZGRmUl5ef8rnDhw/n0KFDtLS0sHTpUq6//vrgY+Xl5WEfc/ny5dx3333t2vfv309KSkpn3o6IiIhYrKamhqysLJKTk8N+blghptWJp2tM0zztKZwtW7ZQV1fH22+/zR133MGZZ57JN77xjS4f884772Tx4sXB+60fQkpKikKMiIhIL9OVoSBhhZj09HTsdnu7HpKKiop2PSknysnJAeCcc87hs88+Y+nSpcEQk5mZGfYxnU4nTqcznPJFRESkDwlrBI3D4SA3N5fi4uKQ9uLiYqZNm9bp45imGTKeJT8/v90xX3vttbCOKSIiIv1L2KeTFi9eTGFhIXl5eeTn57N69WpKS0tZuHAh4D/Nc+DAAdauXQvAY489xogRIxg7dizgnzfm5z//ObfcckvwmLfeeiszZ87kpz/9KfPmzePFF1/k9ddf56233orEexQREZE+KOwQU1BQQFVVFcuWLaOsrIwJEyawYcMGsrOzASgrKwuZM8bn83HnnXeyd+9e4uLiGD16ND/5yU/49re/Hdxn2rRpPPPMM9x1113cfffdjB49mqKiIqZMmRKBtygiIj2daZq0tLTg9XqtLkUizG63ExcXF5XpT8KeJ6anqqmpwe12U11drYG9IiK9iMfjoaysjIaGBqtLkShJTExk6NChOByOdo915/e7S1cniYiIRILP52Pv3r3Y7XaGDRuGw+HQhKV9iGmaeDweDh06xN69eznrrLPCntDuVBRiRETEMh6PB5/PR1ZWFomJiVaXI1GQkJBAfHw8n3zyCR6PB5fLFbFjaxVrERGxXCT/37n0PNH699W3RkRERHolhRgRERHplRRiREREpFdSiBEREQmDYRin3K699touH3vkyJGsWLGiU/t19No/+clPuvzavZGuTjqNJ97ay8eVdVw7bSRnDgl/hU0REelbysrKgreLioq455572L17d7AtISEhJnUsW7aMb33rWyFtJ1sJ2jRNvF4vcXGhP/sej6fDuVtOp6vPizT1xJzGyx8c5Ldvl/LvQ/VWlyIi0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PPdwemFZdmuxORERExGoKMSIiItIrKcSchtPp5N5779XswDGmz90a+tytoc/dGvrcrRHJz73PDOwVERGR/kU9MSIiItIrKcSIiIhIr6QQIyIiIr2SQoyIiIj0SgoxIiIi0ispxJzGypUrycnJweVykZuby5YtW6wuqU9bunQphmGEbJmZmVaX1eds3ryZyy67jGHDhmEYBr///e9DHjdNk6VLlzJs2DASEhKYNWsWf//7360ptg853ed+7bXXtvv+T5061Zpi+4jly5czefJkkpOTGTJkCJdffjm7d+8O2Uff98jrzOceie+7QswpFBUVsWjRIpYsWUJJSQkzZsxg7ty5lJaWWl1an3b22WdTVlYW3D788EOrS+pz6uvrmThxIo8++miHj//sZz/jwQcf5NFHH+W9994jMzOTiy++OLjQqnTN6T53gDlz5oR8/zds2BDDCvueTZs2cdNNN/H2229TXFxMS0sLs2fPpr6+PriPvu+R15nPHSLwfTflpC644AJz4cKFIW1jx44177jjDosq6vvuvfdec+LEiVaX0a8A5gsvvBC87/P5zMzMTPMnP/lJsK2xsdF0u93m448/bkGFfdOJn7tpmuY111xjzps3z5J6+ouKigoTMDdt2mSapr7vsXLi526akfm+qyfmJDweD9u3b2f27Nkh7bNnz2br1q0WVdU/7Nmzh2HDhpGTk8PXv/51Pv74Y6tL6lf27t1LeXl5yHff6XTyhS98Qd/9GHjzzTcZMmQIY8aM4Vvf+hYVFRVWl9SnVFdXA5CWlgbo+x4rJ37urbr7fVeIOYnKykq8Xi8ZGRkh7RkZGZSXl1tUVd83ZcoU1q5dy8aNG/nVr35FeXk506ZNo6qqyurS+o3W77e++7E3d+5c/u///o833niDBx54gPfee48vfvGLNDU1WV1an2CaJosXL+bzn/88EyZMAPR9j4WOPneIzPc9LhoF9yWGYYTcN02zXZtEzty5c4O3zznnHPLz8xk9ejS/+c1vWLx4sYWV9T/67sdeQUFB8PaECRPIy8sjOzubP/7xj1xxxRUWVtY33HzzzXzwwQe89dZb7R7T9z16Tva5R+L7rp6Yk0hPT8dut7dL4hUVFe0Su0RPUlIS55xzDnv27LG6lH6j9WowffetN3ToULKzs/X9j4BbbrmFl156iT//+c8MHz482K7ve3Sd7HPvSFe+7woxJ+FwOMjNzaW4uDikvbi4mGnTpllUVf/T1NTErl27GDp0qNWl9Bs5OTlkZmaGfPc9Hg+bNm3Sdz/Gqqqq2L9/v77/3WCaJjfffDPPP/88b7zxBjk5OSGP6/seHaf73DvSle+7TiedwuLFiyksLCQvL4/8/HxWr15NaWkpCxcutLq0Put73/sel112GSNGjKCiooIf/ehH1NTUcM0111hdWp9SV1fHRx99FLy/d+9eduzYQVpaGiNGjGDRokXcf//9nHXWWZx11lncf//9JCYmcuWVV1pYde93qs89LS2NpUuX8tWvfpWhQ4eyb98+fvCDH5Cens5//Md/WFh173bTTTfx9NNP8+KLL5KcnBzscXG73SQkJGAYhr7vUXC6z72uri4y3/duXdvUDzz22GNmdna26XA4zEmTJoVcHiaRV1BQYA4dOtSMj483hw0bZl5xxRXm3//+d6vL6nP+/Oc/m0C77ZprrjFN03/Z6b333mtmZmaaTqfTnDlzpvnhhx9aW3QfcKrPvaGhwZw9e7Y5ePBgMz4+3hwxYoR5zTXXmKWlpVaX3at19HkD5pNPPhncR9/3yDvd5x6p77sReDERERGRXkVjYkRERKRXUogRERGRXkkhRkRERHolhRgRERHplRRiREREpFdSiBEREZFeSSFGREREeiWFGBEREemVFGJERESkV1KIERERkV5JIUZERER6pf8fxZyuAJxwaloAAAAASUVORK5CYII=\n",
+ "text/plain": [
+ ""
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
"source": [
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
@@ -1998,8 +2146,8 @@
"\n",
"\n",
"np.random.seed(2018)\n",
- "n = 50\n",
- "maxdegree = 5\n",
+ "n = 200\n",
+ "maxdegree = 25\n",
"# Make data set.\n",
"x = np.linspace(-3, 3, n).reshape(-1, 1)\n",
"y = np.exp(-x**2) + 1.5 * np.exp(-(x-2)**2)+ np.random.normal(0, 0.1, x.shape)\n",
@@ -2030,9 +2178,7 @@
{
"cell_type": "markdown",
"id": "496c1b32",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## More preprocessing examples, two-dimensional example, the Franke function"
]
@@ -2041,10 +2187,7 @@
"cell_type": "code",
"execution_count": 12,
"id": "f660fa85",
- "metadata": {
- "collapsed": false,
- "editable": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"# Common imports\n",
@@ -2144,9 +2287,7 @@
{
"cell_type": "markdown",
"id": "896ccb4d",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## To think about, first part\n",
"\n",
@@ -2172,9 +2313,7 @@
{
"cell_type": "markdown",
"id": "99b008af",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## More thinking\n",
"\n",
@@ -2207,9 +2346,7 @@
{
"cell_type": "markdown",
"id": "58f04015",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Still thinking\n",
"\n",
@@ -2222,10 +2359,7 @@
"cell_type": "code",
"execution_count": 13,
"id": "9b656f55",
- "metadata": {
- "collapsed": false,
- "editable": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"#Model training, we compute the mean value of y and X\n",
@@ -2247,9 +2381,7 @@
{
"cell_type": "markdown",
"id": "753cc9e8",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## What does centering (subtracting the mean values) mean mathematically?\n",
"\n",
@@ -2263,9 +2395,7 @@
{
"cell_type": "markdown",
"id": "a5e38f33",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"C(\\beta_0, \\beta_1, ... , \\beta_{p-1}) = \\frac{1}{n}\\sum_{i=0}^{n} \\left(y_i - \\beta_0 - \\sum_{j=1}^{p-1} X_{ij}\\beta_j\\right)^2,.\n",
@@ -2275,9 +2405,7 @@
{
"cell_type": "markdown",
"id": "aae9b92e",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"Recall also that we use the squared value since this leads to an increase of the penalty for higher differences between predicted and output/target values.\n",
"\n",
@@ -2290,9 +2418,7 @@
{
"cell_type": "markdown",
"id": "9c291819",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\frac{\\partial C}{\\partial \\beta_j} = 0,\n",
@@ -2302,9 +2428,7 @@
{
"cell_type": "markdown",
"id": "5899d25a",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"for all $j$. For $\\beta_0$ we have"
]
@@ -2312,9 +2436,7 @@
{
"cell_type": "markdown",
"id": "0f29bd4d",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\frac{\\partial C}{\\partial \\beta_0} = -\\frac{2}{n}\\sum_{i=0}^{n-1} \\left(y_i - \\beta_0 - \\sum_{j=1}^{p-1} X_{ij} \\beta_j\\right).\n",
@@ -2324,9 +2446,7 @@
{
"cell_type": "markdown",
"id": "0cb2e6c9",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"Multiplying away the constant $2/n$, we obtain"
]
@@ -2334,9 +2454,7 @@
{
"cell_type": "markdown",
"id": "1fd38785",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\sum_{i=0}^{n-1} \\beta_0 = \\sum_{i=0}^{n-1}y_i - \\sum_{i=0}^{n-1} \\sum_{j=1}^{p-1} X_{ij} \\beta_j.\n",
@@ -2346,9 +2464,7 @@
{
"cell_type": "markdown",
"id": "5c2d75dc",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Further Manipulations\n",
"\n",
@@ -2359,9 +2475,7 @@
{
"cell_type": "markdown",
"id": "deee598d",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"n\\beta_0 = \\sum_{i=0}^{n-1}y_i - \\sum_{i=0}^{n-1} X_{i1} \\beta_1.\n",
@@ -2371,9 +2485,7 @@
{
"cell_type": "markdown",
"id": "5c6def04",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"We obtain then"
]
@@ -2381,9 +2493,7 @@
{
"cell_type": "markdown",
"id": "b963926f",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\beta_0 = \\frac{1}{n}\\sum_{i=0}^{n-1}y_i - \\beta_1\\frac{1}{n}\\sum_{i=0}^{n-1} X_{i1}.\n",
@@ -2393,9 +2503,7 @@
{
"cell_type": "markdown",
"id": "8ae1234c",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"If we define"
]
@@ -2403,9 +2511,7 @@
{
"cell_type": "markdown",
"id": "55f817b0",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\mu_1=\\frac{1}{n}\\sum_{i=0}^{n-1} (X_{i1},\n",
@@ -2415,9 +2521,7 @@
{
"cell_type": "markdown",
"id": "f9961c0a",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"and if we define the mean value of the outputs as"
]
@@ -2425,9 +2529,7 @@
{
"cell_type": "markdown",
"id": "3dbe6718",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\mu_y=\\frac{1}{n}\\sum_{i=0}^{n-1}y_i,\n",
@@ -2437,9 +2539,7 @@
{
"cell_type": "markdown",
"id": "557a9b28",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"we have"
]
@@ -2447,9 +2547,7 @@
{
"cell_type": "markdown",
"id": "21fc49fe",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\beta_0 = \\mu_y - \\beta_1\\mu_{1}.\n",
@@ -2459,9 +2557,7 @@
{
"cell_type": "markdown",
"id": "7bc10a4b",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"In the general case, that is we have more parameters than $\\beta_0$ and $\\beta_1$, we have"
]
@@ -2469,9 +2565,7 @@
{
"cell_type": "markdown",
"id": "ffdb0ae1",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\beta_0 = \\frac{1}{n}\\sum_{i=0}^{n-1}y_i - \\frac{1}{n}\\sum_{i=0}^{n-1}\\sum_{j=1}^{p-1} X_{ij}\\beta_j.\n",
@@ -2481,9 +2575,7 @@
{
"cell_type": "markdown",
"id": "df958d6d",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"Replacing $y_i$ with $y_i - y_i - \\overline{\\boldsymbol{y}}$ and centering also our design matrix results in a cost function (in vector-matrix disguise)"
]
@@ -2491,9 +2583,7 @@
{
"cell_type": "markdown",
"id": "28dda90e",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"C(\\boldsymbol{\\beta}) = (\\boldsymbol{\\tilde{y}} - \\tilde{X}\\boldsymbol{\\beta})^T(\\boldsymbol{\\tilde{y}} - \\tilde{X}\\boldsymbol{\\beta}).\n",
@@ -2503,9 +2593,7 @@
{
"cell_type": "markdown",
"id": "9cd88088",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Wrapping it up\n",
"\n",
@@ -2515,9 +2603,7 @@
{
"cell_type": "markdown",
"id": "fddcde46",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\hat{\\boldsymbol{\\beta}} = (\\tilde{X}^T\\tilde{X})^{-1}\\tilde{X}^T\\boldsymbol{\\tilde{y}},\n",
@@ -2527,9 +2613,7 @@
{
"cell_type": "markdown",
"id": "4c3b8a3c",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"where $\\boldsymbol{\\tilde{y}} = \\boldsymbol{y} - \\overline{\\boldsymbol{y}}$\n",
"and $\\tilde{X}_{ij} = X_{ij} - \\frac{1}{n}\\sum_{k=0}^{n-1}X_{kj}$.\n",
@@ -2540,9 +2624,7 @@
{
"cell_type": "markdown",
"id": "fa950e26",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\hat{\\boldsymbol{\\beta}} = (\\tilde{X}^T\\tilde{X} + \\lambda I)^{-1}\\tilde{X}^T\\boldsymbol{\\tilde{y}}.\n",
@@ -2552,9 +2634,7 @@
{
"cell_type": "markdown",
"id": "1d98e3f4",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"What does this mean? And why do we insist on all this? Let us look at some examples."
]
@@ -2562,9 +2642,7 @@
{
"cell_type": "markdown",
"id": "6c8035a9",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Linear Regression code, Intercept handling first\n",
"\n",
@@ -2576,10 +2654,7 @@
"cell_type": "code",
"execution_count": 14,
"id": "c83cd747",
- "metadata": {
- "collapsed": false,
- "editable": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
@@ -2673,9 +2748,7 @@
{
"cell_type": "markdown",
"id": "df626a96",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"The intercept is the value of our output/target variable\n",
"when all our features are zero and our function crosses the $y$-axis (for a one-dimensional case). \n",
@@ -2694,9 +2767,7 @@
{
"cell_type": "markdown",
"id": "2e335693",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\lambda \\vert\\vert \\boldsymbol{\\beta} \\vert\\vert_2^2 = \\lambda \\sum_{j=0}^{p-1}\\beta_j^2,\n",
@@ -2706,9 +2777,7 @@
{
"cell_type": "markdown",
"id": "80c69bda",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"but when we take out the intercept, this equation becomes"
]
@@ -2716,9 +2785,7 @@
{
"cell_type": "markdown",
"id": "c178a5ab",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\lambda \\vert\\vert \\boldsymbol{\\beta} \\vert\\vert_2^2 = \\lambda \\sum_{j=1}^{p-1}\\beta_j^2.\n",
@@ -2728,9 +2795,7 @@
{
"cell_type": "markdown",
"id": "35309a6d",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"For Lasso regression we have"
]
@@ -2738,9 +2803,7 @@
{
"cell_type": "markdown",
"id": "d6efaf8b",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\lambda \\vert\\vert \\boldsymbol{\\beta} \\vert\\vert_1 = \\lambda \\sum_{j=1}^{p-1}\\vert\\beta_j\\vert.\n",
@@ -2750,9 +2813,7 @@
{
"cell_type": "markdown",
"id": "cd0f3eff",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"It means that, when scaling the design matrix and the outputs/targets,\n",
"by subtracting the mean values, we have an optimization problem which\n",
@@ -2766,9 +2827,7 @@
{
"cell_type": "markdown",
"id": "0d580e3b",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## The Boston housing data example\n",
"\n",
@@ -2810,9 +2869,7 @@
{
"cell_type": "markdown",
"id": "2404385b",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Housing data, the code\n",
"We start by importing the libraries"
@@ -2822,10 +2879,7 @@
"cell_type": "code",
"execution_count": 15,
"id": "1c4a7d19",
- "metadata": {
- "collapsed": false,
- "editable": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
@@ -2838,9 +2892,7 @@
{
"cell_type": "markdown",
"id": "e71777f2",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"and load the Boston Housing DataSet from **Scikit-Learn**"
]
@@ -2849,10 +2901,7 @@
"cell_type": "code",
"execution_count": 16,
"id": "184a475a",
- "metadata": {
- "collapsed": false,
- "editable": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"from sklearn.datasets import load_boston\n",
@@ -2867,9 +2916,7 @@
{
"cell_type": "markdown",
"id": "b77e02db",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"Then we invoke Pandas"
]
@@ -2878,10 +2925,7 @@
"cell_type": "code",
"execution_count": 17,
"id": "fc3671ce",
- "metadata": {
- "collapsed": false,
- "editable": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"boston = pd.DataFrame(boston_dataset.data, columns=boston_dataset.feature_names)\n",
@@ -2892,9 +2936,7 @@
{
"cell_type": "markdown",
"id": "013d540f",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"and preprocess the data"
]
@@ -2903,10 +2945,7 @@
"cell_type": "code",
"execution_count": 18,
"id": "80a64969",
- "metadata": {
- "collapsed": false,
- "editable": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"# check for missing values in all the columns\n",
@@ -2916,9 +2955,7 @@
{
"cell_type": "markdown",
"id": "428cd58d",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"We can then visualize the data"
]
@@ -2927,10 +2964,7 @@
"cell_type": "code",
"execution_count": 19,
"id": "c793f29e",
- "metadata": {
- "collapsed": false,
- "editable": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"# set the size of the figure\n",
@@ -2944,9 +2978,7 @@
{
"cell_type": "markdown",
"id": "38d0c393",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"It is now useful to look at the correlation matrix"
]
@@ -2955,10 +2987,7 @@
"cell_type": "code",
"execution_count": 20,
"id": "94f80d14",
- "metadata": {
- "collapsed": false,
- "editable": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"# compute the pair wise correlation for all columns \n",
@@ -2971,9 +3000,7 @@
{
"cell_type": "markdown",
"id": "fe08c200",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"From the above coorelation plot we can see that **MEDV** is strongly correlated to **LSTAT** and **RM**. We see also that **RAD** and **TAX** are stronly correlated, but we don't include this in our features together to avoid multi-colinearity"
]
@@ -2982,10 +3009,7 @@
"cell_type": "code",
"execution_count": 21,
"id": "450f268e",
- "metadata": {
- "collapsed": false,
- "editable": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"plt.figure(figsize=(20, 5))\n",
@@ -3006,9 +3030,7 @@
{
"cell_type": "markdown",
"id": "7ba0da29",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"Now we start training our model"
]
@@ -3017,10 +3039,7 @@
"cell_type": "code",
"execution_count": 22,
"id": "27bc62a6",
- "metadata": {
- "collapsed": false,
- "editable": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"X = pd.DataFrame(np.c_[boston['LSTAT'], boston['RM']], columns = ['LSTAT','RM'])\n",
@@ -3030,9 +3049,7 @@
{
"cell_type": "markdown",
"id": "9efee606",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"We split the data into training and test sets"
]
@@ -3041,10 +3058,7 @@
"cell_type": "code",
"execution_count": 23,
"id": "97bd24f3",
- "metadata": {
- "collapsed": false,
- "editable": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"from sklearn.model_selection import train_test_split\n",
@@ -3061,9 +3075,7 @@
{
"cell_type": "markdown",
"id": "05ced8cf",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"Then we use the linear regression functionality from **Scikit-Learn**"
]
@@ -3072,10 +3084,7 @@
"cell_type": "code",
"execution_count": 24,
"id": "f7f08093",
- "metadata": {
- "collapsed": false,
- "editable": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"from sklearn.linear_model import LinearRegression\n",
@@ -3115,10 +3124,7 @@
"cell_type": "code",
"execution_count": 25,
"id": "f3bfd461",
- "metadata": {
- "collapsed": false,
- "editable": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"# plotting the y_test vs y_pred\n",
@@ -3130,9 +3136,7 @@
{
"cell_type": "markdown",
"id": "de8426d4",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Material for lecture Thursday, August 31"
]
@@ -3140,9 +3144,7 @@
{
"cell_type": "markdown",
"id": "f8a82af2",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Mathematical Interpretation of Ordinary Least Squares\n",
"\n",
@@ -3154,9 +3156,7 @@
{
"cell_type": "markdown",
"id": "324717dd",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\hat{\\boldsymbol{\\beta}} = \\left(\\boldsymbol{X}^T\\boldsymbol{X}\\right)^{-1}\\boldsymbol{X}^T\\boldsymbol{y}.\n",
@@ -3166,9 +3166,7 @@
{
"cell_type": "markdown",
"id": "0f14d98b",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"The **hat** over $\\boldsymbol{\\beta}$ means we have the optimal parameters after minimization of the cost function.\n",
"\n",
@@ -3178,9 +3176,7 @@
{
"cell_type": "markdown",
"id": "1cb98122",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\tilde{\\boldsymbol{y}}=\\boldsymbol{X}\\hat{\\boldsymbol{\\beta}} = \\boldsymbol{X}\\left(\\boldsymbol{X}^T\\boldsymbol{X}\\right)^{-1}\\boldsymbol{X}^T\\boldsymbol{y}.\n",
@@ -3190,9 +3186,7 @@
{
"cell_type": "markdown",
"id": "0203949a",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"We now define a matrix"
]
@@ -3200,9 +3194,7 @@
{
"cell_type": "markdown",
"id": "ff35f0a0",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\boldsymbol{A}=\\boldsymbol{X}\\left(\\boldsymbol{X}^T\\boldsymbol{X}\\right)^{-1}\\boldsymbol{X}^T.\n",
@@ -3212,9 +3204,7 @@
{
"cell_type": "markdown",
"id": "b67e78e6",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"We can rewrite"
]
@@ -3222,9 +3212,7 @@
{
"cell_type": "markdown",
"id": "3879f7f1",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\tilde{\\boldsymbol{y}}=\\boldsymbol{X}\\hat{\\boldsymbol{\\beta}} = \\boldsymbol{A}\\boldsymbol{y}.\n",
@@ -3234,9 +3222,7 @@
{
"cell_type": "markdown",
"id": "6029b581",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"The matrix $\\boldsymbol{A}$ has the important property that $\\boldsymbol{A}^2=\\boldsymbol{A}$. This is the definition of a projection matrix.\n",
"We can then interpret our optimal model $\\tilde{\\boldsymbol{y}}$ as being represented by an orthogonal projection of $\\boldsymbol{y}$ onto a space defined by the column vectors of $\\boldsymbol{X}$. In our case here the matrix $\\boldsymbol{A}$ is a square matrix. If it is a general rectangular matrix we have an oblique projection matrix."
@@ -3245,9 +3231,7 @@
{
"cell_type": "markdown",
"id": "09d79eab",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Residual Error\n",
"\n",
@@ -3257,9 +3241,7 @@
{
"cell_type": "markdown",
"id": "83a4102b",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\boldsymbol{\\epsilon}=\\boldsymbol{y}-\\tilde{\\boldsymbol{y}}=\\left[\\boldsymbol{I}-\\boldsymbol{X}\\left(\\boldsymbol{X}^T\\boldsymbol{X}\\right)^{-1}\\boldsymbol{X}^T\\right]\\boldsymbol{y}.\n",
@@ -3269,9 +3251,7 @@
{
"cell_type": "markdown",
"id": "7e682794",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"The residual errors are then the projections of $\\boldsymbol{y}$ onto the orthogonal component of the space defined by the column vectors of $\\boldsymbol{X}$."
]
@@ -3279,9 +3259,7 @@
{
"cell_type": "markdown",
"id": "e4f5a75b",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Simple case\n",
"\n",
@@ -3291,9 +3269,7 @@
{
"cell_type": "markdown",
"id": "e18ea090",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\boldsymbol{X}^T\\boldsymbol{X}=\\boldsymbol{X}\\boldsymbol{X}^T = \\boldsymbol{I}.\n",
@@ -3303,9 +3279,7 @@
{
"cell_type": "markdown",
"id": "73e393f2",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"In this case the matrix $\\boldsymbol{A}$ becomes"
]
@@ -3313,9 +3287,7 @@
{
"cell_type": "markdown",
"id": "af122a67",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\boldsymbol{A}=\\boldsymbol{X}\\left(\\boldsymbol{X}^T\\boldsymbol{X}\\right)^{-1}\\boldsymbol{X}^T)=\\boldsymbol{I},\n",
@@ -3325,9 +3297,7 @@
{
"cell_type": "markdown",
"id": "0d568b19",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"and we have the obvious case"
]
@@ -3335,9 +3305,7 @@
{
"cell_type": "markdown",
"id": "89fd8083",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\boldsymbol{\\epsilon}=\\boldsymbol{y}-\\tilde{\\boldsymbol{y}}=0.\n",
@@ -3347,9 +3315,7 @@
{
"cell_type": "markdown",
"id": "e91751cd",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"This serves also as a useful test of our codes."
]
@@ -3357,9 +3323,7 @@
{
"cell_type": "markdown",
"id": "f9341e2d",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## The singular value decomposition\n",
"\n",
@@ -3397,9 +3361,7 @@
{
"cell_type": "markdown",
"id": "abf1745c",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Linear Regression Problems\n",
"\n",
@@ -3414,9 +3376,7 @@
{
"cell_type": "markdown",
"id": "e584126f",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\begin{align*}\n",
@@ -3437,9 +3397,7 @@
{
"cell_type": "markdown",
"id": "1935162a",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"The columns of $\\boldsymbol{X}$ are linearly dependent. We see this easily since the \n",
"the first column is the row-wise sum of the other two columns. The rank (more correct,\n",
@@ -3454,9 +3412,7 @@
{
"cell_type": "markdown",
"id": "f913930e",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\begin{align*}\n",
@@ -3473,9 +3429,7 @@
{
"cell_type": "markdown",
"id": "7deeba62",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"We see easily that $\\mbox{det}(\\boldsymbol{X}) = x_{11} x_{22} - x_{12} x_{21} = 1 \\times (-1) - 1 \\times (-1) = 0$. Hence, $\\mathbf{X}$ is singular and its inverse is undefined.\n",
"This is equivalent to saying that the matrix $\\boldsymbol{X}$ has at least an eigenvalue which is zero."
@@ -3484,9 +3438,7 @@
{
"cell_type": "markdown",
"id": "e20bb582",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Fixing the singularity\n",
"\n",
@@ -3496,9 +3448,7 @@
{
"cell_type": "markdown",
"id": "0ad6b17e",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"\n",
"\n",
@@ -3514,9 +3464,7 @@
{
"cell_type": "markdown",
"id": "fc980d51",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"has linearly dependent column vectors, we will not be able to compute the inverse\n",
"of $\\boldsymbol{X}^T\\boldsymbol{X}$ and we cannot find the parameters (estimators) $\\beta_i$. \n",
@@ -3530,9 +3478,7 @@
{
"cell_type": "markdown",
"id": "0efbde1b",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\boldsymbol{X}^{T} \\boldsymbol{X} \\rightarrow \\boldsymbol{X}^{T} \\boldsymbol{X}+\\lambda \\boldsymbol{I},\n",
@@ -3542,9 +3488,7 @@
{
"cell_type": "markdown",
"id": "82b89d07",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"where $\\boldsymbol{I}$ is the identity matrix. When we discuss **Ridge** regression this is actually what we end up evaluating. The parameter $\\lambda$ is called a hyperparameter. More about this later."
]
@@ -3552,9 +3496,7 @@
{
"cell_type": "markdown",
"id": "d1710699",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Basic math of the SVD\n",
"\n",
@@ -3567,9 +3509,7 @@
{
"cell_type": "markdown",
"id": "06fba53f",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"(\\lambda_1,\\boldsymbol{u}_1),\\dots, (\\lambda_n,\\boldsymbol{u}_n),\n",
@@ -3579,9 +3519,7 @@
{
"cell_type": "markdown",
"id": "d50f6863",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"and the eigenvalues are given by the diagonal matrix"
]
@@ -3589,9 +3527,7 @@
{
"cell_type": "markdown",
"id": "96c5b41b",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\boldsymbol{\\Sigma}=\\mathrm{Diag}(\\lambda_1, \\dots,\\lambda_n).\n",
@@ -3601,9 +3537,7 @@
{
"cell_type": "markdown",
"id": "bf09f2f2",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"The matrix $\\boldsymbol{X}$ can be written in terms of an orthogonal/unitary transformation $\\boldsymbol{U}$"
]
@@ -3611,9 +3545,7 @@
{
"cell_type": "markdown",
"id": "a252e1f8",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\boldsymbol{X} = \\boldsymbol{U}\\boldsymbol{\\Sigma}\\boldsymbol{V}^T,\n",
@@ -3623,9 +3555,7 @@
{
"cell_type": "markdown",
"id": "c45385a1",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"with $\\boldsymbol{U}\\boldsymbol{U}^T=\\boldsymbol{I}$ or $\\boldsymbol{U}\\boldsymbol{U}^{\\dagger}=\\boldsymbol{I}$.\n",
"\n",
@@ -3635,9 +3565,7 @@
{
"cell_type": "markdown",
"id": "104ee592",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\boldsymbol{X} = \\begin{bmatrix} \n",
@@ -3650,9 +3578,7 @@
{
"cell_type": "markdown",
"id": "449b0b3a",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"is not diagonalizable, it is a so-called [defective matrix](https://en.wikipedia.org/wiki/Defective_matrix). It is easy to see that the condition\n",
"$\\boldsymbol{X}\\boldsymbol{X}^T=\\boldsymbol{X}^T\\boldsymbol{X}$ is not fulfilled."
@@ -3661,9 +3587,7 @@
{
"cell_type": "markdown",
"id": "9dd69828",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## The SVD, a Fantastic Algorithm\n",
"\n",
@@ -3681,9 +3605,7 @@
{
"cell_type": "markdown",
"id": "5c29cff2",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\boldsymbol{X} = \\boldsymbol{U}\\boldsymbol{\\Sigma}\\boldsymbol{V}^T\n",
@@ -3693,9 +3615,7 @@
{
"cell_type": "markdown",
"id": "e2a10501",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"As an example, the above defective matrix can be decomposed as"
]
@@ -3703,9 +3623,7 @@
{
"cell_type": "markdown",
"id": "99152797",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\boldsymbol{X} = \\frac{1}{\\sqrt{2}}\\begin{bmatrix} 1& 1 \\\\ 1& -1\\\\ \\end{bmatrix} \\begin{bmatrix} 2& 0 \\\\ 0& 0\\\\ \\end{bmatrix} \\frac{1}{\\sqrt{2}}\\begin{bmatrix} 1& -1 \\\\ 1& 1\\\\ \\end{bmatrix}=\\boldsymbol{U}\\boldsymbol{\\Sigma}\\boldsymbol{V}^T,\n",
@@ -3715,9 +3633,7 @@
{
"cell_type": "markdown",
"id": "1ac07399",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"with eigenvalues $\\sigma_1=2$ and $\\sigma_2=0$. \n",
"The SVD exits always! \n",
@@ -3744,9 +3660,7 @@
{
"cell_type": "markdown",
"id": "e7b18b54",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Economy-size SVD\n",
"\n",
@@ -3771,9 +3685,7 @@
{
"cell_type": "markdown",
"id": "82154505",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Codes for the SVD"
]
@@ -3782,10 +3694,7 @@
"cell_type": "code",
"execution_count": 26,
"id": "39ca4c5b",
- "metadata": {
- "collapsed": false,
- "editable": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
@@ -3822,9 +3731,7 @@
{
"cell_type": "markdown",
"id": "e44cb513",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"The matrix $\\boldsymbol{X}$ has columns that are linearly dependent. The first\n",
"column is the row-wise sum of the other two columns. The rank of a\n",
@@ -3839,9 +3746,7 @@
{
"cell_type": "markdown",
"id": "f0ef3ab9",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Note about SVD Calculations\n",
"\n",
@@ -3862,9 +3767,7 @@
{
"cell_type": "markdown",
"id": "816aa4d8",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Mathematics of the SVD and implications\n",
"\n",
@@ -3876,9 +3779,7 @@
{
"cell_type": "markdown",
"id": "5b4a5249",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\boldsymbol{X}=\\begin{bmatrix}\n",
@@ -3895,9 +3796,7 @@
{
"cell_type": "markdown",
"id": "1774c4f7",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"We can SVD decompose our matrix as"
]
@@ -3905,9 +3804,7 @@
{
"cell_type": "markdown",
"id": "d88964cb",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\boldsymbol{X}=\\boldsymbol{U}\\boldsymbol{\\Sigma}\\boldsymbol{V}^T,\n",
@@ -3917,9 +3814,7 @@
{
"cell_type": "markdown",
"id": "b25b8172",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"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$.\n",
"\n",
@@ -3931,9 +3826,7 @@
{
"cell_type": "markdown",
"id": "7b7b6f11",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\sigma_0 > \\sigma_1 > \\sigma_2 > \\dots > \\sigma_{p-1} > 0.\n",
@@ -3943,9 +3836,7 @@
{
"cell_type": "markdown",
"id": "aab6628d",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"All values beyond $p-1$ are all zero."
]
@@ -3953,9 +3844,7 @@
{
"cell_type": "markdown",
"id": "3b7403a0",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Example Matrix\n",
"\n",
@@ -3965,9 +3854,7 @@
{
"cell_type": "markdown",
"id": "67fcad16",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\boldsymbol{\\Sigma}=\n",
@@ -3982,9 +3869,7 @@
{
"cell_type": "markdown",
"id": "51a1f1ea",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"The singular values are $\\sigma_0=2$ and $\\sigma_1=1$. It is common to rewrite the matrix $\\boldsymbol{\\Sigma}$ as"
]
@@ -3992,9 +3877,7 @@
{
"cell_type": "markdown",
"id": "e349493c",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\boldsymbol{\\Sigma}=\n",
@@ -4008,9 +3891,7 @@
{
"cell_type": "markdown",
"id": "27d1460f",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"where"
]
@@ -4018,9 +3899,7 @@
{
"cell_type": "markdown",
"id": "e13a2af1",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\boldsymbol{\\tilde{\\Sigma}}=\n",
@@ -4034,9 +3913,7 @@
{
"cell_type": "markdown",
"id": "b5f9291c",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"contains only the singular values. Note also (and we will use this below) that"
]
@@ -4044,9 +3921,7 @@
{
"cell_type": "markdown",
"id": "5d4cc03b",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\boldsymbol{\\Sigma}^T\\boldsymbol{\\Sigma}=\n",
@@ -4060,9 +3935,7 @@
{
"cell_type": "markdown",
"id": "a9dad684",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"which is a $2\\times 2 $ matrix while"
]
@@ -4070,9 +3943,7 @@
{
"cell_type": "markdown",
"id": "325eaed9",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\boldsymbol{\\Sigma}\\boldsymbol{\\Sigma}^T=\n",
@@ -4087,9 +3958,7 @@
{
"cell_type": "markdown",
"id": "f9dc99fd",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"is a $3\\times 3 $ matrix. The last row and column of this last matrix\n",
"contain only zeros. This will have important consequences for our SVD\n",
@@ -4099,9 +3968,7 @@
{
"cell_type": "markdown",
"id": "04e1b274",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Setting up the Matrix to be inverted\n",
"\n",
@@ -4111,9 +3978,7 @@
{
"cell_type": "markdown",
"id": "81f13516",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\boldsymbol{X}^T\\boldsymbol{X}=\\boldsymbol{V}\\boldsymbol{\\Sigma}^T\\boldsymbol{U}^T\\boldsymbol{U}\\boldsymbol{\\Sigma}\\boldsymbol{V}^T,\n",
@@ -4123,9 +3988,7 @@
{
"cell_type": "markdown",
"id": "94f773d3",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"and using the orthogonality of the matrix $\\boldsymbol{U}$ we have"
]
@@ -4133,9 +3996,7 @@
{
"cell_type": "markdown",
"id": "c0be9eca",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\boldsymbol{X}^T\\boldsymbol{X}=\\boldsymbol{V}\\boldsymbol{\\Sigma}^T\\boldsymbol{\\Sigma}\\boldsymbol{V}^T.\n",
@@ -4145,9 +4006,7 @@
{
"cell_type": "markdown",
"id": "71b6ddf1",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"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$.\n",
"\n",
@@ -4157,9 +4016,7 @@
{
"cell_type": "markdown",
"id": "5aff16f9",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\tilde{y}_{\\mathrm{OLS}}=\\boldsymbol{X}\\left(\\boldsymbol{X}^T\\boldsymbol{X}\\right)^{-1}\\boldsymbol{X}^T\\boldsymbol{y},\n",
@@ -4169,9 +4026,7 @@
{
"cell_type": "markdown",
"id": "59861abf",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"and using our SVD decomposition of $\\boldsymbol{X}$ we have"
]
@@ -4179,9 +4034,7 @@
{
"cell_type": "markdown",
"id": "c1a8a9b2",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\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},\n",
@@ -4191,9 +4044,7 @@
{
"cell_type": "markdown",
"id": "abfe2371",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"which gives us, using the orthogonality of the matrices $\\boldsymbol{U}$ and $\\boldsymbol{V}$,"
]
@@ -4201,9 +4052,7 @@
{
"cell_type": "markdown",
"id": "25e07935",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\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},\n",
@@ -4213,9 +4062,7 @@
{
"cell_type": "markdown",
"id": "42346a84",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"It means that the ordinary least square model (with the optimal\n",
"parameters) $\\boldsymbol{\\tilde{y}}$, corresponds to an orthogonal\n",
@@ -4227,9 +4074,7 @@
{
"cell_type": "markdown",
"id": "d77863a3",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Further properties (important for our analyses later)\n",
"\n",
@@ -4239,9 +4084,7 @@
{
"cell_type": "markdown",
"id": "e29d0fb1",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\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.\n",
@@ -4251,9 +4094,7 @@
{
"cell_type": "markdown",
"id": "6b31c4f9",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"If we now multiply from the right with $\\boldsymbol{V}$ (using the orthogonality of $\\boldsymbol{V}$) we get"
]
@@ -4261,9 +4102,7 @@
{
"cell_type": "markdown",
"id": "f6b1d761",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\left(\\boldsymbol{X}^T\\boldsymbol{X}\\right)\\boldsymbol{V}=\\boldsymbol{V}\\boldsymbol{\\Sigma}^T\\boldsymbol{\\Sigma}.\n",
@@ -4273,9 +4112,7 @@
{
"cell_type": "markdown",
"id": "058e70dc",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"This means the vectors $\\boldsymbol{v}_i$ of the orthogonal matrix $\\boldsymbol{V}$ are the eigenvectors of the matrix $\\boldsymbol{X}^T\\boldsymbol{X}$\n",
"with eigenvalues given by the singular values squared, that is"
@@ -4284,9 +4121,7 @@
{
"cell_type": "markdown",
"id": "63c9e0bc",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\left(\\boldsymbol{X}^T\\boldsymbol{X}\\right)\\boldsymbol{v}_i=\\boldsymbol{v}_i\\sigma_i^2.\n",
@@ -4296,9 +4131,7 @@
{
"cell_type": "markdown",
"id": "1e59fc08",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"Similarly, if we use the SVD decomposition for the matrix $\\boldsymbol{X}\\boldsymbol{X}^T$, we have"
]
@@ -4306,9 +4139,7 @@
{
"cell_type": "markdown",
"id": "b2a3a437",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\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.\n",
@@ -4318,9 +4149,7 @@
{
"cell_type": "markdown",
"id": "50947830",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"If we now multiply from the right with $\\boldsymbol{U}$ (using the orthogonality of $\\boldsymbol{U}$) we get"
]
@@ -4328,9 +4157,7 @@
{
"cell_type": "markdown",
"id": "0b2ca780",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\left(\\boldsymbol{X}\\boldsymbol{X}^T\\right)\\boldsymbol{U}=\\boldsymbol{U}\\boldsymbol{\\Sigma}\\boldsymbol{\\Sigma}^T.\n",
@@ -4340,9 +4167,7 @@
{
"cell_type": "markdown",
"id": "cc399e80",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"This means the vectors $\\boldsymbol{u}_i$ of the orthogonal matrix $\\boldsymbol{U}$ are the eigenvectors of the matrix $\\boldsymbol{X}\\boldsymbol{X}^T$\n",
"with eigenvalues given by the singular values squared, that is"
@@ -4351,9 +4176,7 @@
{
"cell_type": "markdown",
"id": "04d39ec1",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\left(\\boldsymbol{X}\\boldsymbol{X}^T\\right)\\boldsymbol{u}_i=\\boldsymbol{u}_i\\sigma_i^2.\n",
@@ -4363,9 +4186,7 @@
{
"cell_type": "markdown",
"id": "c2952ff2",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"**Important note**: we have defined our design matrix $\\boldsymbol{X}$ to be an\n",
"$n\\times p$ matrix. In most supervised learning cases we have that $n\n",
@@ -4381,9 +4202,7 @@
{
"cell_type": "markdown",
"id": "f1066e49",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Meet the Covariance Matrix\n",
"\n",
@@ -4397,9 +4216,7 @@
{
"cell_type": "markdown",
"id": "75241441",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\frac{\\partial^2 C(\\boldsymbol{\\beta})}{\\partial \\boldsymbol{\\beta}^T\\partial \\boldsymbol{\\beta}} =\\frac{2}{n}\\boldsymbol{X}^T\\boldsymbol{X}.\n",
@@ -4409,9 +4226,7 @@
{
"cell_type": "markdown",
"id": "127632fb",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"This quantity defines was what is called the Hessian matrix (the second derivative of a function we want to optimize).\n",
"\n",
@@ -4421,9 +4236,7 @@
{
"cell_type": "markdown",
"id": "478a6cc7",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\boldsymbol{H}=\\boldsymbol{X}^T\\boldsymbol{X}.\n",
@@ -4433,9 +4246,7 @@
{
"cell_type": "markdown",
"id": "100ec228",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"The Hessian matrix for ordinary least squares is also proportional to\n",
"the covariance matrix. This means also that we can use the SVD to find\n",
@@ -4446,9 +4257,7 @@
{
"cell_type": "markdown",
"id": "b9582b4e",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Introducing the Covariance and Correlation functions\n",
"\n",
@@ -4462,9 +4271,7 @@
{
"cell_type": "markdown",
"id": "8d1b1d1e",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\boldsymbol{C}[\\boldsymbol{x},\\boldsymbol{y}] = \\begin{bmatrix} \\mathrm{cov}[\\boldsymbol{x},\\boldsymbol{x}] & \\mathrm{cov}[\\boldsymbol{x},\\boldsymbol{y}] \\\\\n",
@@ -4476,9 +4283,7 @@
{
"cell_type": "markdown",
"id": "b379afd0",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"where for example"
]
@@ -4486,9 +4291,7 @@
{
"cell_type": "markdown",
"id": "016ec85c",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\mathrm{cov}[\\boldsymbol{x},\\boldsymbol{y}] =\\frac{1}{n} \\sum_{i=0}^{n-1}(x_i- \\overline{x})(y_i- \\overline{y}).\n",
@@ -4498,9 +4301,7 @@
{
"cell_type": "markdown",
"id": "ad78bc24",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"With this definition and recalling that the variance is defined as"
]
@@ -4508,9 +4309,7 @@
{
"cell_type": "markdown",
"id": "08ec1bde",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\mathrm{var}[\\boldsymbol{x}]=\\frac{1}{n} \\sum_{i=0}^{n-1}(x_i- \\overline{x})^2,\n",
@@ -4520,9 +4319,7 @@
{
"cell_type": "markdown",
"id": "7024cde8",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"we can rewrite the covariance matrix as"
]
@@ -4530,9 +4327,7 @@
{
"cell_type": "markdown",
"id": "5f4b37ed",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\boldsymbol{C}[\\boldsymbol{x},\\boldsymbol{y}] = \\begin{bmatrix} \\mathrm{var}[\\boldsymbol{x}] & \\mathrm{cov}[\\boldsymbol{x},\\boldsymbol{y}] \\\\\n",
@@ -4544,9 +4339,7 @@
{
"cell_type": "markdown",
"id": "28390d12",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"**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. \n",
"What you will find in essentially all statistics texts are equations\n",
@@ -4561,9 +4354,7 @@
{
"cell_type": "markdown",
"id": "a999b4d5",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Covariance and Correlation Matrix\n",
"\n",
@@ -4577,9 +4368,7 @@
{
"cell_type": "markdown",
"id": "70197591",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\mathrm{corr}[\\boldsymbol{x},\\boldsymbol{y}]=\\frac{\\mathrm{cov}[\\boldsymbol{x},\\boldsymbol{y}]}{\\sqrt{\\mathrm{var}[\\boldsymbol{x}] \\mathrm{var}[\\boldsymbol{y}]}}.\n",
@@ -4589,9 +4378,7 @@
{
"cell_type": "markdown",
"id": "dd66cfbf",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"The correlation function is then given by values $\\mathrm{corr}[\\boldsymbol{x},\\boldsymbol{y}]\n",
"\\in [-1,1]$. This avoids eventual problems with too large values. We\n",
@@ -4602,9 +4389,7 @@
{
"cell_type": "markdown",
"id": "ab6558bb",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\boldsymbol{K}[\\boldsymbol{x},\\boldsymbol{y}] = \\begin{bmatrix} 1 & \\mathrm{corr}[\\boldsymbol{x},\\boldsymbol{y}] \\\\\n",
@@ -4616,9 +4401,7 @@
{
"cell_type": "markdown",
"id": "785365bf",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"In the above example this is the function we constructed using **pandas**."
]
@@ -4626,9 +4409,7 @@
{
"cell_type": "markdown",
"id": "412dd6fd",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Correlation Function and Design/Feature Matrix\n",
"\n",
@@ -4639,9 +4420,7 @@
{
"cell_type": "markdown",
"id": "25a906cb",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\boldsymbol{X}=\\begin{bmatrix}\n",
@@ -4658,9 +4437,7 @@
{
"cell_type": "markdown",
"id": "4b49e0b5",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"with $\\boldsymbol{X}\\in {\\mathbb{R}}^{n\\times p}$, with the predictors/features $p$ refering to the column numbers and the\n",
"entries $n$ being the row elements.\n",
@@ -4670,9 +4447,7 @@
{
"cell_type": "markdown",
"id": "74265043",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\boldsymbol{X}=\\begin{bmatrix} \\boldsymbol{x}_0 & \\boldsymbol{x}_1 & \\boldsymbol{x}_2 & \\dots & \\dots & \\boldsymbol{x}_{p-1}\\end{bmatrix},\n",
@@ -4682,9 +4457,7 @@
{
"cell_type": "markdown",
"id": "b69bbbcb",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"with a given vector"
]
@@ -4692,9 +4465,7 @@
{
"cell_type": "markdown",
"id": "45b17417",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\boldsymbol{x}_i^T = \\begin{bmatrix}x_{0,i} & x_{1,i} & x_{2,i}& \\dots & \\dots x_{n-1,i}\\end{bmatrix}.\n",
@@ -4704,9 +4475,7 @@
{
"cell_type": "markdown",
"id": "b709fa5b",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"With these definitions, we can now rewrite our $2\\times 2$\n",
"correlation/covariance matrix in terms of a moe general design/feature\n",
@@ -4717,9 +4486,7 @@
{
"cell_type": "markdown",
"id": "f93eeadf",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\boldsymbol{C}[\\boldsymbol{x}] = \\begin{bmatrix}\n",
@@ -4736,9 +4503,7 @@
{
"cell_type": "markdown",
"id": "4d180d26",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"and the correlation matrix"
]
@@ -4746,9 +4511,7 @@
{
"cell_type": "markdown",
"id": "ec91d548",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\boldsymbol{K}[\\boldsymbol{x}] = \\begin{bmatrix}\n",
@@ -4765,9 +4528,7 @@
{
"cell_type": "markdown",
"id": "ad6f6693",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Covariance Matrix Examples\n",
"\n",
@@ -4783,9 +4544,7 @@
{
"cell_type": "markdown",
"id": "1c1f25f4",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\boldsymbol{W} = \\begin{bmatrix} x_0 & x_1 & x_2 & \\dots & x_{n-2} & x_{n-1} \\\\\n",
@@ -4797,9 +4556,7 @@
{
"cell_type": "markdown",
"id": "b19b14ec",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"which in turn is converted into into the $2\\times 2$ covariance matrix\n",
"$\\boldsymbol{C}$ via the Numpy function **np.cov()**. We note that we can also calculate\n",
@@ -4812,10 +4569,7 @@
"cell_type": "code",
"execution_count": 27,
"id": "cfe27cc6",
- "metadata": {
- "collapsed": false,
- "editable": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"# Importing various packages\n",
@@ -4833,9 +4587,7 @@
{
"cell_type": "markdown",
"id": "fbb5ed33",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Correlation Matrix\n",
"\n",
@@ -4850,10 +4602,7 @@
"cell_type": "code",
"execution_count": 28,
"id": "b291bb1e",
- "metadata": {
- "collapsed": false,
- "editable": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
@@ -4882,9 +4631,7 @@
{
"cell_type": "markdown",
"id": "f7b82f6f",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"We see that the matrix elements along the diagonal are one as they\n",
"should be and that the matrix is symmetric. Furthermore, diagonalizing\n",
@@ -4896,9 +4643,7 @@
{
"cell_type": "markdown",
"id": "45f5e994",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Correlation Matrix with Pandas\n",
"\n",
@@ -4909,10 +4654,7 @@
"cell_type": "code",
"execution_count": 29,
"id": "2b118fef",
- "metadata": {
- "collapsed": false,
- "editable": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
@@ -4934,9 +4676,7 @@
{
"cell_type": "markdown",
"id": "d188a901",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"We expand this model to the Franke function discussed above."
]
@@ -4944,9 +4684,7 @@
{
"cell_type": "markdown",
"id": "ec43689d",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Correlation Matrix with Pandas and the Franke function"
]
@@ -4955,10 +4693,7 @@
"cell_type": "code",
"execution_count": 30,
"id": "3b1f8867",
- "metadata": {
- "collapsed": false,
- "editable": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"# Common imports\n",
@@ -5009,9 +4744,7 @@
{
"cell_type": "markdown",
"id": "4c8df15e",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"We note here that the covariance is zero for the first rows and\n",
"columns since all matrix elements in the design matrix were set to one\n",
@@ -5026,9 +4759,7 @@
{
"cell_type": "markdown",
"id": "bb4cbd56",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Rewriting the Covariance and/or Correlation Matrix\n",
"\n",
@@ -5038,9 +4769,7 @@
{
"cell_type": "markdown",
"id": "f6a57798",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\boldsymbol{C}[\\boldsymbol{x}] = \\frac{1}{n}\\boldsymbol{X}^T\\boldsymbol{X}= \\mathbb{E}[\\boldsymbol{X}^T\\boldsymbol{X}].\n",
@@ -5050,9 +4779,7 @@
{
"cell_type": "markdown",
"id": "d38cc2d7",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"To see this let us simply look at a design matrix $\\boldsymbol{X}\\in {\\mathbb{R}}^{2\\times 2}$"
]
@@ -5060,9 +4787,7 @@
{
"cell_type": "markdown",
"id": "45582026",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\boldsymbol{X}=\\begin{bmatrix}\n",
@@ -5077,9 +4802,7 @@
{
"cell_type": "markdown",
"id": "89c131b7",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"If we then compute the expectation value (note the $1/n$ factor instead of $1/(n-1)$)"
]
@@ -5087,9 +4810,7 @@
{
"cell_type": "markdown",
"id": "ece1e46b",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\mathbb{E}[\\boldsymbol{X}^T\\boldsymbol{X}] = \\frac{1}{n}\\boldsymbol{X}^T\\boldsymbol{X}=\\frac{1}{n}\\begin{bmatrix}\n",
@@ -5102,9 +4823,7 @@
{
"cell_type": "markdown",
"id": "cce34eb0",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"which is just"
]
@@ -5112,9 +4831,7 @@
{
"cell_type": "markdown",
"id": "a3b7cd4e",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\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] \\\\\n",
@@ -5126,9 +4843,7 @@
{
"cell_type": "markdown",
"id": "ac01fc8d",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"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}$.\n",
"\n",
@@ -5138,9 +4853,7 @@
{
"cell_type": "markdown",
"id": "1dbbed04",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Linking with the SVD\n",
"\n",
@@ -5150,9 +4863,7 @@
{
"cell_type": "markdown",
"id": "ec632bc1",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\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.\n",
@@ -5162,9 +4873,7 @@
{
"cell_type": "markdown",
"id": "c2504d33",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"Since the matrices here have dimension $p\\times p$, with $p$ corresponding to the singular values, we defined earlier the matrix"
]
@@ -5172,9 +4881,7 @@
{
"cell_type": "markdown",
"id": "01e85bfe",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\boldsymbol{\\Sigma}^T\\boldsymbol{\\Sigma} = \\begin{bmatrix} \\tilde{\\boldsymbol{\\Sigma}} & \\boldsymbol{0}\\\\ \\end{bmatrix}\\begin{bmatrix} \\tilde{\\boldsymbol{\\Sigma}} \\\\ \\boldsymbol{0}\\\\ \\end{bmatrix},\n",
@@ -5184,9 +4891,7 @@
{
"cell_type": "markdown",
"id": "2bfccf8e",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"where the tilde-matrix $\\tilde{\\boldsymbol{\\Sigma}}$ is a matrix of dimension $p\\times p$ containing only the singular values $\\sigma_i$, that is"
]
@@ -5194,9 +4899,7 @@
{
"cell_type": "markdown",
"id": "3f676ade",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\tilde{\\boldsymbol{\\Sigma}}=\\begin{bmatrix} \\sigma_0 & 0 & 0 & \\dots & 0 & 0 \\\\\n",
@@ -5211,9 +4914,7 @@
{
"cell_type": "markdown",
"id": "6a82ea60",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"meaning we can write"
]
@@ -5221,9 +4922,7 @@
{
"cell_type": "markdown",
"id": "fb97357e",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\boldsymbol{X}^T\\boldsymbol{X}=\\boldsymbol{V}\\tilde{\\boldsymbol{\\Sigma}}^2\\boldsymbol{V}^T.\n",
@@ -5233,9 +4932,7 @@
{
"cell_type": "markdown",
"id": "7c1571ed",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"Multiplying from the right with $\\boldsymbol{V}$ (using the orthogonality of $\\boldsymbol{V}$) we get"
]
@@ -5243,9 +4940,7 @@
{
"cell_type": "markdown",
"id": "c6985d6d",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\left(\\boldsymbol{X}^T\\boldsymbol{X}\\right)\\boldsymbol{V}=\\boldsymbol{V}\\tilde{\\boldsymbol{\\Sigma}}^2.\n",
@@ -5255,9 +4950,7 @@
{
"cell_type": "markdown",
"id": "d7e2f0bf",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## What does it mean?\n",
"\n",
@@ -5269,9 +4962,7 @@
{
"cell_type": "markdown",
"id": "23029490",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\left(\\boldsymbol{X}^T\\boldsymbol{X}\\right)\\boldsymbol{v}_i=\\boldsymbol{v}_i\\sigma_i^2.\n",
@@ -5281,9 +4972,7 @@
{
"cell_type": "markdown",
"id": "555b0e01",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"In other words, each non-zero singular value of $\\boldsymbol{X}$ is a positive\n",
"square root of an eigenvalue of $\\boldsymbol{X}^T\\boldsymbol{X}$. It means also that\n",
@@ -5303,9 +4992,7 @@
{
"cell_type": "markdown",
"id": "5561c9a2",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\boldsymbol{C}[\\boldsymbol{X}]=\\frac{1}{n}\\boldsymbol{X}^T\\boldsymbol{X},\n",
@@ -5315,9 +5002,7 @@
{
"cell_type": "markdown",
"id": "7bc685b4",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"meaning that every squared non-singular value of $\\boldsymbol{X}$ divided by $n$ (\n",
"the number of samples) are the eigenvalues of the covariance\n",
@@ -5330,9 +5015,7 @@
{
"cell_type": "markdown",
"id": "e5f74689",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## And finally $\\boldsymbol{X}\\boldsymbol{X}^T$\n",
"\n",
@@ -5342,9 +5025,7 @@
{
"cell_type": "markdown",
"id": "88c544a8",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\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.\n",
@@ -5354,9 +5035,7 @@
{
"cell_type": "markdown",
"id": "8bd0dbe9",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"Since the matrices here have dimension $n\\times n$, we have"
]
@@ -5364,9 +5043,7 @@
{
"cell_type": "markdown",
"id": "42f1768e",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\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},\n",
@@ -5376,9 +5053,7 @@
{
"cell_type": "markdown",
"id": "ebfdc4f3",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"leading to"
]
@@ -5386,9 +5061,7 @@
{
"cell_type": "markdown",
"id": "101ad94b",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\boldsymbol{X}\\boldsymbol{X}^T=\\boldsymbol{U}\\begin{bmatrix} \\tilde{\\boldsymbol{\\Sigma}} & \\boldsymbol{0} \\\\ \\boldsymbol{0} & \\boldsymbol{0}\\\\ \\end{bmatrix}\\boldsymbol{U}^T.\n",
@@ -5398,9 +5071,7 @@
{
"cell_type": "markdown",
"id": "0bdd520e",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"Multiplying with $\\boldsymbol{U}$ from the right gives us the eigenvalue problem"
]
@@ -5408,9 +5079,7 @@
{
"cell_type": "markdown",
"id": "5bbf13b1",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"(\\boldsymbol{X}\\boldsymbol{X}^T)\\boldsymbol{U}=\\boldsymbol{U}\\begin{bmatrix} \\tilde{\\boldsymbol{\\Sigma}} & \\boldsymbol{0} \\\\ \\boldsymbol{0} & \\boldsymbol{0}\\\\ \\end{bmatrix}.\n",
@@ -5420,9 +5089,7 @@
{
"cell_type": "markdown",
"id": "85a38e8d",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"It means that the eigenvalues of $\\boldsymbol{X}\\boldsymbol{X}^T$ are again given by\n",
"the non-zero singular values plus now a series of zeros. The column\n",
@@ -5437,9 +5104,7 @@
{
"cell_type": "markdown",
"id": "f6666263",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Ridge and LASSO Regression\n",
"\n",
@@ -5450,9 +5115,7 @@
{
"cell_type": "markdown",
"id": "587b2ce3",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"{\\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\\}.\n",
@@ -5462,9 +5125,7 @@
{
"cell_type": "markdown",
"id": "c22c9ddb",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"or we can state it as"
]
@@ -5472,9 +5133,7 @@
{
"cell_type": "markdown",
"id": "7724b145",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"{\\displaystyle \\min_{\\boldsymbol{\\beta}\\in\n",
@@ -5485,9 +5144,7 @@
{
"cell_type": "markdown",
"id": "ec8b96ea",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"where we have used the definition of a norm-2 vector, that is"
]
@@ -5495,9 +5152,7 @@
{
"cell_type": "markdown",
"id": "3d2a045a",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\vert\\vert \\boldsymbol{x}\\vert\\vert_2 = \\sqrt{\\sum_i x_i^2}.\n",
@@ -5507,9 +5162,7 @@
{
"cell_type": "markdown",
"id": "1056995d",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"By minimizing the above equation with respect to the parameters\n",
"$\\boldsymbol{\\beta}$ we could then obtain an analytical expression for the\n",
@@ -5520,9 +5173,7 @@
{
"cell_type": "markdown",
"id": "fef60cc6",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"{\\displaystyle \\min_{\\boldsymbol{\\beta}\\in\n",
@@ -5533,9 +5184,7 @@
{
"cell_type": "markdown",
"id": "a0f33fda",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"which leads to the Ridge regression minimization problem where we\n",
"require that $\\vert\\vert \\boldsymbol{\\beta}\\vert\\vert_2^2\\le t$, where $t$ is\n",
@@ -5545,9 +5194,7 @@
{
"cell_type": "markdown",
"id": "b2581a7a",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"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,\n",
@@ -5557,9 +5204,7 @@
{
"cell_type": "markdown",
"id": "e4f2ab2e",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"we have a new optimization equation"
]
@@ -5567,9 +5212,7 @@
{
"cell_type": "markdown",
"id": "123fb750",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"{\\displaystyle \\min_{\\boldsymbol{\\beta}\\in\n",
@@ -5580,9 +5223,7 @@
{
"cell_type": "markdown",
"id": "b1d58fbe",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"which leads to Lasso regression. Lasso stands for least absolute shrinkage and selection operator. \n",
"\n",
@@ -5592,9 +5233,7 @@
{
"cell_type": "markdown",
"id": "5f0259bc",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\vert\\vert \\boldsymbol{x}\\vert\\vert_1 = \\sum_i \\vert x_i\\vert.\n",
@@ -5604,9 +5243,7 @@
{
"cell_type": "markdown",
"id": "c8fb5772",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Deriving the Ridge Regression Equations\n",
"\n",
@@ -5616,9 +5253,7 @@
{
"cell_type": "markdown",
"id": "9f73c308",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"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},\n",
@@ -5628,9 +5263,7 @@
{
"cell_type": "markdown",
"id": "ac9096ce",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"and \n",
"taking the derivatives with respect to $\\boldsymbol{\\beta}$ we obtain then\n",
@@ -5642,9 +5275,7 @@
{
"cell_type": "markdown",
"id": "ca0b1176",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\hat{\\boldsymbol{\\beta}}_{\\mathrm{Ridge}} = \\left(\\boldsymbol{X}^T\\boldsymbol{X}+\\lambda\\boldsymbol{I}\\right)^{-1}\\boldsymbol{X}^T\\boldsymbol{y},\n",
@@ -5654,9 +5285,7 @@
{
"cell_type": "markdown",
"id": "c30835a6",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"with $\\boldsymbol{I}$ being a $p\\times p$ identity matrix with the constraint that"
]
@@ -5664,9 +5293,7 @@
{
"cell_type": "markdown",
"id": "ab6bb533",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\sum_{i=0}^{p-1} \\beta_i^2 \\leq t,\n",
@@ -5676,9 +5303,7 @@
{
"cell_type": "markdown",
"id": "53b92c21",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"with $t$ a finite positive number. \n",
"\n",
@@ -5688,9 +5313,7 @@
{
"cell_type": "markdown",
"id": "4667c501",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\hat{\\boldsymbol{\\beta}}_{\\mathrm{Ridge}} = \\left(\\boldsymbol{X}^T\\boldsymbol{X}+n\\lambda\\boldsymbol{I}\\right)^{-1}\\boldsymbol{X}^T\\boldsymbol{y}.\n",
@@ -5700,9 +5323,7 @@
{
"cell_type": "markdown",
"id": "a5f83360",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"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.\n",
"\n",
@@ -5712,9 +5333,7 @@
{
"cell_type": "markdown",
"id": "cd2e2e5e",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\hat{\\boldsymbol{\\beta}}_{\\mathrm{OLS}} = \\left(\\boldsymbol{X}^T\\boldsymbol{X}\\right)^{-1}\\boldsymbol{X}^T\\boldsymbol{y},\n",
@@ -5724,9 +5343,7 @@
{
"cell_type": "markdown",
"id": "c9dc1a87",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"which can lead to singular matrices. However, with the SVD, we can always compute the inverse of the matrix $\\boldsymbol{X}^T\\boldsymbol{X}$.\n",
"\n",
@@ -5743,9 +5360,7 @@
{
"cell_type": "markdown",
"id": "a948cd9f",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\tilde{\\boldsymbol{y}}_{\\mathrm{OLS}}=\\boldsymbol{X}\\boldsymbol{\\beta} =\\boldsymbol{U}\\boldsymbol{U}^T\\boldsymbol{y}.\n",
@@ -5755,9 +5370,7 @@
{
"cell_type": "markdown",
"id": "48e29bd0",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"For Ridge regression this becomes"
]
@@ -5765,9 +5378,7 @@
{
"cell_type": "markdown",
"id": "58ee4e46",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\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},\n",
@@ -5777,9 +5388,7 @@
{
"cell_type": "markdown",
"id": "ced911f5",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"with the vectors $\\boldsymbol{u}_j$ being the columns of $\\boldsymbol{U}$ from the SVD of the matrix $\\boldsymbol{X}$."
]
@@ -5787,9 +5396,7 @@
{
"cell_type": "markdown",
"id": "3330c263",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Interpreting the Ridge results\n",
"\n",
@@ -5799,9 +5406,7 @@
{
"cell_type": "markdown",
"id": "d8e1460a",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\frac{\\sigma_j^2}{\\sigma_j^2+\\lambda} \\leq 1.\n",
@@ -5811,9 +5416,7 @@
{
"cell_type": "markdown",
"id": "55e47a8d",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"Ridge regression finds the coordinates of $\\boldsymbol{y}$ with respect to the\n",
"orthonormal basis $\\boldsymbol{U}$, it then shrinks the coordinates by\n",
@@ -5827,9 +5430,7 @@
{
"cell_type": "markdown",
"id": "4b71f3a0",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## More interpretations\n",
"\n",
@@ -5839,9 +5440,7 @@
{
"cell_type": "markdown",
"id": "a115cebf",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\boldsymbol{X}^T\\boldsymbol{X}=(\\boldsymbol{X}^T\\boldsymbol{X})^{-1} =\\boldsymbol{I}.\n",
@@ -5851,9 +5450,7 @@
{
"cell_type": "markdown",
"id": "c4d6028a",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"In this case the standard OLS results in"
]
@@ -5861,9 +5458,7 @@
{
"cell_type": "markdown",
"id": "98044bee",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\boldsymbol{\\beta}^{\\mathrm{OLS}} = \\boldsymbol{X}^T\\boldsymbol{y}=\\sum_{i=0}^{n-1}\\boldsymbol{u}_i\\boldsymbol{u}_i^T\\boldsymbol{y},\n",
@@ -5873,9 +5468,7 @@
{
"cell_type": "markdown",
"id": "e3534bc0",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"and"
]
@@ -5883,9 +5476,7 @@
{
"cell_type": "markdown",
"id": "99bb4cd3",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\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}},\n",
@@ -5895,9 +5486,7 @@
{
"cell_type": "markdown",
"id": "88fc3c52",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"that is the Ridge estimator scales the OLS estimator by the inverse of a factor $1+\\lambda$, and\n",
"the Ridge estimator converges to zero when the hyperparameter goes to\n",
@@ -5912,9 +5501,7 @@
{
"cell_type": "markdown",
"id": "c05ba72d",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"## Deriving the Lasso Regression Equations\n",
"\n",
@@ -5924,9 +5511,7 @@
{
"cell_type": "markdown",
"id": "75da5d5a",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"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,\n",
@@ -5936,9 +5521,7 @@
{
"cell_type": "markdown",
"id": "fcea82a3",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"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)"
]
@@ -5946,9 +5529,7 @@
{
"cell_type": "markdown",
"id": "96a7a03e",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\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.\n",
@@ -5958,9 +5539,7 @@
{
"cell_type": "markdown",
"id": "4091e1b7",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"we have that the derivative of the cost function is"
]
@@ -5968,9 +5547,7 @@
{
"cell_type": "markdown",
"id": "ded3ce7d",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\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,\n",
@@ -5980,9 +5557,7 @@
{
"cell_type": "markdown",
"id": "cff51920",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"and reordering we have"
]
@@ -5990,9 +5565,7 @@
{
"cell_type": "markdown",
"id": "262759a7",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"$$\n",
"\\boldsymbol{X}^T\\boldsymbol{X}\\boldsymbol{\\beta}+\\lambda sgn(\\boldsymbol{\\beta})=2\\boldsymbol{X}^T\\boldsymbol{y}.\n",
@@ -6002,15 +5575,31 @@
{
"cell_type": "markdown",
"id": "d927c104",
- "metadata": {
- "editable": true
- },
+ "metadata": {},
"source": [
"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](https://cvxopt.org/). We will discuss this later."
]
}
],
- "metadata": {},
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 3 (ipykernel)",
+ "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.9.10"
+ }
+ },
"nbformat": 4,
"nbformat_minor": 5
}
diff --git a/doc/src/week34/week34.do.txt b/doc/src/week34/week34.do.txt
index 4c8aa01e1..6d2fb6ec4 100644
--- a/doc/src/week34/week34.do.txt
+++ b/doc/src/week34/week34.do.txt
@@ -51,7 +51,7 @@ The labs are also available till 6pm Tuesdays and Wednesdays. Videos and learnin
===== Communication channels =====
* Chat and communications via URL:"canvas.uio.no"
-* _Discord_ channel at URL:"https://discord.gg/mKq3zjxP"
+* _Discord_ channel at URL:"https://discord.gg/hAaBRWFT72"
!split