typos in decision trees
This commit is contained in:
@@ -1709,7 +1709,7 @@ $b(x;\gamma_m)$ into the Sigmoid function
|
||||
!et
|
||||
|
||||
where $t=\gamma_0+\gamma_1 x$ and the parameters $\gamma_0$ and
|
||||
$\gamma_1$ where determined by the Logistic Regression fitting
|
||||
$\gamma_1$ were determined by the Logistic Regression fitting
|
||||
algorithm.
|
||||
|
||||
As another example, consider the cost function we defined for linear regression
|
||||
@@ -1721,8 +1721,8 @@ C(\bm{y},\bm{f}) = \frac{1}{n} \sum_{i=0}^{n-1}(y_i-f(x_i))^2.
|
||||
|
||||
In this case the function $f(x)$ was replaced by the design matrix
|
||||
$\bm{X}$ and the unknown linear regression parameters $\bm{\beta}$,
|
||||
that is $\bm{f}=\bm{X}\bm{\beta}$. In linear regression we could
|
||||
simply invert a matrix and obtained the parameters $\beta$ by
|
||||
that is $\bm{f}=\bm{X}\bm{\beta}$. In linear regression we can
|
||||
simply invert a matrix and obtain the parameters $\beta$ by
|
||||
|
||||
!bt
|
||||
\[
|
||||
@@ -1757,11 +1757,11 @@ To better understand what happens, let us develop the steps for the iterative fi
|
||||
|
||||
For simplicity we assume also that our functions $b(x;\gamma)=1+\gamma x$.
|
||||
|
||||
This means that for every iteration, we need to optimize
|
||||
This means that for every iteration $m$, we need to optimize
|
||||
|
||||
!bt
|
||||
\[
|
||||
(\beta_m,\gamma_m) \mathrm{argmin}_{\beta,\lambda}\hspace{0.1cm} \sum_{i=0}^{n-1}(y_i-f_{m-1}(x_i)-\beta b(x;\gamma))^2=\sum_{i=0}^{n-1}(y_i-f_{m-1}(x_i)-\beta(1+\gamma x_i))^2.
|
||||
(\beta_m,\gamma_m) = \mathrm{argmin}_{\beta,\lambda}\hspace{0.1cm} \sum_{i=0}^{n-1}(y_i-f_{m-1}(x_i)-\beta b(x;\gamma))^2=\sum_{i=0}^{n-1}(y_i-f_{m-1}(x_i)-\beta(1+\gamma x_i))^2.
|
||||
\]
|
||||
!et
|
||||
|
||||
@@ -1803,7 +1803,7 @@ $f_1(x) = \beta_1(1+\gamma_1x)$. Doing this $M$ times results in our final estim
|
||||
===== Iterative Fitting, Classification and AdaBoost =====
|
||||
|
||||
Let us consider a binary classification problem with two outcomes $y_i \in \{-1,1\}$ and $i=0,1,2,\dots,n-1$ as our set of
|
||||
observations. We define a classification function $G(x)$ which produces a prediction taking any of the two values
|
||||
observations. We define a classification function $G(x)$ which produces a prediction taking one or the other of the two values
|
||||
$\{-1,1\}$.
|
||||
|
||||
The error rate of the training sample is then
|
||||
@@ -1816,7 +1816,7 @@ The error rate of the training sample is then
|
||||
|
||||
The iterative procedure starts with defining a weak classifier whose
|
||||
error rate is barely better than random guessing. The iterative
|
||||
procedure in boosting is to sequentially apply a the weak
|
||||
procedure in boosting is to sequentially apply a weak
|
||||
classification algorithm to repeatedly modified versions of the data
|
||||
producing a sequence of weak classifiers $G_m(x)$.
|
||||
|
||||
@@ -1934,7 +1934,7 @@ where the function $I()$ is one if we misclassify and zero if we classify correc
|
||||
|
||||
With the above definitions we are now ready to set up the algorithm for AdaBoost.
|
||||
The basic idea is to set up weights which will be used to scale the correctly classified and the misclassified cases.
|
||||
o We start by initializing all weights to $w_i = 1/n$, with $i=0,1,2,\dots n-1$. It is to see then that $\sum_{i=0}^{n-1}w_i = 1$.
|
||||
o We start by initializing all weights to $w_i = 1/n$, with $i=0,1,2,\dots n-1$. It is easy to see that we must have $\sum_{i=0}^{n-1}w_i = 1$.
|
||||
o We rewrite the misclassification error as
|
||||
!bt
|
||||
\[
|
||||
@@ -1942,14 +1942,14 @@ o We rewrite the misclassification error as
|
||||
\]
|
||||
!et
|
||||
o Then we start looping over all attempts at classifying, namely we start an iterative process for $m=1:M$, where $M$ is the final number of classifications. Our given classifier could for example be a plain decision tree.
|
||||
o Fit then a given classifier to the training using the weights $w_i$.
|
||||
o Fit then a given classifier to the training set using the weights $w_i$.
|
||||
o Compute then $\mathrm{err}$ and figure out which events are classified properly and which are classified wrongly.
|
||||
o Define a quantity $\alpha_{m} = \log{(1-\mathrm{\overline{err}}_m)/\mathrm{\overline{err}}_m}$
|
||||
o Set the new weights to $w_i = w_i\times \exp{(\alpha_m I(y_i\ne G(x_i)}$.
|
||||
o Compute the new classifier $G(x)= \sum_{i=0}^{n-1}\alpha_m I(y_i\ne G(x_i)$.
|
||||
|
||||
For the iterations with $m \le 2$ the weights are modified
|
||||
individually at each steps. The obersvations which were misclassified
|
||||
individually at each steps. The observations which were misclassified
|
||||
at iteration $m-1$ have a weight which is larger than those which were
|
||||
classified properly. As this proceeds, the observations which were
|
||||
difficult to classifiy correctly are given a larger influence. Each
|
||||
@@ -1961,7 +1961,7 @@ observations that are missed in the previous iterations.
|
||||
!split
|
||||
===== AdaBoost Examples =====
|
||||
|
||||
Using _Scikit-Learn_ it is easy to appply the adaptive boosting algorithm, as done here.
|
||||
Using _Scikit-Learn_ it is easy to apply the adaptive boosting algorithm, as done here.
|
||||
|
||||
!bc pycod
|
||||
from sklearn.ensemble import AdaBoostClassifier
|
||||
|
||||
Reference in New Issue
Block a user