update of notes

This commit is contained in:
Morten Hjorth-Jensen
2022-12-11 22:07:05 +01:00
parent 8051880d95
commit 5473efe28f
70 changed files with 3777 additions and 1484 deletions
+7 -7
View File
@@ -134,7 +134,7 @@ With the OLS expressions for the parameters $\bm{\beta}$ we can evaluate the exp
\]
!et
This means that the estimator of the regression parameters is unbiased.
v
We can also calculate the variance
The variance of $\bm{\beta}$ is
@@ -222,7 +222,7 @@ we discuss the
o prediction error or simply the _test error_ $\mathrm{Err_{Test}}$, where we have a fixed training set and the test error is the MSE arising from the data reserved for testing. We discuss also the
o training error $\mathrm{Err_{Train}}$, which is the average loss over the training data.
As our model becomes more and more complex, more of the training data tends to used. The training may thence adapt to more complicated structures in the data. This may lead to a decrease in the bias (see below for code example) and a slight increase of the variance for the test error.
As our model becomes more and more complex, more of the training data tends to be used. The training may thence adapt to more complicated structures in the data. This may lead to a decrease in the bias (see below for code example) and a slight increase of the variance for the test error.
For a certain level of complexity the test error will reach minimum, before starting to increase again. The
training error reaches a saturation.
@@ -362,7 +362,7 @@ estimate any statistics thereof. In principle you never draw the
histogram of the relative frequency of $\widehat{\beta}^*$. Instead
you use the estimators corresponding to the statistic of interest. For
example, if you are interested in estimating the variance of $\widehat
\beta$, apply the etsimator $\widehat \sigma^2$ to the values
\beta$, apply the estimator $\widehat \sigma^2$ to the values
$\widehat \beta^*$.
Before we proceed however, we need to remind ourselves about a central
@@ -604,13 +604,13 @@ We can rewrite this as
\]
!et
The three terms represent the square of the bias of the learning
The first term represents the square of the bias of the learning
method, which can be thought of as the error caused by the simplifying
assumptions built into the method. The second term represents the
variance of the chosen model and finally the last terms is variance of
the error $\bm{\epsilon}$.
To derive this equation, we need to recall that the variance of $\bm{y}$ and $\bm{\epsilon}$ are both equal to $\sigma^2$. The mean value of $\bm{\epsilon}$ is by definition equal to zero. Furthermore, the function $f$ is not a stochastics variable, idem for $\bm{\tilde{y}}$.
To derive this equation, we need to recall that the variance of $\bm{y}$ and $\bm{\epsilon}$ are both equal to $\sigma^2$. The mean value of $\bm{\epsilon}$ is by definition equal to zero. Furthermore, the function $f$ is not a stochastic variable, idem for $\bm{\tilde{y}}$.
We use a more compact notation in terms of the expectation value
!bt
\[
@@ -1170,7 +1170,7 @@ plt.show()
!ec
Note that we have kept the intercept in the first column of design matrix $\bm{X}$. When we call the corresponding _Scikit-Learn_ function we need thus to set the intercept to _False_. Libraries like _Scikit-Learn_ normally scale the design matrix and does not fit intercept. See the discussions below.
Note that we have kept the intercept in the first column of design matrix $\bm{X}$. When we call the corresponding _Scikit-Learn_ function we need thus to set the intercept to _False_. Libraries like _Scikit-Learn_ normally scale the design matrix and do not fit intercept. See the discussions below.
===== More on Rescaling data =====
@@ -1472,7 +1472,7 @@ the way we treat the intercept may give a larger or smaller MSE,
meaning that the MSE can be penalized by the value of the
intercept. Not including the intercept in the fit, means that the
regularization term does not include $\beta_0$. For different values
of $\lambda$, this may lead to differeing MSE values.
of $\lambda$, this may lead to different MSE values.
To remind the reader, the regularization term, with the intercept in Ridge regression, is given by
!bt
+1 -1
View File
@@ -222,7 +222,7 @@ p(t) = \frac{1}{1+\mathrm \exp{-t}}=\frac{\exp{t}}{1+\mathrm \exp{t}}.
!et
Note that $1-p(t)= p(-t)$.
===== Examples of likelihood functions used in logistic regression and nueral networks =====
===== Examples of likelihood functions used in logistic regression and neural networks =====
The following code plots the logistic function, the step function and other functions we will encounter from here and on.