Commit 5611e3ae authored by Mathilde Rineau's avatar Mathilde Rineau 🙂
Browse files

Update Devoir2.ipynb

parent e48ac5ce
......@@ -44,7 +44,7 @@
"### Data generation\n",
"\n",
"First, we will generate highly correlated data, containing a sample X (multidim) and a target y (one dim).\n",
"\n",
"#### Data generation first function: generate_data\n",
"We write a function for this.\n",
"Its parameters are :\n",
"- n_samples the number of samples\n",
......@@ -58,7 +58,25 @@
"- For the other dimensions of X, noted i, the value will be calculated as follow :\n",
" - We generate a number from a normal law N(i / 2, 1)\n",
" - We add it to the value of the first column\n",
"- For Y, we select 2 over 3 values of X and we sum them"
"- For Y, we select 2 over 3 values of X and we sum them\n",
"\n",
"#### Data generation second function: generate_data_2\n",
"We have written a second function, which generate another highly correlated data set in order to compare our results.\n",
"Its parameters are\n",
"- n_samples the number of samples \n",
"- n_features the number of features in X\n",
"and the outputs X and y\n",
"\n",
"For this purpose, we proceed in 4 steps:\n",
"\n",
"- we generate samples of a geometric law of parameter p = 0.5, these samples are stored in the first column of X\n",
"- for the other columns of X we do\n",
" - we generate randomly a parameter p between 0 and 1\n",
" - we generate samples of a geometric law of parameter p\n",
" - we add this samples to the sum of the previous column\n",
" \n",
"At the end, we have the matrix X where each column `Xi` is a sum of a samples generated from a geometric law and the previous columns `X0+...+Xi-1`.\n",
"We generate `y` as the mean of `X` on the axis 1."
]
},
{
......@@ -308,7 +326,8 @@
"hash": "3abb0a1ef4892304d86bb3a3dfd052bcca35057beadba016173999c775e8d3ba"
},
"kernelspec": {
"display_name": "Python 3.9.7 64-bit ('AOS1-QteoCFsS': pipenv)",
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
......@@ -320,7 +339,8 @@
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3"
"pygments_lexer": "ipython3",
"version": "3.8.8"
}
},
"nbformat": 4,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment