A Gentle Introduction to Gradient Boosting Cheng Li chengli@ccs.neu.edu College of Computer and Information Science Northeastern University Gradient Boosting I I a powerful machine learning algorithm it can do I I I I regression classification ranking won Track 1 of the Yahoo Learning to Rank Challenge Our implementation of Gradient Boosting is available at https://github.com/cheng-li/pyramid Outline of the Tutorial 1 What is Gradient Boosting 2 A brief history 3 Gradient Boosting for regression 4 Gradient Boosting for classification 5 A demo of Gradient Boosting 6 Relationship between Adaboost and Gradient Boosting 7 Why it works Note: This tutorial focuses on the intuition. For a formal treatment, see [Friedman, 2001] What is Gradient Boosting Gradient Boosting = Gradient Descent + Boosting Adaboost Figure: AdaBoost. Source: Figure 1.1 of [Schapire and Freund, 2012] What is Gradient Boosting Gradient Boosting = Gradient Descent + Boosting Adaboost Figure: AdaBoost. Source: Figure 1.1 of [Schapire and Freund, 2012] P I Fit an additive model (ensemble) stage-wise manner. I In each stage, introduce a weak learner to compensate the shortcomings of existing weak learners. I In Adaboost,“shortcomings” are identified by high-weight data points. t ρt ht (x) in a forward What is Gradient Boosting Gradient Boosting = Gradient Descent + Boosting Adaboost H(x) = X ρt ht (x) t Figure: AdaBoost. Source: Figure 1.2 of [Schapire and Freund, 2012] What is Gradient Boosting Gradient Boosting = Gradient Descent + Boosting Gradient Boosting P I Fit an additive model (ensemble) stage-wise manner. I In each stage, introduce a weak learner to compensate the shortcomings of existing weak learners. I In Gradient Boosting,“shortcomings” are identified by gradients. I Recall that, in Adaboost,“shortcomings” are identified by high-weight data points. I Both high-weight data points and gradients tell us how to improve our model. t ρt ht (x) in a forward What is Gradient Boosting Why and how did researchers invent Gradient Boosting? A Brief History of Gradient Boosting I Invent Adaboost, the first successful boosting algorithm [Freund et al., 1996, Freund and Schapire, 1997] I Formulate Adaboost as gradient descent with a special loss function[Breiman et al., 1998, Breiman, 1999] I Generalize Adaboost to Gradient Boosting in order to handle a variety of loss functions [Friedman et al., 2000, Friedman, 2001] Gradient Boosting for Regression Gradient Boosting for Different Problems Difficulty: regression ===> classification ===> ranking Gradient Boosting for Regression Let’s play a game... You are given (x1 , y1 ), (x2 , y2 ), ..., (xn , yn ), and the task is to fit a model F (x) to minimize square loss. Suppose your friend wants to help you and gives you a model F . You check his model and find the model is good but not perfect. There are some mistakes: F (x1 ) = 0.8, while y1 = 0.9, and F (x2 ) = 1.4 while y2 = 1.3... How can you improve this model? Gradient Boosting for Regression Let’s play a game... You are given (x1 , y1 ), (x2 , y2 ), ..., (xn , yn ), and the task is to fit a model F (x) to minimize square loss. Suppose your friend wants to help you and gives you a model F . You check his model and find the model is good but not perfect. There are some mistakes: F (x1 ) = 0.8, while y1 = 0.9, and F (x2 ) = 1.4 while y2 = 1.3... How can you improve this model? Rule of the game: I You are not allowed to remove anything from F or change any parameter in F . Gradient Boosting for Regression Let’s play a game... You are given (x1 , y1 ), (x2 , y2 ), ..., (xn , yn ), and the task is to fit a model F (x) to minimize square loss. Suppose your friend wants to help you and gives you a model F . You check his model and find the model is good but not perfect. There are some mistakes: F (x1 ) = 0.8, while y1 = 0.9, and F (x2 ) = 1.4 while y2 = 1.3... How can you improve this model? Rule of the game: I You are not allowed to remove anything from F or change any parameter in F . I You can add an additional model (regression tree) h to F , so the new prediction will be F (x) + h(x). Gradient Boosting for Regression Simple solution: You wish to improve the model such that F (x1 ) + h(x1 ) = y1 F (x2 ) + h(x2 ) = y2 ... F (xn ) + h(xn ) = yn Gradient Boosting for Regression Simple solution: Or, equivalently, you wish h(x1 ) = y1 − F (x1 ) h(x2 ) = y2 − F (x2 ) ... h(xn ) = yn − F (xn ) Gradient Boosting for Regression Simple solution: Or, equivalently, you wish h(x1 ) = y1 − F (x1 ) h(x2 ) = y2 − F (x2 ) ... h(xn ) = yn − F (xn ) Can any regression tree h achieve this goal perfectly? Gradient Boosting for Regression Simple solution: Or, equivalently, you wish h(x1 ) = y1 − F (x1 ) h(x2 ) = y2 − F (x2 ) ... h(xn ) = yn − F (xn ) Can any regression tree h achieve this goal perfectly? Maybe not.... Gradient Boosting for Regression Simple solution: Or, equivalently, you wish h(x1 ) = y1 − F (x1 ) h(x2 ) = y2 − F (x2 ) ... h(xn ) = yn − F (xn ) Can any regression tree h achieve this goal perfectly? Maybe not.... But some regression tree might be able to do this approximately. Gradient Boosting for Regression Simple solution: Or, equivalently, you wish h(x1 ) = y1 − F (x1 ) h(x2 ) = y2 − F (x2 ) ... h(xn ) = yn − F (xn ) Can any regression tree h achieve this goal perfectly? Maybe not.... But some regression tree might be able to do this approximately. How? Gradient Boosting for Regression Simple solution: Or, equivalently, you wish h(x1 ) = y1 − F (x1 ) h(x2 ) = y2 − F (x2 ) ... h(xn ) = yn − F (xn ) Can any regression tree h achieve this goal perfectly? Maybe not.... But some regression tree might be able to do this approximately. How? Just fit a regression tree h to data (x1 , y1 − F (x1 )), (x2 , y2 − F (x2 )), ..., (xn , yn − F (xn )) Gradient Boosting for Regression Simple solution: Or, equivalently, you wish h(x1 ) = y1 − F (x1 ) h(x2 ) = y2 − F (x2 ) ... h(xn ) = yn − F (xn ) Can any regression tree h achieve this goal perfectly? Maybe not.... But some regression tree might be able to do this approximately. How? Just fit a regression tree h to data (x1 , y1 − F (x1 )), (x2 , y2 − F (x2 )), ..., (xn , yn − F (xn )) Congratulations, you get a better model! Gradient Boosting for Regression Simple solution: yi − F (xi ) are called residuals. These are the parts that existing model F cannot do well. The role of h is to compensate the shortcoming of existing model F. Gradient Boosting for Regression Simple solution: yi − F (xi ) are called residuals. These are the parts that existing model F cannot do well. The role of h is to compensate the shortcoming of existing model F. If the new model F + h is still not satisfactory, Gradient Boosting for Regression Simple solution: yi − F (xi ) are called residuals. These are the parts that existing model F cannot do well. The role of h is to compensate the shortcoming of existing model F. If the new model F + h is still not satisfactory, we can add another regression tree... Gradient Boosting for Regression Simple solution: yi − F (xi ) are called residuals. These are the parts that existing model F cannot do well. The role of h is to compensate the shortcoming of existing model F. If the new model F + h is still not satisfactory, we can add another regression tree... We are improving the predictions of training data, is the procedure also useful for test data? Gradient Boosting for Regression Simple solution: yi − F (xi ) are called residuals. These are the parts that existing model F cannot do well. The role of h is to compensate the shortcoming of existing model F. If the new model F + h is still not satisfactory, we can add another regression tree... We are improving the predictions of training data, is the procedure also useful for test data? Yes! Because we are building a model, and the model can be applied to test data as well. Gradient Boosting for Regression Simple solution: yi − F (xi ) are called residuals. These are the parts that existing model F cannot do well. The role of h is to compensate the shortcoming of existing model F. If the new model F + h is still not satisfactory, we can add another regression tree... We are improving the predictions of training data, is the procedure also useful for test data? Yes! Because we are building a model, and the model can be applied to test data as well. How is this related to gradient descent? Gradient Boosting for Regression Gradient Descent Minimize a function by moving in the opposite direction of the gradient. ∂J θi := θi − ρ ∂θi Figure: Gradient Descent. Source: http://en.wikipedia.org/wiki/Gradient_descent Gradient Boosting for Regression How is this related to gradient descent? Loss function L(y , F (x)) =P (y − F (x))2 /2 We want to minimize J = i L(yi , F (xi )) by adjusting F (x1 ), F (x2 ), ..., F (xn ). Notice that F (x1 ), F (x2 ), ..., F (xn ) are just some numbers. We can treat F (xi ) as parameters and take derivatives P ∂ i L(yi , F (xi )) ∂L(yi , F (xi )) ∂J = = = F (xi ) − yi ∂F (xi ) ∂F (xi ) ∂F (xi ) So we can interpret residuals as negative gradients. yi − F (xi ) = − ∂J ∂F (xi ) Gradient Boosting for Regression How is this related to gradient descent? F (xi ) := F (xi ) + h(xi ) F (xi ) := F (xi ) + yi − F (xi ) ∂J F (xi ) := F (xi ) − 1 ∂F (xi ) ∂J θi := θi − ρ ∂θi Gradient Boosting for Regression How is this related to gradient descent? For regression with square loss, residual ⇔ negative gradient fit h to residual ⇔ fit h to negative gradient update F based on residual ⇔ update F based on negative gradient Gradient Boosting for Regression How is this related to gradient descent? For regression with square loss, residual ⇔ negative gradient fit h to residual ⇔ fit h to negative gradient update F based on residual ⇔ update F based on negative gradient So we are actually updating our model using gradient descent! Gradient Boosting for Regression How is this related to gradient descent? For regression with square loss, residual ⇔ negative gradient fit h to residual ⇔ fit h to negative gradient update F based on residual ⇔ update F based on negative gradient So we are actually updating our model using gradient descent! It turns out that the concept of gradients is more general and useful than the concept of residuals. So from now on, let’s stick with gradients. The reason will be explained later. Gradient Boosting for Regression Regression with square Loss Let us summarize the algorithm we just derived using the concept of gradients. Negative gradient: −g (xi ) = − ∂L(yi , F (xi )) = yi − F (xi ) ∂F (xi ) Pn y i start with an initial model, say, F (x) = i=1 n iterate until converge: calculate negative gradients −g (xi ) fit a regression tree h to negative gradients −g (xi ) F := F + ρh, where ρ = 1 Gradient Boosting for Regression Regression with square Loss Let us summarize the algorithm we just derived using the concept of gradients. Negative gradient: −g (xi ) = − ∂L(yi , F (xi )) = yi − F (xi ) ∂F (xi ) Pn y i start with an initial model, say, F (x) = i=1 n iterate until converge: calculate negative gradients −g (xi ) fit a regression tree h to negative gradients −g (xi ) F := F + ρh, where ρ = 1 The benefit of formulating this algorithm using gradients is that it allows us to consider other loss functions and derive the corresponding algorithms in the same way. Gradient Boosting for Regression Loss Functions for Regression Problem Why do we need to consider other loss functions? Isn’t square loss good enough? Gradient Boosting for Regression Loss Functions for Regression Problem Square loss is: X Easy to deal with mathematically × Not robust to outliers Outliers are heavily punished because the error is squared. Example: yi 0.5 1.2 2 5* F (xi ) 0.6 1.4 1.5 1.7 L = (y − F )2 /2 0.005 0.02 0.125 5.445 Consequence? Gradient Boosting for Regression Loss Functions for Regression Problem Square loss is: X Easy to deal with mathematically × Not robust to outliers Outliers are heavily punished because the error is squared. Example: yi 0.5 1.2 2 5* F (xi ) 0.6 1.4 1.5 1.7 L = (y − F )2 /2 0.005 0.02 0.125 5.445 Consequence? Pay too much attention to outliers. Try hard to incorporate outliers into the model. Degrade the overall performance. Gradient Boosting for Regression Loss Functions for Regression Problem I Absolute loss (more robust to outliers) L(y , F ) = |y − F | Gradient Boosting for Regression Loss Functions for Regression Problem I Absolute loss (more robust to outliers) L(y , F ) = |y − F | I Huber loss (more robust to outliers) ( 1 (y − F )2 |y − F | ≤ δ L(y , F ) = 2 δ(|y − F | − δ/2) |y − F | > δ Gradient Boosting for Regression Loss Functions for Regression Problem I Absolute loss (more robust to outliers) L(y , F ) = |y − F | I Huber loss (more robust to outliers) ( 1 (y − F )2 |y − F | ≤ δ L(y , F ) = 2 δ(|y − F | − δ/2) |y − F | > δ yi F (xi ) Square loss Absolute loss Huber loss(δ = 0.5) 0.5 0.6 0.005 0.1 0.005 1.2 1.4 0.02 0.2 0.02 2 1.5 0.125 0.5 0.125 5* 1.7 5.445 3.3 1.525 Gradient Boosting for Regression Regression with Absolute Loss Negative gradient: −g (xi ) = − ∂L(yi , F (xi )) = sign(yi − F (xi )) ∂F (xi ) Pn y i start with an initial model, say, F (x) = i=1 n iterate until converge: calculate gradients −g (xi ) fit a regression tree h to negative gradients −g (xi ) F := F + ρh Gradient Boosting for Regression Regression with Huber Loss Negative gradient: ∂L(yi , F (xi )) −g (xi ) = − ∂F (xi ) ( yi − F (xi ) |yi − F (xi )| ≤ δ = δsign(yi − F (xi )) |yi − F (xi )| > δ Pn y i start with an initial model, say, F (x) = i=1 n iterate until converge: calculate negative gradients −g (xi ) fit a regression tree h to negative gradients −g (xi ) F := F + ρh Gradient Boosting for Regression Regression with loss function L: general procedure Give any differentiable loss function L Pn y i start with an initial model, say F (x) = i=1 n iterate until converge: i ,F (xi )) calculate negative gradients −g (xi ) = − ∂L(y ∂F (xi ) fit a regression tree h to negative gradients −g (xi ) F := F + ρh Gradient Boosting for Regression Regression with loss function L: general procedure Give any differentiable loss function L Pn y i start with an initial model, say F (x) = i=1 n iterate until converge: i ,F (xi )) calculate negative gradients −g (xi ) = − ∂L(y ∂F (xi ) fit a regression tree h to negative gradients −g (xi ) F := F + ρh In general, negative gradients 6⇔ residuals We should follow negative gradients rather than residuals. Why? Gradient Boosting for Regression Negative Gradient vs Residual: An Example Huber loss ( L(y , F ) = 1 2 (y − F )2 |y − F | ≤ δ δ(|y − F | − δ/2) |y − F | > δ Update by Negative Gradient: ( yi − F (xi ) |yi − F (xi )| ≤ δ h(xi ) = −g (xi ) = δsign(yi − F (xi )) |yi − F (xi )| > δ Update by Residual: h(xi ) = yi − F (xi ) Difference: negative gradient pays less attention to outliers. Gradient Boosting for Regression Summary of the Section P I Fit an additive model F = manner. I In each stage, introduce a new regression tree h to compensate the shortcomings of existing model. I The“shortcomings” are identified by negative gradients. I For any loss function, we can derive a gradient boosting algorithm. I Absolute loss and Huber loss are more robust to outliers than square loss. t ρt ht in a forward stage-wise Things not covered How to choose a proper learning rate for each gradient boosting algorithm. See [Friedman, 2001] Gradient Boosting for Classification Problem Recognize the given hand written capital letter. I Multi-class classification I 26 classes. A,B,C,...,Z Data Set I http://archive.ics.uci.edu/ml/datasets/Letter+ Recognition I 20000 data points, 16 features Gradient Boosting for Classification Feature Extraction 1 2 3 4 5 6 7 8 horizontal position of box vertical position of box width of box height of box total number on pixels mean x of on pixels in box mean y of on pixels in box mean x variance 9 10 11 12 13 14 15 16 mean y variance mean x y correlation mean of x * x * y mean of x * y * y mean edge count left to right correlation of x-ege with y mean edge count bottom to top correlation of y-ege with x Feature Vector= (2, 1, 3, 1, 1, 8, 6, 6, 6, 6, 5, 9, 1, 7, 5, 10) Label = G Gradient Boosting for Classification Model I 26 score functions (our models): FA , FB , FC , ..., FZ . I FA (x) assigns a score for class A I scores are used to calculate probabilities e FA (x) PA (x) = PZ Fc (x) c=A e e FB (x) PB (x) = PZ Fc (x) c=A e ... e FZ (x) PZ (x) = PZ Fc (x) c=A e I predicted label = class that has the highest probability Loss Function for each data point Step 1 turn the label yi into a (true) probability distribution Yc (xi ) For example: y5 =G, YA (x5 ) = 0, YB (x5 ) = 0, ..., YG (x5 ) = 1, ..., YZ (x5 ) = 0 Gradient Boosting for Classification Figure: true probability distribution Loss Function for each data point Step 1 turn the label yi into a (true) probability distribution Yc (xi ) For example: y5 =G, YA (x5 ) = 0, YB (x5 ) = 0, ..., YG (x5 ) = 1, ..., YZ (x5 ) = 0 Step 2 calculate the predicted probability distribution Pc (xi ) based on the current model FA , FB , ..., FZ . PA (x5 ) = 0.03, PB (x5 ) = 0.05, ..., PG (x5 ) = 0.3, ..., PZ (x5 ) = 0.05 Gradient Boosting for Classification Figure: predicted probability distribution based on current model Loss Function for each data point Step 1 turn the label yi into a (true) probability distribution Yc (xi ) For example: y5 =G, YA (x5 ) = 0, YB (x5 ) = 0, ..., YG (x5 ) = 1, ..., YZ (x5 ) = 0 Step 2 calculate the predicted probability distribution Pc (xi ) based on the current model FA , FB , ..., FZ . PA (x5 ) = 0.03, PB (x5 ) = 0.05, ..., PG (x5 ) = 0.3, ..., PZ (x5 ) = 0.05 Step 3 calculate the difference between the true probability distribution and the predicted probability distribution. Here we use KL-divergence Gradient Boosting for Classification Goal I minimize the total loss (KL-divergence) I for each data point, we wish the predicted probability distribution to match the true probability distribution as closely as possible Gradient Boosting for Classification Figure: true probability distribution Gradient Boosting for Classification Figure: predicted probability distribution at round 0 Gradient Boosting for Classification Figure: predicted probability distribution at round 1 Gradient Boosting for Classification Figure: predicted probability distribution at round 2 Gradient Boosting for Classification Figure: predicted probability distribution at round 10 Gradient Boosting for Classification Figure: predicted probability distribution at round 20 Gradient Boosting for Classification Figure: predicted probability distribution at round 30 Gradient Boosting for Classification Figure: predicted probability distribution at round 40 Gradient Boosting for Classification Figure: predicted probability distribution at round 50 Gradient Boosting for Classification Figure: predicted probability distribution at round 100 Gradient Boosting for Classification Goal I minimize the total loss (KL-divergence) I for each data point, we wish the predicted probability distribution to match the true probability distribution as closely as possible I we achieve this goal by adjusting our models FA , FB , ..., FZ . Gradient Boosting for Regression: Review Regression with loss function L: general procedure Give any differentiable loss function L start with an initial model F iterate until converge: i ,F (xi )) calculate negative gradients −g (xi ) = − ∂L(y ∂F (xi ) fit a regression tree h to negative gradients −g (xi ) F := F + ρh Gradient Boosting for Classification Differences I FA , FB , ..., FZ vs F I a matrix of parameters to optimize vs a column of parameters to optimize FA (x1 ) FB (x1 ) ... FZ (x1 ) FA (x2 ) FB (x2 ) ... FZ (x2 ) ... ... ... ... FA (xn ) FB (xn ) ... FZ (xn ) a matrix of gradients vs a column of gradients ∂L ∂L ... FZ∂L FA (x1 ) FB (x1 ) (x1 ) ∂L ∂L ∂L ... FA (x2 ) FB (x2 ) FZ (x2 ) ... ... ... ... ∂L ∂L ∂L ... FA (xn ) FB (xn ) FZ (xn ) I Gradient Boosting for Classification start with initial models FA , FB , FC , ..., FZ iterate until converge: calculate negative gradients for class A: −gA (xi ) = − ∂F∂L A (xi ) calculate negative gradients for class B: −gB (xi ) = − ∂F∂L B (xi ) ... calculate negative gradients for class Z:−gZ (xi ) = − ∂F∂L Z (xi ) fit a regression tree hA to negative gradients −gA (xi ) fit a regression tree hB to negative gradients −gB (xi ) ... fit a regression tree hZ to negative gradients −gZ (xi ) FA := FA + ρA hA FB := FB + ρB hB ... FZ := FZ + ρZ hZ Gradient Boosting for Classification start with initial models FA , FB , FC , ..., FZ iterate until converge: calculate negative gradients for class A: −gA (xi ) = YA (xi ) − PA (xi ) calculate negative gradients for class B: −gB (xi ) = YB (xi ) − PB (xi ) ... calculate negative gradients for class Z:−gZ (xi ) = YZ (xi ) − PZ (xi ) fit a regression tree hA to negative gradients −gA (xi ) fit a regression tree hB to negative gradients −gB (xi ) ... fit a regression tree hZ to negative gradients −gZ (xi ) FA := FA + ρA hA FB := FB + ρB hB ... FZ := FZ + ρZ hZ Gradient Boosting for Classification round 0 i 1 2 3 4 5 ... y T I D N G ... i 1 2 3 4 5 ... i 1 2 3 4 5 ... i y 1 2 3 4 5 ... T I D N G ... y T I D N G ... YA − PA -0.04 -0.04 -0.04 -0.04 -0.04 ... PA 0.04 0.04 0.04 0.04 0.04 ... PB 0.04 0.04 0.04 0.04 0.04 ... YB − PB -0.04 -0.04 -0.04 -0.04 -0.04 ... YA 0 0 0 0 0 ... y T I D N G ... FA 0 0 0 0 0 ... PC 0.04 0.04 0.04 0.04 0.04 ... YC − PC -0.04 -0.04 -0.04 -0.04 -0.04 ... YB 0 0 0 0 0 ... FB 0 0 0 0 0 ... PD 0.04 0.04 0.04 0.04 0.04 ... YD − PD -0.04 -0.04 0.96 -0.04 -0.04 ... YC 0 0 0 0 0 ... FC 0 0 0 0 0 ... YD 0 0 1 0 0 ... YE 0 0 0 0 0 ... FD 0 0 0 0 0 ... YF 0 0 0 0 0 ... FE 0 0 0 0 0 ... FF 0 0 0 0 0 ... PE 0.04 0.04 0.04 0.04 0.04 ... PF 0.04 0.04 0.04 0.04 0.04 ... PG 0.04 0.04 0.04 0.04 0.04 ... YE − PE -0.04 -0.04 -0.04 -0.04 -0.04 ... YF − PF -0.04 -0.04 -0.04 -0.04 -0.04 ... YG − PG -0.04 -0.04 -0.04 -0.04 0.96 ... YG 0 0 0 0 1 ... FG 0 0 0 0 0 ... PH 0.04 0.04 0.04 0.04 0.04 ... YH − PH -0.04 -0.04 -0.04 -0.04 -0.04 ... YH 0 0 0 0 0 ... FH 0 0 0 0 0 ... PI 0.04 0.04 0.04 0.04 0.04 ... YI 0 1 0 0 0 ... YJ 0 0 0 0 0 ... YK 0 0 0 0 0 ... YL 0 0 0 0 0 ... YM 0 0 0 0 0 ... YN 0 0 0 1 0 ... YO 0 0 0 0 0 ... YP 0 0 0 0 0 ... YQ 0 0 0 0 0 ... FJ 0 0 0 0 0 ... FK 0 0 0 0 0 ... FL 0 0 0 0 0 ... FM 0 0 0 0 0 ... FN 0 0 0 0 0 ... FO 0 0 0 0 0 ... FP 0 0 0 0 0 ... FQ 0 0 0 0 0 ... FI 0 0 0 0 0 ... PJ 0.04 0.04 0.04 0.04 0.04 ... YI − PI -0.04 0.96 -0.04 -0.04 -0.04 ... PK 0.04 0.04 0.04 0.04 0.04 ... YJ − PJ -0.04 -0.04 -0.04 -0.04 -0.04 ... PL 0.04 0.04 0.04 0.04 0.04 ... YK − PK -0.04 -0.04 -0.04 -0.04 -0.04 ... PM 0.04 0.04 0.04 0.04 0.04 ... YL − PL -0.04 -0.04 -0.04 -0.04 -0.04 ... PN 0.04 0.04 0.04 0.04 0.04 ... PO 0.04 0.04 0.04 0.04 0.04 ... YM − PM -0.04 -0.04 -0.04 -0.04 -0.04 ... YN − PN -0.04 -0.04 -0.04 0.96 -0.04 ... PP 0.04 0.04 0.04 0.04 0.04 ... YR 0 0 0 0 0 ... FR 0 0 0 0 0 ... PQ 0.04 0.04 0.04 0.04 0.04 ... YO − PO -0.04 -0.04 -0.04 -0.04 -0.04 ... YS 0 0 0 0 0 ... YT 1 0 0 0 0 ... FS 0 0 0 0 0 ... FT 0 0 0 0 0 ... PR 0.04 0.04 0.04 0.04 0.04 ... YP − PP -0.04 -0.04 -0.04 -0.04 -0.04 ... YU 0 0 0 0 0 ... FU 0 0 0 0 0 ... PS 0.04 0.04 0.04 0.04 0.04 ... YQ − PQ -0.04 -0.04 -0.04 -0.04 -0.04 ... YV 0 0 0 0 0 ... FV 0 0 0 0 0 ... PT 0.04 0.04 0.04 0.04 0.04 ... YR − PR -0.04 -0.04 -0.04 -0.04 -0.04 ... YW 0 0 0 0 0 ... YX 0 0 0 0 0 ... YY 0 0 0 0 0 ... FW 0 0 0 0 0 ... FX 0 0 0 0 0 ... FY 0 0 0 0 0 ... PU 0.04 0.04 0.04 0.04 0.04 ... PV 0.04 0.04 0.04 0.04 0.04 ... YS − PS -0.04 -0.04 -0.04 -0.04 -0.04 ... YT − PT 0.96 -0.04 -0.04 -0.04 -0.04 ... YZ 0 0 0 0 0 ... FZ 0 0 0 0 0 ... PW 0.04 0.04 0.04 0.04 0.04 ... YU − PU -0.04 -0.04 -0.04 -0.04 -0.04 ... PX 0.04 0.04 0.04 0.04 0.04 ... PY 0.04 0.04 0.04 0.04 0.04 ... YV − PV -0.04 -0.04 -0.04 -0.04 -0.04 ... PZ 0.04 0.04 0.04 0.04 0.04 ... YW − PW -0.04 -0.04 -0.04 -0.04 -0.04 ... YX − PX -0.04 -0.04 -0.04 -0.04 -0.04 ... YY − PY -0.04 -0.04 -0.04 -0.04 -0.04 ... YZ − PZ -0.04 -0.04 -0.04 -0.04 -0.04 ... Gradient Boosting for Classification ( 0.98 hA (x) = −0.07 ( −0.07 hB (x) = 0.22 feature 10 of x ≤ 2.0 feature 10 of x > 2.0 feature 15 of x ≤ 8.0 feature 15 of x > 8.0 ... ( −0.07 feature 8 of x ≤ 8.0 hZ (x) = 0.82 feature 8 of x > 8.0 FA := FA + ρA hA FB := FB + ρB hB ... FZ := FZ + ρZ hZ Gradient Boosting for Classification round 1 i 1 2 3 4 5 ... i 1 2 3 4 5 ... y T I D N G ... FA -0.08 -0.08 -0.08 -0.08 -0.08 ... i 1 2 3 4 5 ... y T I D N G ... i y 1 2 3 4 5 ... T I D N G ... YA − PA -0.04 -0.04 -0.04 -0.04 -0.04 ... FB -0.07 0.23 0.23 -0.07 0.23 ... PA 0.04 0.04 0.04 0.04 0.04 ... y T I D N G ... FC -0.06 -0.06 -0.06 -0.06 -0.06 ... PB 0.04 0.05 0.05 0.04 0.05 ... YB − PB -0.04 -0.05 -0.05 -0.04 -0.05 ... YA 0 0 0 0 0 ... FD -0.07 -0.07 -0.07 -0.07 -0.07 ... PC 0.04 0.04 0.04 0.04 0.04 ... YC − PC -0.04 -0.04 -0.04 -0.04 -0.04 ... YB 0 0 0 0 0 ... PD 0.04 0.04 0.04 0.04 0.04 ... YD − PD -0.04 -0.04 0.96 -0.04 -0.04 ... YC 0 0 0 0 0 ... YD 0 0 1 0 0 ... YE 0 0 0 0 0 ... YF 0 0 0 0 0 ... FE -0.02 -0.02 -0.02 -0.02 -0.02 ... FF -0.02 -0.02 -0.02 -0.02 -0.02 ... FG -0.08 0.16 -0.08 0.16 0.16 ... PE 0.04 0.04 0.04 0.04 0.04 ... PF 0.04 0.04 0.04 0.04 0.04 ... PG 0.04 0.05 0.04 0.05 0.05 ... YE − PE -0.04 -0.04 -0.04 -0.04 -0.04 ... YF − PF -0.04 -0.04 -0.04 -0.04 -0.04 ... YG − PG -0.04 -0.05 -0.04 -0.05 0.95 ... YG 0 0 0 0 1 ... FH -0.02 -0.02 -0.02 -0.02 -0.02 ... PH 0.04 0.04 0.04 0.04 0.04 ... YH − PH -0.04 -0.04 -0.04 -0.04 -0.04 ... YH 0 0 0 0 0 ... YI 0 1 0 0 0 ... FI -0.03 -0.03 -0.03 -0.03 -0.03 ... PI 0.04 0.04 0.04 0.04 0.04 ... YJ 0 0 0 0 0 ... FJ -0.03 -0.03 -0.03 -0.03 -0.03 ... PJ 0.04 0.04 0.04 0.04 0.04 ... YI − PI -0.04 0.96 -0.04 -0.04 -0.04 ... YK 0 0 0 0 0 ... FK -0.06 -0.06 -0.06 0.26 -0.06 ... PK 0.04 0.04 0.04 0.05 0.04 ... YJ − PJ -0.04 -0.04 -0.04 -0.04 -0.04 ... YL 0 0 0 0 0 ... PL 0.04 0.04 0.04 0.04 0.04 ... YK − PK -0.04 -0.04 -0.04 -0.05 -0.04 ... YM 0 0 0 0 0 ... FL -0.04 -0.04 -0.04 -0.04 -0.04 ... PM 0.04 0.04 0.04 0.04 0.04 ... YL − PL -0.04 -0.04 -0.04 -0.04 -0.04 ... YN 0 0 0 1 0 ... YO 0 0 0 0 0 ... FM -0.08 -0.08 -0.08 -0.08 -0.08 ... YP 0 0 0 0 0 ... YQ 0 0 0 0 0 ... FN -0.08 -0.08 -0.08 0.3 -0.08 ... FO -0.07 -0.07 -0.07 -0.07 -0.07 ... PN 0.04 0.04 0.04 0.05 0.04 ... PO 0.04 0.04 0.04 0.04 0.04 ... PP 0.04 0.04 0.04 0.04 0.04 ... YM − PM -0.04 -0.04 -0.04 -0.04 -0.04 ... YN − PN -0.04 -0.04 -0.04 0.95 -0.04 ... YR 0 0 0 0 0 ... YS 0 0 0 0 0 ... FP -0.07 -0.07 -0.07 -0.07 -0.07 ... PQ 0.04 0.04 0.04 0.04 0.04 ... YO − PO -0.04 -0.04 -0.04 -0.04 -0.04 ... YT 1 0 0 0 0 ... FQ -0.02 -0.02 -0.02 -0.02 -0.02 ... PR 0.04 0.04 0.04 0.04 0.04 ... YP − PP -0.04 -0.04 -0.04 -0.04 -0.04 ... YU 0 0 0 0 0 ... FR -0.04 -0.04 -0.04 -0.04 -0.04 ... PS 0.04 0.04 0.04 0.04 0.04 ... YQ − PQ -0.04 -0.04 -0.04 -0.04 -0.04 ... YV 0 0 0 0 0 ... YW 0 0 0 0 0 ... FS -0.04 -0.04 -0.04 -0.04 -0.04 ... PT 0.07 0.04 0.04 0.04 0.04 ... YR − PR -0.04 -0.04 -0.04 -0.04 -0.04 ... YX 0 0 0 0 0 ... FT 0.59 -0.07 -0.07 -0.07 -0.07 ... YY 0 0 0 0 0 ... FU -0.01 -0.01 -0.01 -0.01 -0.01 ... PU 0.04 0.04 0.04 0.04 0.04 ... PV 0.04 0.04 0.04 0.04 0.04 ... YS − PS -0.04 -0.04 -0.04 -0.04 -0.04 ... YT − PT 0.93 -0.04 -0.04 -0.04 -0.04 ... YZ 0 0 0 0 0 ... FV -0.07 -0.07 -0.07 -0.07 -0.07 ... FW -0.07 -0.07 -0.07 -0.07 -0.07 ... FX -0.05 -0.05 -0.05 -0.05 -0.05 ... PX 0.04 0.04 0.04 0.04 0.04 ... PY 0.04 0.04 0.04 0.04 0.04 ... PZ 0.04 0.04 0.04 0.04 0.04 ... PW 0.04 0.04 0.04 0.04 0.04 ... YU − PU -0.04 -0.04 -0.04 -0.04 -0.04 ... YV − PV -0.04 -0.04 -0.04 -0.04 -0.04 ... YW − PW -0.04 -0.04 -0.04 -0.04 -0.04 ... FY -0.06 -0.06 -0.06 -0.06 -0.06 ... YX − PX -0.04 -0.04 -0.04 -0.04 -0.04 ... FZ -0.07 -0.07 -0.07 -0.07 -0.07 ... YY − PY -0.04 -0.04 -0.04 -0.04 -0.04 ... YZ − PZ -0.04 -0.04 -0.04 -0.04 -0.04 ... Gradient Boosting for Classification ( 0.37 hA (x) = −0.07 ( −0.07 hB (x) = 0.22 feature 10 of x ≤ 2.0 feature 10 of x > 2.0 feature 14 of x ≤ 5.0 feature 14 of x > 5.0 ... ( −0.07 feature 8 of x ≤ 8.0 hZ (x) = 0.35 feature 8 of x > 8.0 FA := FA + ρA hA FB := FB + ρB hB ... FZ := FZ + ρZ hZ Gradient Boosting for Classification round 2 i 1 2 3 4 5 ... i 1 2 3 4 5 ... y T I D N G ... FA -0.15 -0.15 -0.15 -0.15 -0.15 ... i 1 2 3 4 5 ... y T I D N G ... i y 1 2 3 4 5 ... T I D N G ... YA − PA -0.03 -0.04 -0.04 -0.03 -0.03 ... FB -0.14 0.16 0.16 -0.14 0.16 ... PA 0.03 0.04 0.04 0.03 0.03 ... y T I D N G ... FC -0.12 -0.12 -0.12 -0.12 -0.12 ... PB 0.03 0.05 0.05 0.03 0.05 ... YB − PB -0.03 -0.05 -0.05 -0.03 -0.05 ... YA 0 0 0 0 0 ... FD -0.14 -0.14 -0.14 -0.14 -0.14 ... PC 0.03 0.04 0.04 0.03 0.04 ... YC − PC -0.03 -0.04 -0.04 -0.03 -0.04 ... YB 0 0 0 0 0 ... PD 0.03 0.04 0.04 0.03 0.04 ... YD − PD -0.03 -0.04 0.96 -0.03 -0.04 ... YC 0 0 0 0 0 ... YD 0 0 1 0 0 ... YE 0 0 0 0 0 ... YF 0 0 0 0 0 ... FE -0.03 -0.03 -0.03 -0.03 -0.03 ... FF 0.28 -0.08 -0.08 -0.08 -0.08 ... FG -0.14 0.33 0.1 0.1 0.33 ... PE 0.03 0.04 0.04 0.04 0.04 ... PF 0.04 0.04 0.04 0.04 0.04 ... PG 0.03 0.06 0.05 0.04 0.06 ... YE − PE -0.03 -0.04 -0.04 -0.04 -0.04 ... YF − PF -0.04 -0.04 -0.04 -0.04 -0.04 ... YG − PG -0.03 -0.06 -0.05 -0.04 0.94 ... YG 0 0 0 0 1 ... FH -0.04 -0.04 -0.04 -0.04 -0.04 ... PH 0.03 0.04 0.04 0.04 0.04 ... YH − PH -0.03 -0.04 -0.04 -0.04 -0.04 ... YH 0 0 0 0 0 ... YI 0 1 0 0 0 ... FI 1.49 -0.07 -0.07 -0.07 -0.07 ... PI 0.15 0.04 0.04 0.04 0.04 ... YJ 0 0 0 0 0 ... FJ -0.07 -0.07 -0.07 -0.07 -0.07 ... PJ 0.03 0.04 0.04 0.04 0.04 ... YI − PI -0.15 0.96 -0.04 -0.04 -0.04 ... YK 0 0 0 0 0 ... FK -0.11 -0.11 -0.11 0.46 -0.11 ... PK 0.03 0.04 0.04 0.06 0.04 ... YJ − PJ -0.03 -0.04 -0.04 -0.04 -0.04 ... YL 0 0 0 0 0 ... PL 0.03 0.04 0.04 0.04 0.04 ... YK − PK -0.03 -0.04 -0.04 -0.06 -0.04 ... YM 0 0 0 0 0 ... FL -0.08 -0.08 -0.08 -0.08 -0.08 ... PM 0.03 0.04 0.04 0.03 0.04 ... YL − PL -0.03 -0.04 -0.04 -0.04 -0.04 ... YN 0 0 0 1 0 ... YO 0 0 0 0 0 ... FM -0.14 -0.14 -0.14 -0.14 -0.14 ... YP 0 0 0 0 0 ... YQ 0 0 0 0 0 ... FN -0.17 -0.17 -0.17 0.5 -0.17 ... FO -0.13 -0.13 -0.13 -0.13 -0.13 ... PN 0.03 0.04 0.04 0.06 0.03 ... PO 0.03 0.04 0.04 0.03 0.04 ... PP 0.03 0.04 0.04 0.03 0.04 ... YM − PM -0.03 -0.04 -0.04 -0.03 -0.04 ... YN − PN -0.03 -0.04 -0.04 0.94 -0.03 ... YR 0 0 0 0 0 ... YS 0 0 0 0 0 ... FP -0.13 -0.13 -0.13 -0.13 -0.13 ... PQ 0.03 0.04 0.04 0.04 0.04 ... YO − PO -0.03 -0.04 -0.04 -0.03 -0.04 ... YT 1 0 0 0 0 ... FQ -0.04 -0.04 -0.04 -0.04 -0.04 ... PR 0.03 0.04 0.05 0.04 0.05 ... YP − PP -0.03 -0.04 -0.04 -0.03 -0.04 ... YU 0 0 0 0 0 ... FR -0.11 -0.11 0.19 -0.11 0.19 ... PS 0.03 0.04 0.04 0.04 0.04 ... YQ − PQ -0.03 -0.04 -0.04 -0.04 -0.04 ... YV 0 0 0 0 0 ... YW 0 0 0 0 0 ... FS -0.07 -0.07 -0.07 -0.07 -0.07 ... PT 0.09 0.04 0.04 0.04 0.04 ... YR − PR -0.03 -0.04 -0.05 -0.04 -0.05 ... YX 0 0 0 0 0 ... FT 1.05 -0.11 -0.11 -0.11 -0.11 ... YY 0 0 0 0 0 ... FU 0.19 -0.07 -0.07 -0.07 -0.07 ... PU 0.04 0.04 0.04 0.04 0.04 ... PV 0.04 0.04 0.04 0.03 0.04 ... YS − PS -0.03 -0.04 -0.04 -0.04 -0.04 ... YT − PT 0.91 -0.04 -0.04 -0.04 -0.04 ... YZ 0 0 0 0 0 ... FV 0.25 -0.15 -0.15 -0.15 -0.15 ... FW -0.16 -0.16 -0.16 0.25 -0.16 ... FX -0.09 -0.09 -0.09 -0.09 -0.09 ... PX 0.03 0.04 0.04 0.04 0.04 ... PY 0.05 0.04 0.04 0.03 0.04 ... PZ 0.03 0.04 0.04 0.03 0.04 ... PW 0.03 0.04 0.04 0.05 0.03 ... YU − PU -0.04 -0.04 -0.04 -0.04 -0.04 ... YV − PV -0.04 -0.04 -0.04 -0.03 -0.04 ... YW − PW -0.03 -0.04 -0.04 -0.05 -0.03 ... FY 0.33 -0.13 -0.13 -0.13 -0.13 ... YX − PX -0.03 -0.04 -0.04 -0.04 -0.04 ... FZ -0.14 -0.14 -0.14 -0.14 -0.14 ... YY − PY -0.05 -0.04 -0.04 -0.03 -0.04 ... YZ − PZ -0.03 -0.04 -0.04 -0.03 -0.04 ... Gradient Boosting for Classification round 100 i 1 2 3 4 5 ... i 1 2 3 4 5 ... y T I D N G ... FA -3.26 -1.64 -2.45 -3.95 -3.14 ... i 1 2 3 4 5 ... y T I D N G ... i y 1 2 3 4 5 ... T I D N G ... YA − PA -0 -0.01 -0.01 -0 -0 ... FB -2.7 -1.09 0.18 -3.38 -0.04 ... PA 0 0.01 0.01 0 0 ... YB − PB -0 -0.01 -0.11 -0 -0.03 ... y T I D N G ... YA 0 0 0 0 0 ... FC -2.2 -2.29 -3.01 -0.22 -2.37 ... PB 0 0.01 0.11 0 0.03 ... FD -2.22 -1.8 0.18 -0.94 -0.78 ... PC 0 0 0 0.02 0 ... YC − PC -0 -0 -0 -0.02 -0 ... YB 0 0 0 0 0 ... PD 0 0.01 0.11 0.01 0.01 ... YD − PD -0 -0.01 0.89 -0.01 -0.01 ... YC 0 0 0 0 0 ... YD 0 0 1 0 0 ... FE -2.48 0.45 -2.79 -1.33 0.02 ... PE 0 0.06 0.01 0.01 0.03 ... YE − PE -0 -0.06 -0.01 -0.01 -0.03 ... YE 0 0 0 0 0 ... YF 0 0 0 0 0 ... YG 0 0 0 0 1 ... FF -0.31 -0.43 -1.7 -1.38 -2.68 ... FG -2.77 2.14 -2.21 -1.22 2.6 ... FH -1.19 -1.56 0.43 -0.12 -1.48 ... PF 0.01 0.02 0.02 0.01 0 ... PG 0 0.32 0.01 0.01 0.42 ... PH 0 0.01 0.14 0.03 0.01 ... YF − PF -0.01 -0.02 -0.02 -0.01 -0 ... YG − PG -0 -0.32 -0.01 -0.01 0.58 ... YH − PH -0 -0.01 -0.14 -0.03 -0.01 ... YH 0 0 0 0 0 ... YI 0 1 0 0 0 ... FI 2.77 1.19 -1.12 -2.33 -1.93 ... PI 0.13 0.12 0.03 0 0 ... YJ 0 0 0 0 0 ... YK 0 0 0 0 0 ... FJ 0.1 1.09 0.32 -3.13 0.42 ... PJ 0.01 0.11 0.12 0 0.05 ... YI − PI -0.13 0.88 -0.03 -0 -0 ... FK -1.49 -1.5 0.67 0.58 -1.44 ... PK 0 0.01 0.17 0.05 0.01 ... YJ − PJ -0.01 -0.11 -0.12 -0 -0.05 ... YL 0 0 0 0 0 ... YM 0 0 0 0 0 ... FL -1.02 -0.5 -2.16 -0.65 -1.45 ... PL 0 0.02 0.01 0.02 0.01 ... YK − PK -0 -0.01 -0.17 -0.05 -0.01 ... PM 0 0 0 0.02 0 ... YL − PL -0 -0.02 -0.01 -0.02 -0.01 ... YN 0 0 0 1 0 ... YO 0 0 0 0 0 ... FM -1.64 -3.64 -2.91 -0.25 -3.36 ... YP 0 0 0 0 0 ... FN -0.8 -3.98 -2.76 2.96 -3.98 ... PN 0 0 0.01 0.59 0 ... PO 0 0.03 0.01 0 0.01 ... YM − PM -0 -0 -0 -0.02 -0 ... YN − PN -0 -0 -0.01 0.41 -0 ... YQ 0 0 0 0 0 ... YR 0 0 0 0 0 ... FO -2.4 -0.39 -1.92 -2.84 -0.94 ... PP 0 0 0 0 0 ... YS 0 0 0 0 0 ... FP -3.57 -2.3 -3.04 -1.82 -3.42 ... PQ 0 0.16 0.02 0.04 0.19 ... YO − PO -0 -0.03 -0.01 -0 -0.01 ... YT 1 0 0 0 0 ... FQ -0.9 1.42 -1.47 0.19 1.84 ... PR 0 0.02 0.05 0.05 0.13 ... YP − PP -0 -0 -0 -0 -0 ... YU 0 0 0 0 0 ... FR -2.45 -0.59 -0.48 0.55 1.44 ... PS 0.01 0.05 0.02 0.01 0.06 ... YQ − PQ -0 -0.16 -0.02 -0.04 -0.19 ... YV 0 0 0 0 0 ... YW 0 0 0 0 0 ... FS -0.2 0.27 -1.48 -1.22 0.62 ... YX 0 0 0 0 0 ... FT 4.61 -2.88 -1.25 -1.25 -1.25 ... YY 0 0 0 0 0 ... YZ 0 0 0 0 0 ... FU 0.5 -1.96 -2.25 0.45 -1.33 ... FV -0.71 -1.67 -3.23 -1.8 -4.41 ... FW -1.21 -4.38 -4.38 0.11 -4.71 ... PW 0 0 0 0.03 0 ... PX 0.01 0 0.11 0.02 0 ... PY 0.01 0 0 0.01 0 ... PT 0.79 0 0.03 0.01 0.01 ... PU 0.01 0.01 0.01 0.05 0.01 ... PV 0 0.01 0 0.01 0 ... YR − PR -0 -0.02 -0.05 -0.05 -0.13 ... YS − PS -0.01 -0.05 -0.02 -0.01 -0.06 ... YT − PT 0.21 -0 -0.03 -0.01 -0.01 ... YU − PU -0.01 -0.01 -0.01 -0.05 -0.01 ... YV − PV -0 -0.01 -0 -0.01 -0 ... FX -0.24 -2.06 0.17 -0.69 -2.62 ... FY 0.49 -2.95 -2.95 -1.6 -2.15 ... FZ -1.66 -1.76 -2.65 -3.78 -1.09 ... PZ 0 0.01 0.01 0 0.01 ... YW − PW -0 -0 -0 -0.03 -0 ... YX − PX -0.01 -0 -0.11 -0.02 -0 ... YY − PY -0.01 -0 -0 -0.01 -0 ... YZ − PZ -0 -0.01 -0.01 -0 -0.01 ... Things not covered I How to choose proper learning rates. See [Friedman, 2001] I Other possible loss functions. See [Friedman, 2001] References I Breiman, L. (1999). Prediction games and arcing algorithms. Neural computation, 11(7):1493–1517. Breiman, L. et al. (1998). Arcing classifier (with discussion and a rejoinder by the author). The annals of statistics, 26(3):801–849. Freund, Y. and Schapire, R. E. (1997). A decision-theoretic generalization of on-line learning and an application to boosting. Journal of computer and system sciences, 55(1):119–139. Freund, Y., Schapire, R. E., et al. (1996). Experiments with a new boosting algorithm. In ICML, volume 96, pages 148–156. References II Friedman, J., Hastie, T., and Tibshirani, R. (2000). Special invited paper. additive logistic regression: A statistical view of boosting. Annals of statistics, pages 337–374. Friedman, J. H. (2001). Greedy function approximation: a gradient boosting machine. Annals of Statistics, pages 1189–1232. Schapire, R. E. and Freund, Y. (2012). Boosting: Foundations and Algorithms. MIT Press.