update book chapters

This commit is contained in:
Morten Hjorth-Jensen
2021-10-26 22:58:15 +02:00
parent 6c32c5b5e2
commit 5ee2934f9a
33 changed files with 367 additions and 202 deletions
+51 -13
View File
@@ -1584,7 +1584,7 @@
"the results may differ. \n",
"\n",
"The\n",
"[Standadscaler](https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.StandardScaler.html)\n",
"[Standardscaler](https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.StandardScaler.html)\n",
"function in **Scikit-Learn** does this for us. For the data sets we\n",
"have been studying in our various examples, the data are in many cases\n",
"already scaled and there is no need to scale them. You as a user of different machine learning algorithms, should always perform a\n",
@@ -1659,12 +1659,14 @@
"cell_type": "markdown",
"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",
"Recall also that we use the squared value. This expression can lead to an\n",
"increased penalty for higher differences between predicted and\n",
"output/target values.\n",
"\n",
"What we have done is to single out the $\\beta_0$ term in the definition of the mean squared error (MSE).\n",
"The design matrix\n",
"$X$ does in this case not contain any intercept column.\n",
"When we take the derivative with respect to $\\beta_0$, we want the derivative to obey"
"What we have done is to single out the $\\beta_0$ term in the\n",
"definition of the mean squared error (MSE). The design matrix $X$\n",
"does in this case not contain any intercept column. When we take the\n",
"derivative with respect to $\\beta_0$, we want the derivative to obey"
]
},
{
@@ -1712,7 +1714,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Let us special first to the case where we have only two parameters $\\beta_0$ and $\\beta_1$.\n",
"Let us specialize first to the case where we have only two parameters $\\beta_0$ and $\\beta_1$.\n",
"Our result for $\\beta_0$ simplifies then to"
]
},
@@ -1753,7 +1755,7 @@
"metadata": {},
"source": [
"$$\n",
"\\mu_1=\\frac{1}{n}\\sum_{i=0}^{n-1} (X_{i1},\n",
"\\mu_{\\boldsymbol{x}_1}=\\frac{1}{n}\\sum_{i=0}^{n-1} X_{i1},\n",
"$$"
]
},
@@ -1761,7 +1763,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"and if we define the mean value of the outputs as"
"and the mean value of the outputs as"
]
},
{
@@ -1785,7 +1787,7 @@
"metadata": {},
"source": [
"$$\n",
"\\beta_0 = \\mu_y - \\beta_1\\mu_{1}.\n",
"\\beta_0 = \\mu_y - \\beta_1\\mu_{\\boldsymbol{x}_1}.\n",
"$$"
]
},
@@ -1793,7 +1795,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"In the general case withmore parameters than $\\beta_0$ and $\\beta_1$, we have"
"In the general case with more parameters than $\\beta_0$ and $\\beta_1$, we have"
]
},
{
@@ -1809,6 +1811,42 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"We can rewrite the latter equation as"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"$$\n",
"\\beta_0 = \\frac{1}{n}\\sum_{i=0}^{n-1}y_i - \\sum_{j=1}^{p-1} \\mu_{\\boldsymbol{x}_j}\\beta_j,\n",
"$$"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"where we have defined"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"$$\n",
"\\mu_{\\boldsymbol{x}_j}=\\frac{1}{n}\\sum_{i=0}^{n-1} X_{ij},\n",
"$$"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"the mean value for all elements of the column vector $\\boldsymbol{x}_j$.\n",
"\n",
"\n",
"\n",
"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)"
]
},
@@ -2868,8 +2906,8 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"5\n",
"8\n",
"6\n",
"0\n",
" \n",
"<\n",
"<\n",