added p1
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "f29d1e5a",
|
||||
"id": "6c8c59f8",
|
||||
"metadata": {
|
||||
"editable": true
|
||||
},
|
||||
@@ -14,7 +14,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "60f7a134",
|
||||
"id": "24af4cf5",
|
||||
"metadata": {
|
||||
"editable": true
|
||||
},
|
||||
@@ -27,34 +27,40 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "43b931d0",
|
||||
"id": "2971d68f",
|
||||
"metadata": {
|
||||
"editable": true
|
||||
},
|
||||
"source": [
|
||||
"## Preamble: Note on writing reports, using reference material, AI and other tools\n",
|
||||
"\n",
|
||||
"We want you to answer the three different projects by handing reports written like a standard scientific/technical report.\n",
|
||||
"The link at <https://github.com/CompPhysics/MachineLearning/blob/master/doc/Projects/ProjectWriting/projectwriting.ipynb> gives some guidance. See also the grading suggestion at <https://github.com/CompPhysics/MachineLearning/blob/master/doc/Projects/EvaluationGrading/EvaluationForm.md>.\n",
|
||||
"We want you to answer the three different projects by handing in\n",
|
||||
"reports written like a standard scientific/technical report. The link\n",
|
||||
"at\n",
|
||||
"<https://github.com/CompPhysics/MachineLearning/blob/master/doc/Projects/ProjectWriting/projectwriting.ipynb>\n",
|
||||
"gives some guidance. See also the grading suggestion at\n",
|
||||
"<https://github.com/CompPhysics/MachineLearning/blob/master/doc/Projects/EvaluationGrading/EvaluationForm.md>.\n",
|
||||
"\n",
|
||||
"When using codes from different sources that you have not developed yourself,\n",
|
||||
"you should refer to these in the bibliography of your report, indicating wherefrom you\n",
|
||||
"Furthermore, at\n",
|
||||
"<https://github.com/CompPhysics/MachineLearning/blob/master/doc/Projects/ReportExample/>\n",
|
||||
"you can find examples of previous reports. How to write reports will\n",
|
||||
"also be discussed during the various lab sessions. Please do ask us if you are in doubt.\n",
|
||||
"\n",
|
||||
"When using codes and material from other sources, you should refer to these in the bibliography of your report, indicating wherefrom you for example\n",
|
||||
"got the code, whether this is from the lecture notes, softwares like\n",
|
||||
"Scikit-Learn, TensorFlow, PyTorch or other sources. These should\n",
|
||||
"always be cited correctly. How to cite some of the libraries is often\n",
|
||||
"indicated from their corresponding GitHub sites or websites, see for example how to cite Scikit-Learn at <https://scikit-learn.org/dev/about.html>. \n",
|
||||
"\n",
|
||||
"We enocurage you to use tools like\n",
|
||||
"[ChatGPT](https://openai.com/chatgpt/) in writing the report. If you use for example ChatGPT,\n",
|
||||
"[ChatGPT](https://openai.com/chatgpt/) or similar in writing the report. If you use for example ChatGPT,\n",
|
||||
"please do cite it properly and include (if possible) your questions and answers as an addition to the report. This can\n",
|
||||
"be uplodaed to for example your website, GitHub/GitLab or similar as supplemental material.\n",
|
||||
"\n",
|
||||
"On scaling, we recommend reading the following section from the scikit-learn software description, see <https://scikit-learn.org/stable/auto_examples/preprocessing/plot_all_scaling.html#plot-all-scaling-standard-scaler-section>"
|
||||
"be uploaded to for example your website, GitHub/GitLab or similar as supplemental material."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "131f84dc",
|
||||
"id": "eba3be6a",
|
||||
"metadata": {
|
||||
"editable": true
|
||||
},
|
||||
@@ -64,14 +70,7 @@
|
||||
"The main aim of this project is to study in more detail various\n",
|
||||
"regression methods, including the Ordinary Least Squares (OLS) method.\n",
|
||||
"In addition to the scientific part, in this course we want also to\n",
|
||||
"give you an experience in writing scientific reports. The format for\n",
|
||||
"the delivery of your answers is namely that of a scientific report. At\n",
|
||||
"for example\n",
|
||||
"<https://github.com/CompPhysics/MachineLearning/blob/master/doc/Projects/EvaluationGrading/EvaluationForm.md>\n",
|
||||
"we detail how to write a report. Furthermore, at\n",
|
||||
"<https://github.com/CompPhysics/MachineLearning/blob/master/doc/Projects/ReportExample/>\n",
|
||||
"you can find examples of previous reports. How to write reports will\n",
|
||||
"also be discussed during the various lab sessions.\n",
|
||||
"give you an experience in writing scientific reports.\n",
|
||||
"\n",
|
||||
"**A small recommendation when developing the codes here**. Instead of\n",
|
||||
"jumping on to the two-dimensional function described below, we\n",
|
||||
@@ -90,7 +89,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "335be2ea",
|
||||
"id": "50da25e5",
|
||||
"metadata": {
|
||||
"editable": true
|
||||
},
|
||||
@@ -112,7 +111,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "a77e527b",
|
||||
"id": "7757fb0c",
|
||||
"metadata": {
|
||||
"editable": true
|
||||
},
|
||||
@@ -127,7 +126,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "071b756f",
|
||||
"id": "83fbdb79",
|
||||
"metadata": {
|
||||
"editable": true
|
||||
},
|
||||
@@ -160,7 +159,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"id": "eae160df",
|
||||
"id": "39b900ad",
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"editable": true
|
||||
@@ -212,7 +211,17 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "c2cfaf54",
|
||||
"id": "ef99fea4",
|
||||
"metadata": {
|
||||
"editable": true
|
||||
},
|
||||
"source": [
|
||||
"If you wish to compare your results with other on the Franke function or other popular functions tested with linear regression, see the list in Figure 1 of the article by Cook et al at <https://arxiv.org/abs/2401.11694>."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "b1a7f51d",
|
||||
"metadata": {
|
||||
"editable": true
|
||||
},
|
||||
@@ -234,7 +243,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "a7cd4d8f",
|
||||
"id": "d4bd58e3",
|
||||
"metadata": {
|
||||
"editable": true
|
||||
},
|
||||
@@ -247,7 +256,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "c0bbdb51",
|
||||
"id": "32f767b4",
|
||||
"metadata": {
|
||||
"editable": true
|
||||
},
|
||||
@@ -259,7 +268,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "ddee9b4b",
|
||||
"id": "bae0d9d6",
|
||||
"metadata": {
|
||||
"editable": true
|
||||
},
|
||||
@@ -271,7 +280,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "6f220536",
|
||||
"id": "8f0b2ec9",
|
||||
"metadata": {
|
||||
"editable": true
|
||||
},
|
||||
@@ -281,7 +290,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "feb5938f",
|
||||
"id": "8a455920",
|
||||
"metadata": {
|
||||
"editable": true
|
||||
},
|
||||
@@ -293,7 +302,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "8ca0b371",
|
||||
"id": "3f7ffe3e",
|
||||
"metadata": {
|
||||
"editable": true
|
||||
},
|
||||
@@ -317,12 +326,14 @@
|
||||
"approximately $2/3$ to $4/5$ of the data as training data.\n",
|
||||
"\n",
|
||||
"You can easily reuse the solutions to your exercises from week 35 and week 36.\n",
|
||||
"See also the lecture slides from week 35 and week 36."
|
||||
"See also the lecture slides from week 35 and week 36.\n",
|
||||
"\n",
|
||||
"On scaling, we recommend reading the following section from the scikit-learn software description, see <https://scikit-learn.org/stable/auto_examples/preprocessing/plot_all_scaling.html#plot-all-scaling-standard-scaler-section>."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "17494425",
|
||||
"id": "cf4d70a4",
|
||||
"metadata": {
|
||||
"editable": true
|
||||
},
|
||||
@@ -340,7 +351,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "79411fbf",
|
||||
"id": "8cc60702",
|
||||
"metadata": {
|
||||
"editable": true
|
||||
},
|
||||
@@ -357,7 +368,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "0de10c86",
|
||||
"id": "bd9d1dd3",
|
||||
"metadata": {
|
||||
"editable": true
|
||||
},
|
||||
@@ -373,7 +384,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "b284b2d9",
|
||||
"id": "03fab7b5",
|
||||
"metadata": {
|
||||
"editable": true
|
||||
},
|
||||
@@ -385,7 +396,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "3a862737",
|
||||
"id": "009b7fb9",
|
||||
"metadata": {
|
||||
"editable": true
|
||||
},
|
||||
@@ -396,7 +407,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "8ca87494",
|
||||
"id": "5bf0a0d5",
|
||||
"metadata": {
|
||||
"editable": true
|
||||
},
|
||||
@@ -408,7 +419,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "a253c39b",
|
||||
"id": "52c48acb",
|
||||
"metadata": {
|
||||
"editable": true
|
||||
},
|
||||
@@ -420,7 +431,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "9c38fb19",
|
||||
"id": "3158357a",
|
||||
"metadata": {
|
||||
"editable": true
|
||||
},
|
||||
@@ -432,7 +443,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "8d59d872",
|
||||
"id": "021253bc",
|
||||
"metadata": {
|
||||
"editable": true
|
||||
},
|
||||
@@ -443,7 +454,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "0efd8089",
|
||||
"id": "9e89d5fe",
|
||||
"metadata": {
|
||||
"editable": true
|
||||
},
|
||||
@@ -455,7 +466,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "1a8121b6",
|
||||
"id": "5f79916c",
|
||||
"metadata": {
|
||||
"editable": true
|
||||
},
|
||||
@@ -468,7 +479,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "544da2b4",
|
||||
"id": "a6e62eff",
|
||||
"metadata": {
|
||||
"editable": true
|
||||
},
|
||||
@@ -480,7 +491,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "73fd411a",
|
||||
"id": "7e833f14",
|
||||
"metadata": {
|
||||
"editable": true
|
||||
},
|
||||
@@ -490,7 +501,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "b7160507",
|
||||
"id": "14ef5a97",
|
||||
"metadata": {
|
||||
"editable": true
|
||||
},
|
||||
@@ -502,7 +513,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "b18ae3c3",
|
||||
"id": "a9443b1d",
|
||||
"metadata": {
|
||||
"editable": true
|
||||
},
|
||||
@@ -513,7 +524,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "a57a5e8c",
|
||||
"id": "ff0c2a46",
|
||||
"metadata": {
|
||||
"editable": true
|
||||
},
|
||||
@@ -546,7 +557,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "0a45f635",
|
||||
"id": "4c8ea78a",
|
||||
"metadata": {
|
||||
"editable": true
|
||||
},
|
||||
@@ -558,7 +569,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "ac85531a",
|
||||
"id": "1d119b3e",
|
||||
"metadata": {
|
||||
"editable": true
|
||||
},
|
||||
@@ -577,7 +588,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "69061e11",
|
||||
"id": "b9782b21",
|
||||
"metadata": {
|
||||
"editable": true
|
||||
},
|
||||
@@ -589,7 +600,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "b0ed607f",
|
||||
"id": "457bd0ae",
|
||||
"metadata": {
|
||||
"editable": true
|
||||
},
|
||||
@@ -603,7 +614,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "3ab15499",
|
||||
"id": "fbc011e0",
|
||||
"metadata": {
|
||||
"editable": true
|
||||
},
|
||||
@@ -615,7 +626,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "f1c5e132",
|
||||
"id": "5bb40600",
|
||||
"metadata": {
|
||||
"editable": true
|
||||
},
|
||||
@@ -625,7 +636,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "60f2d431",
|
||||
"id": "e5aebe0a",
|
||||
"metadata": {
|
||||
"editable": true
|
||||
},
|
||||
@@ -637,7 +648,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "572f071d",
|
||||
"id": "6f243211",
|
||||
"metadata": {
|
||||
"editable": true
|
||||
},
|
||||
@@ -647,7 +658,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "89eb115c",
|
||||
"id": "850e1403",
|
||||
"metadata": {
|
||||
"editable": true
|
||||
},
|
||||
@@ -659,7 +670,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "9061bf93",
|
||||
"id": "86066fab",
|
||||
"metadata": {
|
||||
"editable": true
|
||||
},
|
||||
@@ -678,32 +689,30 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "1df7ce8d",
|
||||
"id": "aedb0de8",
|
||||
"metadata": {
|
||||
"editable": true
|
||||
},
|
||||
"source": [
|
||||
"### Part f): Cross-validation as resampling techniques, adding more complexity\n",
|
||||
"\n",
|
||||
"The aim here is to write your own code for another widely popular\n",
|
||||
"The aim here is to implement another widely popular\n",
|
||||
"resampling technique, the so-called cross-validation method. \n",
|
||||
"\n",
|
||||
"Implement the $k$-fold cross-validation algorithm (write your own\n",
|
||||
"code) and evaluate again the MSE function resulting\n",
|
||||
"from the test folds. You can compare your own code with that from\n",
|
||||
"**Scikit-Learn** if needed. \n",
|
||||
"code or use the functionality of **Scikit-Learn**) and evaluate again the MSE function resulting\n",
|
||||
"from the test folds. \n",
|
||||
"\n",
|
||||
"Compare the MSE you get from your cross-validation code with the one\n",
|
||||
"you got from your **bootstrap** code. Comment your results. Try $5-10$\n",
|
||||
"folds. You can also compare your own cross-validation code with the\n",
|
||||
"one provided by **Scikit-Learn**.\n",
|
||||
"folds. \n",
|
||||
"\n",
|
||||
"In addition to using the ordinary least squares method, you should include both Ridge and Lasso regression."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "f99f3b0c",
|
||||
"id": "09e42708",
|
||||
"metadata": {
|
||||
"editable": true
|
||||
},
|
||||
@@ -731,7 +740,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"id": "d9d2d89a",
|
||||
"id": "a7412176",
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"editable": true
|
||||
@@ -743,7 +752,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "59f5b1a6",
|
||||
"id": "2462a733",
|
||||
"metadata": {
|
||||
"editable": true
|
||||
},
|
||||
@@ -755,7 +764,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"id": "ab7fd531",
|
||||
"id": "e299ff99",
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"editable": true
|
||||
@@ -781,7 +790,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "271b3252",
|
||||
"id": "58bfbdc9",
|
||||
"metadata": {
|
||||
"editable": true
|
||||
},
|
||||
@@ -806,7 +815,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "6555e3ff",
|
||||
"id": "5c69b9d7",
|
||||
"metadata": {
|
||||
"editable": true
|
||||
},
|
||||
@@ -820,7 +829,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "8289021b",
|
||||
"id": "a92b1a41",
|
||||
"metadata": {
|
||||
"editable": true
|
||||
},
|
||||
@@ -850,7 +859,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "4349e2d3",
|
||||
"id": "3da35987",
|
||||
"metadata": {
|
||||
"editable": true
|
||||
},
|
||||
@@ -872,7 +881,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "274e1581",
|
||||
"id": "c03bf204",
|
||||
"metadata": {
|
||||
"editable": true
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user