Many people, including me, have been using gradient boosting machine (GBM), one of the most popular and powerful machine learning algorithms, to solve machine learning problems without knowing exactly what is going on underneath.
In this article, I will elucidate all the mathematics behind without leaving anything ambiguous.
Problem Definition
Most of the machine learning problems, including classification and regression problems, could be modeled as
where x and y are features and label respectively, L is the loss function, F is a function which represents the model, and F∗ is the optimized function.
Gradient Descent
Parameter Space
Suppose F is a parameterized model with parameters P, F(x;P), our optimization goal becomes equivalent to
P∗=PargminΦ(P)
where
Φ(P)=E(x,y)∼P(x,y)[L(y,F(x;P))]
and the optimal model is
F∗(x)=F(x;P∗)
We apply gradient descent to optimize the parameters P. Suppose at time step t−1, the value of the parameters are Pt−1. The gradient of the parameters, gt, is computed as follows.
gt={gjt}={[∂Pj∂Φ(P)]P=Pt−1}
where j is the index of the parameter in the model.
The updated parameters at time step t will become
Pt=Pt−1+pt−1
where
pt−1=−ρtgt
Here ρt is a scalar. Usually in machine learning, ρt is arbitrary and is not optimal. To reach good optimization performance, we do linear search for ρt, i.e.,
ρt=ρargminΦ(Pt−1−ρgt)
Because ρt is a scalar, so it could not make all the parameters in P to reach optimal values in one step. To optimize the parameters, we would have to do multiple steps to update. If we unroll the time-series updates, we would have
Pt=P0+i=0∑t−1pi
where P0 is the initialized parameters at time step $0$.
Function Space
In stead of doing optimization in parameter space, we could also do optimization in function space. We consider F(x), i.e., the value of function F evaluated at point x, as the parameter to optimize.
We assume function F has no constrains, i.e., for any x, F(x) could be any value. Minimizing the above objective function is equivalent to minimizing ϕ(F(x)) for each x in the integral interval. Usually, there are infinite number of x, and it is impossible to minimize ϕ(F(x)) for all x. However, in practice, our training data is finite, so we could do this.
Suppose our training set consists of N data points x,y1N, the function F could be represented as a discrete function
F=F(x),x∈{xi}1N
if x does not exist in the training data, F(x) is undefined and it could be any value. Also note that F does not have to be differentiable with respect to x.
For each x from the training set, We compute the derivative of ϕ(F(x)) with respect to F(x),
We apply gradient descent to optimize F. Suppose at time step t−1, the value of the parameters are Ft−1. The gradient of the parameters, gt, is computed as follows.
As we have pointed out, the optimization in functional space directly tunes the value of F(x), and the optimization for F(x) does not dependent on the training data points other than x. So F would be very likely not to generalize well to the data points that have not been shown in the training set.
If we could impose smoothness to F by introducing nearby data points when tuning the value of F(x), F is likely to generalize better.
So instead of updating F using discrete function g which has no smoothness at all, we use another smooth function h such that h(x) is close to g(x) for x∈{xi}1N. In order to make h smooth, we need to use all the data points from training set {xi}1N to fit the parameters for h.
Concretely, we create a new model h(x;at) at each time step t. The update of function F becomes
Ft(x)=Ft−1(x)+ρth(x;at)
Because h(x;at) is a smoothing version of −gt(x), therefore, we use (xi,gt(xi)), x∈{xi}1N, as the train set to fit h(x;at) using L2 loss.
at=a,βargmini=1∑N[−gt(xi)−βh(xi;at)]2
Note that h(x;at) is parameterized and smoothed by fitting using all data points from the train set. Sometimes, −gt(xi) is also denoted as y~i, and y~i is called “pseudo-response”.
Therefore, gradient boosting machine is nothing special but using a parametric smoothing function h(xi;at)) to replace the discrete non-parametric gradient function gt(x) during the machine learning optimization in the function space. In each time step, we introduce a new model, which is called “boost”.