http://wiki.math.uwaterloo.ca/statwiki/api.php?action=feedcontributions&user=Cwloke&feedformat=atomstatwiki - User contributions [US]2022-09-28T07:43:24ZUser contributionsMediaWiki 1.28.3http://wiki.math.uwaterloo.ca/statwiki/index.php?title=XGBoost&diff=51156XGBoost2021-11-29T15:50:11Z<p>Cwloke: /* Sparsity-aware Split Finding */</p>
<hr />
<div>== Presented by == <br />
* Chun Waan Loke<br />
* Peter Chong<br />
* Clarice Osmond<br />
* Zhilong Li<br />
<br />
== Introduction ==<br />
<br />
== Tree Boosting In A Nutshell ==<br />
The author reviews gradient tree boosting in this section.<br />
=== Regularized Learning Objective ===<br />
The author first gives the prediction equation (1) and the regularized objective (2).<br><br />
<br><br />
(1) The additive prediction model is given as<br><br />
<math>\hat{y_i}=\sum_{k=1}^{K}f_k(x_i), f_k \in \mathcal{F} </math> <br><br />
where each <math>f_k</math> corresponds to an independent tree structure with its weights, and <math>\mathcal{F}</math> is the "space of regression trees"<br><br />
<br><br />
(2) The regularized objective to be minimized is given as<br><br />
<math>\mathcal{L}=\sum_{i}l(\hat{y_i},y_i)+\sum_k \Omega(f_k)</math> where <math>\Omega(f)=\gamma T+\frac{1}{2}\lambda ||\omega||^2</math> <br><br />
The first term <math>l</math> is a differentiable convex loss function that calculates the measures between <math>\hat{y}</math> and <math>y</math>.<br><br />
The second term <math>\Omega</math> penalizes on the complexity of model (the <math>f_k</math>'s). For a given tree (<math>f_k</math>), <math>T</math> is the number of leaves, and <math>\omega</math> is the leaf weights.<br><br />
The L1 regularization term <math>\gamma T</math> encourages the tree to be small, and the L2 regularization term <math>\frac{1}{2}\lambda ||\omega||^2</math> encourages the tree to have small weights.<br><br />
<br />
=== Gradient Tree Boosting ===<br />
Let <math>\hat{y_i}^{(t)}</math> be the prediction of <math>y_i</math> at the t-th iteration.<br><br />
Since the prediction equation is simply additive, <math>{\hat y_i}^{(t)}=\hat{y_{i}}^{(t-1)}+f_t(x_i)</math><br><br />
Using this equation and 2nd order Taylor approximation on the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> gives <br><br />
\begin{align}<br />
\mathcal{L}^{(t)}&=\sum_{i}^{n}l(y_i,\hat{y_i}^{(t-1)}+f_t(x_i))+\Omega(f_t)\\<br />
&\simeq \sum_{i}^{n}[l(y_i,\hat{y_i}^{(t-1)})+g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
\end{align}<br />
where <math>g_i</math> and <math>h_i</math> are the first and second derivative of the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> with repspect to the term <math>\hat{y}^{(t-1)}</math><br><br />
We can simplify this objective by removing the constant term <math>l(y_i,\hat{y_i}^{(t-1)})</math>.<br><br />
Define <math>I_j=\{i|q(x_i)=j\}</math>, where <math>q</math> is the tree structure. Since every <math>x_i</math> is mapped by <math>q</math> to some leaf <math>j</math>, going through every <math>x_i</math> is equivalent to going through each leaf j of the structure.<br />
\begin{align}<br />
\tilde{\mathcal{L}}^{(t)}&= \sum_{i}^{n}[g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
&= \sum_{j=1}^{T}[(\sum_{i \in I_j}g_i)\omega_j+\frac{1}{2}(\sum_{i \in I_j}h_i+\lambda)\omega_j^2]+\gamma T<br />
\end{align}<br />
Then for a fixed structure <math>q</math>, the optimal weight of leaf <math>j</math> and the optimal objective value are given as<br><br />
\begin{align}<br />
\omega_j^{*} &= -\frac{\sum_{i \in I_j}g_i}{\sum_{i \in I_j}h_i+\lambda}\\<br />
\tilde{\mathcal{L}}^{(t)}(q) &=-\frac{1}{2}\sum_{j=1}^{T}\frac{(\sum_{i \in I_j}g_i)^2}{\sum_{i \in I_j}h_i+\lambda}+\gamma T<br />
\end{align} <br />
[[File:Structure Score Calculation.png|frame|center|alt=Alt text|Structure Score Calculation]]<br />
Instead of enumerating through all possible tree structures q, a greedy algorithm of iteratively adding branches is used.<br><br />
Let <math>I_L</math> and <math>I_R</math> be the instance sets of left and right nodes after split and let <math>I=I_L\cup I_R</math>.<br><br />
The loss reduction after split is given by<br><br />
\begin{align}<br />
\tilde{\mathcal{L}}_{\text{split}} &=\frac{1}{2}[\frac{(\sum_{i \in I_L}g_i)^2}{\sum_{i \in I_L}h_i+\lambda}+\frac{(\sum_{i \in I_R}g_i)^2}{\sum_{i \in I_R}h_i+\lambda}-\frac{(\sum_{i \in I}g_i)^2}{\sum_{i \in I}h_i+\lambda}]+\gamma<br />
\end{align}<br />
=== Shrinkage and Column Subsampling ===<br />
The author also mentioned two other methods in order to avoid over-fitting.<br><br />
(1) Shrinkage. Similar to the learning rate in stochastic optimization, a new weight is added to each tree boosting to reduce the influence of a single tree and leave space for future trees.<br><br />
(2) Column (feature) subsampling. In the paper, the author only mentioned that this technique speeds up parallel algorithm used in later sections.<br />
<br />
== Split Finding Algorithms ==<br />
<br />
It is very important to find the best split for tree learning to perform well. Here are a few split finding algorithms mentioned in the paper:<br />
<br />
=== Basic Exact Greedy Algorithm ===<br />
<br />
The basic exact greedy algorithm is a split finding algorithm that is computationally expensive because it enumerates over all the possible splits for continuous features. It is impossible to be done efficiently when the memory is not enough to hold the data needed. A way to carry out this algorithm efficiently is to sort the data according to feature values and visit the data in order to accumulate the gradient statistics. The algorithm is shown below:<br />
<br />
[[File:algo1xg.png|frame|center|alt=Alt text|Basic Exact Greedy Algorithm]]<br />
<br />
=== Approximate Algorithm ===<br />
<br />
The paper introduced a more efficient algorithm compared to Basic Exact Greedy Algorithm which is the Approximate Algorithm. The Approximate Algorithm first proposes candidate splitting points according to percentiles of feature distribution. It then maps the continuous features into buckets split by candidate points, aggregates the statistics and finds the best solution among proposals based on the aggregated statistics. The algorithm is shown below:<br />
<br />
[[File:algo2xg.png|frame|center|alt=Alt text|Approximate Algorithm]]<br />
<br />
There are also two variants to this algorithm, the global variant proposes all the candidate splits during the initial phase of tree construction and uses the same proposals for split finding at all levels. Whereas, the local variant re-proposes after each split. The global variant usually requires less proposal steps but uses more candidate points than local variant because candidates are not refined after each split. For deeper trees, usage of local variant may be more appropriate as compared to global variant. The figure below shows the a comparison in accuracy between Basic Exact Greedy and Approximate split finding algorithms with different variant over the number of iterations. We can see that the quantile strategy is able to achieve similar accuracy as the Basic Exact Greedy algorithm given a reasonable approximation level.<br />
<br />
[[File:accuracyxg.png|frame|center|alt=Alt text|Comparison of accuracy between different algorithms]]<br />
<br />
=== Weighted Quantile Sketch ===<br />
<br />
Proposing candidate split points is the most important step in the Approximate Algorithm, it is done by using the percentile of a feature to make candidates distribute evenly on a dataset.<br />
<br />
Formally, we have a dataset<br />
<br />
<math>D_k={(x_{1k},h_1),(x_{2k},h_2),...,(x_{nk},h_n)}</math><br />
<br />
where <math> x_i </math>'s are the feature values of each data point and <math> h_i </math>'s represents the weight of the corresponding feature <math> x_i </math>. <br />
<br />
Then, we can use the following rank function to compute <math>r_k(z)</math>, the proportion of instances whose feature value among <math> (x_i,...,x_k) </math> is smaller than data point <math> z </math>.<br />
<br />
<math>r_k(z) = \frac{1}{\sum_{(x,h) \in D_k} h} \displaystyle\sum_{(x,h) \in D_k, x<z} h,</math><br />
<br />
The objective here is to find candidate split points <math>{s_{k1}, s_{k2}, …, s_{kl}}</math>, such that:<br />
<br />
<math>|r_k(s_{k,j}) – r_k(s_{k,j+1})| < \epsilon, s_{k1} = \displaystyle\min_i x_{ik}, s_{kl} = \displaystyle\max_{i} x_{ik}, \forall i</math><br />
<br />
Where <math>\epsilon</math> is an approximation factor. Usually, it should approximately have <math>\frac{1}{\epsilon}</math> splitting points.<br />
<br />
=== Sparsity-aware Split Finding ===<br />
<br />
Typically in real world situation, it is quite common that our dataset is sparse. Some of the possible causes are:<br />
<br />
# Missing values in the data<br />
# Huge amount of zero entries present in the data<br />
# Artifacts of feature engineering (e.g. One-hot encoding)<br />
<br />
In order to solve the sparsity present in the dataset, we suggest to add a default direction in each tree node will classified into when there is a missing value in the matrix of the dataset. This is demonstrated in the figure below:<br />
<br />
[[File:defaultdirection.png|frame|center|alt=Alt text|Default Direction for missing value]]<br />
<br />
The algorithm below helps us to calculate the optimal direction to proceed in each branch. Beside that, it also allows user to set a range for the accepted value and neglect the out-of-range value when calculating the score. <br />
<br />
[[File:algo3xg.png|frame|center|alt=Alt text|Sparsity-aware Split Finding Algorithm]]<br />
<br />
The figure below shows the difference in time needed per tree over number of threads between Sparsity Aware algorithm compared to a basic algorithm on a sparse dataset Allstate-10K, the sparsity was caused by feature engineering using one-hot encoding.<br />
<br />
[[File:fig5xg.png|frame|center|alt=Alt text|Sparsity-aware Algorithm vs Basic Algorithm on sparse data]]<br />
<br />
== System Design ==<br />
<br />
=== Column Block for Parallel Learning ===<br />
The most time consuming part of tree learning is to get the data into sorted order. To overcome this problem, XGBoost stores the data in blocks where each block performs the sorting operation in parallel. The results are then merged together.<br />
<br />
# For the exact greedy algorithm, XGBoost stores the entire dataset in a single block<br />
#:* Original spase aware algorithm costs: <math>O(Kd∥x∥_0 log(n))</math><br />
#:* Tree boosting on block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(n))</math><br />
#:* Hence, block structure helps to save an additional <math>log(n)</math> factor<br />
# For approximate algorithms, XGBoost stores the dataset in multiple blocks<br />
#:* Original algorithm with binary search costs: <math>O(Kd∥x∥_0 log(q))</math><br />
#:* With block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(B))</math><br />
#:* Hence, block structure helps to save an additional <math>log(q)</math> factor <br />
<br />
K = total number of trees<br /><br />
d = maximum depth of the tree<br /><br />
<math>∥x∥_0</math> = number of non-missing entries in the training data<br /><br />
n = number of rows in the dataset<br /><br />
q = number of proposal candidates in the dataset, usually between 32 to 100<br /><br />
B = maximum number of rows in each block<br />
<br />
[[File: columnblock.png|800px|thumb|center]]<br />
<br />
=== Cache-aware Access ===<br />
The proposed block structure optimizes the computation complexity but requires indirect fetches of gradient statistics by row index. XGBoost optimizes the process by using the following methods.<br />
<br />
# For the exact greedy algorithm, XGBoost uses a cache-aware prefetching algorithm<br />
#:* It stores Gradient and Hessians in the cache to make calculations fast<br />
#:* It runs twice as fast as the naive method when the dataset is large<br />
# For approximate algorithms, XGBoost chooses a specific block size<br />
#:* Choosing a small block size results in inefficient parallelization<br />
#:* Choosing a large block size results in cache misses<br />
#:* Various choices of block size are compared and the results are shown in Figure 9<br />
#:* XGBoost chose <math>2^{16}</math> as the block size<br />
<br />
[[File: blocksize.png|400px|thumb|center]]<br />
<br />
=== Blocks for Out-of-core Computation ===<br />
When the dataset is too large for the cache and main memory, XGBoost utilizes disk spaces as well. Since reading and writing data to the disks are slow, XGBoost optimizes the process by using the following two methods.<br />
<br />
# Block Compression<br />
#:* Blocks are compressed by columns<br />
#:* Although decompressing takes time, it is still faster than reading from the disks<br />
# Block Sharding<br />
#:* If multiple disks are available, data is split into those disks<br />
#:* When the CPU needs data, all the disks can be read at the same time<br />
<br />
== End To End Evaluations ==<br />
=== System Implementation ===<br />
XGBoost is a portable and reusable open-source package. It supports:<br />
* various weighted classification<br />
* various objective functions (rank & user defined)<br />
* popular languages (python, R, Julia)<br />
* data science pipelines (scikit-learn)<br />
* big data stacks (Flink, Spark)<br />
* cloud platform (Tianchi8)<br />
<br />
=== Dataset and Setup ===<br />
<br />
A summary of the 4 datasets used in the experiments is in table 2.<br />
<br />
[[File: table2data.png|500px|thumb|center]]<br />
<br />
The first and last datasets were used specifically to evaluate the impact of sparsity-aware algorithm and the scaling property of the system in the out-of-core and the distributed settings respectively. In all of the experiments, common settings such as maximum depth equal to 8, shrinkage equal to 0.1 and no column subsampling are applied.<br />
<br />
=== Classification ===<br />
A subset (n = 1M) of Higgs Boson dataset was used for classification. The results are shown in Table 3.<br />
<br />
[[File: classification.png|500px|thumb|center]]<br />
<br />
* R’s GBM creates a tree fast by using greedy approach that only expands one branch of a tree but with the cost of lower accuracy<br />
* XGBoost and scikit-learn have better performance than R’s GBM<br />
* XGBoost runs more than 10x faster than scikit-learn in learning a full tree<br />
* Column subsamples give slightly worse performance possibly due to a few important features in this dataset.<br />
<br />
=== Learning to Rank ===<br />
The results in comparing XGBoost with pGBRT are shown in Table 4.<br />
<br />
[[File: rank.png|500px|thumb|center]]<br />
<br />
* XGBoost runs exact greedy algorithm while pGBRT only supports an approximate algorithm<br />
* XGBoost runs faster<br />
* Subsampling column reduces running time and gives higher performance possibly due to preventing overfitting<br />
<br />
=== Out-of-core Experiment ===<br />
An extremely large Criteo dataset was used to evaluate the out-of-core setting. The results are shown in the figure below.<br />
<br />
[[File: outofcore.png|350px|thumb|center]]<br />
<br />
* Compression speed up the computation by a factor of 3<br />
* Sharding into 2 disks further gives 2x speed<br />
<br />
=== Distributed Experiment ===<br />
YARN cluster on EC2 with m3.2xlarge machines was used to evaluate the distributed setting. XGBoost was compared with Spark MLLib and H20.<br />
<br />
* XGBoost can switch to out-of-core setting when the memory runs out, while the baseline systems need to store the data in RAM<br />
* XGBoost runs faster than the baseline systems<br />
* The baseline systems are only able to handle a subset of the data with the given resources while XGBoost was able to scale smoothly to all 1.7B rows<br />
* XGBoost’s performance scales linearly with more machines<br />
* XGBoost is able to handle all 1.7B data with only 4 machines<br />
<br />
== Conclusion ==<br />
<br />
== References ==<br />
[1] R. Bekkerman. The present and the future of the kdd cup competition: an outsider’s perspective. <br />
<br />
[2] R. Bekkerman, M. Bilenko, and J. Langford. Scaling Up Machine Learning: Parallel and Distributed Approaches. Cambridge University Press, New York, NY, USA, 2011. <br />
<br />
[3] J. Bennett and S. Lanning. The netflix prize. In Proceedings of the KDD Cup Workshop 2007, pages 3–6, New York, Aug. 2007.<br />
<br />
[4] L. Breiman. Random forests. Maching Learning, 45(1):5–32, Oct. 2001.<br />
<br />
[5] C. Burges. From ranknet to lambdarank to lambdamart: An overview. Learning, 11:23–581, 2010.<br />
<br />
[6] O. Chapelle and Y. Chang. Yahoo! Learning to Rank Challenge Overview. Journal of Machine Learning Research - W & CP, 14:1–24, 2011.<br />
<br />
[7] T. Chen, H. Li, Q. Yang, and Y. Yu. General functional matrix factorization using gradient boosting. In Proceeding of 30th International Conference on Machine Learning (ICML’13), volume 1, pages 436–444, 2013.<br />
<br />
[8] T. Chen, S. Singh, B. Taskar, and C. Guestrin. Efficient second-order gradient boosting for conditional random fields. In Proceeding of 18th Artificial Intelligence and Statistics Conference (AISTATS’15), volume 1, 2015.<br />
<br />
[9] R.-E. Fan, K.-W. Chang, C.-J. Hsieh, X.-R. Wang, and C.-J. Lin. LIBLINEAR: A library for large linear classification. Journal of Machine Learning Research, 9:1871–1874, 2008.<br />
<br />
[10] J. Friedman. Greedy function approximation: a gradient boosting machine. Annals of Statistics, 29(5):1189–1232, 2001.<br />
<br />
[11] J. Friedman. Stochastic gradient boosting. Computational Statistics & Data Analysis, 38(4):367–378, 2002.<br />
<br />
[12] J. Friedman, T. Hastie, and R. Tibshirani. Additive logistic regression: a statistical view of boosting. Annals of Statistics, 28(2):337–407, 2000.<br />
<br />
[13] J. H. Friedman and B. E. Popescu. Importance sampled learning ensembles, 2003.<br />
<br />
[14] M. Greenwald and S. Khanna. Space-efficient online computation of quantile summaries. In Proceedings of the 2001 ACM SIGMOD International Conference on Management of Data, pages 58–66, 2001.<br />
<br />
[15] X. He, J. Pan, O. Jin, T. Xu, B. Liu, T. Xu, Y. Shi, A. Atallah, R. Herbrich, S. Bowers, and J. Q. n. Candela. Practical lessons from predicting clicks on ads at facebook. In Proceedings of the Eighth International Workshop on Data Mining for Online Advertising, ADKDD’14, 2014.<br />
<br />
[16] P. Li. Robust Logitboost and adaptive base class (ABC) Logitboost. In Proceedings of the Twenty-Sixth Conference Annual Conference on Uncertainty in Artificial Intelligence (UAI’10), pages 302–311, 2010.<br />
<br />
[17] P. Li, Q. Wu, and C. J. Burges. Mcrank: Learning to rank using multiple classification and gradient boosting. In Advances in Neural Information Processing Systems 20, pages 897–904. 2008.<br />
<br />
[18] X. Meng, J. Bradley, B. Yavuz, E. Sparks, S. Venkataraman, D. Liu, J. Freeman, D. Tsai, M. Amde, S. Owen, D. Xin, R. Xin, M. J. Franklin, R. Zadeh, M. Zaharia, and A. Talwalkar. MLlib: Machine learning in apache spark. Journal of Machine Learning Research, 17(34):1–7, 2016.<br />
<br />
[19] B. Panda, J. S. Herbach, S. Basu, and R. J. Bayardo. Planet: Massively parallel learning of tree ensembles with mapreduce. Proceeding of VLDB Endowment, 2(2):1426–1437, Aug. 2009.<br />
<br />
[20] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.<br />
<br />
[21] G. Ridgeway. Generalized Boosted Models: A guide to the gbm package.<br />
<br />
[22] S. Tyree, K. Weinberger, K. Agrawal, and J. Paykin. Parallel boosted regression trees for web search ranking. In Proceedings of the 20th international conference on World wide web, pages 387–396. ACM, 2011.<br />
<br />
[23] J. Ye, J.-H. Chow, J. Chen, and Z. Zheng. Stochastic gradient boosted distributed decision trees. In Proceedings of the 18th ACM Conference on Information and Knowledge Management, CIKM ’09.<br />
<br />
[24] Q. Zhang and W. Wang. A fast algorithm for approximate quantiles in high speed data streams. In Proceedings of the 19th International Conference on Scientific and Statistical Database Management, 2007.<br />
<br />
[25] T. Zhang and R. Johnson. Learning nonlinear functions using regularized greedy forest. IEEE Transactions on Pattern Analysis and Machine Intelligence, 36(5), 2014.</div>Cwlokehttp://wiki.math.uwaterloo.ca/statwiki/index.php?title=XGBoost&diff=51155XGBoost2021-11-29T15:47:30Z<p>Cwloke: /* Sparsity-aware Split Finding */</p>
<hr />
<div>== Presented by == <br />
* Chun Waan Loke<br />
* Peter Chong<br />
* Clarice Osmond<br />
* Zhilong Li<br />
<br />
== Introduction ==<br />
<br />
== Tree Boosting In A Nutshell ==<br />
The author reviews gradient tree boosting in this section.<br />
=== Regularized Learning Objective ===<br />
The author first gives the prediction equation (1) and the regularized objective (2).<br><br />
<br><br />
(1) The additive prediction model is given as<br><br />
<math>\hat{y_i}=\sum_{k=1}^{K}f_k(x_i), f_k \in \mathcal{F} </math> <br><br />
where each <math>f_k</math> corresponds to an independent tree structure with its weights, and <math>\mathcal{F}</math> is the "space of regression trees"<br><br />
<br><br />
(2) The regularized objective to be minimized is given as<br><br />
<math>\mathcal{L}=\sum_{i}l(\hat{y_i},y_i)+\sum_k \Omega(f_k)</math> where <math>\Omega(f)=\gamma T+\frac{1}{2}\lambda ||\omega||^2</math> <br><br />
The first term <math>l</math> is a differentiable convex loss function that calculates the measures between <math>\hat{y}</math> and <math>y</math>.<br><br />
The second term <math>\Omega</math> penalizes on the complexity of model (the <math>f_k</math>'s). For a given tree (<math>f_k</math>), <math>T</math> is the number of leaves, and <math>\omega</math> is the leaf weights.<br><br />
The L1 regularization term <math>\gamma T</math> encourages the tree to be small, and the L2 regularization term <math>\frac{1}{2}\lambda ||\omega||^2</math> encourages the tree to have small weights.<br><br />
<br />
=== Gradient Tree Boosting ===<br />
Let <math>\hat{y_i}^{(t)}</math> be the prediction of <math>y_i</math> at the t-th iteration.<br><br />
Since the prediction equation is simply additive, <math>{\hat y_i}^{(t)}=\hat{y_{i}}^{(t-1)}+f_t(x_i)</math><br><br />
Using this equation and 2nd order Taylor approximation on the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> gives <br><br />
\begin{align}<br />
\mathcal{L}^{(t)}&=\sum_{i}^{n}l(y_i,\hat{y_i}^{(t-1)}+f_t(x_i))+\Omega(f_t)\\<br />
&\simeq \sum_{i}^{n}[l(y_i,\hat{y_i}^{(t-1)})+g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
\end{align}<br />
where <math>g_i</math> and <math>h_i</math> are the first and second derivative of the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> with repspect to the term <math>\hat{y}^{(t-1)}</math><br><br />
We can simplify this objective by removing the constant term <math>l(y_i,\hat{y_i}^{(t-1)})</math>.<br><br />
Define <math>I_j=\{i|q(x_i)=j\}</math>, where <math>q</math> is the tree structure. Since every <math>x_i</math> is mapped by <math>q</math> to some leaf <math>j</math>, going through every <math>x_i</math> is equivalent to going through each leaf j of the structure.<br />
\begin{align}<br />
\tilde{\mathcal{L}}^{(t)}&= \sum_{i}^{n}[g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
&= \sum_{j=1}^{T}[(\sum_{i \in I_j}g_i)\omega_j+\frac{1}{2}(\sum_{i \in I_j}h_i+\lambda)\omega_j^2]+\gamma T<br />
\end{align}<br />
Then for a fixed structure <math>q</math>, the optimal weight of leaf <math>j</math> and the optimal objective value are given as<br><br />
\begin{align}<br />
\omega_j^{*} &= -\frac{\sum_{i \in I_j}g_i}{\sum_{i \in I_j}h_i+\lambda}\\<br />
\tilde{\mathcal{L}}^{(t)}(q) &=-\frac{1}{2}\sum_{j=1}^{T}\frac{(\sum_{i \in I_j}g_i)^2}{\sum_{i \in I_j}h_i+\lambda}+\gamma T<br />
\end{align} <br />
[[File:Structure Score Calculation.png|frame|center|alt=Alt text|Structure Score Calculation]]<br />
Instead of enumerating through all possible tree structures q, a greedy algorithm of iteratively adding branches is used.<br><br />
Let <math>I_L</math> and <math>I_R</math> be the instance sets of left and right nodes after split and let <math>I=I_L\cup I_R</math>.<br><br />
The loss reduction after split is given by<br><br />
\begin{align}<br />
\tilde{\mathcal{L}}_{\text{split}} &=\frac{1}{2}[\frac{(\sum_{i \in I_L}g_i)^2}{\sum_{i \in I_L}h_i+\lambda}+\frac{(\sum_{i \in I_R}g_i)^2}{\sum_{i \in I_R}h_i+\lambda}-\frac{(\sum_{i \in I}g_i)^2}{\sum_{i \in I}h_i+\lambda}]+\gamma<br />
\end{align}<br />
=== Shrinkage and Column Subsampling ===<br />
The author also mentioned two other methods in order to avoid over-fitting.<br><br />
(1) Shrinkage. Similar to the learning rate in stochastic optimization, a new weight is added to each tree boosting to reduce the influence of a single tree and leave space for future trees.<br><br />
(2) Column (feature) subsampling. In the paper, the author only mentioned that this technique speeds up parallel algorithm used in later sections.<br />
<br />
== Split Finding Algorithms ==<br />
<br />
It is very important to find the best split for tree learning to perform well. Here are a few split finding algorithms mentioned in the paper:<br />
<br />
=== Basic Exact Greedy Algorithm ===<br />
<br />
The basic exact greedy algorithm is a split finding algorithm that is computationally expensive because it enumerates over all the possible splits for continuous features. It is impossible to be done efficiently when the memory is not enough to hold the data needed. A way to carry out this algorithm efficiently is to sort the data according to feature values and visit the data in order to accumulate the gradient statistics. The algorithm is shown below:<br />
<br />
[[File:algo1xg.png|frame|center|alt=Alt text|Basic Exact Greedy Algorithm]]<br />
<br />
=== Approximate Algorithm ===<br />
<br />
The paper introduced a more efficient algorithm compared to Basic Exact Greedy Algorithm which is the Approximate Algorithm. The Approximate Algorithm first proposes candidate splitting points according to percentiles of feature distribution. It then maps the continuous features into buckets split by candidate points, aggregates the statistics and finds the best solution among proposals based on the aggregated statistics. The algorithm is shown below:<br />
<br />
[[File:algo2xg.png|frame|center|alt=Alt text|Approximate Algorithm]]<br />
<br />
There are also two variants to this algorithm, the global variant proposes all the candidate splits during the initial phase of tree construction and uses the same proposals for split finding at all levels. Whereas, the local variant re-proposes after each split. The global variant usually requires less proposal steps but uses more candidate points than local variant because candidates are not refined after each split. For deeper trees, usage of local variant may be more appropriate as compared to global variant. The figure below shows the a comparison in accuracy between Basic Exact Greedy and Approximate split finding algorithms with different variant over the number of iterations. We can see that the quantile strategy is able to achieve similar accuracy as the Basic Exact Greedy algorithm given a reasonable approximation level.<br />
<br />
[[File:accuracyxg.png|frame|center|alt=Alt text|Comparison of accuracy between different algorithms]]<br />
<br />
=== Weighted Quantile Sketch ===<br />
<br />
Proposing candidate split points is the most important step in the Approximate Algorithm, it is done by using the percentile of a feature to make candidates distribute evenly on a dataset.<br />
<br />
Formally, we have a dataset<br />
<br />
<math>D_k={(x_{1k},h_1),(x_{2k},h_2),...,(x_{nk},h_n)}</math><br />
<br />
where <math> x_i </math>'s are the feature values of each data point and <math> h_i </math>'s represents the weight of the corresponding feature <math> x_i </math>. <br />
<br />
Then, we can use the following rank function to compute <math>r_k(z)</math>, the proportion of instances whose feature value among <math> (x_i,...,x_k) </math> is smaller than data point <math> z </math>.<br />
<br />
<math>r_k(z) = \frac{1}{\sum_{(x,h) \in D_k} h} \displaystyle\sum_{(x,h) \in D_k, x<z} h,</math><br />
<br />
The objective here is to find candidate split points <math>{s_{k1}, s_{k2}, …, s_{kl}}</math>, such that:<br />
<br />
<math>|r_k(s_{k,j}) – r_k(s_{k,j+1})| < \epsilon, s_{k1} = \displaystyle\min_i x_{ik}, s_{kl} = \displaystyle\max_{i} x_{ik}, \forall i</math><br />
<br />
Where <math>\epsilon</math> is an approximation factor. Usually, it should approximately have <math>\frac{1}{\epsilon}</math> splitting points.<br />
<br />
=== Sparsity-aware Split Finding ===<br />
<br />
Typically in real world situation, it is quite common that our dataset is sparse. Some of the possible causes are:<br />
<br />
# Missing values in the data<br />
# Huge amount of zero entries present in the data<br />
# Artifacts of feature engineering (e.g. One-hot encoding)<br />
<br />
In order to solve the sparsity present in the dataset, we suggest to add a default direction in each tree node will classified into when there is a missing value in the matrix of the dataset. This is demonstrated in the figure below:<br />
<br />
[[File:defaultdirection.png|frame|center|alt=Alt text|Default Direction for missing value]]<br />
<br />
The algorithm below helps us to calculate the optimal direction to proceed in each branch. Beside that, it also allows user to set a range for the accepted value and neglect the out-of-range value when calculating the score. <br />
<br />
[[File:algo3xg.png|frame|center|alt=Alt text|Sparsity-aware Split Finding Algorithm]]<br />
<br />
The figure below shows the difference between Sparsity Aware algorithm compared to a basic algorithm on a sparse dataset Allstate-10K, the sparsity was caused by feature engineering using one-hot encoding.<br />
<br />
[[File:fig5xg.png|frame|center|alt=Alt text|Sparsity-aware Algorithm vs Basic Algorithm on sparse data]]<br />
<br />
== System Design ==<br />
<br />
=== Column Block for Parallel Learning ===<br />
The most time consuming part of tree learning is to get the data into sorted order. To overcome this problem, XGBoost stores the data in blocks where each block performs the sorting operation in parallel. The results are then merged together.<br />
<br />
# For the exact greedy algorithm, XGBoost stores the entire dataset in a single block<br />
#:* Original spase aware algorithm costs: <math>O(Kd∥x∥_0 log(n))</math><br />
#:* Tree boosting on block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(n))</math><br />
#:* Hence, block structure helps to save an additional <math>log(n)</math> factor<br />
# For approximate algorithms, XGBoost stores the dataset in multiple blocks<br />
#:* Original algorithm with binary search costs: <math>O(Kd∥x∥_0 log(q))</math><br />
#:* With block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(B))</math><br />
#:* Hence, block structure helps to save an additional <math>log(q)</math> factor <br />
<br />
K = total number of trees<br /><br />
d = maximum depth of the tree<br /><br />
<math>∥x∥_0</math> = number of non-missing entries in the training data<br /><br />
n = number of rows in the dataset<br /><br />
q = number of proposal candidates in the dataset, usually between 32 to 100<br /><br />
B = maximum number of rows in each block<br />
<br />
[[File: columnblock.png|800px|thumb|center]]<br />
<br />
=== Cache-aware Access ===<br />
The proposed block structure optimizes the computation complexity but requires indirect fetches of gradient statistics by row index. XGBoost optimizes the process by using the following methods.<br />
<br />
# For the exact greedy algorithm, XGBoost uses a cache-aware prefetching algorithm<br />
#:* It stores Gradient and Hessians in the cache to make calculations fast<br />
#:* It runs twice as fast as the naive method when the dataset is large<br />
# For approximate algorithms, XGBoost chooses a specific block size<br />
#:* Choosing a small block size results in inefficient parallelization<br />
#:* Choosing a large block size results in cache misses<br />
#:* Various choices of block size are compared and the results are shown in Figure 9<br />
#:* XGBoost chose <math>2^{16}</math> as the block size<br />
<br />
[[File: blocksize.png|400px|thumb|center]]<br />
<br />
=== Blocks for Out-of-core Computation ===<br />
When the dataset is too large for the cache and main memory, XGBoost utilizes disk spaces as well. Since reading and writing data to the disks are slow, XGBoost optimizes the process by using the following two methods.<br />
<br />
# Block Compression<br />
#:* Blocks are compressed by columns<br />
#:* Although decompressing takes time, it is still faster than reading from the disks<br />
# Block Sharding<br />
#:* If multiple disks are available, data is split into those disks<br />
#:* When the CPU needs data, all the disks can be read at the same time<br />
<br />
== End To End Evaluations ==<br />
=== System Implementation ===<br />
XGBoost is a portable and reusable open-source package. It supports:<br />
* various weighted classification<br />
* various objective functions (rank & user defined)<br />
* popular languages (python, R, Julia)<br />
* data science pipelines (scikit-learn)<br />
* big data stacks (Flink, Spark)<br />
* cloud platform (Tianchi8)<br />
<br />
=== Dataset and Setup ===<br />
<br />
A summary of the 4 datasets used in the experiments is in table 2.<br />
<br />
[[File: table2data.png|500px|thumb|center]]<br />
<br />
The first and last datasets were used specifically to evaluate the impact of sparsity-aware algorithm and the scaling property of the system in the out-of-core and the distributed settings respectively. In all of the experiments, common settings such as maximum depth equal to 8, shrinkage equal to 0.1 and no column subsampling are applied.<br />
<br />
=== Classification ===<br />
A subset (n = 1M) of Higgs Boson dataset was used for classification. The results are shown in Table 3.<br />
<br />
[[File: classification.png|500px|thumb|center]]<br />
<br />
* R’s GBM creates a tree fast by using greedy approach that only expands one branch of a tree but with the cost of lower accuracy<br />
* XGBoost and scikit-learn have better performance than R’s GBM<br />
* XGBoost runs more than 10x faster than scikit-learn in learning a full tree<br />
* Column subsamples give slightly worse performance possibly due to a few important features in this dataset.<br />
<br />
=== Learning to Rank ===<br />
The results in comparing XGBoost with pGBRT are shown in Table 4.<br />
<br />
[[File: rank.png|500px|thumb|center]]<br />
<br />
* XGBoost runs exact greedy algorithm while pGBRT only supports an approximate algorithm<br />
* XGBoost runs faster<br />
* Subsampling column reduces running time and gives higher performance possibly due to preventing overfitting<br />
<br />
=== Out-of-core Experiment ===<br />
An extremely large Criteo dataset was used to evaluate the out-of-core setting. The results are shown in the figure below.<br />
<br />
[[File: outofcore.png|350px|thumb|center]]<br />
<br />
* Compression speed up the computation by a factor of 3<br />
* Sharding into 2 disks further gives 2x speed<br />
<br />
=== Distributed Experiment ===<br />
YARN cluster on EC2 with m3.2xlarge machines was used to evaluate the distributed setting. XGBoost was compared with Spark MLLib and H20.<br />
<br />
* XGBoost can switch to out-of-core setting when the memory runs out, while the baseline systems need to store the data in RAM<br />
* XGBoost runs faster than the baseline systems<br />
* The baseline systems are only able to handle a subset of the data with the given resources while XGBoost was able to scale smoothly to all 1.7B rows<br />
* XGBoost’s performance scales linearly with more machines<br />
* XGBoost is able to handle all 1.7B data with only 4 machines<br />
<br />
== Conclusion ==<br />
<br />
== References ==<br />
[1] R. Bekkerman. The present and the future of the kdd cup competition: an outsider’s perspective. <br />
<br />
[2] R. Bekkerman, M. Bilenko, and J. Langford. Scaling Up Machine Learning: Parallel and Distributed Approaches. Cambridge University Press, New York, NY, USA, 2011. <br />
<br />
[3] J. Bennett and S. Lanning. The netflix prize. In Proceedings of the KDD Cup Workshop 2007, pages 3–6, New York, Aug. 2007.<br />
<br />
[4] L. Breiman. Random forests. Maching Learning, 45(1):5–32, Oct. 2001.<br />
<br />
[5] C. Burges. From ranknet to lambdarank to lambdamart: An overview. Learning, 11:23–581, 2010.<br />
<br />
[6] O. Chapelle and Y. Chang. Yahoo! Learning to Rank Challenge Overview. Journal of Machine Learning Research - W & CP, 14:1–24, 2011.<br />
<br />
[7] T. Chen, H. Li, Q. Yang, and Y. Yu. General functional matrix factorization using gradient boosting. In Proceeding of 30th International Conference on Machine Learning (ICML’13), volume 1, pages 436–444, 2013.<br />
<br />
[8] T. Chen, S. Singh, B. Taskar, and C. Guestrin. Efficient second-order gradient boosting for conditional random fields. In Proceeding of 18th Artificial Intelligence and Statistics Conference (AISTATS’15), volume 1, 2015.<br />
<br />
[9] R.-E. Fan, K.-W. Chang, C.-J. Hsieh, X.-R. Wang, and C.-J. Lin. LIBLINEAR: A library for large linear classification. Journal of Machine Learning Research, 9:1871–1874, 2008.<br />
<br />
[10] J. Friedman. Greedy function approximation: a gradient boosting machine. Annals of Statistics, 29(5):1189–1232, 2001.<br />
<br />
[11] J. Friedman. Stochastic gradient boosting. Computational Statistics & Data Analysis, 38(4):367–378, 2002.<br />
<br />
[12] J. Friedman, T. Hastie, and R. Tibshirani. Additive logistic regression: a statistical view of boosting. Annals of Statistics, 28(2):337–407, 2000.<br />
<br />
[13] J. H. Friedman and B. E. Popescu. Importance sampled learning ensembles, 2003.<br />
<br />
[14] M. Greenwald and S. Khanna. Space-efficient online computation of quantile summaries. In Proceedings of the 2001 ACM SIGMOD International Conference on Management of Data, pages 58–66, 2001.<br />
<br />
[15] X. He, J. Pan, O. Jin, T. Xu, B. Liu, T. Xu, Y. Shi, A. Atallah, R. Herbrich, S. Bowers, and J. Q. n. Candela. Practical lessons from predicting clicks on ads at facebook. In Proceedings of the Eighth International Workshop on Data Mining for Online Advertising, ADKDD’14, 2014.<br />
<br />
[16] P. Li. Robust Logitboost and adaptive base class (ABC) Logitboost. In Proceedings of the Twenty-Sixth Conference Annual Conference on Uncertainty in Artificial Intelligence (UAI’10), pages 302–311, 2010.<br />
<br />
[17] P. Li, Q. Wu, and C. J. Burges. Mcrank: Learning to rank using multiple classification and gradient boosting. In Advances in Neural Information Processing Systems 20, pages 897–904. 2008.<br />
<br />
[18] X. Meng, J. Bradley, B. Yavuz, E. Sparks, S. Venkataraman, D. Liu, J. Freeman, D. Tsai, M. Amde, S. Owen, D. Xin, R. Xin, M. J. Franklin, R. Zadeh, M. Zaharia, and A. Talwalkar. MLlib: Machine learning in apache spark. Journal of Machine Learning Research, 17(34):1–7, 2016.<br />
<br />
[19] B. Panda, J. S. Herbach, S. Basu, and R. J. Bayardo. Planet: Massively parallel learning of tree ensembles with mapreduce. Proceeding of VLDB Endowment, 2(2):1426–1437, Aug. 2009.<br />
<br />
[20] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.<br />
<br />
[21] G. Ridgeway. Generalized Boosted Models: A guide to the gbm package.<br />
<br />
[22] S. Tyree, K. Weinberger, K. Agrawal, and J. Paykin. Parallel boosted regression trees for web search ranking. In Proceedings of the 20th international conference on World wide web, pages 387–396. ACM, 2011.<br />
<br />
[23] J. Ye, J.-H. Chow, J. Chen, and Z. Zheng. Stochastic gradient boosted distributed decision trees. In Proceedings of the 18th ACM Conference on Information and Knowledge Management, CIKM ’09.<br />
<br />
[24] Q. Zhang and W. Wang. A fast algorithm for approximate quantiles in high speed data streams. In Proceedings of the 19th International Conference on Scientific and Statistical Database Management, 2007.<br />
<br />
[25] T. Zhang and R. Johnson. Learning nonlinear functions using regularized greedy forest. IEEE Transactions on Pattern Analysis and Machine Intelligence, 36(5), 2014.</div>Cwlokehttp://wiki.math.uwaterloo.ca/statwiki/index.php?title=XGBoost&diff=51140XGBoost2021-11-29T05:42:44Z<p>Cwloke: /* Sparsity-aware Split Finding */</p>
<hr />
<div>== Presented by == <br />
* Chun Waan Loke<br />
* Peter Chong<br />
* Clarice Osmond<br />
* Zhilong Li<br />
<br />
== Introduction ==<br />
<br />
== Tree Boosting In A Nutshell ==<br />
The author reviews gradient tree boosting in this section.<br />
=== Regularized Learning Objective ===<br />
The author first gives the prediction equation (1) and the regularized objective (2).<br><br />
<br><br />
(1) The additive prediction model is given as<br><br />
<math>\hat{y_i}=\sum_{k=1}^{K}f_k(x_i), f_k \in \mathcal{F} </math> <br><br />
where each <math>f_k</math> corresponds to an independent tree structure with its weights, and <math>\mathcal{F}</math> is the "space of regression trees"<br><br />
<br><br />
(2) The regularized objective to be minimized is given as<br><br />
<math>\mathcal{L}=\sum_{i}l(\hat{y_i},y_i)+\sum_k \Omega(f_k)</math> where <math>\Omega(f)=\gamma T+\frac{1}{2}\lambda ||\omega||^2</math> <br><br />
The first term <math>l</math> is a differentiable convex loss function that calculates the measures between <math>\hat{y}</math> and <math>y</math>.<br><br />
The second term <math>\Omega</math> penalizes on the complexity of model (the <math>f_k</math>'s). For a given tree (<math>f_k</math>), <math>T</math> is the number of leaves, and <math>\omega</math> is the leaf weights.<br><br />
The L1 regularization term <math>\gamma T</math> encourages the tree to be small, and the L2 regularization term <math>\frac{1}{2}\lambda ||\omega||^2</math> encourages the tree to have small weights.<br><br />
<br />
=== Gradient Tree Boosting ===<br />
Let <math>\hat{y_i}^{(t)}</math> be the prediction of <math>y_i</math> at the t-th iteration.<br><br />
Since the prediction equation is simply additive, <math>{\hat y_i}^{(t)}=\hat{y_{i}}^{(t-1)}+f_t(x_i)</math><br><br />
Using this equation and 2nd order Taylor approximation on the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> gives <br><br />
\begin{align}<br />
\mathcal{L}^{(t)}&=\sum_{i}^{n}l(y_i,\hat{y_i}^{(t-1)}+f_t(x_i))+\Omega(f_t)\\<br />
&\simeq \sum_{i}^{n}[l(y_i,\hat{y_i}^{(t-1)})+g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
\end{align}<br />
where <math>g_i</math> and <math>h_i</math> are the first and second derivative of the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> with repspect to the term <math>\hat{y}^{(t-1)}</math><br><br />
We can simplify this objective by removing the constant term <math>l(y_i,\hat{y_i}^{(t-1)})</math>.<br><br />
Define <math>I_j=\{i|q(x_i)=j\}</math>, where <math>q</math> is the tree structure. Since every <math>x_i</math> is mapped by <math>q</math> to some leaf <math>j</math>, going through every <math>x_i</math> is equivalent to going through each leaf j of the structure.<br />
\begin{align}<br />
\tilde{\mathcal{L}}^{(t)}&= \sum_{i}^{n}[g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
&= \sum_{j=1}^{T}[(\sum_{i \in I_j}g_i)\omega_j+\frac{1}{2}(\sum_{i \in I_j}h_i+\lambda)\omega_j^2]+\gamma T<br />
\end{align}<br />
Then for a fixed structure <math>q</math>, the optimal weight of leaf <math>j</math> and the optimal objective value are given as<br><br />
\begin{align}<br />
\omega_j^{*} &= -\frac{\sum_{i \in I_j}g_i}{\sum_{i \in I_j}h_i+\lambda}\\<br />
\tilde{\mathcal{L}}^{(t)}(q) &=-\frac{1}{2}\sum_{j=1}^{T}\frac{(\sum_{i \in I_j}g_i)^2}{\sum_{i \in I_j}h_i+\lambda}+\gamma T<br />
\end{align} <br />
[[File:Structure Score Calculation.png|frame|center|alt=Alt text|Structure Score Calculation]]<br />
Instead of enumerating through all possible tree structures q, a greedy algorithm of iteratively adding branches is used.<br><br />
Let <math>I_L</math> and <math>I_R</math> be the instance sets of left and right nodes after split and let <math>I=I_L\cup I_R</math>.<br><br />
The loss reduction after split is given by<br><br />
\begin{align}<br />
\tilde{\mathcal{L}}_{\text{split}} &=\frac{1}{2}[\frac{(\sum_{i \in I_L}g_i)^2}{\sum_{i \in I_L}h_i+\lambda}+\frac{(\sum_{i \in I_R}g_i)^2}{\sum_{i \in I_R}h_i+\lambda}-\frac{(\sum_{i \in I}g_i)^2}{\sum_{i \in I}h_i+\lambda}]+\gamma<br />
\end{align}<br />
=== Shrinkage and Column Subsampling ===<br />
The author also mentioned two other methods in order to avoid over-fitting.<br><br />
(1) Shrinkage. Similar to the learning rate in stochastic optimization, a new weight is added to each tree boosting to reduce the influence of a single tree and leave space for future trees.<br><br />
(2) Column (feature) subsampling. In the paper, the author only mentioned that this technique speeds up parallel algorithm used in later sections.<br />
<br />
== Split Finding Algorithms ==<br />
<br />
It is very important to find the best split for tree learning to perform well. Here are a few split finding algorithms mentioned in the paper:<br />
<br />
=== Basic Exact Greedy Algorithm ===<br />
<br />
The basic exact greedy algorithm is a split finding algorithm that is computationally expensive because it enumerates over all the possible splits for continuous features. It is impossible to be done efficiently when the memory is not enough to hold the data needed. A way to carry out this algorithm efficiently is to sort the data according to feature values and visit the data in order to accumulate the gradient statistics. The algorithm is shown below:<br />
<br />
[[File:algo1xg.png|frame|center|alt=Alt text|Basic Exact Greedy Algorithm]]<br />
<br />
=== Approximate Algorithm ===<br />
<br />
The paper introduced a more efficient algorithm compared to Basic Exact Greedy Algorithm which is the Approximate Algorithm. The Approximate Algorithm first proposes candidate splitting points according to percentiles of feature distribution. It then maps the continuous features into buckets split by candidate points, aggregates the statistics and finds the best solution among proposals based on the aggregated statistics. The algorithm is shown below:<br />
<br />
[[File:algo2xg.png|frame|center|alt=Alt text|Approximate Algorithm]]<br />
<br />
There are also two variants to this algorithm, the global variant proposes all the candidate splits during the initial phase of tree construction and uses the same proposals for split finding at all levels. Whereas, the local variant re-proposes after each split. The global variant usually requires less proposal steps but uses more candidate points than local variant because candidates are not refined after each split. For deeper trees, usage of local variant may be more appropriate as compared to global variant. The figure below shows the a comparison in accuracy between Basic Exact Greedy and Approximate split finding algorithms with different variant over the number of iterations. We can see that the quantile strategy is able to achieve similar accuracy as the Basic Exact Greedy algorithm given a reasonable approximation level.<br />
<br />
[[File:accuracyxg.png|frame|center|alt=Alt text|Comparison of accuracy between different algorithms]]<br />
<br />
=== Weighted Quantile Sketch ===<br />
<br />
Proposing candidate split points is the most important step in the Approximate Algorithm, it is done by using the percentile of a feature to make candidates distribute evenly on a dataset.<br />
<br />
Formally, we have a dataset<br />
<br />
<math>D_k={(x_{1k},h_1),(x_{2k},h_2),...,(x_{nk},h_n)}</math><br />
<br />
where <math> x_i </math>'s are the feature values of each data point and <math> h_i </math>'s represents the weight of the corresponding feature <math> x_i </math>. <br />
<br />
Then, we can use the following rank function to compute <math>r_k(z)</math>, the proportion of instances whose feature value among <math> (x_i,...,x_k) </math> is smaller than data point <math> z </math>.<br />
<br />
<math>r_k(z) = \frac{1}{\sum_{(x,h) \in D_k} h} \displaystyle\sum_{(x,h) \in D_k, x<z} h,</math><br />
<br />
The objective here is to find candidate split points <math>{s_{k1}, s_{k2}, …, s_{kl}}</math>, such that:<br />
<br />
<math>|r_k(s_{k,j}) – r_k(s_{k,j+1})| < \epsilon, s_{k1} = \displaystyle\min_i x_{ik}, s_{kl} = \displaystyle\max_{i} x_{ik}, \forall i</math><br />
<br />
Where <math>\epsilon</math> is an approximation factor. Usually, it should approximately have <math>\frac{1}{\epsilon}</math> splitting points.<br />
<br />
=== Sparsity-aware Split Finding ===<br />
<br />
Typically in real world situation, it is quite common that our dataset is sparse. Some of the possible causes are:<br />
<br />
# Missing values in the data<br />
# Huge amount of zero entries present in the data<br />
# Artifacts of feature engineering (e.g. One-hot encoding)<br />
<br />
In order to solve the sparsity present in the dataset, we suggest to add a default direction in each tree node will classified into when there is a missing value in the matrix of the dataset. This is demonstrated in the figure below:<br />
<br />
[[File:defaultdirection.png|frame|center|alt=Alt text|Default Direction for missing value]]<br />
<br />
The algorithm below, helps us to calculate the optimal direction to proceed in each branch. Beside that, it also allows user to set a range for the accepted value and neglect the out-of-range value when calculating the score. <br />
<br />
[[File:algo3xg.png|frame|center|alt=Alt text|Sparsity-aware Split Finding Algorithm]]<br />
<br />
== System Design ==<br />
<br />
=== Column Block for Parallel Learning ===<br />
The most time consuming part of tree learning is to get the data into sorted order. To overcome this problem, XGBoost stores the data in blocks where each block performs the sorting operation in parallel. The results are then merged together.<br />
<br />
# For the exact greedy algorithm, XGBoost stores the entire dataset in a single block<br />
#:* Original spase aware algorithm costs: <math>O(Kd∥x∥_0 log(n))</math><br />
#:* Tree boosting on block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(n))</math><br />
#:* Hence, block structure helps to save an additional <math>log(n)</math> factor<br />
# For approximate algorithms, XGBoost stores the dataset in multiple blocks<br />
#:* Original algorithm with binary search costs: <math>O(Kd∥x∥_0 log(q))</math><br />
#:* With block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(B))</math><br />
#:* Hence, block structure helps to save an additional <math>log(q)</math> factor <br />
<br />
K = total number of trees<br /><br />
d = maximum depth of the tree<br /><br />
<math>∥x∥_0</math> = number of non-missing entries in the training data<br /><br />
n = number of rows in the dataset<br /><br />
q = number of proposal candidates in the dataset, usually between 32 to 100<br /><br />
B = maximum number of rows in each block<br />
<br />
[[File: columnblock.png|800px|thumb|center]]<br />
<br />
=== Cache-aware Access ===<br />
The proposed block structure optimizes the computation complexity but requires indirect fetches of gradient statistics by row index. XGBoost optimizes the process by using the following methods.<br />
<br />
# For the exact greedy algorithm, XGBoost uses a cache-aware prefetching algorithm<br />
#:* It stores Gradient and Hessians in the cache to make calculations fast<br />
#:* It runs twice as fast as the naive method when the dataset is large<br />
# For approximate algorithms, XGBoost chooses a specific block size<br />
#:* Choosing a small block size results in inefficient parallelization<br />
#:* Choosing a large block size results in cache misses<br />
#:* Various choices of block size are compared and the results are shown in Figure 9<br />
#:* XGBoost chose <math>2^{16}</math> as the block size<br />
<br />
[[File: blocksize.png|400px|thumb|center]]<br />
<br />
=== Blocks for Out-of-core Computation ===<br />
When the dataset is too large for the cache and main memory, XGBoost utilizes disk spaces as well. Since reading and writing data to the disks are slow, XGBoost optimizes the process by using the following two methods.<br />
<br />
# Block Compression<br />
#:* Blocks are compressed by columns<br />
#:* Although decompressing takes time, it is still faster than reading from the disks<br />
# Block Sharding<br />
#:* If multiple disks are available, data is split into those disks<br />
#:* When the CPU needs data, all the disks can be read at the same time<br />
<br />
== End To End Evaluations ==<br />
=== System Implementation ===<br />
XGBoost is a portable and reusable open-source package. It supports:<br />
* various weighted classification<br />
* various objective functions (rank & user defined)<br />
* popular languages (python, R, Julia)<br />
* data science pipelines (scikit-learn)<br />
* big data stacks (Flink, Spark)<br />
* cloud platform (Tianchi8)<br />
<br />
=== Dataset and Setup ===<br />
<br />
A summary of the 4 datasets used in the experiments is in table 2.<br />
<br />
[[File: table2data.png|500px|thumb|center]]<br />
<br />
The first and last datasets were used specifically to evaluate the impact of sparsity-aware algorithm and the scaling property of the system in the out-of-core and the distributed settings respectively. In all of the experiments, common settings such as maximum depth equal to 8, shrinkage equal to 0.1 and no column subsampling are applied.<br />
<br />
=== Classification ===<br />
A subset (n = 1M) of Higgs Boson dataset was used for classification. The results are shown in Table 3.<br />
<br />
[[File: classification.png|500px|thumb|center]]<br />
<br />
* R’s GBM creates a tree fast by using greedy approach that only expands one branch of a tree but with the cost of lower accuracy<br />
* XGBoost and scikit-learn have better performance than R’s GBM<br />
* XGBoost runs more than 10x faster than scikit-learn in learning a full tree<br />
* Column subsamples give slightly worse performance possibly due to a few important features in this dataset.<br />
<br />
=== Learning to Rank ===<br />
The results in comparing XGBoost with pGBRT are shown in Table 4.<br />
<br />
[[File: rank.png|500px|thumb|center]]<br />
<br />
* XGBoost runs exact greedy algorithm while pGBRT only supports an approximate algorithm<br />
* XGBoost runs faster<br />
* Subsampling column reduces running time and gives higher performance possibly due to preventing overfitting<br />
<br />
=== Out-of-core Experiment ===<br />
An extremely large Criteo dataset was used to evaluate the out-of-core setting. The results are shown in the figure below.<br />
<br />
[[File: outofcore.png|350px|thumb|center]]<br />
<br />
* Compression speed up the computation by a factor of 3<br />
* Sharding into 2 disks further gives 2x speed<br />
<br />
=== Distributed Experiment ===<br />
YARN cluster on EC2 with m3.2xlarge machines was used to evaluate the distributed setting. XGBoost was compared with Spark MLLib and H20.<br />
<br />
* XGBoost can switch to out-of-core setting when the memory runs out, while the baseline systems need to store the data in RAM<br />
* XGBoost runs faster than the baseline systems<br />
* The baseline systems are only able to handle a subset of the data with the given resources while XGBoost was able to scale smoothly to all 1.7B rows<br />
* XGBoost’s performance scales linearly with more machines<br />
* XGBoost is able to handle all 1.7B data with only 4 machines<br />
<br />
== Conclusion ==<br />
<br />
== References ==<br />
[1] R. Bekkerman. The present and the future of the kdd cup competition: an outsider’s perspective. <br />
<br />
[2] R. Bekkerman, M. Bilenko, and J. Langford. Scaling Up Machine Learning: Parallel and Distributed Approaches. Cambridge University Press, New York, NY, USA, 2011. <br />
<br />
[3] J. Bennett and S. Lanning. The netflix prize. In Proceedings of the KDD Cup Workshop 2007, pages 3–6, New York, Aug. 2007.<br />
<br />
[4] L. Breiman. Random forests. Maching Learning, 45(1):5–32, Oct. 2001.<br />
<br />
[5] C. Burges. From ranknet to lambdarank to lambdamart: An overview. Learning, 11:23–581, 2010.<br />
<br />
[6] O. Chapelle and Y. Chang. Yahoo! Learning to Rank Challenge Overview. Journal of Machine Learning Research - W & CP, 14:1–24, 2011.<br />
<br />
[7] T. Chen, H. Li, Q. Yang, and Y. Yu. General functional matrix factorization using gradient boosting. In Proceeding of 30th International Conference on Machine Learning (ICML’13), volume 1, pages 436–444, 2013.<br />
<br />
[8] T. Chen, S. Singh, B. Taskar, and C. Guestrin. Efficient second-order gradient boosting for conditional random fields. In Proceeding of 18th Artificial Intelligence and Statistics Conference (AISTATS’15), volume 1, 2015.<br />
<br />
[9] R.-E. Fan, K.-W. Chang, C.-J. Hsieh, X.-R. Wang, and C.-J. Lin. LIBLINEAR: A library for large linear classification. Journal of Machine Learning Research, 9:1871–1874, 2008.<br />
<br />
[10] J. Friedman. Greedy function approximation: a gradient boosting machine. Annals of Statistics, 29(5):1189–1232, 2001.<br />
<br />
[11] J. Friedman. Stochastic gradient boosting. Computational Statistics & Data Analysis, 38(4):367–378, 2002.<br />
<br />
[12] J. Friedman, T. Hastie, and R. Tibshirani. Additive logistic regression: a statistical view of boosting. Annals of Statistics, 28(2):337–407, 2000.<br />
<br />
[13] J. H. Friedman and B. E. Popescu. Importance sampled learning ensembles, 2003.<br />
<br />
[14] M. Greenwald and S. Khanna. Space-efficient online computation of quantile summaries. In Proceedings of the 2001 ACM SIGMOD International Conference on Management of Data, pages 58–66, 2001.<br />
<br />
[15] X. He, J. Pan, O. Jin, T. Xu, B. Liu, T. Xu, Y. Shi, A. Atallah, R. Herbrich, S. Bowers, and J. Q. n. Candela. Practical lessons from predicting clicks on ads at facebook. In Proceedings of the Eighth International Workshop on Data Mining for Online Advertising, ADKDD’14, 2014.<br />
<br />
[16] P. Li. Robust Logitboost and adaptive base class (ABC) Logitboost. In Proceedings of the Twenty-Sixth Conference Annual Conference on Uncertainty in Artificial Intelligence (UAI’10), pages 302–311, 2010.<br />
<br />
[17] P. Li, Q. Wu, and C. J. Burges. Mcrank: Learning to rank using multiple classification and gradient boosting. In Advances in Neural Information Processing Systems 20, pages 897–904. 2008.<br />
<br />
[18] X. Meng, J. Bradley, B. Yavuz, E. Sparks, S. Venkataraman, D. Liu, J. Freeman, D. Tsai, M. Amde, S. Owen, D. Xin, R. Xin, M. J. Franklin, R. Zadeh, M. Zaharia, and A. Talwalkar. MLlib: Machine learning in apache spark. Journal of Machine Learning Research, 17(34):1–7, 2016.<br />
<br />
[19] B. Panda, J. S. Herbach, S. Basu, and R. J. Bayardo. Planet: Massively parallel learning of tree ensembles with mapreduce. Proceeding of VLDB Endowment, 2(2):1426–1437, Aug. 2009.<br />
<br />
[20] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.<br />
<br />
[21] G. Ridgeway. Generalized Boosted Models: A guide to the gbm package.<br />
<br />
[22] S. Tyree, K. Weinberger, K. Agrawal, and J. Paykin. Parallel boosted regression trees for web search ranking. In Proceedings of the 20th international conference on World wide web, pages 387–396. ACM, 2011.<br />
<br />
[23] J. Ye, J.-H. Chow, J. Chen, and Z. Zheng. Stochastic gradient boosted distributed decision trees. In Proceedings of the 18th ACM Conference on Information and Knowledge Management, CIKM ’09.<br />
<br />
[24] Q. Zhang and W. Wang. A fast algorithm for approximate quantiles in high speed data streams. In Proceedings of the 19th International Conference on Scientific and Statistical Database Management, 2007.<br />
<br />
[25] T. Zhang and R. Johnson. Learning nonlinear functions using regularized greedy forest. IEEE Transactions on Pattern Analysis and Machine Intelligence, 36(5), 2014.</div>Cwlokehttp://wiki.math.uwaterloo.ca/statwiki/index.php?title=XGBoost&diff=51139XGBoost2021-11-29T05:42:32Z<p>Cwloke: /* Sparsity-aware Split Finding */</p>
<hr />
<div>== Presented by == <br />
* Chun Waan Loke<br />
* Peter Chong<br />
* Clarice Osmond<br />
* Zhilong Li<br />
<br />
== Introduction ==<br />
<br />
== Tree Boosting In A Nutshell ==<br />
The author reviews gradient tree boosting in this section.<br />
=== Regularized Learning Objective ===<br />
The author first gives the prediction equation (1) and the regularized objective (2).<br><br />
<br><br />
(1) The additive prediction model is given as<br><br />
<math>\hat{y_i}=\sum_{k=1}^{K}f_k(x_i), f_k \in \mathcal{F} </math> <br><br />
where each <math>f_k</math> corresponds to an independent tree structure with its weights, and <math>\mathcal{F}</math> is the "space of regression trees"<br><br />
<br><br />
(2) The regularized objective to be minimized is given as<br><br />
<math>\mathcal{L}=\sum_{i}l(\hat{y_i},y_i)+\sum_k \Omega(f_k)</math> where <math>\Omega(f)=\gamma T+\frac{1}{2}\lambda ||\omega||^2</math> <br><br />
The first term <math>l</math> is a differentiable convex loss function that calculates the measures between <math>\hat{y}</math> and <math>y</math>.<br><br />
The second term <math>\Omega</math> penalizes on the complexity of model (the <math>f_k</math>'s). For a given tree (<math>f_k</math>), <math>T</math> is the number of leaves, and <math>\omega</math> is the leaf weights.<br><br />
The L1 regularization term <math>\gamma T</math> encourages the tree to be small, and the L2 regularization term <math>\frac{1}{2}\lambda ||\omega||^2</math> encourages the tree to have small weights.<br><br />
<br />
=== Gradient Tree Boosting ===<br />
Let <math>\hat{y_i}^{(t)}</math> be the prediction of <math>y_i</math> at the t-th iteration.<br><br />
Since the prediction equation is simply additive, <math>{\hat y_i}^{(t)}=\hat{y_{i}}^{(t-1)}+f_t(x_i)</math><br><br />
Using this equation and 2nd order Taylor approximation on the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> gives <br><br />
\begin{align}<br />
\mathcal{L}^{(t)}&=\sum_{i}^{n}l(y_i,\hat{y_i}^{(t-1)}+f_t(x_i))+\Omega(f_t)\\<br />
&\simeq \sum_{i}^{n}[l(y_i,\hat{y_i}^{(t-1)})+g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
\end{align}<br />
where <math>g_i</math> and <math>h_i</math> are the first and second derivative of the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> with repspect to the term <math>\hat{y}^{(t-1)}</math><br><br />
We can simplify this objective by removing the constant term <math>l(y_i,\hat{y_i}^{(t-1)})</math>.<br><br />
Define <math>I_j=\{i|q(x_i)=j\}</math>, where <math>q</math> is the tree structure. Since every <math>x_i</math> is mapped by <math>q</math> to some leaf <math>j</math>, going through every <math>x_i</math> is equivalent to going through each leaf j of the structure.<br />
\begin{align}<br />
\tilde{\mathcal{L}}^{(t)}&= \sum_{i}^{n}[g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
&= \sum_{j=1}^{T}[(\sum_{i \in I_j}g_i)\omega_j+\frac{1}{2}(\sum_{i \in I_j}h_i+\lambda)\omega_j^2]+\gamma T<br />
\end{align}<br />
Then for a fixed structure <math>q</math>, the optimal weight of leaf <math>j</math> and the optimal objective value are given as<br><br />
\begin{align}<br />
\omega_j^{*} &= -\frac{\sum_{i \in I_j}g_i}{\sum_{i \in I_j}h_i+\lambda}\\<br />
\tilde{\mathcal{L}}^{(t)}(q) &=-\frac{1}{2}\sum_{j=1}^{T}\frac{(\sum_{i \in I_j}g_i)^2}{\sum_{i \in I_j}h_i+\lambda}+\gamma T<br />
\end{align} <br />
[[File:Structure Score Calculation.png|frame|center|alt=Alt text|Structure Score Calculation]]<br />
Instead of enumerating through all possible tree structures q, a greedy algorithm of iteratively adding branches is used.<br><br />
Let <math>I_L</math> and <math>I_R</math> be the instance sets of left and right nodes after split and let <math>I=I_L\cup I_R</math>.<br><br />
The loss reduction after split is given by<br><br />
\begin{align}<br />
\tilde{\mathcal{L}}_{\text{split}} &=\frac{1}{2}[\frac{(\sum_{i \in I_L}g_i)^2}{\sum_{i \in I_L}h_i+\lambda}+\frac{(\sum_{i \in I_R}g_i)^2}{\sum_{i \in I_R}h_i+\lambda}-\frac{(\sum_{i \in I}g_i)^2}{\sum_{i \in I}h_i+\lambda}]+\gamma<br />
\end{align}<br />
=== Shrinkage and Column Subsampling ===<br />
The author also mentioned two other methods in order to avoid over-fitting.<br><br />
(1) Shrinkage. Similar to the learning rate in stochastic optimization, a new weight is added to each tree boosting to reduce the influence of a single tree and leave space for future trees.<br><br />
(2) Column (feature) subsampling. In the paper, the author only mentioned that this technique speeds up parallel algorithm used in later sections.<br />
<br />
== Split Finding Algorithms ==<br />
<br />
It is very important to find the best split for tree learning to perform well. Here are a few split finding algorithms mentioned in the paper:<br />
<br />
=== Basic Exact Greedy Algorithm ===<br />
<br />
The basic exact greedy algorithm is a split finding algorithm that is computationally expensive because it enumerates over all the possible splits for continuous features. It is impossible to be done efficiently when the memory is not enough to hold the data needed. A way to carry out this algorithm efficiently is to sort the data according to feature values and visit the data in order to accumulate the gradient statistics. The algorithm is shown below:<br />
<br />
[[File:algo1xg.png|frame|center|alt=Alt text|Basic Exact Greedy Algorithm]]<br />
<br />
=== Approximate Algorithm ===<br />
<br />
The paper introduced a more efficient algorithm compared to Basic Exact Greedy Algorithm which is the Approximate Algorithm. The Approximate Algorithm first proposes candidate splitting points according to percentiles of feature distribution. It then maps the continuous features into buckets split by candidate points, aggregates the statistics and finds the best solution among proposals based on the aggregated statistics. The algorithm is shown below:<br />
<br />
[[File:algo2xg.png|frame|center|alt=Alt text|Approximate Algorithm]]<br />
<br />
There are also two variants to this algorithm, the global variant proposes all the candidate splits during the initial phase of tree construction and uses the same proposals for split finding at all levels. Whereas, the local variant re-proposes after each split. The global variant usually requires less proposal steps but uses more candidate points than local variant because candidates are not refined after each split. For deeper trees, usage of local variant may be more appropriate as compared to global variant. The figure below shows the a comparison in accuracy between Basic Exact Greedy and Approximate split finding algorithms with different variant over the number of iterations. We can see that the quantile strategy is able to achieve similar accuracy as the Basic Exact Greedy algorithm given a reasonable approximation level.<br />
<br />
[[File:accuracyxg.png|frame|center|alt=Alt text|Comparison of accuracy between different algorithms]]<br />
<br />
=== Weighted Quantile Sketch ===<br />
<br />
Proposing candidate split points is the most important step in the Approximate Algorithm, it is done by using the percentile of a feature to make candidates distribute evenly on a dataset.<br />
<br />
Formally, we have a dataset<br />
<br />
<math>D_k={(x_{1k},h_1),(x_{2k},h_2),...,(x_{nk},h_n)}</math><br />
<br />
where <math> x_i </math>'s are the feature values of each data point and <math> h_i </math>'s represents the weight of the corresponding feature <math> x_i </math>. <br />
<br />
Then, we can use the following rank function to compute <math>r_k(z)</math>, the proportion of instances whose feature value among <math> (x_i,...,x_k) </math> is smaller than data point <math> z </math>.<br />
<br />
<math>r_k(z) = \frac{1}{\sum_{(x,h) \in D_k} h} \displaystyle\sum_{(x,h) \in D_k, x<z} h,</math><br />
<br />
The objective here is to find candidate split points <math>{s_{k1}, s_{k2}, …, s_{kl}}</math>, such that:<br />
<br />
<math>|r_k(s_{k,j}) – r_k(s_{k,j+1})| < \epsilon, s_{k1} = \displaystyle\min_i x_{ik}, s_{kl} = \displaystyle\max_{i} x_{ik}, \forall i</math><br />
<br />
Where <math>\epsilon</math> is an approximation factor. Usually, it should approximately have <math>\frac{1}{\epsilon}</math> splitting points.<br />
<br />
=== Sparsity-aware Split Finding ===<br />
<br />
Typically in real world situation, it is quite common that our dataset is sparse. Some of the possible causes are:<br />
<br />
# Missing values in the data<br />
# Huge amount of zero entries present in the data<br />
# Artifacts of feature engineering (e.g. One-hot encoding)<br />
<br />
In order to solve the sparsity present in the dataset, we suggest to add a default direction in each tree node will classified into when there is a missing value in the matrix of the dataset. This is demonstrated in the figure below:<br />
<br />
[[File:defaultdirection.png|frame|center|alt=Alt text|Default Direction for sparsity]]<br />
<br />
The algorithm below, helps us to calculate the optimal direction to proceed in each branch. Beside that, it also allows user to set a range for the accepted value and neglect the out-of-range value when calculating the score. <br />
<br />
[[File:algo3xg.png|frame|center|alt=Alt text|Sparsity-aware Split Finding Algorithm]]<br />
<br />
== System Design ==<br />
<br />
=== Column Block for Parallel Learning ===<br />
The most time consuming part of tree learning is to get the data into sorted order. To overcome this problem, XGBoost stores the data in blocks where each block performs the sorting operation in parallel. The results are then merged together.<br />
<br />
# For the exact greedy algorithm, XGBoost stores the entire dataset in a single block<br />
#:* Original spase aware algorithm costs: <math>O(Kd∥x∥_0 log(n))</math><br />
#:* Tree boosting on block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(n))</math><br />
#:* Hence, block structure helps to save an additional <math>log(n)</math> factor<br />
# For approximate algorithms, XGBoost stores the dataset in multiple blocks<br />
#:* Original algorithm with binary search costs: <math>O(Kd∥x∥_0 log(q))</math><br />
#:* With block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(B))</math><br />
#:* Hence, block structure helps to save an additional <math>log(q)</math> factor <br />
<br />
K = total number of trees<br /><br />
d = maximum depth of the tree<br /><br />
<math>∥x∥_0</math> = number of non-missing entries in the training data<br /><br />
n = number of rows in the dataset<br /><br />
q = number of proposal candidates in the dataset, usually between 32 to 100<br /><br />
B = maximum number of rows in each block<br />
<br />
[[File: columnblock.png|800px|thumb|center]]<br />
<br />
=== Cache-aware Access ===<br />
The proposed block structure optimizes the computation complexity but requires indirect fetches of gradient statistics by row index. XGBoost optimizes the process by using the following methods.<br />
<br />
# For the exact greedy algorithm, XGBoost uses a cache-aware prefetching algorithm<br />
#:* It stores Gradient and Hessians in the cache to make calculations fast<br />
#:* It runs twice as fast as the naive method when the dataset is large<br />
# For approximate algorithms, XGBoost chooses a specific block size<br />
#:* Choosing a small block size results in inefficient parallelization<br />
#:* Choosing a large block size results in cache misses<br />
#:* Various choices of block size are compared and the results are shown in Figure 9<br />
#:* XGBoost chose <math>2^{16}</math> as the block size<br />
<br />
[[File: blocksize.png|400px|thumb|center]]<br />
<br />
=== Blocks for Out-of-core Computation ===<br />
When the dataset is too large for the cache and main memory, XGBoost utilizes disk spaces as well. Since reading and writing data to the disks are slow, XGBoost optimizes the process by using the following two methods.<br />
<br />
# Block Compression<br />
#:* Blocks are compressed by columns<br />
#:* Although decompressing takes time, it is still faster than reading from the disks<br />
# Block Sharding<br />
#:* If multiple disks are available, data is split into those disks<br />
#:* When the CPU needs data, all the disks can be read at the same time<br />
<br />
== End To End Evaluations ==<br />
=== System Implementation ===<br />
XGBoost is a portable and reusable open-source package. It supports:<br />
* various weighted classification<br />
* various objective functions (rank & user defined)<br />
* popular languages (python, R, Julia)<br />
* data science pipelines (scikit-learn)<br />
* big data stacks (Flink, Spark)<br />
* cloud platform (Tianchi8)<br />
<br />
=== Dataset and Setup ===<br />
<br />
A summary of the 4 datasets used in the experiments is in table 2.<br />
<br />
[[File: table2data.png|500px|thumb|center]]<br />
<br />
The first and last datasets were used specifically to evaluate the impact of sparsity-aware algorithm and the scaling property of the system in the out-of-core and the distributed settings respectively. In all of the experiments, common settings such as maximum depth equal to 8, shrinkage equal to 0.1 and no column subsampling are applied.<br />
<br />
=== Classification ===<br />
A subset (n = 1M) of Higgs Boson dataset was used for classification. The results are shown in Table 3.<br />
<br />
[[File: classification.png|500px|thumb|center]]<br />
<br />
* R’s GBM creates a tree fast by using greedy approach that only expands one branch of a tree but with the cost of lower accuracy<br />
* XGBoost and scikit-learn have better performance than R’s GBM<br />
* XGBoost runs more than 10x faster than scikit-learn in learning a full tree<br />
* Column subsamples give slightly worse performance possibly due to a few important features in this dataset.<br />
<br />
=== Learning to Rank ===<br />
The results in comparing XGBoost with pGBRT are shown in Table 4.<br />
<br />
[[File: rank.png|500px|thumb|center]]<br />
<br />
* XGBoost runs exact greedy algorithm while pGBRT only supports an approximate algorithm<br />
* XGBoost runs faster<br />
* Subsampling column reduces running time and gives higher performance possibly due to preventing overfitting<br />
<br />
=== Out-of-core Experiment ===<br />
An extremely large Criteo dataset was used to evaluate the out-of-core setting. The results are shown in the figure below.<br />
<br />
[[File: outofcore.png|350px|thumb|center]]<br />
<br />
* Compression speed up the computation by a factor of 3<br />
* Sharding into 2 disks further gives 2x speed<br />
<br />
=== Distributed Experiment ===<br />
YARN cluster on EC2 with m3.2xlarge machines was used to evaluate the distributed setting. XGBoost was compared with Spark MLLib and H20.<br />
<br />
* XGBoost can switch to out-of-core setting when the memory runs out, while the baseline systems need to store the data in RAM<br />
* XGBoost runs faster than the baseline systems<br />
* The baseline systems are only able to handle a subset of the data with the given resources while XGBoost was able to scale smoothly to all 1.7B rows<br />
* XGBoost’s performance scales linearly with more machines<br />
* XGBoost is able to handle all 1.7B data with only 4 machines<br />
<br />
== Conclusion ==<br />
<br />
== References ==<br />
[1] R. Bekkerman. The present and the future of the kdd cup competition: an outsider’s perspective. <br />
<br />
[2] R. Bekkerman, M. Bilenko, and J. Langford. Scaling Up Machine Learning: Parallel and Distributed Approaches. Cambridge University Press, New York, NY, USA, 2011. <br />
<br />
[3] J. Bennett and S. Lanning. The netflix prize. In Proceedings of the KDD Cup Workshop 2007, pages 3–6, New York, Aug. 2007.<br />
<br />
[4] L. Breiman. Random forests. Maching Learning, 45(1):5–32, Oct. 2001.<br />
<br />
[5] C. Burges. From ranknet to lambdarank to lambdamart: An overview. Learning, 11:23–581, 2010.<br />
<br />
[6] O. Chapelle and Y. Chang. Yahoo! Learning to Rank Challenge Overview. Journal of Machine Learning Research - W & CP, 14:1–24, 2011.<br />
<br />
[7] T. Chen, H. Li, Q. Yang, and Y. Yu. General functional matrix factorization using gradient boosting. In Proceeding of 30th International Conference on Machine Learning (ICML’13), volume 1, pages 436–444, 2013.<br />
<br />
[8] T. Chen, S. Singh, B. Taskar, and C. Guestrin. Efficient second-order gradient boosting for conditional random fields. In Proceeding of 18th Artificial Intelligence and Statistics Conference (AISTATS’15), volume 1, 2015.<br />
<br />
[9] R.-E. Fan, K.-W. Chang, C.-J. Hsieh, X.-R. Wang, and C.-J. Lin. LIBLINEAR: A library for large linear classification. Journal of Machine Learning Research, 9:1871–1874, 2008.<br />
<br />
[10] J. Friedman. Greedy function approximation: a gradient boosting machine. Annals of Statistics, 29(5):1189–1232, 2001.<br />
<br />
[11] J. Friedman. Stochastic gradient boosting. Computational Statistics & Data Analysis, 38(4):367–378, 2002.<br />
<br />
[12] J. Friedman, T. Hastie, and R. Tibshirani. Additive logistic regression: a statistical view of boosting. Annals of Statistics, 28(2):337–407, 2000.<br />
<br />
[13] J. H. Friedman and B. E. Popescu. Importance sampled learning ensembles, 2003.<br />
<br />
[14] M. Greenwald and S. Khanna. Space-efficient online computation of quantile summaries. In Proceedings of the 2001 ACM SIGMOD International Conference on Management of Data, pages 58–66, 2001.<br />
<br />
[15] X. He, J. Pan, O. Jin, T. Xu, B. Liu, T. Xu, Y. Shi, A. Atallah, R. Herbrich, S. Bowers, and J. Q. n. Candela. Practical lessons from predicting clicks on ads at facebook. In Proceedings of the Eighth International Workshop on Data Mining for Online Advertising, ADKDD’14, 2014.<br />
<br />
[16] P. Li. Robust Logitboost and adaptive base class (ABC) Logitboost. In Proceedings of the Twenty-Sixth Conference Annual Conference on Uncertainty in Artificial Intelligence (UAI’10), pages 302–311, 2010.<br />
<br />
[17] P. Li, Q. Wu, and C. J. Burges. Mcrank: Learning to rank using multiple classification and gradient boosting. In Advances in Neural Information Processing Systems 20, pages 897–904. 2008.<br />
<br />
[18] X. Meng, J. Bradley, B. Yavuz, E. Sparks, S. Venkataraman, D. Liu, J. Freeman, D. Tsai, M. Amde, S. Owen, D. Xin, R. Xin, M. J. Franklin, R. Zadeh, M. Zaharia, and A. Talwalkar. MLlib: Machine learning in apache spark. Journal of Machine Learning Research, 17(34):1–7, 2016.<br />
<br />
[19] B. Panda, J. S. Herbach, S. Basu, and R. J. Bayardo. Planet: Massively parallel learning of tree ensembles with mapreduce. Proceeding of VLDB Endowment, 2(2):1426–1437, Aug. 2009.<br />
<br />
[20] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.<br />
<br />
[21] G. Ridgeway. Generalized Boosted Models: A guide to the gbm package.<br />
<br />
[22] S. Tyree, K. Weinberger, K. Agrawal, and J. Paykin. Parallel boosted regression trees for web search ranking. In Proceedings of the 20th international conference on World wide web, pages 387–396. ACM, 2011.<br />
<br />
[23] J. Ye, J.-H. Chow, J. Chen, and Z. Zheng. Stochastic gradient boosted distributed decision trees. In Proceedings of the 18th ACM Conference on Information and Knowledge Management, CIKM ’09.<br />
<br />
[24] Q. Zhang and W. Wang. A fast algorithm for approximate quantiles in high speed data streams. In Proceedings of the 19th International Conference on Scientific and Statistical Database Management, 2007.<br />
<br />
[25] T. Zhang and R. Johnson. Learning nonlinear functions using regularized greedy forest. IEEE Transactions on Pattern Analysis and Machine Intelligence, 36(5), 2014.</div>Cwlokehttp://wiki.math.uwaterloo.ca/statwiki/index.php?title=XGBoost&diff=51138XGBoost2021-11-29T05:42:25Z<p>Cwloke: /* Sparsity-aware Split Finding */</p>
<hr />
<div>== Presented by == <br />
* Chun Waan Loke<br />
* Peter Chong<br />
* Clarice Osmond<br />
* Zhilong Li<br />
<br />
== Introduction ==<br />
<br />
== Tree Boosting In A Nutshell ==<br />
The author reviews gradient tree boosting in this section.<br />
=== Regularized Learning Objective ===<br />
The author first gives the prediction equation (1) and the regularized objective (2).<br><br />
<br><br />
(1) The additive prediction model is given as<br><br />
<math>\hat{y_i}=\sum_{k=1}^{K}f_k(x_i), f_k \in \mathcal{F} </math> <br><br />
where each <math>f_k</math> corresponds to an independent tree structure with its weights, and <math>\mathcal{F}</math> is the "space of regression trees"<br><br />
<br><br />
(2) The regularized objective to be minimized is given as<br><br />
<math>\mathcal{L}=\sum_{i}l(\hat{y_i},y_i)+\sum_k \Omega(f_k)</math> where <math>\Omega(f)=\gamma T+\frac{1}{2}\lambda ||\omega||^2</math> <br><br />
The first term <math>l</math> is a differentiable convex loss function that calculates the measures between <math>\hat{y}</math> and <math>y</math>.<br><br />
The second term <math>\Omega</math> penalizes on the complexity of model (the <math>f_k</math>'s). For a given tree (<math>f_k</math>), <math>T</math> is the number of leaves, and <math>\omega</math> is the leaf weights.<br><br />
The L1 regularization term <math>\gamma T</math> encourages the tree to be small, and the L2 regularization term <math>\frac{1}{2}\lambda ||\omega||^2</math> encourages the tree to have small weights.<br><br />
<br />
=== Gradient Tree Boosting ===<br />
Let <math>\hat{y_i}^{(t)}</math> be the prediction of <math>y_i</math> at the t-th iteration.<br><br />
Since the prediction equation is simply additive, <math>{\hat y_i}^{(t)}=\hat{y_{i}}^{(t-1)}+f_t(x_i)</math><br><br />
Using this equation and 2nd order Taylor approximation on the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> gives <br><br />
\begin{align}<br />
\mathcal{L}^{(t)}&=\sum_{i}^{n}l(y_i,\hat{y_i}^{(t-1)}+f_t(x_i))+\Omega(f_t)\\<br />
&\simeq \sum_{i}^{n}[l(y_i,\hat{y_i}^{(t-1)})+g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
\end{align}<br />
where <math>g_i</math> and <math>h_i</math> are the first and second derivative of the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> with repspect to the term <math>\hat{y}^{(t-1)}</math><br><br />
We can simplify this objective by removing the constant term <math>l(y_i,\hat{y_i}^{(t-1)})</math>.<br><br />
Define <math>I_j=\{i|q(x_i)=j\}</math>, where <math>q</math> is the tree structure. Since every <math>x_i</math> is mapped by <math>q</math> to some leaf <math>j</math>, going through every <math>x_i</math> is equivalent to going through each leaf j of the structure.<br />
\begin{align}<br />
\tilde{\mathcal{L}}^{(t)}&= \sum_{i}^{n}[g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
&= \sum_{j=1}^{T}[(\sum_{i \in I_j}g_i)\omega_j+\frac{1}{2}(\sum_{i \in I_j}h_i+\lambda)\omega_j^2]+\gamma T<br />
\end{align}<br />
Then for a fixed structure <math>q</math>, the optimal weight of leaf <math>j</math> and the optimal objective value are given as<br><br />
\begin{align}<br />
\omega_j^{*} &= -\frac{\sum_{i \in I_j}g_i}{\sum_{i \in I_j}h_i+\lambda}\\<br />
\tilde{\mathcal{L}}^{(t)}(q) &=-\frac{1}{2}\sum_{j=1}^{T}\frac{(\sum_{i \in I_j}g_i)^2}{\sum_{i \in I_j}h_i+\lambda}+\gamma T<br />
\end{align} <br />
[[File:Structure Score Calculation.png|frame|center|alt=Alt text|Structure Score Calculation]]<br />
Instead of enumerating through all possible tree structures q, a greedy algorithm of iteratively adding branches is used.<br><br />
Let <math>I_L</math> and <math>I_R</math> be the instance sets of left and right nodes after split and let <math>I=I_L\cup I_R</math>.<br><br />
The loss reduction after split is given by<br><br />
\begin{align}<br />
\tilde{\mathcal{L}}_{\text{split}} &=\frac{1}{2}[\frac{(\sum_{i \in I_L}g_i)^2}{\sum_{i \in I_L}h_i+\lambda}+\frac{(\sum_{i \in I_R}g_i)^2}{\sum_{i \in I_R}h_i+\lambda}-\frac{(\sum_{i \in I}g_i)^2}{\sum_{i \in I}h_i+\lambda}]+\gamma<br />
\end{align}<br />
=== Shrinkage and Column Subsampling ===<br />
The author also mentioned two other methods in order to avoid over-fitting.<br><br />
(1) Shrinkage. Similar to the learning rate in stochastic optimization, a new weight is added to each tree boosting to reduce the influence of a single tree and leave space for future trees.<br><br />
(2) Column (feature) subsampling. In the paper, the author only mentioned that this technique speeds up parallel algorithm used in later sections.<br />
<br />
== Split Finding Algorithms ==<br />
<br />
It is very important to find the best split for tree learning to perform well. Here are a few split finding algorithms mentioned in the paper:<br />
<br />
=== Basic Exact Greedy Algorithm ===<br />
<br />
The basic exact greedy algorithm is a split finding algorithm that is computationally expensive because it enumerates over all the possible splits for continuous features. It is impossible to be done efficiently when the memory is not enough to hold the data needed. A way to carry out this algorithm efficiently is to sort the data according to feature values and visit the data in order to accumulate the gradient statistics. The algorithm is shown below:<br />
<br />
[[File:algo1xg.png|frame|center|alt=Alt text|Basic Exact Greedy Algorithm]]<br />
<br />
=== Approximate Algorithm ===<br />
<br />
The paper introduced a more efficient algorithm compared to Basic Exact Greedy Algorithm which is the Approximate Algorithm. The Approximate Algorithm first proposes candidate splitting points according to percentiles of feature distribution. It then maps the continuous features into buckets split by candidate points, aggregates the statistics and finds the best solution among proposals based on the aggregated statistics. The algorithm is shown below:<br />
<br />
[[File:algo2xg.png|frame|center|alt=Alt text|Approximate Algorithm]]<br />
<br />
There are also two variants to this algorithm, the global variant proposes all the candidate splits during the initial phase of tree construction and uses the same proposals for split finding at all levels. Whereas, the local variant re-proposes after each split. The global variant usually requires less proposal steps but uses more candidate points than local variant because candidates are not refined after each split. For deeper trees, usage of local variant may be more appropriate as compared to global variant. The figure below shows the a comparison in accuracy between Basic Exact Greedy and Approximate split finding algorithms with different variant over the number of iterations. We can see that the quantile strategy is able to achieve similar accuracy as the Basic Exact Greedy algorithm given a reasonable approximation level.<br />
<br />
[[File:accuracyxg.png|frame|center|alt=Alt text|Comparison of accuracy between different algorithms]]<br />
<br />
=== Weighted Quantile Sketch ===<br />
<br />
Proposing candidate split points is the most important step in the Approximate Algorithm, it is done by using the percentile of a feature to make candidates distribute evenly on a dataset.<br />
<br />
Formally, we have a dataset<br />
<br />
<math>D_k={(x_{1k},h_1),(x_{2k},h_2),...,(x_{nk},h_n)}</math><br />
<br />
where <math> x_i </math>'s are the feature values of each data point and <math> h_i </math>'s represents the weight of the corresponding feature <math> x_i </math>. <br />
<br />
Then, we can use the following rank function to compute <math>r_k(z)</math>, the proportion of instances whose feature value among <math> (x_i,...,x_k) </math> is smaller than data point <math> z </math>.<br />
<br />
<math>r_k(z) = \frac{1}{\sum_{(x,h) \in D_k} h} \displaystyle\sum_{(x,h) \in D_k, x<z} h,</math><br />
<br />
The objective here is to find candidate split points <math>{s_{k1}, s_{k2}, …, s_{kl}}</math>, such that:<br />
<br />
<math>|r_k(s_{k,j}) – r_k(s_{k,j+1})| < \epsilon, s_{k1} = \displaystyle\min_i x_{ik}, s_{kl} = \displaystyle\max_{i} x_{ik}, \forall i</math><br />
<br />
Where <math>\epsilon</math> is an approximation factor. Usually, it should approximately have <math>\frac{1}{\epsilon}</math> splitting points.<br />
<br />
=== Sparsity-aware Split Finding ===<br />
<br />
Typically in real world situation, it is quite common that our dataset is sparse. Some of the possible causes are:<br />
<br />
# Missing values in the data<br />
# Huge amount of zero entries present in the data<br />
# Artifacts of feature engineering (e.g. One-hot encoding)<br />
<br />
In order to solve the sparsity present in the dataset, we suggest to add a default direction in each tree node will classified into when there is a missing value in the matrix of the dataset. This is demonstrated in the figure below:<br />
<br />
[[File:defaultdirection.png|center|alt=Alt text|Default Direction for sparsity]]<br />
<br />
The algorithm below, helps us to calculate the optimal direction to proceed in each branch. Beside that, it also allows user to set a range for the accepted value and neglect the out-of-range value when calculating the score. <br />
<br />
[[File:algo3xg.png|frame|center|alt=Alt text|Sparsity-aware Split Finding Algorithm]]<br />
<br />
== System Design ==<br />
<br />
=== Column Block for Parallel Learning ===<br />
The most time consuming part of tree learning is to get the data into sorted order. To overcome this problem, XGBoost stores the data in blocks where each block performs the sorting operation in parallel. The results are then merged together.<br />
<br />
# For the exact greedy algorithm, XGBoost stores the entire dataset in a single block<br />
#:* Original spase aware algorithm costs: <math>O(Kd∥x∥_0 log(n))</math><br />
#:* Tree boosting on block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(n))</math><br />
#:* Hence, block structure helps to save an additional <math>log(n)</math> factor<br />
# For approximate algorithms, XGBoost stores the dataset in multiple blocks<br />
#:* Original algorithm with binary search costs: <math>O(Kd∥x∥_0 log(q))</math><br />
#:* With block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(B))</math><br />
#:* Hence, block structure helps to save an additional <math>log(q)</math> factor <br />
<br />
K = total number of trees<br /><br />
d = maximum depth of the tree<br /><br />
<math>∥x∥_0</math> = number of non-missing entries in the training data<br /><br />
n = number of rows in the dataset<br /><br />
q = number of proposal candidates in the dataset, usually between 32 to 100<br /><br />
B = maximum number of rows in each block<br />
<br />
[[File: columnblock.png|800px|thumb|center]]<br />
<br />
=== Cache-aware Access ===<br />
The proposed block structure optimizes the computation complexity but requires indirect fetches of gradient statistics by row index. XGBoost optimizes the process by using the following methods.<br />
<br />
# For the exact greedy algorithm, XGBoost uses a cache-aware prefetching algorithm<br />
#:* It stores Gradient and Hessians in the cache to make calculations fast<br />
#:* It runs twice as fast as the naive method when the dataset is large<br />
# For approximate algorithms, XGBoost chooses a specific block size<br />
#:* Choosing a small block size results in inefficient parallelization<br />
#:* Choosing a large block size results in cache misses<br />
#:* Various choices of block size are compared and the results are shown in Figure 9<br />
#:* XGBoost chose <math>2^{16}</math> as the block size<br />
<br />
[[File: blocksize.png|400px|thumb|center]]<br />
<br />
=== Blocks for Out-of-core Computation ===<br />
When the dataset is too large for the cache and main memory, XGBoost utilizes disk spaces as well. Since reading and writing data to the disks are slow, XGBoost optimizes the process by using the following two methods.<br />
<br />
# Block Compression<br />
#:* Blocks are compressed by columns<br />
#:* Although decompressing takes time, it is still faster than reading from the disks<br />
# Block Sharding<br />
#:* If multiple disks are available, data is split into those disks<br />
#:* When the CPU needs data, all the disks can be read at the same time<br />
<br />
== End To End Evaluations ==<br />
=== System Implementation ===<br />
XGBoost is a portable and reusable open-source package. It supports:<br />
* various weighted classification<br />
* various objective functions (rank & user defined)<br />
* popular languages (python, R, Julia)<br />
* data science pipelines (scikit-learn)<br />
* big data stacks (Flink, Spark)<br />
* cloud platform (Tianchi8)<br />
<br />
=== Dataset and Setup ===<br />
<br />
A summary of the 4 datasets used in the experiments is in table 2.<br />
<br />
[[File: table2data.png|500px|thumb|center]]<br />
<br />
The first and last datasets were used specifically to evaluate the impact of sparsity-aware algorithm and the scaling property of the system in the out-of-core and the distributed settings respectively. In all of the experiments, common settings such as maximum depth equal to 8, shrinkage equal to 0.1 and no column subsampling are applied.<br />
<br />
=== Classification ===<br />
A subset (n = 1M) of Higgs Boson dataset was used for classification. The results are shown in Table 3.<br />
<br />
[[File: classification.png|500px|thumb|center]]<br />
<br />
* R’s GBM creates a tree fast by using greedy approach that only expands one branch of a tree but with the cost of lower accuracy<br />
* XGBoost and scikit-learn have better performance than R’s GBM<br />
* XGBoost runs more than 10x faster than scikit-learn in learning a full tree<br />
* Column subsamples give slightly worse performance possibly due to a few important features in this dataset.<br />
<br />
=== Learning to Rank ===<br />
The results in comparing XGBoost with pGBRT are shown in Table 4.<br />
<br />
[[File: rank.png|500px|thumb|center]]<br />
<br />
* XGBoost runs exact greedy algorithm while pGBRT only supports an approximate algorithm<br />
* XGBoost runs faster<br />
* Subsampling column reduces running time and gives higher performance possibly due to preventing overfitting<br />
<br />
=== Out-of-core Experiment ===<br />
An extremely large Criteo dataset was used to evaluate the out-of-core setting. The results are shown in the figure below.<br />
<br />
[[File: outofcore.png|350px|thumb|center]]<br />
<br />
* Compression speed up the computation by a factor of 3<br />
* Sharding into 2 disks further gives 2x speed<br />
<br />
=== Distributed Experiment ===<br />
YARN cluster on EC2 with m3.2xlarge machines was used to evaluate the distributed setting. XGBoost was compared with Spark MLLib and H20.<br />
<br />
* XGBoost can switch to out-of-core setting when the memory runs out, while the baseline systems need to store the data in RAM<br />
* XGBoost runs faster than the baseline systems<br />
* The baseline systems are only able to handle a subset of the data with the given resources while XGBoost was able to scale smoothly to all 1.7B rows<br />
* XGBoost’s performance scales linearly with more machines<br />
* XGBoost is able to handle all 1.7B data with only 4 machines<br />
<br />
== Conclusion ==<br />
<br />
== References ==<br />
[1] R. Bekkerman. The present and the future of the kdd cup competition: an outsider’s perspective. <br />
<br />
[2] R. Bekkerman, M. Bilenko, and J. Langford. Scaling Up Machine Learning: Parallel and Distributed Approaches. Cambridge University Press, New York, NY, USA, 2011. <br />
<br />
[3] J. Bennett and S. Lanning. The netflix prize. In Proceedings of the KDD Cup Workshop 2007, pages 3–6, New York, Aug. 2007.<br />
<br />
[4] L. Breiman. Random forests. Maching Learning, 45(1):5–32, Oct. 2001.<br />
<br />
[5] C. Burges. From ranknet to lambdarank to lambdamart: An overview. Learning, 11:23–581, 2010.<br />
<br />
[6] O. Chapelle and Y. Chang. Yahoo! Learning to Rank Challenge Overview. Journal of Machine Learning Research - W & CP, 14:1–24, 2011.<br />
<br />
[7] T. Chen, H. Li, Q. Yang, and Y. Yu. General functional matrix factorization using gradient boosting. In Proceeding of 30th International Conference on Machine Learning (ICML’13), volume 1, pages 436–444, 2013.<br />
<br />
[8] T. Chen, S. Singh, B. Taskar, and C. Guestrin. Efficient second-order gradient boosting for conditional random fields. In Proceeding of 18th Artificial Intelligence and Statistics Conference (AISTATS’15), volume 1, 2015.<br />
<br />
[9] R.-E. Fan, K.-W. Chang, C.-J. Hsieh, X.-R. Wang, and C.-J. Lin. LIBLINEAR: A library for large linear classification. Journal of Machine Learning Research, 9:1871–1874, 2008.<br />
<br />
[10] J. Friedman. Greedy function approximation: a gradient boosting machine. Annals of Statistics, 29(5):1189–1232, 2001.<br />
<br />
[11] J. Friedman. Stochastic gradient boosting. Computational Statistics & Data Analysis, 38(4):367–378, 2002.<br />
<br />
[12] J. Friedman, T. Hastie, and R. Tibshirani. Additive logistic regression: a statistical view of boosting. Annals of Statistics, 28(2):337–407, 2000.<br />
<br />
[13] J. H. Friedman and B. E. Popescu. Importance sampled learning ensembles, 2003.<br />
<br />
[14] M. Greenwald and S. Khanna. Space-efficient online computation of quantile summaries. In Proceedings of the 2001 ACM SIGMOD International Conference on Management of Data, pages 58–66, 2001.<br />
<br />
[15] X. He, J. Pan, O. Jin, T. Xu, B. Liu, T. Xu, Y. Shi, A. Atallah, R. Herbrich, S. Bowers, and J. Q. n. Candela. Practical lessons from predicting clicks on ads at facebook. In Proceedings of the Eighth International Workshop on Data Mining for Online Advertising, ADKDD’14, 2014.<br />
<br />
[16] P. Li. Robust Logitboost and adaptive base class (ABC) Logitboost. In Proceedings of the Twenty-Sixth Conference Annual Conference on Uncertainty in Artificial Intelligence (UAI’10), pages 302–311, 2010.<br />
<br />
[17] P. Li, Q. Wu, and C. J. Burges. Mcrank: Learning to rank using multiple classification and gradient boosting. In Advances in Neural Information Processing Systems 20, pages 897–904. 2008.<br />
<br />
[18] X. Meng, J. Bradley, B. Yavuz, E. Sparks, S. Venkataraman, D. Liu, J. Freeman, D. Tsai, M. Amde, S. Owen, D. Xin, R. Xin, M. J. Franklin, R. Zadeh, M. Zaharia, and A. Talwalkar. MLlib: Machine learning in apache spark. Journal of Machine Learning Research, 17(34):1–7, 2016.<br />
<br />
[19] B. Panda, J. S. Herbach, S. Basu, and R. J. Bayardo. Planet: Massively parallel learning of tree ensembles with mapreduce. Proceeding of VLDB Endowment, 2(2):1426–1437, Aug. 2009.<br />
<br />
[20] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.<br />
<br />
[21] G. Ridgeway. Generalized Boosted Models: A guide to the gbm package.<br />
<br />
[22] S. Tyree, K. Weinberger, K. Agrawal, and J. Paykin. Parallel boosted regression trees for web search ranking. In Proceedings of the 20th international conference on World wide web, pages 387–396. ACM, 2011.<br />
<br />
[23] J. Ye, J.-H. Chow, J. Chen, and Z. Zheng. Stochastic gradient boosted distributed decision trees. In Proceedings of the 18th ACM Conference on Information and Knowledge Management, CIKM ’09.<br />
<br />
[24] Q. Zhang and W. Wang. A fast algorithm for approximate quantiles in high speed data streams. In Proceedings of the 19th International Conference on Scientific and Statistical Database Management, 2007.<br />
<br />
[25] T. Zhang and R. Johnson. Learning nonlinear functions using regularized greedy forest. IEEE Transactions on Pattern Analysis and Machine Intelligence, 36(5), 2014.</div>Cwlokehttp://wiki.math.uwaterloo.ca/statwiki/index.php?title=XGBoost&diff=51137XGBoost2021-11-29T05:42:16Z<p>Cwloke: /* Approximate Algorithm */</p>
<hr />
<div>== Presented by == <br />
* Chun Waan Loke<br />
* Peter Chong<br />
* Clarice Osmond<br />
* Zhilong Li<br />
<br />
== Introduction ==<br />
<br />
== Tree Boosting In A Nutshell ==<br />
The author reviews gradient tree boosting in this section.<br />
=== Regularized Learning Objective ===<br />
The author first gives the prediction equation (1) and the regularized objective (2).<br><br />
<br><br />
(1) The additive prediction model is given as<br><br />
<math>\hat{y_i}=\sum_{k=1}^{K}f_k(x_i), f_k \in \mathcal{F} </math> <br><br />
where each <math>f_k</math> corresponds to an independent tree structure with its weights, and <math>\mathcal{F}</math> is the "space of regression trees"<br><br />
<br><br />
(2) The regularized objective to be minimized is given as<br><br />
<math>\mathcal{L}=\sum_{i}l(\hat{y_i},y_i)+\sum_k \Omega(f_k)</math> where <math>\Omega(f)=\gamma T+\frac{1}{2}\lambda ||\omega||^2</math> <br><br />
The first term <math>l</math> is a differentiable convex loss function that calculates the measures between <math>\hat{y}</math> and <math>y</math>.<br><br />
The second term <math>\Omega</math> penalizes on the complexity of model (the <math>f_k</math>'s). For a given tree (<math>f_k</math>), <math>T</math> is the number of leaves, and <math>\omega</math> is the leaf weights.<br><br />
The L1 regularization term <math>\gamma T</math> encourages the tree to be small, and the L2 regularization term <math>\frac{1}{2}\lambda ||\omega||^2</math> encourages the tree to have small weights.<br><br />
<br />
=== Gradient Tree Boosting ===<br />
Let <math>\hat{y_i}^{(t)}</math> be the prediction of <math>y_i</math> at the t-th iteration.<br><br />
Since the prediction equation is simply additive, <math>{\hat y_i}^{(t)}=\hat{y_{i}}^{(t-1)}+f_t(x_i)</math><br><br />
Using this equation and 2nd order Taylor approximation on the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> gives <br><br />
\begin{align}<br />
\mathcal{L}^{(t)}&=\sum_{i}^{n}l(y_i,\hat{y_i}^{(t-1)}+f_t(x_i))+\Omega(f_t)\\<br />
&\simeq \sum_{i}^{n}[l(y_i,\hat{y_i}^{(t-1)})+g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
\end{align}<br />
where <math>g_i</math> and <math>h_i</math> are the first and second derivative of the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> with repspect to the term <math>\hat{y}^{(t-1)}</math><br><br />
We can simplify this objective by removing the constant term <math>l(y_i,\hat{y_i}^{(t-1)})</math>.<br><br />
Define <math>I_j=\{i|q(x_i)=j\}</math>, where <math>q</math> is the tree structure. Since every <math>x_i</math> is mapped by <math>q</math> to some leaf <math>j</math>, going through every <math>x_i</math> is equivalent to going through each leaf j of the structure.<br />
\begin{align}<br />
\tilde{\mathcal{L}}^{(t)}&= \sum_{i}^{n}[g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
&= \sum_{j=1}^{T}[(\sum_{i \in I_j}g_i)\omega_j+\frac{1}{2}(\sum_{i \in I_j}h_i+\lambda)\omega_j^2]+\gamma T<br />
\end{align}<br />
Then for a fixed structure <math>q</math>, the optimal weight of leaf <math>j</math> and the optimal objective value are given as<br><br />
\begin{align}<br />
\omega_j^{*} &= -\frac{\sum_{i \in I_j}g_i}{\sum_{i \in I_j}h_i+\lambda}\\<br />
\tilde{\mathcal{L}}^{(t)}(q) &=-\frac{1}{2}\sum_{j=1}^{T}\frac{(\sum_{i \in I_j}g_i)^2}{\sum_{i \in I_j}h_i+\lambda}+\gamma T<br />
\end{align} <br />
[[File:Structure Score Calculation.png|frame|center|alt=Alt text|Structure Score Calculation]]<br />
Instead of enumerating through all possible tree structures q, a greedy algorithm of iteratively adding branches is used.<br><br />
Let <math>I_L</math> and <math>I_R</math> be the instance sets of left and right nodes after split and let <math>I=I_L\cup I_R</math>.<br><br />
The loss reduction after split is given by<br><br />
\begin{align}<br />
\tilde{\mathcal{L}}_{\text{split}} &=\frac{1}{2}[\frac{(\sum_{i \in I_L}g_i)^2}{\sum_{i \in I_L}h_i+\lambda}+\frac{(\sum_{i \in I_R}g_i)^2}{\sum_{i \in I_R}h_i+\lambda}-\frac{(\sum_{i \in I}g_i)^2}{\sum_{i \in I}h_i+\lambda}]+\gamma<br />
\end{align}<br />
=== Shrinkage and Column Subsampling ===<br />
The author also mentioned two other methods in order to avoid over-fitting.<br><br />
(1) Shrinkage. Similar to the learning rate in stochastic optimization, a new weight is added to each tree boosting to reduce the influence of a single tree and leave space for future trees.<br><br />
(2) Column (feature) subsampling. In the paper, the author only mentioned that this technique speeds up parallel algorithm used in later sections.<br />
<br />
== Split Finding Algorithms ==<br />
<br />
It is very important to find the best split for tree learning to perform well. Here are a few split finding algorithms mentioned in the paper:<br />
<br />
=== Basic Exact Greedy Algorithm ===<br />
<br />
The basic exact greedy algorithm is a split finding algorithm that is computationally expensive because it enumerates over all the possible splits for continuous features. It is impossible to be done efficiently when the memory is not enough to hold the data needed. A way to carry out this algorithm efficiently is to sort the data according to feature values and visit the data in order to accumulate the gradient statistics. The algorithm is shown below:<br />
<br />
[[File:algo1xg.png|frame|center|alt=Alt text|Basic Exact Greedy Algorithm]]<br />
<br />
=== Approximate Algorithm ===<br />
<br />
The paper introduced a more efficient algorithm compared to Basic Exact Greedy Algorithm which is the Approximate Algorithm. The Approximate Algorithm first proposes candidate splitting points according to percentiles of feature distribution. It then maps the continuous features into buckets split by candidate points, aggregates the statistics and finds the best solution among proposals based on the aggregated statistics. The algorithm is shown below:<br />
<br />
[[File:algo2xg.png|frame|center|alt=Alt text|Approximate Algorithm]]<br />
<br />
There are also two variants to this algorithm, the global variant proposes all the candidate splits during the initial phase of tree construction and uses the same proposals for split finding at all levels. Whereas, the local variant re-proposes after each split. The global variant usually requires less proposal steps but uses more candidate points than local variant because candidates are not refined after each split. For deeper trees, usage of local variant may be more appropriate as compared to global variant. The figure below shows the a comparison in accuracy between Basic Exact Greedy and Approximate split finding algorithms with different variant over the number of iterations. We can see that the quantile strategy is able to achieve similar accuracy as the Basic Exact Greedy algorithm given a reasonable approximation level.<br />
<br />
[[File:accuracyxg.png|frame|center|alt=Alt text|Comparison of accuracy between different algorithms]]<br />
<br />
=== Weighted Quantile Sketch ===<br />
<br />
Proposing candidate split points is the most important step in the Approximate Algorithm, it is done by using the percentile of a feature to make candidates distribute evenly on a dataset.<br />
<br />
Formally, we have a dataset<br />
<br />
<math>D_k={(x_{1k},h_1),(x_{2k},h_2),...,(x_{nk},h_n)}</math><br />
<br />
where <math> x_i </math>'s are the feature values of each data point and <math> h_i </math>'s represents the weight of the corresponding feature <math> x_i </math>. <br />
<br />
Then, we can use the following rank function to compute <math>r_k(z)</math>, the proportion of instances whose feature value among <math> (x_i,...,x_k) </math> is smaller than data point <math> z </math>.<br />
<br />
<math>r_k(z) = \frac{1}{\sum_{(x,h) \in D_k} h} \displaystyle\sum_{(x,h) \in D_k, x<z} h,</math><br />
<br />
The objective here is to find candidate split points <math>{s_{k1}, s_{k2}, …, s_{kl}}</math>, such that:<br />
<br />
<math>|r_k(s_{k,j}) – r_k(s_{k,j+1})| < \epsilon, s_{k1} = \displaystyle\min_i x_{ik}, s_{kl} = \displaystyle\max_{i} x_{ik}, \forall i</math><br />
<br />
Where <math>\epsilon</math> is an approximation factor. Usually, it should approximately have <math>\frac{1}{\epsilon}</math> splitting points.<br />
<br />
=== Sparsity-aware Split Finding ===<br />
<br />
Typically in real world situation, it is quite common that our dataset is sparse. Some of the possible causes are:<br />
<br />
# Missing values in the data<br />
# Huge amount of zero entries present in the data<br />
# Artifacts of feature engineering (e.g. One-hot encoding)<br />
<br />
In order to solve the sparsity present in the dataset, we suggest to add a default direction in each tree node will classified into when there is a missing value in the matrix of the dataset. This is demonstrated in the figure below:<br />
<br />
[[File:defaultdirection.png|center|alt=Alt text|Default Direction for sparsity]]<br />
<br />
The algorithm below, helps us to calculate the optimal direction to proceed in each branch. Beside that, it also allows user to set a range for the accepted value and neglect the out-of-range value when calculating the score. <br />
<br />
[[File:algo3xg.png|center|alt=Alt text|Sparsity-aware Split Finding Algorithm]]<br />
<br />
== System Design ==<br />
<br />
=== Column Block for Parallel Learning ===<br />
The most time consuming part of tree learning is to get the data into sorted order. To overcome this problem, XGBoost stores the data in blocks where each block performs the sorting operation in parallel. The results are then merged together.<br />
<br />
# For the exact greedy algorithm, XGBoost stores the entire dataset in a single block<br />
#:* Original spase aware algorithm costs: <math>O(Kd∥x∥_0 log(n))</math><br />
#:* Tree boosting on block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(n))</math><br />
#:* Hence, block structure helps to save an additional <math>log(n)</math> factor<br />
# For approximate algorithms, XGBoost stores the dataset in multiple blocks<br />
#:* Original algorithm with binary search costs: <math>O(Kd∥x∥_0 log(q))</math><br />
#:* With block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(B))</math><br />
#:* Hence, block structure helps to save an additional <math>log(q)</math> factor <br />
<br />
K = total number of trees<br /><br />
d = maximum depth of the tree<br /><br />
<math>∥x∥_0</math> = number of non-missing entries in the training data<br /><br />
n = number of rows in the dataset<br /><br />
q = number of proposal candidates in the dataset, usually between 32 to 100<br /><br />
B = maximum number of rows in each block<br />
<br />
[[File: columnblock.png|800px|thumb|center]]<br />
<br />
=== Cache-aware Access ===<br />
The proposed block structure optimizes the computation complexity but requires indirect fetches of gradient statistics by row index. XGBoost optimizes the process by using the following methods.<br />
<br />
# For the exact greedy algorithm, XGBoost uses a cache-aware prefetching algorithm<br />
#:* It stores Gradient and Hessians in the cache to make calculations fast<br />
#:* It runs twice as fast as the naive method when the dataset is large<br />
# For approximate algorithms, XGBoost chooses a specific block size<br />
#:* Choosing a small block size results in inefficient parallelization<br />
#:* Choosing a large block size results in cache misses<br />
#:* Various choices of block size are compared and the results are shown in Figure 9<br />
#:* XGBoost chose <math>2^{16}</math> as the block size<br />
<br />
[[File: blocksize.png|400px|thumb|center]]<br />
<br />
=== Blocks for Out-of-core Computation ===<br />
When the dataset is too large for the cache and main memory, XGBoost utilizes disk spaces as well. Since reading and writing data to the disks are slow, XGBoost optimizes the process by using the following two methods.<br />
<br />
# Block Compression<br />
#:* Blocks are compressed by columns<br />
#:* Although decompressing takes time, it is still faster than reading from the disks<br />
# Block Sharding<br />
#:* If multiple disks are available, data is split into those disks<br />
#:* When the CPU needs data, all the disks can be read at the same time<br />
<br />
== End To End Evaluations ==<br />
=== System Implementation ===<br />
XGBoost is a portable and reusable open-source package. It supports:<br />
* various weighted classification<br />
* various objective functions (rank & user defined)<br />
* popular languages (python, R, Julia)<br />
* data science pipelines (scikit-learn)<br />
* big data stacks (Flink, Spark)<br />
* cloud platform (Tianchi8)<br />
<br />
=== Dataset and Setup ===<br />
<br />
A summary of the 4 datasets used in the experiments is in table 2.<br />
<br />
[[File: table2data.png|500px|thumb|center]]<br />
<br />
The first and last datasets were used specifically to evaluate the impact of sparsity-aware algorithm and the scaling property of the system in the out-of-core and the distributed settings respectively. In all of the experiments, common settings such as maximum depth equal to 8, shrinkage equal to 0.1 and no column subsampling are applied.<br />
<br />
=== Classification ===<br />
A subset (n = 1M) of Higgs Boson dataset was used for classification. The results are shown in Table 3.<br />
<br />
[[File: classification.png|500px|thumb|center]]<br />
<br />
* R’s GBM creates a tree fast by using greedy approach that only expands one branch of a tree but with the cost of lower accuracy<br />
* XGBoost and scikit-learn have better performance than R’s GBM<br />
* XGBoost runs more than 10x faster than scikit-learn in learning a full tree<br />
* Column subsamples give slightly worse performance possibly due to a few important features in this dataset.<br />
<br />
=== Learning to Rank ===<br />
The results in comparing XGBoost with pGBRT are shown in Table 4.<br />
<br />
[[File: rank.png|500px|thumb|center]]<br />
<br />
* XGBoost runs exact greedy algorithm while pGBRT only supports an approximate algorithm<br />
* XGBoost runs faster<br />
* Subsampling column reduces running time and gives higher performance possibly due to preventing overfitting<br />
<br />
=== Out-of-core Experiment ===<br />
An extremely large Criteo dataset was used to evaluate the out-of-core setting. The results are shown in the figure below.<br />
<br />
[[File: outofcore.png|350px|thumb|center]]<br />
<br />
* Compression speed up the computation by a factor of 3<br />
* Sharding into 2 disks further gives 2x speed<br />
<br />
=== Distributed Experiment ===<br />
YARN cluster on EC2 with m3.2xlarge machines was used to evaluate the distributed setting. XGBoost was compared with Spark MLLib and H20.<br />
<br />
* XGBoost can switch to out-of-core setting when the memory runs out, while the baseline systems need to store the data in RAM<br />
* XGBoost runs faster than the baseline systems<br />
* The baseline systems are only able to handle a subset of the data with the given resources while XGBoost was able to scale smoothly to all 1.7B rows<br />
* XGBoost’s performance scales linearly with more machines<br />
* XGBoost is able to handle all 1.7B data with only 4 machines<br />
<br />
== Conclusion ==<br />
<br />
== References ==<br />
[1] R. Bekkerman. The present and the future of the kdd cup competition: an outsider’s perspective. <br />
<br />
[2] R. Bekkerman, M. Bilenko, and J. Langford. Scaling Up Machine Learning: Parallel and Distributed Approaches. Cambridge University Press, New York, NY, USA, 2011. <br />
<br />
[3] J. Bennett and S. Lanning. The netflix prize. In Proceedings of the KDD Cup Workshop 2007, pages 3–6, New York, Aug. 2007.<br />
<br />
[4] L. Breiman. Random forests. Maching Learning, 45(1):5–32, Oct. 2001.<br />
<br />
[5] C. Burges. From ranknet to lambdarank to lambdamart: An overview. Learning, 11:23–581, 2010.<br />
<br />
[6] O. Chapelle and Y. Chang. Yahoo! Learning to Rank Challenge Overview. Journal of Machine Learning Research - W & CP, 14:1–24, 2011.<br />
<br />
[7] T. Chen, H. Li, Q. Yang, and Y. Yu. General functional matrix factorization using gradient boosting. In Proceeding of 30th International Conference on Machine Learning (ICML’13), volume 1, pages 436–444, 2013.<br />
<br />
[8] T. Chen, S. Singh, B. Taskar, and C. Guestrin. Efficient second-order gradient boosting for conditional random fields. In Proceeding of 18th Artificial Intelligence and Statistics Conference (AISTATS’15), volume 1, 2015.<br />
<br />
[9] R.-E. Fan, K.-W. Chang, C.-J. Hsieh, X.-R. Wang, and C.-J. Lin. LIBLINEAR: A library for large linear classification. Journal of Machine Learning Research, 9:1871–1874, 2008.<br />
<br />
[10] J. Friedman. Greedy function approximation: a gradient boosting machine. Annals of Statistics, 29(5):1189–1232, 2001.<br />
<br />
[11] J. Friedman. Stochastic gradient boosting. Computational Statistics & Data Analysis, 38(4):367–378, 2002.<br />
<br />
[12] J. Friedman, T. Hastie, and R. Tibshirani. Additive logistic regression: a statistical view of boosting. Annals of Statistics, 28(2):337–407, 2000.<br />
<br />
[13] J. H. Friedman and B. E. Popescu. Importance sampled learning ensembles, 2003.<br />
<br />
[14] M. Greenwald and S. Khanna. Space-efficient online computation of quantile summaries. In Proceedings of the 2001 ACM SIGMOD International Conference on Management of Data, pages 58–66, 2001.<br />
<br />
[15] X. He, J. Pan, O. Jin, T. Xu, B. Liu, T. Xu, Y. Shi, A. Atallah, R. Herbrich, S. Bowers, and J. Q. n. Candela. Practical lessons from predicting clicks on ads at facebook. In Proceedings of the Eighth International Workshop on Data Mining for Online Advertising, ADKDD’14, 2014.<br />
<br />
[16] P. Li. Robust Logitboost and adaptive base class (ABC) Logitboost. In Proceedings of the Twenty-Sixth Conference Annual Conference on Uncertainty in Artificial Intelligence (UAI’10), pages 302–311, 2010.<br />
<br />
[17] P. Li, Q. Wu, and C. J. Burges. Mcrank: Learning to rank using multiple classification and gradient boosting. In Advances in Neural Information Processing Systems 20, pages 897–904. 2008.<br />
<br />
[18] X. Meng, J. Bradley, B. Yavuz, E. Sparks, S. Venkataraman, D. Liu, J. Freeman, D. Tsai, M. Amde, S. Owen, D. Xin, R. Xin, M. J. Franklin, R. Zadeh, M. Zaharia, and A. Talwalkar. MLlib: Machine learning in apache spark. Journal of Machine Learning Research, 17(34):1–7, 2016.<br />
<br />
[19] B. Panda, J. S. Herbach, S. Basu, and R. J. Bayardo. Planet: Massively parallel learning of tree ensembles with mapreduce. Proceeding of VLDB Endowment, 2(2):1426–1437, Aug. 2009.<br />
<br />
[20] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.<br />
<br />
[21] G. Ridgeway. Generalized Boosted Models: A guide to the gbm package.<br />
<br />
[22] S. Tyree, K. Weinberger, K. Agrawal, and J. Paykin. Parallel boosted regression trees for web search ranking. In Proceedings of the 20th international conference on World wide web, pages 387–396. ACM, 2011.<br />
<br />
[23] J. Ye, J.-H. Chow, J. Chen, and Z. Zheng. Stochastic gradient boosted distributed decision trees. In Proceedings of the 18th ACM Conference on Information and Knowledge Management, CIKM ’09.<br />
<br />
[24] Q. Zhang and W. Wang. A fast algorithm for approximate quantiles in high speed data streams. In Proceedings of the 19th International Conference on Scientific and Statistical Database Management, 2007.<br />
<br />
[25] T. Zhang and R. Johnson. Learning nonlinear functions using regularized greedy forest. IEEE Transactions on Pattern Analysis and Machine Intelligence, 36(5), 2014.</div>Cwlokehttp://wiki.math.uwaterloo.ca/statwiki/index.php?title=XGBoost&diff=51136XGBoost2021-11-29T05:42:04Z<p>Cwloke: /* Basic Exact Greedy Algorithm */</p>
<hr />
<div>== Presented by == <br />
* Chun Waan Loke<br />
* Peter Chong<br />
* Clarice Osmond<br />
* Zhilong Li<br />
<br />
== Introduction ==<br />
<br />
== Tree Boosting In A Nutshell ==<br />
The author reviews gradient tree boosting in this section.<br />
=== Regularized Learning Objective ===<br />
The author first gives the prediction equation (1) and the regularized objective (2).<br><br />
<br><br />
(1) The additive prediction model is given as<br><br />
<math>\hat{y_i}=\sum_{k=1}^{K}f_k(x_i), f_k \in \mathcal{F} </math> <br><br />
where each <math>f_k</math> corresponds to an independent tree structure with its weights, and <math>\mathcal{F}</math> is the "space of regression trees"<br><br />
<br><br />
(2) The regularized objective to be minimized is given as<br><br />
<math>\mathcal{L}=\sum_{i}l(\hat{y_i},y_i)+\sum_k \Omega(f_k)</math> where <math>\Omega(f)=\gamma T+\frac{1}{2}\lambda ||\omega||^2</math> <br><br />
The first term <math>l</math> is a differentiable convex loss function that calculates the measures between <math>\hat{y}</math> and <math>y</math>.<br><br />
The second term <math>\Omega</math> penalizes on the complexity of model (the <math>f_k</math>'s). For a given tree (<math>f_k</math>), <math>T</math> is the number of leaves, and <math>\omega</math> is the leaf weights.<br><br />
The L1 regularization term <math>\gamma T</math> encourages the tree to be small, and the L2 regularization term <math>\frac{1}{2}\lambda ||\omega||^2</math> encourages the tree to have small weights.<br><br />
<br />
=== Gradient Tree Boosting ===<br />
Let <math>\hat{y_i}^{(t)}</math> be the prediction of <math>y_i</math> at the t-th iteration.<br><br />
Since the prediction equation is simply additive, <math>{\hat y_i}^{(t)}=\hat{y_{i}}^{(t-1)}+f_t(x_i)</math><br><br />
Using this equation and 2nd order Taylor approximation on the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> gives <br><br />
\begin{align}<br />
\mathcal{L}^{(t)}&=\sum_{i}^{n}l(y_i,\hat{y_i}^{(t-1)}+f_t(x_i))+\Omega(f_t)\\<br />
&\simeq \sum_{i}^{n}[l(y_i,\hat{y_i}^{(t-1)})+g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
\end{align}<br />
where <math>g_i</math> and <math>h_i</math> are the first and second derivative of the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> with repspect to the term <math>\hat{y}^{(t-1)}</math><br><br />
We can simplify this objective by removing the constant term <math>l(y_i,\hat{y_i}^{(t-1)})</math>.<br><br />
Define <math>I_j=\{i|q(x_i)=j\}</math>, where <math>q</math> is the tree structure. Since every <math>x_i</math> is mapped by <math>q</math> to some leaf <math>j</math>, going through every <math>x_i</math> is equivalent to going through each leaf j of the structure.<br />
\begin{align}<br />
\tilde{\mathcal{L}}^{(t)}&= \sum_{i}^{n}[g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
&= \sum_{j=1}^{T}[(\sum_{i \in I_j}g_i)\omega_j+\frac{1}{2}(\sum_{i \in I_j}h_i+\lambda)\omega_j^2]+\gamma T<br />
\end{align}<br />
Then for a fixed structure <math>q</math>, the optimal weight of leaf <math>j</math> and the optimal objective value are given as<br><br />
\begin{align}<br />
\omega_j^{*} &= -\frac{\sum_{i \in I_j}g_i}{\sum_{i \in I_j}h_i+\lambda}\\<br />
\tilde{\mathcal{L}}^{(t)}(q) &=-\frac{1}{2}\sum_{j=1}^{T}\frac{(\sum_{i \in I_j}g_i)^2}{\sum_{i \in I_j}h_i+\lambda}+\gamma T<br />
\end{align} <br />
[[File:Structure Score Calculation.png|frame|center|alt=Alt text|Structure Score Calculation]]<br />
Instead of enumerating through all possible tree structures q, a greedy algorithm of iteratively adding branches is used.<br><br />
Let <math>I_L</math> and <math>I_R</math> be the instance sets of left and right nodes after split and let <math>I=I_L\cup I_R</math>.<br><br />
The loss reduction after split is given by<br><br />
\begin{align}<br />
\tilde{\mathcal{L}}_{\text{split}} &=\frac{1}{2}[\frac{(\sum_{i \in I_L}g_i)^2}{\sum_{i \in I_L}h_i+\lambda}+\frac{(\sum_{i \in I_R}g_i)^2}{\sum_{i \in I_R}h_i+\lambda}-\frac{(\sum_{i \in I}g_i)^2}{\sum_{i \in I}h_i+\lambda}]+\gamma<br />
\end{align}<br />
=== Shrinkage and Column Subsampling ===<br />
The author also mentioned two other methods in order to avoid over-fitting.<br><br />
(1) Shrinkage. Similar to the learning rate in stochastic optimization, a new weight is added to each tree boosting to reduce the influence of a single tree and leave space for future trees.<br><br />
(2) Column (feature) subsampling. In the paper, the author only mentioned that this technique speeds up parallel algorithm used in later sections.<br />
<br />
== Split Finding Algorithms ==<br />
<br />
It is very important to find the best split for tree learning to perform well. Here are a few split finding algorithms mentioned in the paper:<br />
<br />
=== Basic Exact Greedy Algorithm ===<br />
<br />
The basic exact greedy algorithm is a split finding algorithm that is computationally expensive because it enumerates over all the possible splits for continuous features. It is impossible to be done efficiently when the memory is not enough to hold the data needed. A way to carry out this algorithm efficiently is to sort the data according to feature values and visit the data in order to accumulate the gradient statistics. The algorithm is shown below:<br />
<br />
[[File:algo1xg.png|frame|center|alt=Alt text|Basic Exact Greedy Algorithm]]<br />
<br />
=== Approximate Algorithm ===<br />
<br />
The paper introduced a more efficient algorithm compared to Basic Exact Greedy Algorithm which is the Approximate Algorithm. The Approximate Algorithm first proposes candidate splitting points according to percentiles of feature distribution. It then maps the continuous features into buckets split by candidate points, aggregates the statistics and finds the best solution among proposals based on the aggregated statistics. The algorithm is shown below:<br />
<br />
[[File:algo2xg.png|center|alt=Alt text|Approximate Algorithm]]<br />
<br />
There are also two variants to this algorithm, the global variant proposes all the candidate splits during the initial phase of tree construction and uses the same proposals for split finding at all levels. Whereas, the local variant re-proposes after each split. The global variant usually requires less proposal steps but uses more candidate points than local variant because candidates are not refined after each split. For deeper trees, usage of local variant may be more appropriate as compared to global variant. The figure below shows the a comparison in accuracy between Basic Exact Greedy and Approximate split finding algorithms with different variant over the number of iterations. We can see that the quantile strategy is able to achieve similar accuracy as the Basic Exact Greedy algorithm given a reasonable approximation level.<br />
<br />
[[File:accuracyxg.png|center|alt=Alt text|Comparison of accuracy between different algorithms]]<br />
<br />
=== Weighted Quantile Sketch ===<br />
<br />
Proposing candidate split points is the most important step in the Approximate Algorithm, it is done by using the percentile of a feature to make candidates distribute evenly on a dataset.<br />
<br />
Formally, we have a dataset<br />
<br />
<math>D_k={(x_{1k},h_1),(x_{2k},h_2),...,(x_{nk},h_n)}</math><br />
<br />
where <math> x_i </math>'s are the feature values of each data point and <math> h_i </math>'s represents the weight of the corresponding feature <math> x_i </math>. <br />
<br />
Then, we can use the following rank function to compute <math>r_k(z)</math>, the proportion of instances whose feature value among <math> (x_i,...,x_k) </math> is smaller than data point <math> z </math>.<br />
<br />
<math>r_k(z) = \frac{1}{\sum_{(x,h) \in D_k} h} \displaystyle\sum_{(x,h) \in D_k, x<z} h,</math><br />
<br />
The objective here is to find candidate split points <math>{s_{k1}, s_{k2}, …, s_{kl}}</math>, such that:<br />
<br />
<math>|r_k(s_{k,j}) – r_k(s_{k,j+1})| < \epsilon, s_{k1} = \displaystyle\min_i x_{ik}, s_{kl} = \displaystyle\max_{i} x_{ik}, \forall i</math><br />
<br />
Where <math>\epsilon</math> is an approximation factor. Usually, it should approximately have <math>\frac{1}{\epsilon}</math> splitting points.<br />
<br />
=== Sparsity-aware Split Finding ===<br />
<br />
Typically in real world situation, it is quite common that our dataset is sparse. Some of the possible causes are:<br />
<br />
# Missing values in the data<br />
# Huge amount of zero entries present in the data<br />
# Artifacts of feature engineering (e.g. One-hot encoding)<br />
<br />
In order to solve the sparsity present in the dataset, we suggest to add a default direction in each tree node will classified into when there is a missing value in the matrix of the dataset. This is demonstrated in the figure below:<br />
<br />
[[File:defaultdirection.png|center|alt=Alt text|Default Direction for sparsity]]<br />
<br />
The algorithm below, helps us to calculate the optimal direction to proceed in each branch. Beside that, it also allows user to set a range for the accepted value and neglect the out-of-range value when calculating the score. <br />
<br />
[[File:algo3xg.png|center|alt=Alt text|Sparsity-aware Split Finding Algorithm]]<br />
<br />
== System Design ==<br />
<br />
=== Column Block for Parallel Learning ===<br />
The most time consuming part of tree learning is to get the data into sorted order. To overcome this problem, XGBoost stores the data in blocks where each block performs the sorting operation in parallel. The results are then merged together.<br />
<br />
# For the exact greedy algorithm, XGBoost stores the entire dataset in a single block<br />
#:* Original spase aware algorithm costs: <math>O(Kd∥x∥_0 log(n))</math><br />
#:* Tree boosting on block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(n))</math><br />
#:* Hence, block structure helps to save an additional <math>log(n)</math> factor<br />
# For approximate algorithms, XGBoost stores the dataset in multiple blocks<br />
#:* Original algorithm with binary search costs: <math>O(Kd∥x∥_0 log(q))</math><br />
#:* With block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(B))</math><br />
#:* Hence, block structure helps to save an additional <math>log(q)</math> factor <br />
<br />
K = total number of trees<br /><br />
d = maximum depth of the tree<br /><br />
<math>∥x∥_0</math> = number of non-missing entries in the training data<br /><br />
n = number of rows in the dataset<br /><br />
q = number of proposal candidates in the dataset, usually between 32 to 100<br /><br />
B = maximum number of rows in each block<br />
<br />
[[File: columnblock.png|800px|thumb|center]]<br />
<br />
=== Cache-aware Access ===<br />
The proposed block structure optimizes the computation complexity but requires indirect fetches of gradient statistics by row index. XGBoost optimizes the process by using the following methods.<br />
<br />
# For the exact greedy algorithm, XGBoost uses a cache-aware prefetching algorithm<br />
#:* It stores Gradient and Hessians in the cache to make calculations fast<br />
#:* It runs twice as fast as the naive method when the dataset is large<br />
# For approximate algorithms, XGBoost chooses a specific block size<br />
#:* Choosing a small block size results in inefficient parallelization<br />
#:* Choosing a large block size results in cache misses<br />
#:* Various choices of block size are compared and the results are shown in Figure 9<br />
#:* XGBoost chose <math>2^{16}</math> as the block size<br />
<br />
[[File: blocksize.png|400px|thumb|center]]<br />
<br />
=== Blocks for Out-of-core Computation ===<br />
When the dataset is too large for the cache and main memory, XGBoost utilizes disk spaces as well. Since reading and writing data to the disks are slow, XGBoost optimizes the process by using the following two methods.<br />
<br />
# Block Compression<br />
#:* Blocks are compressed by columns<br />
#:* Although decompressing takes time, it is still faster than reading from the disks<br />
# Block Sharding<br />
#:* If multiple disks are available, data is split into those disks<br />
#:* When the CPU needs data, all the disks can be read at the same time<br />
<br />
== End To End Evaluations ==<br />
=== System Implementation ===<br />
XGBoost is a portable and reusable open-source package. It supports:<br />
* various weighted classification<br />
* various objective functions (rank & user defined)<br />
* popular languages (python, R, Julia)<br />
* data science pipelines (scikit-learn)<br />
* big data stacks (Flink, Spark)<br />
* cloud platform (Tianchi8)<br />
<br />
=== Dataset and Setup ===<br />
<br />
A summary of the 4 datasets used in the experiments is in table 2.<br />
<br />
[[File: table2data.png|500px|thumb|center]]<br />
<br />
The first and last datasets were used specifically to evaluate the impact of sparsity-aware algorithm and the scaling property of the system in the out-of-core and the distributed settings respectively. In all of the experiments, common settings such as maximum depth equal to 8, shrinkage equal to 0.1 and no column subsampling are applied.<br />
<br />
=== Classification ===<br />
A subset (n = 1M) of Higgs Boson dataset was used for classification. The results are shown in Table 3.<br />
<br />
[[File: classification.png|500px|thumb|center]]<br />
<br />
* R’s GBM creates a tree fast by using greedy approach that only expands one branch of a tree but with the cost of lower accuracy<br />
* XGBoost and scikit-learn have better performance than R’s GBM<br />
* XGBoost runs more than 10x faster than scikit-learn in learning a full tree<br />
* Column subsamples give slightly worse performance possibly due to a few important features in this dataset.<br />
<br />
=== Learning to Rank ===<br />
The results in comparing XGBoost with pGBRT are shown in Table 4.<br />
<br />
[[File: rank.png|500px|thumb|center]]<br />
<br />
* XGBoost runs exact greedy algorithm while pGBRT only supports an approximate algorithm<br />
* XGBoost runs faster<br />
* Subsampling column reduces running time and gives higher performance possibly due to preventing overfitting<br />
<br />
=== Out-of-core Experiment ===<br />
An extremely large Criteo dataset was used to evaluate the out-of-core setting. The results are shown in the figure below.<br />
<br />
[[File: outofcore.png|350px|thumb|center]]<br />
<br />
* Compression speed up the computation by a factor of 3<br />
* Sharding into 2 disks further gives 2x speed<br />
<br />
=== Distributed Experiment ===<br />
YARN cluster on EC2 with m3.2xlarge machines was used to evaluate the distributed setting. XGBoost was compared with Spark MLLib and H20.<br />
<br />
* XGBoost can switch to out-of-core setting when the memory runs out, while the baseline systems need to store the data in RAM<br />
* XGBoost runs faster than the baseline systems<br />
* The baseline systems are only able to handle a subset of the data with the given resources while XGBoost was able to scale smoothly to all 1.7B rows<br />
* XGBoost’s performance scales linearly with more machines<br />
* XGBoost is able to handle all 1.7B data with only 4 machines<br />
<br />
== Conclusion ==<br />
<br />
== References ==<br />
[1] R. Bekkerman. The present and the future of the kdd cup competition: an outsider’s perspective. <br />
<br />
[2] R. Bekkerman, M. Bilenko, and J. Langford. Scaling Up Machine Learning: Parallel and Distributed Approaches. Cambridge University Press, New York, NY, USA, 2011. <br />
<br />
[3] J. Bennett and S. Lanning. The netflix prize. In Proceedings of the KDD Cup Workshop 2007, pages 3–6, New York, Aug. 2007.<br />
<br />
[4] L. Breiman. Random forests. Maching Learning, 45(1):5–32, Oct. 2001.<br />
<br />
[5] C. Burges. From ranknet to lambdarank to lambdamart: An overview. Learning, 11:23–581, 2010.<br />
<br />
[6] O. Chapelle and Y. Chang. Yahoo! Learning to Rank Challenge Overview. Journal of Machine Learning Research - W & CP, 14:1–24, 2011.<br />
<br />
[7] T. Chen, H. Li, Q. Yang, and Y. Yu. General functional matrix factorization using gradient boosting. In Proceeding of 30th International Conference on Machine Learning (ICML’13), volume 1, pages 436–444, 2013.<br />
<br />
[8] T. Chen, S. Singh, B. Taskar, and C. Guestrin. Efficient second-order gradient boosting for conditional random fields. In Proceeding of 18th Artificial Intelligence and Statistics Conference (AISTATS’15), volume 1, 2015.<br />
<br />
[9] R.-E. Fan, K.-W. Chang, C.-J. Hsieh, X.-R. Wang, and C.-J. Lin. LIBLINEAR: A library for large linear classification. Journal of Machine Learning Research, 9:1871–1874, 2008.<br />
<br />
[10] J. Friedman. Greedy function approximation: a gradient boosting machine. Annals of Statistics, 29(5):1189–1232, 2001.<br />
<br />
[11] J. Friedman. Stochastic gradient boosting. Computational Statistics & Data Analysis, 38(4):367–378, 2002.<br />
<br />
[12] J. Friedman, T. Hastie, and R. Tibshirani. Additive logistic regression: a statistical view of boosting. Annals of Statistics, 28(2):337–407, 2000.<br />
<br />
[13] J. H. Friedman and B. E. Popescu. Importance sampled learning ensembles, 2003.<br />
<br />
[14] M. Greenwald and S. Khanna. Space-efficient online computation of quantile summaries. In Proceedings of the 2001 ACM SIGMOD International Conference on Management of Data, pages 58–66, 2001.<br />
<br />
[15] X. He, J. Pan, O. Jin, T. Xu, B. Liu, T. Xu, Y. Shi, A. Atallah, R. Herbrich, S. Bowers, and J. Q. n. Candela. Practical lessons from predicting clicks on ads at facebook. In Proceedings of the Eighth International Workshop on Data Mining for Online Advertising, ADKDD’14, 2014.<br />
<br />
[16] P. Li. Robust Logitboost and adaptive base class (ABC) Logitboost. In Proceedings of the Twenty-Sixth Conference Annual Conference on Uncertainty in Artificial Intelligence (UAI’10), pages 302–311, 2010.<br />
<br />
[17] P. Li, Q. Wu, and C. J. Burges. Mcrank: Learning to rank using multiple classification and gradient boosting. In Advances in Neural Information Processing Systems 20, pages 897–904. 2008.<br />
<br />
[18] X. Meng, J. Bradley, B. Yavuz, E. Sparks, S. Venkataraman, D. Liu, J. Freeman, D. Tsai, M. Amde, S. Owen, D. Xin, R. Xin, M. J. Franklin, R. Zadeh, M. Zaharia, and A. Talwalkar. MLlib: Machine learning in apache spark. Journal of Machine Learning Research, 17(34):1–7, 2016.<br />
<br />
[19] B. Panda, J. S. Herbach, S. Basu, and R. J. Bayardo. Planet: Massively parallel learning of tree ensembles with mapreduce. Proceeding of VLDB Endowment, 2(2):1426–1437, Aug. 2009.<br />
<br />
[20] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.<br />
<br />
[21] G. Ridgeway. Generalized Boosted Models: A guide to the gbm package.<br />
<br />
[22] S. Tyree, K. Weinberger, K. Agrawal, and J. Paykin. Parallel boosted regression trees for web search ranking. In Proceedings of the 20th international conference on World wide web, pages 387–396. ACM, 2011.<br />
<br />
[23] J. Ye, J.-H. Chow, J. Chen, and Z. Zheng. Stochastic gradient boosted distributed decision trees. In Proceedings of the 18th ACM Conference on Information and Knowledge Management, CIKM ’09.<br />
<br />
[24] Q. Zhang and W. Wang. A fast algorithm for approximate quantiles in high speed data streams. In Proceedings of the 19th International Conference on Scientific and Statistical Database Management, 2007.<br />
<br />
[25] T. Zhang and R. Johnson. Learning nonlinear functions using regularized greedy forest. IEEE Transactions on Pattern Analysis and Machine Intelligence, 36(5), 2014.</div>Cwlokehttp://wiki.math.uwaterloo.ca/statwiki/index.php?title=XGBoost&diff=51135XGBoost2021-11-29T05:39:26Z<p>Cwloke: /* Sparsity-aware Split Finding */</p>
<hr />
<div>== Presented by == <br />
* Chun Waan Loke<br />
* Peter Chong<br />
* Clarice Osmond<br />
* Zhilong Li<br />
<br />
== Introduction ==<br />
<br />
== Tree Boosting In A Nutshell ==<br />
The author reviews gradient tree boosting in this section.<br />
=== Regularized Learning Objective ===<br />
The author first gives the prediction equation (1) and the regularized objective (2).<br><br />
<br><br />
(1) The additive prediction model is given as<br><br />
<math>\hat{y_i}=\sum_{k=1}^{K}f_k(x_i), f_k \in \mathcal{F} </math> <br><br />
where each <math>f_k</math> corresponds to an independent tree structure with its weights, and <math>\mathcal{F}</math> is the "space of regression trees"<br><br />
<br><br />
(2) The regularized objective to be minimized is given as<br><br />
<math>\mathcal{L}=\sum_{i}l(\hat{y_i},y_i)+\sum_k \Omega(f_k)</math> where <math>\Omega(f)=\gamma T+\frac{1}{2}\lambda ||\omega||^2</math> <br><br />
The first term <math>l</math> is a differentiable convex loss function that calculates the measures between <math>\hat{y}</math> and <math>y</math>.<br><br />
The second term <math>\Omega</math> penalizes on the complexity of model (the <math>f_k</math>'s). For a given tree (<math>f_k</math>), <math>T</math> is the number of leaves, and <math>\omega</math> is the leaf weights.<br><br />
The L1 regularization term <math>\gamma T</math> encourages the tree to be small, and the L2 regularization term <math>\frac{1}{2}\lambda ||\omega||^2</math> encourages the tree to have small weights.<br><br />
<br />
=== Gradient Tree Boosting ===<br />
Let <math>\hat{y_i}^{(t)}</math> be the prediction of <math>y_i</math> at the t-th iteration.<br><br />
Since the prediction equation is simply additive, <math>{\hat y_i}^{(t)}=\hat{y_{i}}^{(t-1)}+f_t(x_i)</math><br><br />
Using this equation and 2nd order Taylor approximation on the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> gives <br><br />
\begin{align}<br />
\mathcal{L}^{(t)}&=\sum_{i}^{n}l(y_i,\hat{y_i}^{(t-1)}+f_t(x_i))+\Omega(f_t)\\<br />
&\simeq \sum_{i}^{n}[l(y_i,\hat{y_i}^{(t-1)})+g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
\end{align}<br />
where <math>g_i</math> and <math>h_i</math> are the first and second derivative of the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> with repspect to the term <math>\hat{y}^{(t-1)}</math><br><br />
We can simplify this objective by removing the constant term <math>l(y_i,\hat{y_i}^{(t-1)})</math>.<br><br />
Define <math>I_j=\{i|q(x_i)=j\}</math>, where <math>q</math> is the tree structure. Since every <math>x_i</math> is mapped by <math>q</math> to some leaf <math>j</math>, going through every <math>x_i</math> is equivalent to going through each leaf j of the structure.<br />
\begin{align}<br />
\tilde{\mathcal{L}}^{(t)}&= \sum_{i}^{n}[g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
&= \sum_{j=1}^{T}[(\sum_{i \in I_j}g_i)\omega_j+\frac{1}{2}(\sum_{i \in I_j}h_i+\lambda)\omega_j^2]+\gamma T<br />
\end{align}<br />
Then for a fixed structure <math>q</math>, the optimal weight of leaf <math>j</math> and the optimal objective value are given as<br><br />
\begin{align}<br />
\omega_j^{*} &= -\frac{\sum_{i \in I_j}g_i}{\sum_{i \in I_j}h_i+\lambda}\\<br />
\tilde{\mathcal{L}}^{(t)}(q) &=-\frac{1}{2}\sum_{j=1}^{T}\frac{(\sum_{i \in I_j}g_i)^2}{\sum_{i \in I_j}h_i+\lambda}+\gamma T<br />
\end{align} <br />
[[File:Structure Score Calculation.png|frame|center|alt=Alt text|Structure Score Calculation]]<br />
Instead of enumerating through all possible tree structures q, a greedy algorithm of iteratively adding branches is used.<br><br />
Let <math>I_L</math> and <math>I_R</math> be the instance sets of left and right nodes after split and let <math>I=I_L\cup I_R</math>.<br><br />
The loss reduction after split is given by<br><br />
\begin{align}<br />
\tilde{\mathcal{L}}_{\text{split}} &=\frac{1}{2}[\frac{(\sum_{i \in I_L}g_i)^2}{\sum_{i \in I_L}h_i+\lambda}+\frac{(\sum_{i \in I_R}g_i)^2}{\sum_{i \in I_R}h_i+\lambda}-\frac{(\sum_{i \in I}g_i)^2}{\sum_{i \in I}h_i+\lambda}]+\gamma<br />
\end{align}<br />
=== Shrinkage and Column Subsampling ===<br />
The author also mentioned two other methods in order to avoid over-fitting.<br><br />
(1) Shrinkage. Similar to the learning rate in stochastic optimization, a new weight is added to each tree boosting to reduce the influence of a single tree and leave space for future trees.<br><br />
(2) Column (feature) subsampling. In the paper, the author only mentioned that this technique speeds up parallel algorithm used in later sections.<br />
<br />
== Split Finding Algorithms ==<br />
<br />
It is very important to find the best split for tree learning to perform well. Here are a few split finding algorithms mentioned in the paper:<br />
<br />
=== Basic Exact Greedy Algorithm ===<br />
<br />
The basic exact greedy algorithm is a split finding algorithm that is computationally expensive because it enumerates over all the possible splits for continuous features. It is impossible to be done efficiently when the memory is not enough to hold the data needed. A way to carry out this algorithm efficiently is to sort the data according to feature values and visit the data in order to accumulate the gradient statistics. The algorithm is shown below:<br />
<br />
[[File:algo1xg.png|center|alt=Alt text|Basic Exact Greedy Algorithm]]<br />
<br />
=== Approximate Algorithm ===<br />
<br />
The paper introduced a more efficient algorithm compared to Basic Exact Greedy Algorithm which is the Approximate Algorithm. The Approximate Algorithm first proposes candidate splitting points according to percentiles of feature distribution. It then maps the continuous features into buckets split by candidate points, aggregates the statistics and finds the best solution among proposals based on the aggregated statistics. The algorithm is shown below:<br />
<br />
[[File:algo2xg.png|center|alt=Alt text|Approximate Algorithm]]<br />
<br />
There are also two variants to this algorithm, the global variant proposes all the candidate splits during the initial phase of tree construction and uses the same proposals for split finding at all levels. Whereas, the local variant re-proposes after each split. The global variant usually requires less proposal steps but uses more candidate points than local variant because candidates are not refined after each split. For deeper trees, usage of local variant may be more appropriate as compared to global variant. The figure below shows the a comparison in accuracy between Basic Exact Greedy and Approximate split finding algorithms with different variant over the number of iterations. We can see that the quantile strategy is able to achieve similar accuracy as the Basic Exact Greedy algorithm given a reasonable approximation level.<br />
<br />
[[File:accuracyxg.png|center|alt=Alt text|Comparison of accuracy between different algorithms]]<br />
<br />
=== Weighted Quantile Sketch ===<br />
<br />
Proposing candidate split points is the most important step in the Approximate Algorithm, it is done by using the percentile of a feature to make candidates distribute evenly on a dataset.<br />
<br />
Formally, we have a dataset<br />
<br />
<math>D_k={(x_{1k},h_1),(x_{2k},h_2),...,(x_{nk},h_n)}</math><br />
<br />
where <math> x_i </math>'s are the feature values of each data point and <math> h_i </math>'s represents the weight of the corresponding feature <math> x_i </math>. <br />
<br />
Then, we can use the following rank function to compute <math>r_k(z)</math>, the proportion of instances whose feature value among <math> (x_i,...,x_k) </math> is smaller than data point <math> z </math>.<br />
<br />
<math>r_k(z) = \frac{1}{\sum_{(x,h) \in D_k} h} \displaystyle\sum_{(x,h) \in D_k, x<z} h,</math><br />
<br />
The objective here is to find candidate split points <math>{s_{k1}, s_{k2}, …, s_{kl}}</math>, such that:<br />
<br />
<math>|r_k(s_{k,j}) – r_k(s_{k,j+1})| < \epsilon, s_{k1} = \displaystyle\min_i x_{ik}, s_{kl} = \displaystyle\max_{i} x_{ik}, \forall i</math><br />
<br />
Where <math>\epsilon</math> is an approximation factor. Usually, it should approximately have <math>\frac{1}{\epsilon}</math> splitting points.<br />
<br />
=== Sparsity-aware Split Finding ===<br />
<br />
Typically in real world situation, it is quite common that our dataset is sparse. Some of the possible causes are:<br />
<br />
# Missing values in the data<br />
# Huge amount of zero entries present in the data<br />
# Artifacts of feature engineering (e.g. One-hot encoding)<br />
<br />
In order to solve the sparsity present in the dataset, we suggest to add a default direction in each tree node will classified into when there is a missing value in the matrix of the dataset. This is demonstrated in the figure below:<br />
<br />
[[File:defaultdirection.png|center|alt=Alt text|Default Direction for sparsity]]<br />
<br />
The algorithm below, helps us to calculate the optimal direction to proceed in each branch. Beside that, it also allows user to set a range for the accepted value and neglect the out-of-range value when calculating the score. <br />
<br />
[[File:algo3xg.png|center|alt=Alt text|Sparsity-aware Split Finding Algorithm]]<br />
<br />
== System Design ==<br />
<br />
=== Column Block for Parallel Learning ===<br />
The most time consuming part of tree learning is to get the data into sorted order. To overcome this problem, XGBoost stores the data in blocks where each block performs the sorting operation in parallel. The results are then merged together.<br />
<br />
# For the exact greedy algorithm, XGBoost stores the entire dataset in a single block<br />
#:* Original spase aware algorithm costs: <math>O(Kd∥x∥_0 log(n))</math><br />
#:* Tree boosting on block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(n))</math><br />
#:* Hence, block structure helps to save an additional <math>log(n)</math> factor<br />
# For approximate algorithms, XGBoost stores the dataset in multiple blocks<br />
#:* Original algorithm with binary search costs: <math>O(Kd∥x∥_0 log(q))</math><br />
#:* With block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(B))</math><br />
#:* Hence, block structure helps to save an additional <math>log(q)</math> factor <br />
<br />
K = total number of trees<br /><br />
d = maximum depth of the tree<br /><br />
<math>∥x∥_0</math> = number of non-missing entries in the training data<br /><br />
n = number of rows in the dataset<br /><br />
q = number of proposal candidates in the dataset, usually between 32 to 100<br /><br />
B = maximum number of rows in each block<br />
<br />
[[File: columnblock.png|800px|thumb|center]]<br />
<br />
=== Cache-aware Access ===<br />
The proposed block structure optimizes the computation complexity but requires indirect fetches of gradient statistics by row index. XGBoost optimizes the process by using the following methods.<br />
<br />
# For the exact greedy algorithm, XGBoost uses a cache-aware prefetching algorithm<br />
#:* It stores Gradient and Hessians in the cache to make calculations fast<br />
#:* It runs twice as fast as the naive method when the dataset is large<br />
# For approximate algorithms, XGBoost chooses a specific block size<br />
#:* Choosing a small block size results in inefficient parallelization<br />
#:* Choosing a large block size results in cache misses<br />
#:* Various choices of block size are compared and the results are shown in Figure 9<br />
#:* XGBoost chose <math>2^{16}</math> as the block size<br />
<br />
[[File: blocksize.png|400px|thumb|center]]<br />
<br />
=== Blocks for Out-of-core Computation ===<br />
When the dataset is too large for the cache and main memory, XGBoost utilizes disk spaces as well. Since reading and writing data to the disks are slow, XGBoost optimizes the process by using the following two methods.<br />
<br />
# Block Compression<br />
#:* Blocks are compressed by columns<br />
#:* Although decompressing takes time, it is still faster than reading from the disks<br />
# Block Sharding<br />
#:* If multiple disks are available, data is split into those disks<br />
#:* When the CPU needs data, all the disks can be read at the same time<br />
<br />
== End To End Evaluations ==<br />
=== System Implementation ===<br />
XGBoost is a portable and reusable open-source package. It supports:<br />
* various weighted classification<br />
* various objective functions (rank & user defined)<br />
* popular languages (python, R, Julia)<br />
* data science pipelines (scikit-learn)<br />
* big data stacks (Flink, Spark)<br />
* cloud platform (Tianchi8)<br />
<br />
=== Dataset and Setup ===<br />
<br />
A summary of the 4 datasets used in the experiments is in table 2.<br />
<br />
[[File: table2data.png|500px|thumb|center]]<br />
<br />
The first and last datasets were used specifically to evaluate the impact of sparsity-aware algorithm and the scaling property of the system in the out-of-core and the distributed settings respectively. In all of the experiments, common settings such as maximum depth equal to 8, shrinkage equal to 0.1 and no column subsampling are applied.<br />
<br />
=== Classification ===<br />
A subset (n = 1M) of Higgs Boson dataset was used for classification. The results are shown in Table 3.<br />
<br />
[[File: classification.png|500px|thumb|center]]<br />
<br />
* R’s GBM creates a tree fast by using greedy approach that only expands one branch of a tree but with the cost of lower accuracy<br />
* XGBoost and scikit-learn have better performance than R’s GBM<br />
* XGBoost runs more than 10x faster than scikit-learn in learning a full tree<br />
* Column subsamples give slightly worse performance possibly due to a few important features in this dataset.<br />
<br />
=== Learning to Rank ===<br />
The results in comparing XGBoost with pGBRT are shown in Table 4.<br />
<br />
[[File: rank.png|500px|thumb|center]]<br />
<br />
* XGBoost runs exact greedy algorithm while pGBRT only supports an approximate algorithm<br />
* XGBoost runs faster<br />
* Subsampling column reduces running time and gives higher performance possibly due to preventing overfitting<br />
<br />
=== Out-of-core Experiment ===<br />
An extremely large Criteo dataset was used to evaluate the out-of-core setting. The results are shown in the figure below.<br />
<br />
[[File: outofcore.png|350px|thumb|center]]<br />
<br />
* Compression speed up the computation by a factor of 3<br />
* Sharding into 2 disks further gives 2x speed<br />
<br />
=== Distributed Experiment ===<br />
YARN cluster on EC2 with m3.2xlarge machines was used to evaluate the distributed setting. XGBoost was compared with Spark MLLib and H20.<br />
<br />
* XGBoost can switch to out-of-core setting when the memory runs out, while the baseline systems need to store the data in RAM<br />
* XGBoost runs faster than the baseline systems<br />
* The baseline systems are only able to handle a subset of the data with the given resources while XGBoost was able to scale smoothly to all 1.7B rows<br />
* XGBoost’s performance scales linearly with more machines<br />
* XGBoost is able to handle all 1.7B data with only 4 machines<br />
<br />
== Conclusion ==<br />
<br />
== References ==<br />
[1] R. Bekkerman. The present and the future of the kdd cup competition: an outsider’s perspective. <br />
<br />
[2] R. Bekkerman, M. Bilenko, and J. Langford. Scaling Up Machine Learning: Parallel and Distributed Approaches. Cambridge University Press, New York, NY, USA, 2011. <br />
<br />
[3] J. Bennett and S. Lanning. The netflix prize. In Proceedings of the KDD Cup Workshop 2007, pages 3–6, New York, Aug. 2007.<br />
<br />
[4] L. Breiman. Random forests. Maching Learning, 45(1):5–32, Oct. 2001.<br />
<br />
[5] C. Burges. From ranknet to lambdarank to lambdamart: An overview. Learning, 11:23–581, 2010.<br />
<br />
[6] O. Chapelle and Y. Chang. Yahoo! Learning to Rank Challenge Overview. Journal of Machine Learning Research - W & CP, 14:1–24, 2011.<br />
<br />
[7] T. Chen, H. Li, Q. Yang, and Y. Yu. General functional matrix factorization using gradient boosting. In Proceeding of 30th International Conference on Machine Learning (ICML’13), volume 1, pages 436–444, 2013.<br />
<br />
[8] T. Chen, S. Singh, B. Taskar, and C. Guestrin. Efficient second-order gradient boosting for conditional random fields. In Proceeding of 18th Artificial Intelligence and Statistics Conference (AISTATS’15), volume 1, 2015.<br />
<br />
[9] R.-E. Fan, K.-W. Chang, C.-J. Hsieh, X.-R. Wang, and C.-J. Lin. LIBLINEAR: A library for large linear classification. Journal of Machine Learning Research, 9:1871–1874, 2008.<br />
<br />
[10] J. Friedman. Greedy function approximation: a gradient boosting machine. Annals of Statistics, 29(5):1189–1232, 2001.<br />
<br />
[11] J. Friedman. Stochastic gradient boosting. Computational Statistics & Data Analysis, 38(4):367–378, 2002.<br />
<br />
[12] J. Friedman, T. Hastie, and R. Tibshirani. Additive logistic regression: a statistical view of boosting. Annals of Statistics, 28(2):337–407, 2000.<br />
<br />
[13] J. H. Friedman and B. E. Popescu. Importance sampled learning ensembles, 2003.<br />
<br />
[14] M. Greenwald and S. Khanna. Space-efficient online computation of quantile summaries. In Proceedings of the 2001 ACM SIGMOD International Conference on Management of Data, pages 58–66, 2001.<br />
<br />
[15] X. He, J. Pan, O. Jin, T. Xu, B. Liu, T. Xu, Y. Shi, A. Atallah, R. Herbrich, S. Bowers, and J. Q. n. Candela. Practical lessons from predicting clicks on ads at facebook. In Proceedings of the Eighth International Workshop on Data Mining for Online Advertising, ADKDD’14, 2014.<br />
<br />
[16] P. Li. Robust Logitboost and adaptive base class (ABC) Logitboost. In Proceedings of the Twenty-Sixth Conference Annual Conference on Uncertainty in Artificial Intelligence (UAI’10), pages 302–311, 2010.<br />
<br />
[17] P. Li, Q. Wu, and C. J. Burges. Mcrank: Learning to rank using multiple classification and gradient boosting. In Advances in Neural Information Processing Systems 20, pages 897–904. 2008.<br />
<br />
[18] X. Meng, J. Bradley, B. Yavuz, E. Sparks, S. Venkataraman, D. Liu, J. Freeman, D. Tsai, M. Amde, S. Owen, D. Xin, R. Xin, M. J. Franklin, R. Zadeh, M. Zaharia, and A. Talwalkar. MLlib: Machine learning in apache spark. Journal of Machine Learning Research, 17(34):1–7, 2016.<br />
<br />
[19] B. Panda, J. S. Herbach, S. Basu, and R. J. Bayardo. Planet: Massively parallel learning of tree ensembles with mapreduce. Proceeding of VLDB Endowment, 2(2):1426–1437, Aug. 2009.<br />
<br />
[20] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.<br />
<br />
[21] G. Ridgeway. Generalized Boosted Models: A guide to the gbm package.<br />
<br />
[22] S. Tyree, K. Weinberger, K. Agrawal, and J. Paykin. Parallel boosted regression trees for web search ranking. In Proceedings of the 20th international conference on World wide web, pages 387–396. ACM, 2011.<br />
<br />
[23] J. Ye, J.-H. Chow, J. Chen, and Z. Zheng. Stochastic gradient boosted distributed decision trees. In Proceedings of the 18th ACM Conference on Information and Knowledge Management, CIKM ’09.<br />
<br />
[24] Q. Zhang and W. Wang. A fast algorithm for approximate quantiles in high speed data streams. In Proceedings of the 19th International Conference on Scientific and Statistical Database Management, 2007.<br />
<br />
[25] T. Zhang and R. Johnson. Learning nonlinear functions using regularized greedy forest. IEEE Transactions on Pattern Analysis and Machine Intelligence, 36(5), 2014.</div>Cwlokehttp://wiki.math.uwaterloo.ca/statwiki/index.php?title=XGBoost&diff=51134XGBoost2021-11-29T05:38:44Z<p>Cwloke: /* Sparsity-aware Split Finding */</p>
<hr />
<div>== Presented by == <br />
* Chun Waan Loke<br />
* Peter Chong<br />
* Clarice Osmond<br />
* Zhilong Li<br />
<br />
== Introduction ==<br />
<br />
== Tree Boosting In A Nutshell ==<br />
The author reviews gradient tree boosting in this section.<br />
=== Regularized Learning Objective ===<br />
The author first gives the prediction equation (1) and the regularized objective (2).<br><br />
<br><br />
(1) The additive prediction model is given as<br><br />
<math>\hat{y_i}=\sum_{k=1}^{K}f_k(x_i), f_k \in \mathcal{F} </math> <br><br />
where each <math>f_k</math> corresponds to an independent tree structure with its weights, and <math>\mathcal{F}</math> is the "space of regression trees"<br><br />
<br><br />
(2) The regularized objective to be minimized is given as<br><br />
<math>\mathcal{L}=\sum_{i}l(\hat{y_i},y_i)+\sum_k \Omega(f_k)</math> where <math>\Omega(f)=\gamma T+\frac{1}{2}\lambda ||\omega||^2</math> <br><br />
The first term <math>l</math> is a differentiable convex loss function that calculates the measures between <math>\hat{y}</math> and <math>y</math>.<br><br />
The second term <math>\Omega</math> penalizes on the complexity of model (the <math>f_k</math>'s). For a given tree (<math>f_k</math>), <math>T</math> is the number of leaves, and <math>\omega</math> is the leaf weights.<br><br />
The L1 regularization term <math>\gamma T</math> encourages the tree to be small, and the L2 regularization term <math>\frac{1}{2}\lambda ||\omega||^2</math> encourages the tree to have small weights.<br><br />
<br />
=== Gradient Tree Boosting ===<br />
Let <math>\hat{y_i}^{(t)}</math> be the prediction of <math>y_i</math> at the t-th iteration.<br><br />
Since the prediction equation is simply additive, <math>{\hat y_i}^{(t)}=\hat{y_{i}}^{(t-1)}+f_t(x_i)</math><br><br />
Using this equation and 2nd order Taylor approximation on the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> gives <br><br />
\begin{align}<br />
\mathcal{L}^{(t)}&=\sum_{i}^{n}l(y_i,\hat{y_i}^{(t-1)}+f_t(x_i))+\Omega(f_t)\\<br />
&\simeq \sum_{i}^{n}[l(y_i,\hat{y_i}^{(t-1)})+g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
\end{align}<br />
where <math>g_i</math> and <math>h_i</math> are the first and second derivative of the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> with repspect to the term <math>\hat{y}^{(t-1)}</math><br><br />
We can simplify this objective by removing the constant term <math>l(y_i,\hat{y_i}^{(t-1)})</math>.<br><br />
Define <math>I_j=\{i|q(x_i)=j\}</math>, where <math>q</math> is the tree structure. Since every <math>x_i</math> is mapped by <math>q</math> to some leaf <math>j</math>, going through every <math>x_i</math> is equivalent to going through each leaf j of the structure.<br />
\begin{align}<br />
\tilde{\mathcal{L}}^{(t)}&= \sum_{i}^{n}[g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
&= \sum_{j=1}^{T}[(\sum_{i \in I_j}g_i)\omega_j+\frac{1}{2}(\sum_{i \in I_j}h_i+\lambda)\omega_j^2]+\gamma T<br />
\end{align}<br />
Then for a fixed structure <math>q</math>, the optimal weight of leaf <math>j</math> and the optimal objective value are given as<br><br />
\begin{align}<br />
\omega_j^{*} &= -\frac{\sum_{i \in I_j}g_i}{\sum_{i \in I_j}h_i+\lambda}\\<br />
\tilde{\mathcal{L}}^{(t)}(q) &=-\frac{1}{2}\sum_{j=1}^{T}\frac{(\sum_{i \in I_j}g_i)^2}{\sum_{i \in I_j}h_i+\lambda}+\gamma T<br />
\end{align} <br />
[[File:Structure Score Calculation.png|frame|center|alt=Alt text|Structure Score Calculation]]<br />
Instead of enumerating through all possible tree structures q, a greedy algorithm of iteratively adding branches is used.<br><br />
Let <math>I_L</math> and <math>I_R</math> be the instance sets of left and right nodes after split and let <math>I=I_L\cup I_R</math>.<br><br />
The loss reduction after split is given by<br><br />
\begin{align}<br />
\tilde{\mathcal{L}}_{\text{split}} &=\frac{1}{2}[\frac{(\sum_{i \in I_L}g_i)^2}{\sum_{i \in I_L}h_i+\lambda}+\frac{(\sum_{i \in I_R}g_i)^2}{\sum_{i \in I_R}h_i+\lambda}-\frac{(\sum_{i \in I}g_i)^2}{\sum_{i \in I}h_i+\lambda}]+\gamma<br />
\end{align}<br />
=== Shrinkage and Column Subsampling ===<br />
The author also mentioned two other methods in order to avoid over-fitting.<br><br />
(1) Shrinkage. Similar to the learning rate in stochastic optimization, a new weight is added to each tree boosting to reduce the influence of a single tree and leave space for future trees.<br><br />
(2) Column (feature) subsampling. In the paper, the author only mentioned that this technique speeds up parallel algorithm used in later sections.<br />
<br />
== Split Finding Algorithms ==<br />
<br />
It is very important to find the best split for tree learning to perform well. Here are a few split finding algorithms mentioned in the paper:<br />
<br />
=== Basic Exact Greedy Algorithm ===<br />
<br />
The basic exact greedy algorithm is a split finding algorithm that is computationally expensive because it enumerates over all the possible splits for continuous features. It is impossible to be done efficiently when the memory is not enough to hold the data needed. A way to carry out this algorithm efficiently is to sort the data according to feature values and visit the data in order to accumulate the gradient statistics. The algorithm is shown below:<br />
<br />
[[File:algo1xg.png|center|alt=Alt text|Basic Exact Greedy Algorithm]]<br />
<br />
=== Approximate Algorithm ===<br />
<br />
The paper introduced a more efficient algorithm compared to Basic Exact Greedy Algorithm which is the Approximate Algorithm. The Approximate Algorithm first proposes candidate splitting points according to percentiles of feature distribution. It then maps the continuous features into buckets split by candidate points, aggregates the statistics and finds the best solution among proposals based on the aggregated statistics. The algorithm is shown below:<br />
<br />
[[File:algo2xg.png|center|alt=Alt text|Approximate Algorithm]]<br />
<br />
There are also two variants to this algorithm, the global variant proposes all the candidate splits during the initial phase of tree construction and uses the same proposals for split finding at all levels. Whereas, the local variant re-proposes after each split. The global variant usually requires less proposal steps but uses more candidate points than local variant because candidates are not refined after each split. For deeper trees, usage of local variant may be more appropriate as compared to global variant. The figure below shows the a comparison in accuracy between Basic Exact Greedy and Approximate split finding algorithms with different variant over the number of iterations. We can see that the quantile strategy is able to achieve similar accuracy as the Basic Exact Greedy algorithm given a reasonable approximation level.<br />
<br />
[[File:accuracyxg.png|center|alt=Alt text|Comparison of accuracy between different algorithms]]<br />
<br />
=== Weighted Quantile Sketch ===<br />
<br />
Proposing candidate split points is the most important step in the Approximate Algorithm, it is done by using the percentile of a feature to make candidates distribute evenly on a dataset.<br />
<br />
Formally, we have a dataset<br />
<br />
<math>D_k={(x_{1k},h_1),(x_{2k},h_2),...,(x_{nk},h_n)}</math><br />
<br />
where <math> x_i </math>'s are the feature values of each data point and <math> h_i </math>'s represents the weight of the corresponding feature <math> x_i </math>. <br />
<br />
Then, we can use the following rank function to compute <math>r_k(z)</math>, the proportion of instances whose feature value among <math> (x_i,...,x_k) </math> is smaller than data point <math> z </math>.<br />
<br />
<math>r_k(z) = \frac{1}{\sum_{(x,h) \in D_k} h} \displaystyle\sum_{(x,h) \in D_k, x<z} h,</math><br />
<br />
The objective here is to find candidate split points <math>{s_{k1}, s_{k2}, …, s_{kl}}</math>, such that:<br />
<br />
<math>|r_k(s_{k,j}) – r_k(s_{k,j+1})| < \epsilon, s_{k1} = \displaystyle\min_i x_{ik}, s_{kl} = \displaystyle\max_{i} x_{ik}, \forall i</math><br />
<br />
Where <math>\epsilon</math> is an approximation factor. Usually, it should approximately have <math>\frac{1}{\epsilon}</math> splitting points.<br />
<br />
=== Sparsity-aware Split Finding ===<br />
<br />
Typically in real world situation, it is quite common that our dataset is sparse. Some of the possible causes are:<br />
<br />
# Missing values in the data<br />
# Huge amount of zero entries present in the data<br />
# Artifacts of feature engineering (e.g. One-hot encoding)<br />
<br />
In order to solve the sparsity present in the dataset, we suggest to add a default direction in each tree node will classified into when there is a missing value in the matrix of the dataset. This is demonstrated in the figure below:<br />
<br />
[[File:defaultdirection.png|center|alt=Alt text|Default Direction for sparsity]]<br />
<br />
The algorithm shown below, helps us to calculate the optimal direction to proceed in each branch. Beside that, it also allows user to set a range for the accepted value and neglect the out-of-range value when calculating the score. <br />
<br />
[[File:algo3xg.png|center|alt=Alt text|Sparsity-aware Split Finding Algorithm]]<br />
<br />
== System Design ==<br />
<br />
=== Column Block for Parallel Learning ===<br />
The most time consuming part of tree learning is to get the data into sorted order. To overcome this problem, XGBoost stores the data in blocks where each block performs the sorting operation in parallel. The results are then merged together.<br />
<br />
# For the exact greedy algorithm, XGBoost stores the entire dataset in a single block<br />
#:* Original spase aware algorithm costs: <math>O(Kd∥x∥_0 log(n))</math><br />
#:* Tree boosting on block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(n))</math><br />
#:* Hence, block structure helps to save an additional <math>log(n)</math> factor<br />
# For approximate algorithms, XGBoost stores the dataset in multiple blocks<br />
#:* Original algorithm with binary search costs: <math>O(Kd∥x∥_0 log(q))</math><br />
#:* With block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(B))</math><br />
#:* Hence, block structure helps to save an additional <math>log(q)</math> factor <br />
<br />
K = total number of trees<br /><br />
d = maximum depth of the tree<br /><br />
<math>∥x∥_0</math> = number of non-missing entries in the training data<br /><br />
n = number of rows in the dataset<br /><br />
q = number of proposal candidates in the dataset, usually between 32 to 100<br /><br />
B = maximum number of rows in each block<br />
<br />
[[File: columnblock.png|800px|thumb|center]]<br />
<br />
=== Cache-aware Access ===<br />
The proposed block structure optimizes the computation complexity but requires indirect fetches of gradient statistics by row index. XGBoost optimizes the process by using the following methods.<br />
<br />
# For the exact greedy algorithm, XGBoost uses a cache-aware prefetching algorithm<br />
#:* It stores Gradient and Hessians in the cache to make calculations fast<br />
#:* It runs twice as fast as the naive method when the dataset is large<br />
# For approximate algorithms, XGBoost chooses a specific block size<br />
#:* Choosing a small block size results in inefficient parallelization<br />
#:* Choosing a large block size results in cache misses<br />
#:* Various choices of block size are compared and the results are shown in Figure 9<br />
#:* XGBoost chose <math>2^{16}</math> as the block size<br />
<br />
[[File: blocksize.png|400px|thumb|center]]<br />
<br />
=== Blocks for Out-of-core Computation ===<br />
When the dataset is too large for the cache and main memory, XGBoost utilizes disk spaces as well. Since reading and writing data to the disks are slow, XGBoost optimizes the process by using the following two methods.<br />
<br />
# Block Compression<br />
#:* Blocks are compressed by columns<br />
#:* Although decompressing takes time, it is still faster than reading from the disks<br />
# Block Sharding<br />
#:* If multiple disks are available, data is split into those disks<br />
#:* When the CPU needs data, all the disks can be read at the same time<br />
<br />
== End To End Evaluations ==<br />
=== System Implementation ===<br />
XGBoost is a portable and reusable open-source package. It supports:<br />
* various weighted classification<br />
* various objective functions (rank & user defined)<br />
* popular languages (python, R, Julia)<br />
* data science pipelines (scikit-learn)<br />
* big data stacks (Flink, Spark)<br />
* cloud platform (Tianchi8)<br />
<br />
=== Dataset and Setup ===<br />
<br />
A summary of the 4 datasets used in the experiments is in table 2.<br />
<br />
[[File: table2data.png|500px|thumb|center]]<br />
<br />
The first and last datasets were used specifically to evaluate the impact of sparsity-aware algorithm and the scaling property of the system in the out-of-core and the distributed settings respectively. In all of the experiments, common settings such as maximum depth equal to 8, shrinkage equal to 0.1 and no column subsampling are applied.<br />
<br />
=== Classification ===<br />
A subset (n = 1M) of Higgs Boson dataset was used for classification. The results are shown in Table 3.<br />
<br />
[[File: classification.png|500px|thumb|center]]<br />
<br />
* R’s GBM creates a tree fast by using greedy approach that only expands one branch of a tree but with the cost of lower accuracy<br />
* XGBoost and scikit-learn have better performance than R’s GBM<br />
* XGBoost runs more than 10x faster than scikit-learn in learning a full tree<br />
* Column subsamples give slightly worse performance possibly due to a few important features in this dataset.<br />
<br />
=== Learning to Rank ===<br />
The results in comparing XGBoost with pGBRT are shown in Table 4.<br />
<br />
[[File: rank.png|500px|thumb|center]]<br />
<br />
* XGBoost runs exact greedy algorithm while pGBRT only supports an approximate algorithm<br />
* XGBoost runs faster<br />
* Subsampling column reduces running time and gives higher performance possibly due to preventing overfitting<br />
<br />
=== Out-of-core Experiment ===<br />
An extremely large Criteo dataset was used to evaluate the out-of-core setting. The results are shown in the figure below.<br />
<br />
[[File: outofcore.png|350px|thumb|center]]<br />
<br />
* Compression speed up the computation by a factor of 3<br />
* Sharding into 2 disks further gives 2x speed<br />
<br />
=== Distributed Experiment ===<br />
YARN cluster on EC2 with m3.2xlarge machines was used to evaluate the distributed setting. XGBoost was compared with Spark MLLib and H20.<br />
<br />
* XGBoost can switch to out-of-core setting when the memory runs out, while the baseline systems need to store the data in RAM<br />
* XGBoost runs faster than the baseline systems<br />
* The baseline systems are only able to handle a subset of the data with the given resources while XGBoost was able to scale smoothly to all 1.7B rows<br />
* XGBoost’s performance scales linearly with more machines<br />
* XGBoost is able to handle all 1.7B data with only 4 machines<br />
<br />
== Conclusion ==<br />
<br />
== References ==<br />
[1] R. Bekkerman. The present and the future of the kdd cup competition: an outsider’s perspective. <br />
<br />
[2] R. Bekkerman, M. Bilenko, and J. Langford. Scaling Up Machine Learning: Parallel and Distributed Approaches. Cambridge University Press, New York, NY, USA, 2011. <br />
<br />
[3] J. Bennett and S. Lanning. The netflix prize. In Proceedings of the KDD Cup Workshop 2007, pages 3–6, New York, Aug. 2007.<br />
<br />
[4] L. Breiman. Random forests. Maching Learning, 45(1):5–32, Oct. 2001.<br />
<br />
[5] C. Burges. From ranknet to lambdarank to lambdamart: An overview. Learning, 11:23–581, 2010.<br />
<br />
[6] O. Chapelle and Y. Chang. Yahoo! Learning to Rank Challenge Overview. Journal of Machine Learning Research - W & CP, 14:1–24, 2011.<br />
<br />
[7] T. Chen, H. Li, Q. Yang, and Y. Yu. General functional matrix factorization using gradient boosting. In Proceeding of 30th International Conference on Machine Learning (ICML’13), volume 1, pages 436–444, 2013.<br />
<br />
[8] T. Chen, S. Singh, B. Taskar, and C. Guestrin. Efficient second-order gradient boosting for conditional random fields. In Proceeding of 18th Artificial Intelligence and Statistics Conference (AISTATS’15), volume 1, 2015.<br />
<br />
[9] R.-E. Fan, K.-W. Chang, C.-J. Hsieh, X.-R. Wang, and C.-J. Lin. LIBLINEAR: A library for large linear classification. Journal of Machine Learning Research, 9:1871–1874, 2008.<br />
<br />
[10] J. Friedman. Greedy function approximation: a gradient boosting machine. Annals of Statistics, 29(5):1189–1232, 2001.<br />
<br />
[11] J. Friedman. Stochastic gradient boosting. Computational Statistics & Data Analysis, 38(4):367–378, 2002.<br />
<br />
[12] J. Friedman, T. Hastie, and R. Tibshirani. Additive logistic regression: a statistical view of boosting. Annals of Statistics, 28(2):337–407, 2000.<br />
<br />
[13] J. H. Friedman and B. E. Popescu. Importance sampled learning ensembles, 2003.<br />
<br />
[14] M. Greenwald and S. Khanna. Space-efficient online computation of quantile summaries. In Proceedings of the 2001 ACM SIGMOD International Conference on Management of Data, pages 58–66, 2001.<br />
<br />
[15] X. He, J. Pan, O. Jin, T. Xu, B. Liu, T. Xu, Y. Shi, A. Atallah, R. Herbrich, S. Bowers, and J. Q. n. Candela. Practical lessons from predicting clicks on ads at facebook. In Proceedings of the Eighth International Workshop on Data Mining for Online Advertising, ADKDD’14, 2014.<br />
<br />
[16] P. Li. Robust Logitboost and adaptive base class (ABC) Logitboost. In Proceedings of the Twenty-Sixth Conference Annual Conference on Uncertainty in Artificial Intelligence (UAI’10), pages 302–311, 2010.<br />
<br />
[17] P. Li, Q. Wu, and C. J. Burges. Mcrank: Learning to rank using multiple classification and gradient boosting. In Advances in Neural Information Processing Systems 20, pages 897–904. 2008.<br />
<br />
[18] X. Meng, J. Bradley, B. Yavuz, E. Sparks, S. Venkataraman, D. Liu, J. Freeman, D. Tsai, M. Amde, S. Owen, D. Xin, R. Xin, M. J. Franklin, R. Zadeh, M. Zaharia, and A. Talwalkar. MLlib: Machine learning in apache spark. Journal of Machine Learning Research, 17(34):1–7, 2016.<br />
<br />
[19] B. Panda, J. S. Herbach, S. Basu, and R. J. Bayardo. Planet: Massively parallel learning of tree ensembles with mapreduce. Proceeding of VLDB Endowment, 2(2):1426–1437, Aug. 2009.<br />
<br />
[20] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.<br />
<br />
[21] G. Ridgeway. Generalized Boosted Models: A guide to the gbm package.<br />
<br />
[22] S. Tyree, K. Weinberger, K. Agrawal, and J. Paykin. Parallel boosted regression trees for web search ranking. In Proceedings of the 20th international conference on World wide web, pages 387–396. ACM, 2011.<br />
<br />
[23] J. Ye, J.-H. Chow, J. Chen, and Z. Zheng. Stochastic gradient boosted distributed decision trees. In Proceedings of the 18th ACM Conference on Information and Knowledge Management, CIKM ’09.<br />
<br />
[24] Q. Zhang and W. Wang. A fast algorithm for approximate quantiles in high speed data streams. In Proceedings of the 19th International Conference on Scientific and Statistical Database Management, 2007.<br />
<br />
[25] T. Zhang and R. Johnson. Learning nonlinear functions using regularized greedy forest. IEEE Transactions on Pattern Analysis and Machine Intelligence, 36(5), 2014.</div>Cwlokehttp://wiki.math.uwaterloo.ca/statwiki/index.php?title=File:fig5xg.png&diff=51133File:fig5xg.png2021-11-29T05:22:37Z<p>Cwloke: </p>
<hr />
<div></div>Cwlokehttp://wiki.math.uwaterloo.ca/statwiki/index.php?title=File:algo3xg.png&diff=51132File:algo3xg.png2021-11-29T05:22:25Z<p>Cwloke: </p>
<hr />
<div></div>Cwlokehttp://wiki.math.uwaterloo.ca/statwiki/index.php?title=XGBoost&diff=51131XGBoost2021-11-29T05:18:49Z<p>Cwloke: /* Sparsity-aware Split Finding */</p>
<hr />
<div>== Presented by == <br />
* Chun Waan Loke<br />
* Peter Chong<br />
* Clarice Osmond<br />
* Zhilong Li<br />
<br />
== Introduction ==<br />
<br />
== Tree Boosting In A Nutshell ==<br />
The author reviews gradient tree boosting in this section.<br />
=== Regularized Learning Objective ===<br />
The author first gives the prediction equation (1) and the regularized objective (2).<br><br />
<br><br />
(1) The additive prediction model is given as<br><br />
<math>\hat{y_i}=\sum_{k=1}^{K}f_k(x_i), f_k \in \mathcal{F} </math> <br><br />
where each <math>f_k</math> corresponds to an independent tree structure with its weights, and <math>\mathcal{F}</math> is the "space of regression trees"<br><br />
<br><br />
(2) The regularized objective to be minimized is given as<br><br />
<math>\mathcal{L}=\sum_{i}l(\hat{y_i},y_i)+\sum_k \Omega(f_k)</math> where <math>\Omega(f)=\gamma T+\frac{1}{2}\lambda ||\omega||^2</math> <br><br />
The first term <math>l</math> is a differentiable convex loss function that calculates the measures between <math>\hat{y}</math> and <math>y</math>.<br><br />
The second term <math>\Omega</math> penalizes on the complexity of model (the <math>f_k</math>'s). For a given tree (<math>f_k</math>), <math>T</math> is the number of leaves, and <math>\omega</math> is the leaf weights.<br><br />
The L1 regularization term <math>\gamma T</math> encourages the tree to be small, and the L2 regularization term <math>\frac{1}{2}\lambda ||\omega||^2</math> encourages the tree to have small weights.<br><br />
<br />
=== Gradient Tree Boosting ===<br />
Let <math>\hat{y_i}^{(t)}</math> be the prediction of <math>y_i</math> at the t-th iteration.<br><br />
Since the prediction equation is simply additive, <math>{\hat y_i}^{(t)}=\hat{y_{i}}^{(t-1)}+f_t(x_i)</math><br><br />
Using this equation and 2nd order Taylor approximation on the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> gives <br><br />
\begin{align}<br />
\mathcal{L}^{(t)}&=\sum_{i}^{n}l(y_i,\hat{y_i}^{(t-1)}+f_t(x_i))+\Omega(f_t)\\<br />
&\simeq \sum_{i}^{n}[l(y_i,\hat{y_i}^{(t-1)})+g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
\end{align}<br />
where <math>g_i</math> and <math>h_i</math> are the first and second derivative of the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> with repspect to the term <math>\hat{y}^{(t-1)}</math><br><br />
We can simplify this objective by removing the constant term <math>l(y_i,\hat{y_i}^{(t-1)})</math>.<br><br />
Define <math>I_j=\{i|q(x_i)=j\}</math>, where <math>q</math> is the tree structure. Since every <math>x_i</math> is mapped by <math>q</math> to some leaf <math>j</math>, going through every <math>x_i</math> is equivalent to going through each leaf j of the structure.<br />
\begin{align}<br />
\tilde{\mathcal{L}}^{(t)}&= \sum_{i}^{n}[g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
&= \sum_{j=1}^{T}[(\sum_{i \in I_j}g_i)\omega_j+\frac{1}{2}(\sum_{i \in I_j}h_i+\lambda)\omega_j^2]+\gamma T<br />
\end{align}<br />
Then for a fixed structure <math>q</math>, the optimal weight of leaf <math>j</math> and the optimal objective value are given as<br><br />
\begin{align}<br />
\omega_j^{*} &= -\frac{\sum_{i \in I_j}g_i}{\sum_{i \in I_j}h_i+\lambda}\\<br />
\tilde{\mathcal{L}}^{(t)}(q) &=-\frac{1}{2}\sum_{j=1}^{T}\frac{(\sum_{i \in I_j}g_i)^2}{\sum_{i \in I_j}h_i+\lambda}+\gamma T<br />
\end{align} <br />
[[File:Structure Score Calculation.png|frame|center|alt=Alt text|Structure Score Calculation]]<br />
Instead of enumerating through all possible tree structures q, a greedy algorithm of iteratively adding branches is used.<br><br />
Let <math>I_L</math> and <math>I_R</math> be the instance sets of left and right nodes after split and let <math>I=I_L\cup I_R</math>.<br><br />
The loss reduction after split is given by<br><br />
\begin{align}<br />
\tilde{\mathcal{L}}_{\text{split}} &=\frac{1}{2}[\frac{(\sum_{i \in I_L}g_i)^2}{\sum_{i \in I_L}h_i+\lambda}+\frac{(\sum_{i \in I_R}g_i)^2}{\sum_{i \in I_R}h_i+\lambda}-\frac{(\sum_{i \in I}g_i)^2}{\sum_{i \in I}h_i+\lambda}]+\gamma<br />
\end{align}<br />
=== Shrinkage and Column Subsampling ===<br />
The author also mentioned two other methods in order to avoid over-fitting.<br><br />
(1) Shrinkage. Similar to the learning rate in stochastic optimization, a new weight is added to each tree boosting to reduce the influence of a single tree and leave space for future trees.<br><br />
(2) Column (feature) subsampling. In the paper, the author only mentioned that this technique speeds up parallel algorithm used in later sections.<br />
<br />
== Split Finding Algorithms ==<br />
<br />
It is very important to find the best split for tree learning to perform well. Here are a few split finding algorithms mentioned in the paper:<br />
<br />
=== Basic Exact Greedy Algorithm ===<br />
<br />
The basic exact greedy algorithm is a split finding algorithm that is computationally expensive because it enumerates over all the possible splits for continuous features. It is impossible to be done efficiently when the memory is not enough to hold the data needed. A way to carry out this algorithm efficiently is to sort the data according to feature values and visit the data in order to accumulate the gradient statistics. The algorithm is shown below:<br />
<br />
[[File:algo1xg.png|center|alt=Alt text|Basic Exact Greedy Algorithm]]<br />
<br />
=== Approximate Algorithm ===<br />
<br />
The paper introduced a more efficient algorithm compared to Basic Exact Greedy Algorithm which is the Approximate Algorithm. The Approximate Algorithm first proposes candidate splitting points according to percentiles of feature distribution. It then maps the continuous features into buckets split by candidate points, aggregates the statistics and finds the best solution among proposals based on the aggregated statistics. The algorithm is shown below:<br />
<br />
[[File:algo2xg.png|center|alt=Alt text|Approximate Algorithm]]<br />
<br />
There are also two variants to this algorithm, the global variant proposes all the candidate splits during the initial phase of tree construction and uses the same proposals for split finding at all levels. Whereas, the local variant re-proposes after each split. The global variant usually requires less proposal steps but uses more candidate points than local variant because candidates are not refined after each split. For deeper trees, usage of local variant may be more appropriate as compared to global variant. The figure below shows the a comparison in accuracy between Basic Exact Greedy and Approximate split finding algorithms with different variant over the number of iterations. We can see that the quantile strategy is able to achieve similar accuracy as the Basic Exact Greedy algorithm given a reasonable approximation level.<br />
<br />
[[File:accuracyxg.png|center|alt=Alt text|Comparison of accuracy between different algorithms]]<br />
<br />
=== Weighted Quantile Sketch ===<br />
<br />
Proposing candidate split points is the most important step in the Approximate Algorithm, it is done by using the percentile of a feature to make candidates distribute evenly on a dataset.<br />
<br />
Formally, we have a dataset<br />
<br />
<math>D_k={(x_{1k},h_1),(x_{2k},h_2),...,(x_{nk},h_n)}</math><br />
<br />
where <math> x_i </math>'s are the feature values of each data point and <math> h_i </math>'s represents the weight of the corresponding feature <math> x_i </math>. <br />
<br />
Then, we can use the following rank function to compute <math>r_k(z)</math>, the proportion of instances whose feature value among <math> (x_i,...,x_k) </math> is smaller than data point <math> z </math>.<br />
<br />
<math>r_k(z) = \frac{1}{\sum_{(x,h) \in D_k} h} \displaystyle\sum_{(x,h) \in D_k, x<z} h,</math><br />
<br />
The objective here is to find candidate split points <math>{s_{k1}, s_{k2}, …, s_{kl}}</math>, such that:<br />
<br />
<math>|r_k(s_{k,j}) – r_k(s_{k,j+1})| < \epsilon, s_{k1} = \displaystyle\min_i x_{ik}, s_{kl} = \displaystyle\max_{i} x_{ik}, \forall i</math><br />
<br />
Where <math>\epsilon</math> is an approximation factor. Usually, it should approximately have <math>\frac{1}{\epsilon}</math> splitting points.<br />
<br />
=== Sparsity-aware Split Finding ===<br />
<br />
Typically in real world situation, it is quite common that our dataset is sparse. Some of the possible causes are:<br />
<br />
# Missing values in the data<br />
# Huge amount of zero entries present in the data<br />
# Artifacts of feature engineering (e.g. One-hot encoding)<br />
<br />
In order to solve the sparsity present in the dataset, we suggest to add a default direction in each tree node will classified into when there is a missing value in the matrix of the dataset. This is demonstrated in the figure below:<br />
<br />
[[File:defaultdirection.png|center|alt=Alt text|Default Direction for sparsity]]<br />
<br />
== System Design ==<br />
<br />
=== Column Block for Parallel Learning ===<br />
The most time consuming part of tree learning is to get the data into sorted order. To overcome this problem, XGBoost stores the data in blocks where each block performs the sorting operation in parallel. The results are then merged together.<br />
<br />
# For the exact greedy algorithm, XGBoost stores the entire dataset in a single block<br />
#:* Original spase aware algorithm costs: <math>O(Kd∥x∥_0 log(n))</math><br />
#:* Tree boosting on block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(n))</math><br />
#:* Hence, block structure helps to save an additional <math>log(n)</math> factor<br />
# For approximate algorithms, XGBoost stores the dataset in multiple blocks<br />
#:* Original algorithm with binary search costs: <math>O(Kd∥x∥_0 log(q))</math><br />
#:* With block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(B))</math><br />
#:* Hence, block structure helps to save an additional <math>log(q)</math> factor <br />
<br />
K = total number of trees<br /><br />
d = maximum depth of the tree<br /><br />
<math>∥x∥_0</math> = number of non-missing entries in the training data<br /><br />
n = number of rows in the dataset<br /><br />
q = number of proposal candidates in the dataset, usually between 32 to 100<br /><br />
B = maximum number of rows in each block<br />
<br />
[[File: columnblock.png|800px|thumb|center]]<br />
<br />
=== Cache-aware Access ===<br />
The proposed block structure optimizes the computation complexity but requires indirect fetches of gradient statistics by row index. XGBoost optimizes the process by using the following methods.<br />
<br />
# For the exact greedy algorithm, XGBoost uses a cache-aware prefetching algorithm<br />
#:* It stores Gradient and Hessians in the cache to make calculations fast<br />
#:* It runs twice as fast as the naive method when the dataset is large<br />
# For approximate algorithms, XGBoost chooses a specific block size<br />
#:* Choosing a small block size results in inefficient parallelization<br />
#:* Choosing a large block size results in cache misses<br />
#:* Various choices of block size are compared and the results are shown in Figure 9<br />
#:* XGBoost chose <math>2^{16}</math> as the block size<br />
<br />
[[File: blocksize.png|400px|thumb|center]]<br />
<br />
=== Blocks for Out-of-core Computation ===<br />
When the dataset is too large for the cache and main memory, XGBoost utilizes disk spaces as well. Since reading and writing data to the disks are slow, XGBoost optimizes the process by using the following two methods.<br />
<br />
# Block Compression<br />
#:* Blocks are compressed by columns<br />
#:* Although decompressing takes time, it is still faster than reading from the disks<br />
# Block Sharding<br />
#:* If multiple disks are available, data is split into those disks<br />
#:* When the CPU needs data, all the disks can be read at the same time<br />
<br />
== End To End Evaluations ==<br />
=== System Implementation ===<br />
XGBoost is a portable and reusable open-source package. It supports:<br />
* various weighted classification<br />
* various objective functions (rank & user defined)<br />
* popular languages (python, R, Julia)<br />
* data science pipelines (scikit-learn)<br />
* big data stacks (Flink, Spark)<br />
* cloud platform (Tianchi8)<br />
<br />
=== Dataset and Setup ===<br />
<br />
A summary of the 4 datasets used in the experiments is in table 2.<br />
<br />
[[File: table2data.png|500px|thumb|center]]<br />
<br />
The first and last datasets were used specifically to evaluate the impact of sparsity-aware algorithm and the scaling property of the system in the out-of-core and the distributed settings respectively. In all of the experiments, common settings such as maximum depth equal to 8, shrinkage equal to 0.1 and no column subsampling are applied.<br />
<br />
=== Classification ===<br />
A subset (n = 1M) of Higgs Boson dataset was used for classification. The results are shown in Table 3.<br />
<br />
[[File: classification.png|500px|thumb|center]]<br />
<br />
* R’s GBM creates a tree fast by using greedy approach that only expands one branch of a tree but with the cost of lower accuracy<br />
* XGBoost and scikit-learn have better performance than R’s GBM<br />
* XGBoost runs more than 10x faster than scikit-learn in learning a full tree<br />
* Column subsamples give slightly worse performance possibly due to a few important features in this dataset.<br />
<br />
=== Learning to Rank ===<br />
The results in comparing XGBoost with pGBRT are shown in Table 4.<br />
<br />
[[File: rank.png|500px|thumb|center]]<br />
<br />
* XGBoost runs exact greedy algorithm while pGBRT only supports an approximate algorithm<br />
* XGBoost runs faster<br />
* Subsampling column reduces running time and gives higher performance possibly due to preventing overfitting<br />
<br />
=== Out-of-core Experiment ===<br />
An extremely large Criteo dataset was used to evaluate the out-of-core setting. The results are shown in the figure below.<br />
<br />
[[File: outofcore.png|350px|thumb|center]]<br />
<br />
* Compression speed up the computation by a factor of 3<br />
* Sharding into 2 disks further gives 2x speed<br />
<br />
=== Distributed Experiment ===<br />
YARN cluster on EC2 with m3.2xlarge machines was used to evaluate the distributed setting. XGBoost was compared with Spark MLLib and H20.<br />
<br />
* XGBoost can switch to out-of-core setting when the memory runs out, while the baseline systems need to store the data in RAM<br />
* XGBoost runs faster than the baseline systems<br />
* The baseline systems are only able to handle a subset of the data with the given resources while XGBoost was able to scale smoothly to all 1.7B rows<br />
* XGBoost’s performance scales linearly with more machines<br />
* XGBoost is able to handle all 1.7B data with only 4 machines<br />
<br />
== Conclusion ==<br />
<br />
== References ==<br />
[1] R. Bekkerman. The present and the future of the kdd cup competition: an outsider’s perspective. <br />
<br />
[2] R. Bekkerman, M. Bilenko, and J. Langford. Scaling Up Machine Learning: Parallel and Distributed Approaches. Cambridge University Press, New York, NY, USA, 2011. <br />
<br />
[3] J. Bennett and S. Lanning. The netflix prize. In Proceedings of the KDD Cup Workshop 2007, pages 3–6, New York, Aug. 2007.<br />
<br />
[4] L. Breiman. Random forests. Maching Learning, 45(1):5–32, Oct. 2001.<br />
<br />
[5] C. Burges. From ranknet to lambdarank to lambdamart: An overview. Learning, 11:23–581, 2010.<br />
<br />
[6] O. Chapelle and Y. Chang. Yahoo! Learning to Rank Challenge Overview. Journal of Machine Learning Research - W & CP, 14:1–24, 2011.<br />
<br />
[7] T. Chen, H. Li, Q. Yang, and Y. Yu. General functional matrix factorization using gradient boosting. In Proceeding of 30th International Conference on Machine Learning (ICML’13), volume 1, pages 436–444, 2013.<br />
<br />
[8] T. Chen, S. Singh, B. Taskar, and C. Guestrin. Efficient second-order gradient boosting for conditional random fields. In Proceeding of 18th Artificial Intelligence and Statistics Conference (AISTATS’15), volume 1, 2015.<br />
<br />
[9] R.-E. Fan, K.-W. Chang, C.-J. Hsieh, X.-R. Wang, and C.-J. Lin. LIBLINEAR: A library for large linear classification. Journal of Machine Learning Research, 9:1871–1874, 2008.<br />
<br />
[10] J. Friedman. Greedy function approximation: a gradient boosting machine. Annals of Statistics, 29(5):1189–1232, 2001.<br />
<br />
[11] J. Friedman. Stochastic gradient boosting. Computational Statistics & Data Analysis, 38(4):367–378, 2002.<br />
<br />
[12] J. Friedman, T. Hastie, and R. Tibshirani. Additive logistic regression: a statistical view of boosting. Annals of Statistics, 28(2):337–407, 2000.<br />
<br />
[13] J. H. Friedman and B. E. Popescu. Importance sampled learning ensembles, 2003.<br />
<br />
[14] M. Greenwald and S. Khanna. Space-efficient online computation of quantile summaries. In Proceedings of the 2001 ACM SIGMOD International Conference on Management of Data, pages 58–66, 2001.<br />
<br />
[15] X. He, J. Pan, O. Jin, T. Xu, B. Liu, T. Xu, Y. Shi, A. Atallah, R. Herbrich, S. Bowers, and J. Q. n. Candela. Practical lessons from predicting clicks on ads at facebook. In Proceedings of the Eighth International Workshop on Data Mining for Online Advertising, ADKDD’14, 2014.<br />
<br />
[16] P. Li. Robust Logitboost and adaptive base class (ABC) Logitboost. In Proceedings of the Twenty-Sixth Conference Annual Conference on Uncertainty in Artificial Intelligence (UAI’10), pages 302–311, 2010.<br />
<br />
[17] P. Li, Q. Wu, and C. J. Burges. Mcrank: Learning to rank using multiple classification and gradient boosting. In Advances in Neural Information Processing Systems 20, pages 897–904. 2008.<br />
<br />
[18] X. Meng, J. Bradley, B. Yavuz, E. Sparks, S. Venkataraman, D. Liu, J. Freeman, D. Tsai, M. Amde, S. Owen, D. Xin, R. Xin, M. J. Franklin, R. Zadeh, M. Zaharia, and A. Talwalkar. MLlib: Machine learning in apache spark. Journal of Machine Learning Research, 17(34):1–7, 2016.<br />
<br />
[19] B. Panda, J. S. Herbach, S. Basu, and R. J. Bayardo. Planet: Massively parallel learning of tree ensembles with mapreduce. Proceeding of VLDB Endowment, 2(2):1426–1437, Aug. 2009.<br />
<br />
[20] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.<br />
<br />
[21] G. Ridgeway. Generalized Boosted Models: A guide to the gbm package.<br />
<br />
[22] S. Tyree, K. Weinberger, K. Agrawal, and J. Paykin. Parallel boosted regression trees for web search ranking. In Proceedings of the 20th international conference on World wide web, pages 387–396. ACM, 2011.<br />
<br />
[23] J. Ye, J.-H. Chow, J. Chen, and Z. Zheng. Stochastic gradient boosted distributed decision trees. In Proceedings of the 18th ACM Conference on Information and Knowledge Management, CIKM ’09.<br />
<br />
[24] Q. Zhang and W. Wang. A fast algorithm for approximate quantiles in high speed data streams. In Proceedings of the 19th International Conference on Scientific and Statistical Database Management, 2007.<br />
<br />
[25] T. Zhang and R. Johnson. Learning nonlinear functions using regularized greedy forest. IEEE Transactions on Pattern Analysis and Machine Intelligence, 36(5), 2014.</div>Cwlokehttp://wiki.math.uwaterloo.ca/statwiki/index.php?title=XGBoost&diff=51130XGBoost2021-11-29T05:16:51Z<p>Cwloke: /* Sparsity-aware Split Finding */</p>
<hr />
<div>== Presented by == <br />
* Chun Waan Loke<br />
* Peter Chong<br />
* Clarice Osmond<br />
* Zhilong Li<br />
<br />
== Introduction ==<br />
<br />
== Tree Boosting In A Nutshell ==<br />
The author reviews gradient tree boosting in this section.<br />
=== Regularized Learning Objective ===<br />
The author first gives the prediction equation (1) and the regularized objective (2).<br><br />
<br><br />
(1) The additive prediction model is given as<br><br />
<math>\hat{y_i}=\sum_{k=1}^{K}f_k(x_i), f_k \in \mathcal{F} </math> <br><br />
where each <math>f_k</math> corresponds to an independent tree structure with its weights, and <math>\mathcal{F}</math> is the "space of regression trees"<br><br />
<br><br />
(2) The regularized objective to be minimized is given as<br><br />
<math>\mathcal{L}=\sum_{i}l(\hat{y_i},y_i)+\sum_k \Omega(f_k)</math> where <math>\Omega(f)=\gamma T+\frac{1}{2}\lambda ||\omega||^2</math> <br><br />
The first term <math>l</math> is a differentiable convex loss function that calculates the measures between <math>\hat{y}</math> and <math>y</math>.<br><br />
The second term <math>\Omega</math> penalizes on the complexity of model (the <math>f_k</math>'s). For a given tree (<math>f_k</math>), <math>T</math> is the number of leaves, and <math>\omega</math> is the leaf weights.<br><br />
The L1 regularization term <math>\gamma T</math> encourages the tree to be small, and the L2 regularization term <math>\frac{1}{2}\lambda ||\omega||^2</math> encourages the tree to have small weights.<br><br />
<br />
=== Gradient Tree Boosting ===<br />
Let <math>\hat{y_i}^{(t)}</math> be the prediction of <math>y_i</math> at the t-th iteration.<br><br />
Since the prediction equation is simply additive, <math>{\hat y_i}^{(t)}=\hat{y_{i}}^{(t-1)}+f_t(x_i)</math><br><br />
Using this equation and 2nd order Taylor approximation on the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> gives <br><br />
\begin{align}<br />
\mathcal{L}^{(t)}&=\sum_{i}^{n}l(y_i,\hat{y_i}^{(t-1)}+f_t(x_i))+\Omega(f_t)\\<br />
&\simeq \sum_{i}^{n}[l(y_i,\hat{y_i}^{(t-1)})+g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
\end{align}<br />
where <math>g_i</math> and <math>h_i</math> are the first and second derivative of the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> with repspect to the term <math>\hat{y}^{(t-1)}</math><br><br />
We can simplify this objective by removing the constant term <math>l(y_i,\hat{y_i}^{(t-1)})</math>.<br><br />
Define <math>I_j=\{i|q(x_i)=j\}</math>, where <math>q</math> is the tree structure. Since every <math>x_i</math> is mapped by <math>q</math> to some leaf <math>j</math>, going through every <math>x_i</math> is equivalent to going through each leaf j of the structure.<br />
\begin{align}<br />
\tilde{\mathcal{L}}^{(t)}&= \sum_{i}^{n}[g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
&= \sum_{j=1}^{T}[(\sum_{i \in I_j}g_i)\omega_j+\frac{1}{2}(\sum_{i \in I_j}h_i+\lambda)\omega_j^2]+\gamma T<br />
\end{align}<br />
Then for a fixed structure <math>q</math>, the optimal weight of leaf <math>j</math> and the optimal objective value are given as<br><br />
\begin{align}<br />
\omega_j^{*} &= -\frac{\sum_{i \in I_j}g_i}{\sum_{i \in I_j}h_i+\lambda}\\<br />
\tilde{\mathcal{L}}^{(t)}(q) &=-\frac{1}{2}\sum_{j=1}^{T}\frac{(\sum_{i \in I_j}g_i)^2}{\sum_{i \in I_j}h_i+\lambda}+\gamma T<br />
\end{align} <br />
[[File:Structure Score Calculation.png|frame|center|alt=Alt text|Structure Score Calculation]]<br />
Instead of enumerating through all possible tree structures q, a greedy algorithm of iteratively adding branches is used.<br><br />
Let <math>I_L</math> and <math>I_R</math> be the instance sets of left and right nodes after split and let <math>I=I_L\cup I_R</math>.<br><br />
The loss reduction after split is given by<br><br />
\begin{align}<br />
\tilde{\mathcal{L}}_{\text{split}} &=\frac{1}{2}[\frac{(\sum_{i \in I_L}g_i)^2}{\sum_{i \in I_L}h_i+\lambda}+\frac{(\sum_{i \in I_R}g_i)^2}{\sum_{i \in I_R}h_i+\lambda}-\frac{(\sum_{i \in I}g_i)^2}{\sum_{i \in I}h_i+\lambda}]+\gamma<br />
\end{align}<br />
=== Shrinkage and Column Subsampling ===<br />
The author also mentioned two other methods in order to avoid over-fitting.<br><br />
(1) Shrinkage. Similar to the learning rate in stochastic optimization, a new weight is added to each tree boosting to reduce the influence of a single tree and leave space for future trees.<br><br />
(2) Column (feature) subsampling. In the paper, the author only mentioned that this technique speeds up parallel algorithm used in later sections.<br />
<br />
== Split Finding Algorithms ==<br />
<br />
It is very important to find the best split for tree learning to perform well. Here are a few split finding algorithms mentioned in the paper:<br />
<br />
=== Basic Exact Greedy Algorithm ===<br />
<br />
The basic exact greedy algorithm is a split finding algorithm that is computationally expensive because it enumerates over all the possible splits for continuous features. It is impossible to be done efficiently when the memory is not enough to hold the data needed. A way to carry out this algorithm efficiently is to sort the data according to feature values and visit the data in order to accumulate the gradient statistics. The algorithm is shown below:<br />
<br />
[[File:algo1xg.png|center|alt=Alt text|Basic Exact Greedy Algorithm]]<br />
<br />
=== Approximate Algorithm ===<br />
<br />
The paper introduced a more efficient algorithm compared to Basic Exact Greedy Algorithm which is the Approximate Algorithm. The Approximate Algorithm first proposes candidate splitting points according to percentiles of feature distribution. It then maps the continuous features into buckets split by candidate points, aggregates the statistics and finds the best solution among proposals based on the aggregated statistics. The algorithm is shown below:<br />
<br />
[[File:algo2xg.png|center|alt=Alt text|Approximate Algorithm]]<br />
<br />
There are also two variants to this algorithm, the global variant proposes all the candidate splits during the initial phase of tree construction and uses the same proposals for split finding at all levels. Whereas, the local variant re-proposes after each split. The global variant usually requires less proposal steps but uses more candidate points than local variant because candidates are not refined after each split. For deeper trees, usage of local variant may be more appropriate as compared to global variant. The figure below shows the a comparison in accuracy between Basic Exact Greedy and Approximate split finding algorithms with different variant over the number of iterations. We can see that the quantile strategy is able to achieve similar accuracy as the Basic Exact Greedy algorithm given a reasonable approximation level.<br />
<br />
[[File:accuracyxg.png|center|alt=Alt text|Comparison of accuracy between different algorithms]]<br />
<br />
=== Weighted Quantile Sketch ===<br />
<br />
Proposing candidate split points is the most important step in the Approximate Algorithm, it is done by using the percentile of a feature to make candidates distribute evenly on a dataset.<br />
<br />
Formally, we have a dataset<br />
<br />
<math>D_k={(x_{1k},h_1),(x_{2k},h_2),...,(x_{nk},h_n)}</math><br />
<br />
where <math> x_i </math>'s are the feature values of each data point and <math> h_i </math>'s represents the weight of the corresponding feature <math> x_i </math>. <br />
<br />
Then, we can use the following rank function to compute <math>r_k(z)</math>, the proportion of instances whose feature value among <math> (x_i,...,x_k) </math> is smaller than data point <math> z </math>.<br />
<br />
<math>r_k(z) = \frac{1}{\sum_{(x,h) \in D_k} h} \displaystyle\sum_{(x,h) \in D_k, x<z} h,</math><br />
<br />
The objective here is to find candidate split points <math>{s_{k1}, s_{k2}, …, s_{kl}}</math>, such that:<br />
<br />
<math>|r_k(s_{k,j}) – r_k(s_{k,j+1})| < \epsilon, s_{k1} = \displaystyle\min_i x_{ik}, s_{kl} = \displaystyle\max_{i} x_{ik}, \forall i</math><br />
<br />
Where <math>\epsilon</math> is an approximation factor. Usually, it should approximately have <math>\frac{1}{\epsilon}</math> splitting points.<br />
<br />
=== Sparsity-aware Split Finding ===<br />
<br />
Typically in real world situation, it is quite common that our dataset is sparse. Some of the possible causes are:<br />
<br />
# Missing values in the data<br />
# Huge amount of zero entries present in the data<br />
# Artifacts of feature engineering (e.g. One-hot encoding)<br />
<br />
In order to solve the sparsity present in the dataset, we suggest to add a default direction in each tree node will classified into when there is a missing value in the matrix of the dataset. This is demonstrated in the figure below:<br />
<br />
[[File:fig4xg.png|center|alt=Alt text|Default Direction for sparsity]]<br />
<br />
== System Design ==<br />
<br />
=== Column Block for Parallel Learning ===<br />
The most time consuming part of tree learning is to get the data into sorted order. To overcome this problem, XGBoost stores the data in blocks where each block performs the sorting operation in parallel. The results are then merged together.<br />
<br />
# For the exact greedy algorithm, XGBoost stores the entire dataset in a single block<br />
#:* Original spase aware algorithm costs: <math>O(Kd∥x∥_0 log(n))</math><br />
#:* Tree boosting on block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(n))</math><br />
#:* Hence, block structure helps to save an additional <math>log(n)</math> factor<br />
# For approximate algorithms, XGBoost stores the dataset in multiple blocks<br />
#:* Original algorithm with binary search costs: <math>O(Kd∥x∥_0 log(q))</math><br />
#:* With block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(B))</math><br />
#:* Hence, block structure helps to save an additional <math>log(q)</math> factor <br />
<br />
K = total number of trees<br /><br />
d = maximum depth of the tree<br /><br />
<math>∥x∥_0</math> = number of non-missing entries in the training data<br /><br />
n = number of rows in the dataset<br /><br />
q = number of proposal candidates in the dataset, usually between 32 to 100<br /><br />
B = maximum number of rows in each block<br />
<br />
[[File: columnblock.png|800px|thumb|center]]<br />
<br />
=== Cache-aware Access ===<br />
The proposed block structure optimizes the computation complexity but requires indirect fetches of gradient statistics by row index. XGBoost optimizes the process by using the following methods.<br />
<br />
# For the exact greedy algorithm, XGBoost uses a cache-aware prefetching algorithm<br />
#:* It stores Gradient and Hessians in the cache to make calculations fast<br />
#:* It runs twice as fast as the naive method when the dataset is large<br />
# For approximate algorithms, XGBoost chooses a specific block size<br />
#:* Choosing a small block size results in inefficient parallelization<br />
#:* Choosing a large block size results in cache misses<br />
#:* Various choices of block size are compared and the results are shown in Figure 9<br />
#:* XGBoost chose <math>2^{16}</math> as the block size<br />
<br />
[[File: blocksize.png|400px|thumb|center]]<br />
<br />
=== Blocks for Out-of-core Computation ===<br />
When the dataset is too large for the cache and main memory, XGBoost utilizes disk spaces as well. Since reading and writing data to the disks are slow, XGBoost optimizes the process by using the following two methods.<br />
<br />
# Block Compression<br />
#:* Blocks are compressed by columns<br />
#:* Although decompressing takes time, it is still faster than reading from the disks<br />
# Block Sharding<br />
#:* If multiple disks are available, data is split into those disks<br />
#:* When the CPU needs data, all the disks can be read at the same time<br />
<br />
== End To End Evaluations ==<br />
=== System Implementation ===<br />
XGBoost is a portable and reusable open-source package. It supports:<br />
* various weighted classification<br />
* various objective functions (rank & user defined)<br />
* popular languages (python, R, Julia)<br />
* data science pipelines (scikit-learn)<br />
* big data stacks (Flink, Spark)<br />
* cloud platform (Tianchi8)<br />
<br />
=== Dataset and Setup ===<br />
<br />
A summary of the 4 datasets used in the experiments is in table 2.<br />
<br />
[[File: table2data.png|500px|thumb|center]]<br />
<br />
The first and last datasets were used specifically to evaluate the impact of sparsity-aware algorithm and the scaling property of the system in the out-of-core and the distributed settings respectively. In all of the experiments, common settings such as maximum depth equal to 8, shrinkage equal to 0.1 and no column subsampling are applied.<br />
<br />
=== Classification ===<br />
A subset (n = 1M) of Higgs Boson dataset was used for classification. The results are shown in Table 3.<br />
<br />
[[File: classification.png|500px|thumb|center]]<br />
<br />
* R’s GBM creates a tree fast by using greedy approach that only expands one branch of a tree but with the cost of lower accuracy<br />
* XGBoost and scikit-learn have better performance than R’s GBM<br />
* XGBoost runs more than 10x faster than scikit-learn in learning a full tree<br />
* Column subsamples give slightly worse performance possibly due to a few important features in this dataset.<br />
<br />
=== Learning to Rank ===<br />
The results in comparing XGBoost with pGBRT are shown in Table 4.<br />
<br />
[[File: rank.png|500px|thumb|center]]<br />
<br />
* XGBoost runs exact greedy algorithm while pGBRT only supports an approximate algorithm<br />
* XGBoost runs faster<br />
* Subsampling column reduces running time and gives higher performance possibly due to preventing overfitting<br />
<br />
=== Out-of-core Experiment ===<br />
An extremely large Criteo dataset was used to evaluate the out-of-core setting. The results are shown in the figure below.<br />
<br />
[[File: outofcore.png|350px|thumb|center]]<br />
<br />
* Compression speed up the computation by a factor of 3<br />
* Sharding into 2 disks further gives 2x speed<br />
<br />
=== Distributed Experiment ===<br />
YARN cluster on EC2 with m3.2xlarge machines was used to evaluate the distributed setting. XGBoost was compared with Spark MLLib and H20.<br />
<br />
* XGBoost can switch to out-of-core setting when the memory runs out, while the baseline systems need to store the data in RAM<br />
* XGBoost runs faster than the baseline systems<br />
* The baseline systems are only able to handle a subset of the data with the given resources while XGBoost was able to scale smoothly to all 1.7B rows<br />
* XGBoost’s performance scales linearly with more machines<br />
* XGBoost is able to handle all 1.7B data with only 4 machines<br />
<br />
== Conclusion ==<br />
<br />
== References ==<br />
[1] R. Bekkerman. The present and the future of the kdd cup competition: an outsider’s perspective. <br />
<br />
[2] R. Bekkerman, M. Bilenko, and J. Langford. Scaling Up Machine Learning: Parallel and Distributed Approaches. Cambridge University Press, New York, NY, USA, 2011. <br />
<br />
[3] J. Bennett and S. Lanning. The netflix prize. In Proceedings of the KDD Cup Workshop 2007, pages 3–6, New York, Aug. 2007.<br />
<br />
[4] L. Breiman. Random forests. Maching Learning, 45(1):5–32, Oct. 2001.<br />
<br />
[5] C. Burges. From ranknet to lambdarank to lambdamart: An overview. Learning, 11:23–581, 2010.<br />
<br />
[6] O. Chapelle and Y. Chang. Yahoo! Learning to Rank Challenge Overview. Journal of Machine Learning Research - W & CP, 14:1–24, 2011.<br />
<br />
[7] T. Chen, H. Li, Q. Yang, and Y. Yu. General functional matrix factorization using gradient boosting. In Proceeding of 30th International Conference on Machine Learning (ICML’13), volume 1, pages 436–444, 2013.<br />
<br />
[8] T. Chen, S. Singh, B. Taskar, and C. Guestrin. Efficient second-order gradient boosting for conditional random fields. In Proceeding of 18th Artificial Intelligence and Statistics Conference (AISTATS’15), volume 1, 2015.<br />
<br />
[9] R.-E. Fan, K.-W. Chang, C.-J. Hsieh, X.-R. Wang, and C.-J. Lin. LIBLINEAR: A library for large linear classification. Journal of Machine Learning Research, 9:1871–1874, 2008.<br />
<br />
[10] J. Friedman. Greedy function approximation: a gradient boosting machine. Annals of Statistics, 29(5):1189–1232, 2001.<br />
<br />
[11] J. Friedman. Stochastic gradient boosting. Computational Statistics & Data Analysis, 38(4):367–378, 2002.<br />
<br />
[12] J. Friedman, T. Hastie, and R. Tibshirani. Additive logistic regression: a statistical view of boosting. Annals of Statistics, 28(2):337–407, 2000.<br />
<br />
[13] J. H. Friedman and B. E. Popescu. Importance sampled learning ensembles, 2003.<br />
<br />
[14] M. Greenwald and S. Khanna. Space-efficient online computation of quantile summaries. In Proceedings of the 2001 ACM SIGMOD International Conference on Management of Data, pages 58–66, 2001.<br />
<br />
[15] X. He, J. Pan, O. Jin, T. Xu, B. Liu, T. Xu, Y. Shi, A. Atallah, R. Herbrich, S. Bowers, and J. Q. n. Candela. Practical lessons from predicting clicks on ads at facebook. In Proceedings of the Eighth International Workshop on Data Mining for Online Advertising, ADKDD’14, 2014.<br />
<br />
[16] P. Li. Robust Logitboost and adaptive base class (ABC) Logitboost. In Proceedings of the Twenty-Sixth Conference Annual Conference on Uncertainty in Artificial Intelligence (UAI’10), pages 302–311, 2010.<br />
<br />
[17] P. Li, Q. Wu, and C. J. Burges. Mcrank: Learning to rank using multiple classification and gradient boosting. In Advances in Neural Information Processing Systems 20, pages 897–904. 2008.<br />
<br />
[18] X. Meng, J. Bradley, B. Yavuz, E. Sparks, S. Venkataraman, D. Liu, J. Freeman, D. Tsai, M. Amde, S. Owen, D. Xin, R. Xin, M. J. Franklin, R. Zadeh, M. Zaharia, and A. Talwalkar. MLlib: Machine learning in apache spark. Journal of Machine Learning Research, 17(34):1–7, 2016.<br />
<br />
[19] B. Panda, J. S. Herbach, S. Basu, and R. J. Bayardo. Planet: Massively parallel learning of tree ensembles with mapreduce. Proceeding of VLDB Endowment, 2(2):1426–1437, Aug. 2009.<br />
<br />
[20] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.<br />
<br />
[21] G. Ridgeway. Generalized Boosted Models: A guide to the gbm package.<br />
<br />
[22] S. Tyree, K. Weinberger, K. Agrawal, and J. Paykin. Parallel boosted regression trees for web search ranking. In Proceedings of the 20th international conference on World wide web, pages 387–396. ACM, 2011.<br />
<br />
[23] J. Ye, J.-H. Chow, J. Chen, and Z. Zheng. Stochastic gradient boosted distributed decision trees. In Proceedings of the 18th ACM Conference on Information and Knowledge Management, CIKM ’09.<br />
<br />
[24] Q. Zhang and W. Wang. A fast algorithm for approximate quantiles in high speed data streams. In Proceedings of the 19th International Conference on Scientific and Statistical Database Management, 2007.<br />
<br />
[25] T. Zhang and R. Johnson. Learning nonlinear functions using regularized greedy forest. IEEE Transactions on Pattern Analysis and Machine Intelligence, 36(5), 2014.</div>Cwlokehttp://wiki.math.uwaterloo.ca/statwiki/index.php?title=File:fig4xg.PNG&diff=51129File:fig4xg.PNG2021-11-29T05:16:32Z<p>Cwloke: </p>
<hr />
<div></div>Cwlokehttp://wiki.math.uwaterloo.ca/statwiki/index.php?title=XGBoost&diff=51128XGBoost2021-11-29T05:15:44Z<p>Cwloke: /* Approximate Algorithm */</p>
<hr />
<div>== Presented by == <br />
* Chun Waan Loke<br />
* Peter Chong<br />
* Clarice Osmond<br />
* Zhilong Li<br />
<br />
== Introduction ==<br />
<br />
== Tree Boosting In A Nutshell ==<br />
The author reviews gradient tree boosting in this section.<br />
=== Regularized Learning Objective ===<br />
The author first gives the prediction equation (1) and the regularized objective (2).<br><br />
<br><br />
(1) The additive prediction model is given as<br><br />
<math>\hat{y_i}=\sum_{k=1}^{K}f_k(x_i), f_k \in \mathcal{F} </math> <br><br />
where each <math>f_k</math> corresponds to an independent tree structure with its weights, and <math>\mathcal{F}</math> is the "space of regression trees"<br><br />
<br><br />
(2) The regularized objective to be minimized is given as<br><br />
<math>\mathcal{L}=\sum_{i}l(\hat{y_i},y_i)+\sum_k \Omega(f_k)</math> where <math>\Omega(f)=\gamma T+\frac{1}{2}\lambda ||\omega||^2</math> <br><br />
The first term <math>l</math> is a differentiable convex loss function that calculates the measures between <math>\hat{y}</math> and <math>y</math>.<br><br />
The second term <math>\Omega</math> penalizes on the complexity of model (the <math>f_k</math>'s). For a given tree (<math>f_k</math>), <math>T</math> is the number of leaves, and <math>\omega</math> is the leaf weights.<br><br />
The L1 regularization term <math>\gamma T</math> encourages the tree to be small, and the L2 regularization term <math>\frac{1}{2}\lambda ||\omega||^2</math> encourages the tree to have small weights.<br><br />
<br />
=== Gradient Tree Boosting ===<br />
Let <math>\hat{y_i}^{(t)}</math> be the prediction of <math>y_i</math> at the t-th iteration.<br><br />
Since the prediction equation is simply additive, <math>{\hat y_i}^{(t)}=\hat{y_{i}}^{(t-1)}+f_t(x_i)</math><br><br />
Using this equation and 2nd order Taylor approximation on the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> gives <br><br />
\begin{align}<br />
\mathcal{L}^{(t)}&=\sum_{i}^{n}l(y_i,\hat{y_i}^{(t-1)}+f_t(x_i))+\Omega(f_t)\\<br />
&\simeq \sum_{i}^{n}[l(y_i,\hat{y_i}^{(t-1)})+g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
\end{align}<br />
where <math>g_i</math> and <math>h_i</math> are the first and second derivative of the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> with repspect to the term <math>\hat{y}^{(t-1)}</math><br><br />
We can simplify this objective by removing the constant term <math>l(y_i,\hat{y_i}^{(t-1)})</math>.<br><br />
Define <math>I_j=\{i|q(x_i)=j\}</math>, where <math>q</math> is the tree structure. Since every <math>x_i</math> is mapped by <math>q</math> to some leaf <math>j</math>, going through every <math>x_i</math> is equivalent to going through each leaf j of the structure.<br />
\begin{align}<br />
\tilde{\mathcal{L}}^{(t)}&= \sum_{i}^{n}[g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
&= \sum_{j=1}^{T}[(\sum_{i \in I_j}g_i)\omega_j+\frac{1}{2}(\sum_{i \in I_j}h_i+\lambda)\omega_j^2]+\gamma T<br />
\end{align}<br />
Then for a fixed structure <math>q</math>, the optimal weight of leaf <math>j</math> and the optimal objective value are given as<br><br />
\begin{align}<br />
\omega_j^{*} &= -\frac{\sum_{i \in I_j}g_i}{\sum_{i \in I_j}h_i+\lambda}\\<br />
\tilde{\mathcal{L}}^{(t)}(q) &=-\frac{1}{2}\sum_{j=1}^{T}\frac{(\sum_{i \in I_j}g_i)^2}{\sum_{i \in I_j}h_i+\lambda}+\gamma T<br />
\end{align} <br />
[[File:Structure Score Calculation.png|frame|center|alt=Alt text|Structure Score Calculation]]<br />
Instead of enumerating through all possible tree structures q, a greedy algorithm of iteratively adding branches is used.<br><br />
Let <math>I_L</math> and <math>I_R</math> be the instance sets of left and right nodes after split and let <math>I=I_L\cup I_R</math>.<br><br />
The loss reduction after split is given by<br><br />
\begin{align}<br />
\tilde{\mathcal{L}}_{\text{split}} &=\frac{1}{2}[\frac{(\sum_{i \in I_L}g_i)^2}{\sum_{i \in I_L}h_i+\lambda}+\frac{(\sum_{i \in I_R}g_i)^2}{\sum_{i \in I_R}h_i+\lambda}-\frac{(\sum_{i \in I}g_i)^2}{\sum_{i \in I}h_i+\lambda}]+\gamma<br />
\end{align}<br />
=== Shrinkage and Column Subsampling ===<br />
The author also mentioned two other methods in order to avoid over-fitting.<br><br />
(1) Shrinkage. Similar to the learning rate in stochastic optimization, a new weight is added to each tree boosting to reduce the influence of a single tree and leave space for future trees.<br><br />
(2) Column (feature) subsampling. In the paper, the author only mentioned that this technique speeds up parallel algorithm used in later sections.<br />
<br />
== Split Finding Algorithms ==<br />
<br />
It is very important to find the best split for tree learning to perform well. Here are a few split finding algorithms mentioned in the paper:<br />
<br />
=== Basic Exact Greedy Algorithm ===<br />
<br />
The basic exact greedy algorithm is a split finding algorithm that is computationally expensive because it enumerates over all the possible splits for continuous features. It is impossible to be done efficiently when the memory is not enough to hold the data needed. A way to carry out this algorithm efficiently is to sort the data according to feature values and visit the data in order to accumulate the gradient statistics. The algorithm is shown below:<br />
<br />
[[File:algo1xg.png|center|alt=Alt text|Basic Exact Greedy Algorithm]]<br />
<br />
=== Approximate Algorithm ===<br />
<br />
The paper introduced a more efficient algorithm compared to Basic Exact Greedy Algorithm which is the Approximate Algorithm. The Approximate Algorithm first proposes candidate splitting points according to percentiles of feature distribution. It then maps the continuous features into buckets split by candidate points, aggregates the statistics and finds the best solution among proposals based on the aggregated statistics. The algorithm is shown below:<br />
<br />
[[File:algo2xg.png|center|alt=Alt text|Approximate Algorithm]]<br />
<br />
There are also two variants to this algorithm, the global variant proposes all the candidate splits during the initial phase of tree construction and uses the same proposals for split finding at all levels. Whereas, the local variant re-proposes after each split. The global variant usually requires less proposal steps but uses more candidate points than local variant because candidates are not refined after each split. For deeper trees, usage of local variant may be more appropriate as compared to global variant. The figure below shows the a comparison in accuracy between Basic Exact Greedy and Approximate split finding algorithms with different variant over the number of iterations. We can see that the quantile strategy is able to achieve similar accuracy as the Basic Exact Greedy algorithm given a reasonable approximation level.<br />
<br />
[[File:accuracyxg.png|center|alt=Alt text|Comparison of accuracy between different algorithms]]<br />
<br />
=== Weighted Quantile Sketch ===<br />
<br />
Proposing candidate split points is the most important step in the Approximate Algorithm, it is done by using the percentile of a feature to make candidates distribute evenly on a dataset.<br />
<br />
Formally, we have a dataset<br />
<br />
<math>D_k={(x_{1k},h_1),(x_{2k},h_2),...,(x_{nk},h_n)}</math><br />
<br />
where <math> x_i </math>'s are the feature values of each data point and <math> h_i </math>'s represents the weight of the corresponding feature <math> x_i </math>. <br />
<br />
Then, we can use the following rank function to compute <math>r_k(z)</math>, the proportion of instances whose feature value among <math> (x_i,...,x_k) </math> is smaller than data point <math> z </math>.<br />
<br />
<math>r_k(z) = \frac{1}{\sum_{(x,h) \in D_k} h} \displaystyle\sum_{(x,h) \in D_k, x<z} h,</math><br />
<br />
The objective here is to find candidate split points <math>{s_{k1}, s_{k2}, …, s_{kl}}</math>, such that:<br />
<br />
<math>|r_k(s_{k,j}) – r_k(s_{k,j+1})| < \epsilon, s_{k1} = \displaystyle\min_i x_{ik}, s_{kl} = \displaystyle\max_{i} x_{ik}, \forall i</math><br />
<br />
Where <math>\epsilon</math> is an approximation factor. Usually, it should approximately have <math>\frac{1}{\epsilon}</math> splitting points.<br />
<br />
=== Sparsity-aware Split Finding ===<br />
<br />
Typically in real world situation, it is quite common that our dataset is sparse. Some of the possible causes are:<br />
<br />
# Missing values in the data<br />
# Huge amount of zero entries present in the data<br />
# Artifacts of feature engineering (e.g. One-hot encoding)<br />
<br />
In order to solve the sparsity present in the dataset, we suggest to add a default direction in each tree node will classified into when there is a missing value in the matrix of the dataset. This is demonstrated in the figure below:<br />
<br />
[[File:defaultdirection.png|center|alt=Alt text|Default Direction for sparsity]]<br />
<br />
== System Design ==<br />
<br />
=== Column Block for Parallel Learning ===<br />
The most time consuming part of tree learning is to get the data into sorted order. To overcome this problem, XGBoost stores the data in blocks where each block performs the sorting operation in parallel. The results are then merged together.<br />
<br />
# For the exact greedy algorithm, XGBoost stores the entire dataset in a single block<br />
#:* Original spase aware algorithm costs: <math>O(Kd∥x∥_0 log(n))</math><br />
#:* Tree boosting on block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(n))</math><br />
#:* Hence, block structure helps to save an additional <math>log(n)</math> factor<br />
# For approximate algorithms, XGBoost stores the dataset in multiple blocks<br />
#:* Original algorithm with binary search costs: <math>O(Kd∥x∥_0 log(q))</math><br />
#:* With block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(B))</math><br />
#:* Hence, block structure helps to save an additional <math>log(q)</math> factor <br />
<br />
K = total number of trees<br /><br />
d = maximum depth of the tree<br /><br />
<math>∥x∥_0</math> = number of non-missing entries in the training data<br /><br />
n = number of rows in the dataset<br /><br />
q = number of proposal candidates in the dataset, usually between 32 to 100<br /><br />
B = maximum number of rows in each block<br />
<br />
[[File: columnblock.png|800px|thumb|center]]<br />
<br />
=== Cache-aware Access ===<br />
The proposed block structure optimizes the computation complexity but requires indirect fetches of gradient statistics by row index. XGBoost optimizes the process by using the following methods.<br />
<br />
# For the exact greedy algorithm, XGBoost uses a cache-aware prefetching algorithm<br />
#:* It stores Gradient and Hessians in the cache to make calculations fast<br />
#:* It runs twice as fast as the naive method when the dataset is large<br />
# For approximate algorithms, XGBoost chooses a specific block size<br />
#:* Choosing a small block size results in inefficient parallelization<br />
#:* Choosing a large block size results in cache misses<br />
#:* Various choices of block size are compared and the results are shown in Figure 9<br />
#:* XGBoost chose <math>2^{16}</math> as the block size<br />
<br />
[[File: blocksize.png|400px|thumb|center]]<br />
<br />
=== Blocks for Out-of-core Computation ===<br />
When the dataset is too large for the cache and main memory, XGBoost utilizes disk spaces as well. Since reading and writing data to the disks are slow, XGBoost optimizes the process by using the following two methods.<br />
<br />
# Block Compression<br />
#:* Blocks are compressed by columns<br />
#:* Although decompressing takes time, it is still faster than reading from the disks<br />
# Block Sharding<br />
#:* If multiple disks are available, data is split into those disks<br />
#:* When the CPU needs data, all the disks can be read at the same time<br />
<br />
== End To End Evaluations ==<br />
=== System Implementation ===<br />
XGBoost is a portable and reusable open-source package. It supports:<br />
* various weighted classification<br />
* various objective functions (rank & user defined)<br />
* popular languages (python, R, Julia)<br />
* data science pipelines (scikit-learn)<br />
* big data stacks (Flink, Spark)<br />
* cloud platform (Tianchi8)<br />
<br />
=== Dataset and Setup ===<br />
<br />
A summary of the 4 datasets used in the experiments is in table 2.<br />
<br />
[[File: table2data.png|500px|thumb|center]]<br />
<br />
The first and last datasets were used specifically to evaluate the impact of sparsity-aware algorithm and the scaling property of the system in the out-of-core and the distributed settings respectively. In all of the experiments, common settings such as maximum depth equal to 8, shrinkage equal to 0.1 and no column subsampling are applied.<br />
<br />
=== Classification ===<br />
A subset (n = 1M) of Higgs Boson dataset was used for classification. The results are shown in Table 3.<br />
<br />
[[File: classification.png|500px|thumb|center]]<br />
<br />
* R’s GBM creates a tree fast by using greedy approach that only expands one branch of a tree but with the cost of lower accuracy<br />
* XGBoost and scikit-learn have better performance than R’s GBM<br />
* XGBoost runs more than 10x faster than scikit-learn in learning a full tree<br />
* Column subsamples give slightly worse performance possibly due to a few important features in this dataset.<br />
<br />
=== Learning to Rank ===<br />
The results in comparing XGBoost with pGBRT are shown in Table 4.<br />
<br />
[[File: rank.png|500px|thumb|center]]<br />
<br />
* XGBoost runs exact greedy algorithm while pGBRT only supports an approximate algorithm<br />
* XGBoost runs faster<br />
* Subsampling column reduces running time and gives higher performance possibly due to preventing overfitting<br />
<br />
=== Out-of-core Experiment ===<br />
An extremely large Criteo dataset was used to evaluate the out-of-core setting. The results are shown in the figure below.<br />
<br />
[[File: outofcore.png|350px|thumb|center]]<br />
<br />
* Compression speed up the computation by a factor of 3<br />
* Sharding into 2 disks further gives 2x speed<br />
<br />
=== Distributed Experiment ===<br />
YARN cluster on EC2 with m3.2xlarge machines was used to evaluate the distributed setting. XGBoost was compared with Spark MLLib and H20.<br />
<br />
* XGBoost can switch to out-of-core setting when the memory runs out, while the baseline systems need to store the data in RAM<br />
* XGBoost runs faster than the baseline systems<br />
* The baseline systems are only able to handle a subset of the data with the given resources while XGBoost was able to scale smoothly to all 1.7B rows<br />
* XGBoost’s performance scales linearly with more machines<br />
* XGBoost is able to handle all 1.7B data with only 4 machines<br />
<br />
== Conclusion ==<br />
<br />
== References ==<br />
[1] R. Bekkerman. The present and the future of the kdd cup competition: an outsider’s perspective. <br />
<br />
[2] R. Bekkerman, M. Bilenko, and J. Langford. Scaling Up Machine Learning: Parallel and Distributed Approaches. Cambridge University Press, New York, NY, USA, 2011. <br />
<br />
[3] J. Bennett and S. Lanning. The netflix prize. In Proceedings of the KDD Cup Workshop 2007, pages 3–6, New York, Aug. 2007.<br />
<br />
[4] L. Breiman. Random forests. Maching Learning, 45(1):5–32, Oct. 2001.<br />
<br />
[5] C. Burges. From ranknet to lambdarank to lambdamart: An overview. Learning, 11:23–581, 2010.<br />
<br />
[6] O. Chapelle and Y. Chang. Yahoo! Learning to Rank Challenge Overview. Journal of Machine Learning Research - W & CP, 14:1–24, 2011.<br />
<br />
[7] T. Chen, H. Li, Q. Yang, and Y. Yu. General functional matrix factorization using gradient boosting. In Proceeding of 30th International Conference on Machine Learning (ICML’13), volume 1, pages 436–444, 2013.<br />
<br />
[8] T. Chen, S. Singh, B. Taskar, and C. Guestrin. Efficient second-order gradient boosting for conditional random fields. In Proceeding of 18th Artificial Intelligence and Statistics Conference (AISTATS’15), volume 1, 2015.<br />
<br />
[9] R.-E. Fan, K.-W. Chang, C.-J. Hsieh, X.-R. Wang, and C.-J. Lin. LIBLINEAR: A library for large linear classification. Journal of Machine Learning Research, 9:1871–1874, 2008.<br />
<br />
[10] J. Friedman. Greedy function approximation: a gradient boosting machine. Annals of Statistics, 29(5):1189–1232, 2001.<br />
<br />
[11] J. Friedman. Stochastic gradient boosting. Computational Statistics & Data Analysis, 38(4):367–378, 2002.<br />
<br />
[12] J. Friedman, T. Hastie, and R. Tibshirani. Additive logistic regression: a statistical view of boosting. Annals of Statistics, 28(2):337–407, 2000.<br />
<br />
[13] J. H. Friedman and B. E. Popescu. Importance sampled learning ensembles, 2003.<br />
<br />
[14] M. Greenwald and S. Khanna. Space-efficient online computation of quantile summaries. In Proceedings of the 2001 ACM SIGMOD International Conference on Management of Data, pages 58–66, 2001.<br />
<br />
[15] X. He, J. Pan, O. Jin, T. Xu, B. Liu, T. Xu, Y. Shi, A. Atallah, R. Herbrich, S. Bowers, and J. Q. n. Candela. Practical lessons from predicting clicks on ads at facebook. In Proceedings of the Eighth International Workshop on Data Mining for Online Advertising, ADKDD’14, 2014.<br />
<br />
[16] P. Li. Robust Logitboost and adaptive base class (ABC) Logitboost. In Proceedings of the Twenty-Sixth Conference Annual Conference on Uncertainty in Artificial Intelligence (UAI’10), pages 302–311, 2010.<br />
<br />
[17] P. Li, Q. Wu, and C. J. Burges. Mcrank: Learning to rank using multiple classification and gradient boosting. In Advances in Neural Information Processing Systems 20, pages 897–904. 2008.<br />
<br />
[18] X. Meng, J. Bradley, B. Yavuz, E. Sparks, S. Venkataraman, D. Liu, J. Freeman, D. Tsai, M. Amde, S. Owen, D. Xin, R. Xin, M. J. Franklin, R. Zadeh, M. Zaharia, and A. Talwalkar. MLlib: Machine learning in apache spark. Journal of Machine Learning Research, 17(34):1–7, 2016.<br />
<br />
[19] B. Panda, J. S. Herbach, S. Basu, and R. J. Bayardo. Planet: Massively parallel learning of tree ensembles with mapreduce. Proceeding of VLDB Endowment, 2(2):1426–1437, Aug. 2009.<br />
<br />
[20] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.<br />
<br />
[21] G. Ridgeway. Generalized Boosted Models: A guide to the gbm package.<br />
<br />
[22] S. Tyree, K. Weinberger, K. Agrawal, and J. Paykin. Parallel boosted regression trees for web search ranking. In Proceedings of the 20th international conference on World wide web, pages 387–396. ACM, 2011.<br />
<br />
[23] J. Ye, J.-H. Chow, J. Chen, and Z. Zheng. Stochastic gradient boosted distributed decision trees. In Proceedings of the 18th ACM Conference on Information and Knowledge Management, CIKM ’09.<br />
<br />
[24] Q. Zhang and W. Wang. A fast algorithm for approximate quantiles in high speed data streams. In Proceedings of the 19th International Conference on Scientific and Statistical Database Management, 2007.<br />
<br />
[25] T. Zhang and R. Johnson. Learning nonlinear functions using regularized greedy forest. IEEE Transactions on Pattern Analysis and Machine Intelligence, 36(5), 2014.</div>Cwlokehttp://wiki.math.uwaterloo.ca/statwiki/index.php?title=File:accuracyxg.png&diff=51127File:accuracyxg.png2021-11-29T05:15:32Z<p>Cwloke: </p>
<hr />
<div></div>Cwlokehttp://wiki.math.uwaterloo.ca/statwiki/index.php?title=XGBoost&diff=51126XGBoost2021-11-29T05:14:50Z<p>Cwloke: /* Approximate Algorithm */</p>
<hr />
<div>== Presented by == <br />
* Chun Waan Loke<br />
* Peter Chong<br />
* Clarice Osmond<br />
* Zhilong Li<br />
<br />
== Introduction ==<br />
<br />
== Tree Boosting In A Nutshell ==<br />
The author reviews gradient tree boosting in this section.<br />
=== Regularized Learning Objective ===<br />
The author first gives the prediction equation (1) and the regularized objective (2).<br><br />
<br><br />
(1) The additive prediction model is given as<br><br />
<math>\hat{y_i}=\sum_{k=1}^{K}f_k(x_i), f_k \in \mathcal{F} </math> <br><br />
where each <math>f_k</math> corresponds to an independent tree structure with its weights, and <math>\mathcal{F}</math> is the "space of regression trees"<br><br />
<br><br />
(2) The regularized objective to be minimized is given as<br><br />
<math>\mathcal{L}=\sum_{i}l(\hat{y_i},y_i)+\sum_k \Omega(f_k)</math> where <math>\Omega(f)=\gamma T+\frac{1}{2}\lambda ||\omega||^2</math> <br><br />
The first term <math>l</math> is a differentiable convex loss function that calculates the measures between <math>\hat{y}</math> and <math>y</math>.<br><br />
The second term <math>\Omega</math> penalizes on the complexity of model (the <math>f_k</math>'s). For a given tree (<math>f_k</math>), <math>T</math> is the number of leaves, and <math>\omega</math> is the leaf weights.<br><br />
The L1 regularization term <math>\gamma T</math> encourages the tree to be small, and the L2 regularization term <math>\frac{1}{2}\lambda ||\omega||^2</math> encourages the tree to have small weights.<br><br />
<br />
=== Gradient Tree Boosting ===<br />
Let <math>\hat{y_i}^{(t)}</math> be the prediction of <math>y_i</math> at the t-th iteration.<br><br />
Since the prediction equation is simply additive, <math>{\hat y_i}^{(t)}=\hat{y_{i}}^{(t-1)}+f_t(x_i)</math><br><br />
Using this equation and 2nd order Taylor approximation on the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> gives <br><br />
\begin{align}<br />
\mathcal{L}^{(t)}&=\sum_{i}^{n}l(y_i,\hat{y_i}^{(t-1)}+f_t(x_i))+\Omega(f_t)\\<br />
&\simeq \sum_{i}^{n}[l(y_i,\hat{y_i}^{(t-1)})+g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
\end{align}<br />
where <math>g_i</math> and <math>h_i</math> are the first and second derivative of the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> with repspect to the term <math>\hat{y}^{(t-1)}</math><br><br />
We can simplify this objective by removing the constant term <math>l(y_i,\hat{y_i}^{(t-1)})</math>.<br><br />
Define <math>I_j=\{i|q(x_i)=j\}</math>, where <math>q</math> is the tree structure. Since every <math>x_i</math> is mapped by <math>q</math> to some leaf <math>j</math>, going through every <math>x_i</math> is equivalent to going through each leaf j of the structure.<br />
\begin{align}<br />
\tilde{\mathcal{L}}^{(t)}&= \sum_{i}^{n}[g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
&= \sum_{j=1}^{T}[(\sum_{i \in I_j}g_i)\omega_j+\frac{1}{2}(\sum_{i \in I_j}h_i+\lambda)\omega_j^2]+\gamma T<br />
\end{align}<br />
Then for a fixed structure <math>q</math>, the optimal weight of leaf <math>j</math> and the optimal objective value are given as<br><br />
\begin{align}<br />
\omega_j^{*} &= -\frac{\sum_{i \in I_j}g_i}{\sum_{i \in I_j}h_i+\lambda}\\<br />
\tilde{\mathcal{L}}^{(t)}(q) &=-\frac{1}{2}\sum_{j=1}^{T}\frac{(\sum_{i \in I_j}g_i)^2}{\sum_{i \in I_j}h_i+\lambda}+\gamma T<br />
\end{align} <br />
[[File:Structure Score Calculation.png|frame|center|alt=Alt text|Structure Score Calculation]]<br />
Instead of enumerating through all possible tree structures q, a greedy algorithm of iteratively adding branches is used.<br><br />
Let <math>I_L</math> and <math>I_R</math> be the instance sets of left and right nodes after split and let <math>I=I_L\cup I_R</math>.<br><br />
The loss reduction after split is given by<br><br />
\begin{align}<br />
\tilde{\mathcal{L}}_{\text{split}} &=\frac{1}{2}[\frac{(\sum_{i \in I_L}g_i)^2}{\sum_{i \in I_L}h_i+\lambda}+\frac{(\sum_{i \in I_R}g_i)^2}{\sum_{i \in I_R}h_i+\lambda}-\frac{(\sum_{i \in I}g_i)^2}{\sum_{i \in I}h_i+\lambda}]+\gamma<br />
\end{align}<br />
=== Shrinkage and Column Subsampling ===<br />
The author also mentioned two other methods in order to avoid over-fitting.<br><br />
(1) Shrinkage. Similar to the learning rate in stochastic optimization, a new weight is added to each tree boosting to reduce the influence of a single tree and leave space for future trees.<br><br />
(2) Column (feature) subsampling. In the paper, the author only mentioned that this technique speeds up parallel algorithm used in later sections.<br />
<br />
== Split Finding Algorithms ==<br />
<br />
It is very important to find the best split for tree learning to perform well. Here are a few split finding algorithms mentioned in the paper:<br />
<br />
=== Basic Exact Greedy Algorithm ===<br />
<br />
The basic exact greedy algorithm is a split finding algorithm that is computationally expensive because it enumerates over all the possible splits for continuous features. It is impossible to be done efficiently when the memory is not enough to hold the data needed. A way to carry out this algorithm efficiently is to sort the data according to feature values and visit the data in order to accumulate the gradient statistics. The algorithm is shown below:<br />
<br />
[[File:algo1xg.png|center|alt=Alt text|Basic Exact Greedy Algorithm]]<br />
<br />
=== Approximate Algorithm ===<br />
<br />
The paper introduced a more efficient algorithm compared to Basic Exact Greedy Algorithm which is the Approximate Algorithm. The Approximate Algorithm first proposes candidate splitting points according to percentiles of feature distribution. It then maps the continuous features into buckets split by candidate points, aggregates the statistics and finds the best solution among proposals based on the aggregated statistics. The algorithm is shown below:<br />
<br />
[[File:algo2xg.png|center|alt=Alt text|Approximate Algorithm]]<br />
<br />
There are also two variants to this algorithm, the global variant proposes all the candidate splits during the initial phase of tree construction and uses the same proposals for split finding at all levels. Whereas, the local variant re-proposes after each split. The global variant usually requires less proposal steps but uses more candidate points than local variant because candidates are not refined after each split. For deeper trees, usage of local variant may be more appropriate as compared to global variant. The figure below shows the a comparison in accuracy between Basic Exact Greedy and Approximate split finding algorithms with different variant over the number of iterations. We can see that the quantile strategy is able to achieve similar accuracy as the Basic Exact Greedy algorithm given a reasonable approximation level.<br />
<br />
[[File:iterations.png|center|alt=Alt text|Comparison of accuracy between different algorithms]]<br />
<br />
=== Weighted Quantile Sketch ===<br />
<br />
Proposing candidate split points is the most important step in the Approximate Algorithm, it is done by using the percentile of a feature to make candidates distribute evenly on a dataset.<br />
<br />
Formally, we have a dataset<br />
<br />
<math>D_k={(x_{1k},h_1),(x_{2k},h_2),...,(x_{nk},h_n)}</math><br />
<br />
where <math> x_i </math>'s are the feature values of each data point and <math> h_i </math>'s represents the weight of the corresponding feature <math> x_i </math>. <br />
<br />
Then, we can use the following rank function to compute <math>r_k(z)</math>, the proportion of instances whose feature value among <math> (x_i,...,x_k) </math> is smaller than data point <math> z </math>.<br />
<br />
<math>r_k(z) = \frac{1}{\sum_{(x,h) \in D_k} h} \displaystyle\sum_{(x,h) \in D_k, x<z} h,</math><br />
<br />
The objective here is to find candidate split points <math>{s_{k1}, s_{k2}, …, s_{kl}}</math>, such that:<br />
<br />
<math>|r_k(s_{k,j}) – r_k(s_{k,j+1})| < \epsilon, s_{k1} = \displaystyle\min_i x_{ik}, s_{kl} = \displaystyle\max_{i} x_{ik}, \forall i</math><br />
<br />
Where <math>\epsilon</math> is an approximation factor. Usually, it should approximately have <math>\frac{1}{\epsilon}</math> splitting points.<br />
<br />
=== Sparsity-aware Split Finding ===<br />
<br />
Typically in real world situation, it is quite common that our dataset is sparse. Some of the possible causes are:<br />
<br />
# Missing values in the data<br />
# Huge amount of zero entries present in the data<br />
# Artifacts of feature engineering (e.g. One-hot encoding)<br />
<br />
In order to solve the sparsity present in the dataset, we suggest to add a default direction in each tree node will classified into when there is a missing value in the matrix of the dataset. This is demonstrated in the figure below:<br />
<br />
[[File:defaultdirection.png|center|alt=Alt text|Default Direction for sparsity]]<br />
<br />
== System Design ==<br />
<br />
=== Column Block for Parallel Learning ===<br />
The most time consuming part of tree learning is to get the data into sorted order. To overcome this problem, XGBoost stores the data in blocks where each block performs the sorting operation in parallel. The results are then merged together.<br />
<br />
# For the exact greedy algorithm, XGBoost stores the entire dataset in a single block<br />
#:* Original spase aware algorithm costs: <math>O(Kd∥x∥_0 log(n))</math><br />
#:* Tree boosting on block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(n))</math><br />
#:* Hence, block structure helps to save an additional <math>log(n)</math> factor<br />
# For approximate algorithms, XGBoost stores the dataset in multiple blocks<br />
#:* Original algorithm with binary search costs: <math>O(Kd∥x∥_0 log(q))</math><br />
#:* With block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(B))</math><br />
#:* Hence, block structure helps to save an additional <math>log(q)</math> factor <br />
<br />
K = total number of trees<br /><br />
d = maximum depth of the tree<br /><br />
<math>∥x∥_0</math> = number of non-missing entries in the training data<br /><br />
n = number of rows in the dataset<br /><br />
q = number of proposal candidates in the dataset, usually between 32 to 100<br /><br />
B = maximum number of rows in each block<br />
<br />
[[File: columnblock.png|800px|thumb|center]]<br />
<br />
=== Cache-aware Access ===<br />
The proposed block structure optimizes the computation complexity but requires indirect fetches of gradient statistics by row index. XGBoost optimizes the process by using the following methods.<br />
<br />
# For the exact greedy algorithm, XGBoost uses a cache-aware prefetching algorithm<br />
#:* It stores Gradient and Hessians in the cache to make calculations fast<br />
#:* It runs twice as fast as the naive method when the dataset is large<br />
# For approximate algorithms, XGBoost chooses a specific block size<br />
#:* Choosing a small block size results in inefficient parallelization<br />
#:* Choosing a large block size results in cache misses<br />
#:* Various choices of block size are compared and the results are shown in Figure 9<br />
#:* XGBoost chose <math>2^{16}</math> as the block size<br />
<br />
[[File: blocksize.png|400px|thumb|center]]<br />
<br />
=== Blocks for Out-of-core Computation ===<br />
When the dataset is too large for the cache and main memory, XGBoost utilizes disk spaces as well. Since reading and writing data to the disks are slow, XGBoost optimizes the process by using the following two methods.<br />
<br />
# Block Compression<br />
#:* Blocks are compressed by columns<br />
#:* Although decompressing takes time, it is still faster than reading from the disks<br />
# Block Sharding<br />
#:* If multiple disks are available, data is split into those disks<br />
#:* When the CPU needs data, all the disks can be read at the same time<br />
<br />
== End To End Evaluations ==<br />
=== System Implementation ===<br />
XGBoost is a portable and reusable open-source package. It supports:<br />
* various weighted classification<br />
* various objective functions (rank & user defined)<br />
* popular languages (python, R, Julia)<br />
* data science pipelines (scikit-learn)<br />
* big data stacks (Flink, Spark)<br />
* cloud platform (Tianchi8)<br />
<br />
=== Dataset and Setup ===<br />
<br />
A summary of the 4 datasets used in the experiments is in table 2.<br />
<br />
[[File: table2data.png|500px|thumb|center]]<br />
<br />
The first and last datasets were used specifically to evaluate the impact of sparsity-aware algorithm and the scaling property of the system in the out-of-core and the distributed settings respectively. In all of the experiments, common settings such as maximum depth equal to 8, shrinkage equal to 0.1 and no column subsampling are applied.<br />
<br />
=== Classification ===<br />
A subset (n = 1M) of Higgs Boson dataset was used for classification. The results are shown in Table 3.<br />
<br />
[[File: classification.png|500px|thumb|center]]<br />
<br />
* R’s GBM creates a tree fast by using greedy approach that only expands one branch of a tree but with the cost of lower accuracy<br />
* XGBoost and scikit-learn have better performance than R’s GBM<br />
* XGBoost runs more than 10x faster than scikit-learn in learning a full tree<br />
* Column subsamples give slightly worse performance possibly due to a few important features in this dataset.<br />
<br />
=== Learning to Rank ===<br />
The results in comparing XGBoost with pGBRT are shown in Table 4.<br />
<br />
[[File: rank.png|500px|thumb|center]]<br />
<br />
* XGBoost runs exact greedy algorithm while pGBRT only supports an approximate algorithm<br />
* XGBoost runs faster<br />
* Subsampling column reduces running time and gives higher performance possibly due to preventing overfitting<br />
<br />
=== Out-of-core Experiment ===<br />
An extremely large Criteo dataset was used to evaluate the out-of-core setting. The results are shown in the figure below.<br />
<br />
[[File: outofcore.png|350px|thumb|center]]<br />
<br />
* Compression speed up the computation by a factor of 3<br />
* Sharding into 2 disks further gives 2x speed<br />
<br />
=== Distributed Experiment ===<br />
YARN cluster on EC2 with m3.2xlarge machines was used to evaluate the distributed setting. XGBoost was compared with Spark MLLib and H20.<br />
<br />
* XGBoost can switch to out-of-core setting when the memory runs out, while the baseline systems need to store the data in RAM<br />
* XGBoost runs faster than the baseline systems<br />
* The baseline systems are only able to handle a subset of the data with the given resources while XGBoost was able to scale smoothly to all 1.7B rows<br />
* XGBoost’s performance scales linearly with more machines<br />
* XGBoost is able to handle all 1.7B data with only 4 machines<br />
<br />
== Conclusion ==<br />
<br />
== References ==<br />
[1] R. Bekkerman. The present and the future of the kdd cup competition: an outsider’s perspective. <br />
<br />
[2] R. Bekkerman, M. Bilenko, and J. Langford. Scaling Up Machine Learning: Parallel and Distributed Approaches. Cambridge University Press, New York, NY, USA, 2011. <br />
<br />
[3] J. Bennett and S. Lanning. The netflix prize. In Proceedings of the KDD Cup Workshop 2007, pages 3–6, New York, Aug. 2007.<br />
<br />
[4] L. Breiman. Random forests. Maching Learning, 45(1):5–32, Oct. 2001.<br />
<br />
[5] C. Burges. From ranknet to lambdarank to lambdamart: An overview. Learning, 11:23–581, 2010.<br />
<br />
[6] O. Chapelle and Y. Chang. Yahoo! Learning to Rank Challenge Overview. Journal of Machine Learning Research - W & CP, 14:1–24, 2011.<br />
<br />
[7] T. Chen, H. Li, Q. Yang, and Y. Yu. General functional matrix factorization using gradient boosting. In Proceeding of 30th International Conference on Machine Learning (ICML’13), volume 1, pages 436–444, 2013.<br />
<br />
[8] T. Chen, S. Singh, B. Taskar, and C. Guestrin. Efficient second-order gradient boosting for conditional random fields. In Proceeding of 18th Artificial Intelligence and Statistics Conference (AISTATS’15), volume 1, 2015.<br />
<br />
[9] R.-E. Fan, K.-W. Chang, C.-J. Hsieh, X.-R. Wang, and C.-J. Lin. LIBLINEAR: A library for large linear classification. Journal of Machine Learning Research, 9:1871–1874, 2008.<br />
<br />
[10] J. Friedman. Greedy function approximation: a gradient boosting machine. Annals of Statistics, 29(5):1189–1232, 2001.<br />
<br />
[11] J. Friedman. Stochastic gradient boosting. Computational Statistics & Data Analysis, 38(4):367–378, 2002.<br />
<br />
[12] J. Friedman, T. Hastie, and R. Tibshirani. Additive logistic regression: a statistical view of boosting. Annals of Statistics, 28(2):337–407, 2000.<br />
<br />
[13] J. H. Friedman and B. E. Popescu. Importance sampled learning ensembles, 2003.<br />
<br />
[14] M. Greenwald and S. Khanna. Space-efficient online computation of quantile summaries. In Proceedings of the 2001 ACM SIGMOD International Conference on Management of Data, pages 58–66, 2001.<br />
<br />
[15] X. He, J. Pan, O. Jin, T. Xu, B. Liu, T. Xu, Y. Shi, A. Atallah, R. Herbrich, S. Bowers, and J. Q. n. Candela. Practical lessons from predicting clicks on ads at facebook. In Proceedings of the Eighth International Workshop on Data Mining for Online Advertising, ADKDD’14, 2014.<br />
<br />
[16] P. Li. Robust Logitboost and adaptive base class (ABC) Logitboost. In Proceedings of the Twenty-Sixth Conference Annual Conference on Uncertainty in Artificial Intelligence (UAI’10), pages 302–311, 2010.<br />
<br />
[17] P. Li, Q. Wu, and C. J. Burges. Mcrank: Learning to rank using multiple classification and gradient boosting. In Advances in Neural Information Processing Systems 20, pages 897–904. 2008.<br />
<br />
[18] X. Meng, J. Bradley, B. Yavuz, E. Sparks, S. Venkataraman, D. Liu, J. Freeman, D. Tsai, M. Amde, S. Owen, D. Xin, R. Xin, M. J. Franklin, R. Zadeh, M. Zaharia, and A. Talwalkar. MLlib: Machine learning in apache spark. Journal of Machine Learning Research, 17(34):1–7, 2016.<br />
<br />
[19] B. Panda, J. S. Herbach, S. Basu, and R. J. Bayardo. Planet: Massively parallel learning of tree ensembles with mapreduce. Proceeding of VLDB Endowment, 2(2):1426–1437, Aug. 2009.<br />
<br />
[20] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.<br />
<br />
[21] G. Ridgeway. Generalized Boosted Models: A guide to the gbm package.<br />
<br />
[22] S. Tyree, K. Weinberger, K. Agrawal, and J. Paykin. Parallel boosted regression trees for web search ranking. In Proceedings of the 20th international conference on World wide web, pages 387–396. ACM, 2011.<br />
<br />
[23] J. Ye, J.-H. Chow, J. Chen, and Z. Zheng. Stochastic gradient boosted distributed decision trees. In Proceedings of the 18th ACM Conference on Information and Knowledge Management, CIKM ’09.<br />
<br />
[24] Q. Zhang and W. Wang. A fast algorithm for approximate quantiles in high speed data streams. In Proceedings of the 19th International Conference on Scientific and Statistical Database Management, 2007.<br />
<br />
[25] T. Zhang and R. Johnson. Learning nonlinear functions using regularized greedy forest. IEEE Transactions on Pattern Analysis and Machine Intelligence, 36(5), 2014.</div>Cwlokehttp://wiki.math.uwaterloo.ca/statwiki/index.php?title=File:algo2xg.png&diff=51125File:algo2xg.png2021-11-29T05:14:36Z<p>Cwloke: </p>
<hr />
<div></div>Cwlokehttp://wiki.math.uwaterloo.ca/statwiki/index.php?title=File:algo1xg.png&diff=51124File:algo1xg.png2021-11-29T05:13:54Z<p>Cwloke: </p>
<hr />
<div></div>Cwlokehttp://wiki.math.uwaterloo.ca/statwiki/index.php?title=XGBoost&diff=51123XGBoost2021-11-29T05:12:51Z<p>Cwloke: /* Basic Exact Greedy Algorithm */</p>
<hr />
<div>== Presented by == <br />
* Chun Waan Loke<br />
* Peter Chong<br />
* Clarice Osmond<br />
* Zhilong Li<br />
<br />
== Introduction ==<br />
<br />
== Tree Boosting In A Nutshell ==<br />
The author reviews gradient tree boosting in this section.<br />
=== Regularized Learning Objective ===<br />
The author first gives the prediction equation (1) and the regularized objective (2).<br><br />
<br><br />
(1) The additive prediction model is given as<br><br />
<math>\hat{y_i}=\sum_{k=1}^{K}f_k(x_i), f_k \in \mathcal{F} </math> <br><br />
where each <math>f_k</math> corresponds to an independent tree structure with its weights, and <math>\mathcal{F}</math> is the "space of regression trees"<br><br />
<br><br />
(2) The regularized objective to be minimized is given as<br><br />
<math>\mathcal{L}=\sum_{i}l(\hat{y_i},y_i)+\sum_k \Omega(f_k)</math> where <math>\Omega(f)=\gamma T+\frac{1}{2}\lambda ||\omega||^2</math> <br><br />
The first term <math>l</math> is a differentiable convex loss function that calculates the measures between <math>\hat{y}</math> and <math>y</math>.<br><br />
The second term <math>\Omega</math> penalizes on the complexity of model (the <math>f_k</math>'s). For a given tree (<math>f_k</math>), <math>T</math> is the number of leaves, and <math>\omega</math> is the leaf weights.<br><br />
The L1 regularization term <math>\gamma T</math> encourages the tree to be small, and the L2 regularization term <math>\frac{1}{2}\lambda ||\omega||^2</math> encourages the tree to have small weights.<br><br />
<br />
=== Gradient Tree Boosting ===<br />
Let <math>\hat{y_i}^{(t)}</math> be the prediction of <math>y_i</math> at the t-th iteration.<br><br />
Since the prediction equation is simply additive, <math>{\hat y_i}^{(t)}=\hat{y_{i}}^{(t-1)}+f_t(x_i)</math><br><br />
Using this equation and 2nd order Taylor approximation on the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> gives <br><br />
\begin{align}<br />
\mathcal{L}^{(t)}&=\sum_{i}^{n}l(y_i,\hat{y_i}^{(t-1)}+f_t(x_i))+\Omega(f_t)\\<br />
&\simeq \sum_{i}^{n}[l(y_i,\hat{y_i}^{(t-1)})+g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
\end{align}<br />
where <math>g_i</math> and <math>h_i</math> are the first and second derivative of the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> with repspect to the term <math>\hat{y}^{(t-1)}</math><br><br />
We can simplify this objective by removing the constant term <math>l(y_i,\hat{y_i}^{(t-1)})</math>.<br><br />
Define <math>I_j=\{i|q(x_i)=j\}</math>, where <math>q</math> is the tree structure. Since every <math>x_i</math> is mapped by <math>q</math> to some leaf <math>j</math>, going through every <math>x_i</math> is equivalent to going through each leaf j of the structure.<br />
\begin{align}<br />
\tilde{\mathcal{L}}^{(t)}&= \sum_{i}^{n}[g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
&= \sum_{j=1}^{T}[(\sum_{i \in I_j}g_i)\omega_j+\frac{1}{2}(\sum_{i \in I_j}h_i+\lambda)\omega_j^2]+\gamma T<br />
\end{align}<br />
Then for a fixed structure <math>q</math>, the optimal weight of leaf <math>j</math> and the optimal objective value are given as<br><br />
\begin{align}<br />
\omega_j^{*} &= -\frac{\sum_{i \in I_j}g_i}{\sum_{i \in I_j}h_i+\lambda}\\<br />
\tilde{\mathcal{L}}^{(t)}(q) &=-\frac{1}{2}\sum_{j=1}^{T}\frac{(\sum_{i \in I_j}g_i)^2}{\sum_{i \in I_j}h_i+\lambda}+\gamma T<br />
\end{align} <br />
[[File:Structure Score Calculation.png|frame|center|alt=Alt text|Structure Score Calculation]]<br />
Instead of enumerating through all possible tree structures q, a greedy algorithm of iteratively adding branches is used.<br><br />
Let <math>I_L</math> and <math>I_R</math> be the instance sets of left and right nodes after split and let <math>I=I_L\cup I_R</math>.<br><br />
The loss reduction after split is given by<br><br />
\begin{align}<br />
\tilde{\mathcal{L}}_{\text{split}} &=\frac{1}{2}[\frac{(\sum_{i \in I_L}g_i)^2}{\sum_{i \in I_L}h_i+\lambda}+\frac{(\sum_{i \in I_R}g_i)^2}{\sum_{i \in I_R}h_i+\lambda}-\frac{(\sum_{i \in I}g_i)^2}{\sum_{i \in I}h_i+\lambda}]+\gamma<br />
\end{align}<br />
=== Shrinkage and Column Subsampling ===<br />
The author also mentioned two other methods in order to avoid over-fitting.<br><br />
(1) Shrinkage. Similar to the learning rate in stochastic optimization, a new weight is added to each tree boosting to reduce the influence of a single tree and leave space for future trees.<br><br />
(2) Column (feature) subsampling. In the paper, the author only mentioned that this technique speeds up parallel algorithm used in later sections.<br />
<br />
== Split Finding Algorithms ==<br />
<br />
It is very important to find the best split for tree learning to perform well. Here are a few split finding algorithms mentioned in the paper:<br />
<br />
=== Basic Exact Greedy Algorithm ===<br />
<br />
The basic exact greedy algorithm is a split finding algorithm that is computationally expensive because it enumerates over all the possible splits for continuous features. It is impossible to be done efficiently when the memory is not enough to hold the data needed. A way to carry out this algorithm efficiently is to sort the data according to feature values and visit the data in order to accumulate the gradient statistics. The algorithm is shown below:<br />
<br />
[[File:algo1xg.png|center|alt=Alt text|Basic Exact Greedy Algorithm]]<br />
<br />
=== Approximate Algorithm ===<br />
<br />
The paper introduced a more efficient algorithm compared to Basic Exact Greedy Algorithm which is the Approximate Algorithm. The Approximate Algorithm first proposes candidate splitting points according to percentiles of feature distribution. It then maps the continuous features into buckets split by candidate points, aggregates the statistics and finds the best solution among proposals based on the aggregated statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_2.png|center|alt=Alt text|Approximate Algorithm]]<br />
<br />
There are also two variants to this algorithm, the global variant proposes all the candidate splits during the initial phase of tree construction and uses the same proposals for split finding at all levels. Whereas, the local variant re-proposes after each split. The global variant usually requires less proposal steps but uses more candidate points than local variant because candidates are not refined after each split. For deeper trees, usage of local variant may be more appropriate as compared to global variant. The figure below shows the a comparison in accuracy between Basic Exact Greedy and Approximate split finding algorithms with different variant over the number of iterations. We can see that the quantile strategy is able to achieve similar accuracy as the Basic Exact Greedy algorithm given a reasonable approximation level.<br />
<br />
[[File:iterations.png|center|alt=Alt text|Comparison of accuracy between different algorithms]]<br />
<br />
=== Weighted Quantile Sketch ===<br />
<br />
Proposing candidate split points is the most important step in the Approximate Algorithm, it is done by using the percentile of a feature to make candidates distribute evenly on a dataset.<br />
<br />
Formally, we have a dataset<br />
<br />
<math>D_k={(x_{1k},h_1),(x_{2k},h_2),...,(x_{nk},h_n)}</math><br />
<br />
where <math> x_i </math>'s are the feature values of each data point and <math> h_i </math>'s represents the weight of the corresponding feature <math> x_i </math>. <br />
<br />
Then, we can use the following rank function to compute <math>r_k(z)</math>, the proportion of instances whose feature value among <math> (x_i,...,x_k) </math> is smaller than data point <math> z </math>.<br />
<br />
<math>r_k(z) = \frac{1}{\sum_{(x,h) \in D_k} h} \displaystyle\sum_{(x,h) \in D_k, x<z} h,</math><br />
<br />
The objective here is to find candidate split points <math>{s_{k1}, s_{k2}, …, s_{kl}}</math>, such that:<br />
<br />
<math>|r_k(s_{k,j}) – r_k(s_{k,j+1})| < \epsilon, s_{k1} = \displaystyle\min_i x_{ik}, s_{kl} = \displaystyle\max_{i} x_{ik}, \forall i</math><br />
<br />
Where <math>\epsilon</math> is an approximation factor. Usually, it should approximately have <math>\frac{1}{\epsilon}</math> splitting points.<br />
<br />
=== Sparsity-aware Split Finding ===<br />
<br />
Typically in real world situation, it is quite common that our dataset is sparse. Some of the possible causes are:<br />
<br />
# Missing values in the data<br />
# Huge amount of zero entries present in the data<br />
# Artifacts of feature engineering (e.g. One-hot encoding)<br />
<br />
In order to solve the sparsity present in the dataset, we suggest to add a default direction in each tree node will classified into when there is a missing value in the matrix of the dataset. This is demonstrated in the figure below:<br />
<br />
[[File:defaultdirection.png|center|alt=Alt text|Default Direction for sparsity]]<br />
<br />
== System Design ==<br />
<br />
=== Column Block for Parallel Learning ===<br />
The most time consuming part of tree learning is to get the data into sorted order. To overcome this problem, XGBoost stores the data in blocks where each block performs the sorting operation in parallel. The results are then merged together.<br />
<br />
# For the exact greedy algorithm, XGBoost stores the entire dataset in a single block<br />
#:* Original spase aware algorithm costs: <math>O(Kd∥x∥_0 log(n))</math><br />
#:* Tree boosting on block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(n))</math><br />
#:* Hence, block structure helps to save an additional <math>log(n)</math> factor<br />
# For approximate algorithms, XGBoost stores the dataset in multiple blocks<br />
#:* Original algorithm with binary search costs: <math>O(Kd∥x∥_0 log(q))</math><br />
#:* With block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(B))</math><br />
#:* Hence, block structure helps to save an additional <math>log(q)</math> factor <br />
<br />
K = total number of trees<br /><br />
d = maximum depth of the tree<br /><br />
<math>∥x∥_0</math> = number of non-missing entries in the training data<br /><br />
n = number of rows in the dataset<br /><br />
q = number of proposal candidates in the dataset, usually between 32 to 100<br /><br />
B = maximum number of rows in each block<br />
<br />
[[File: columnblock.png|800px|thumb|center]]<br />
<br />
=== Cache-aware Access ===<br />
The proposed block structure optimizes the computation complexity but requires indirect fetches of gradient statistics by row index. XGBoost optimizes the process by using the following methods.<br />
<br />
# For the exact greedy algorithm, XGBoost uses a cache-aware prefetching algorithm<br />
#:* It stores Gradient and Hessians in the cache to make calculations fast<br />
#:* It runs twice as fast as the naive method when the dataset is large<br />
# For approximate algorithms, XGBoost chooses a specific block size<br />
#:* Choosing a small block size results in inefficient parallelization<br />
#:* Choosing a large block size results in cache misses<br />
#:* Various choices of block size are compared and the results are shown in Figure 9<br />
#:* XGBoost chose <math>2^{16}</math> as the block size<br />
<br />
[[File: blocksize.png|400px|thumb|center]]<br />
<br />
=== Blocks for Out-of-core Computation ===<br />
When the dataset is too large for the cache and main memory, XGBoost utilizes disk spaces as well. Since reading and writing data to the disks are slow, XGBoost optimizes the process by using the following two methods.<br />
<br />
# Block Compression<br />
#:* Blocks are compressed by columns<br />
#:* Although decompressing takes time, it is still faster than reading from the disks<br />
# Block Sharding<br />
#:* If multiple disks are available, data is split into those disks<br />
#:* When the CPU needs data, all the disks can be read at the same time<br />
<br />
== End To End Evaluations ==<br />
=== System Implementation ===<br />
XGBoost is a portable and reusable open-source package. It supports:<br />
* various weighted classification<br />
* various objective functions (rank & user defined)<br />
* popular languages (python, R, Julia)<br />
* data science pipelines (scikit-learn)<br />
* big data stacks (Flink, Spark)<br />
* cloud platform (Tianchi8)<br />
<br />
=== Dataset and Setup ===<br />
<br />
A summary of the 4 datasets used in the experiments is in table 2.<br />
<br />
[[File: table2data.png|500px|thumb|center]]<br />
<br />
The first and last datasets were used specifically to evaluate the impact of sparsity-aware algorithm and the scaling property of the system in the out-of-core and the distributed settings respectively. In all of the experiments, common settings such as maximum depth equal to 8, shrinkage equal to 0.1 and no column subsampling are applied.<br />
<br />
=== Classification ===<br />
A subset (n = 1M) of Higgs Boson dataset was used for classification. The results are shown in Table 3.<br />
<br />
[[File: classification.png|500px|thumb|center]]<br />
<br />
* R’s GBM creates a tree fast by using greedy approach that only expands one branch of a tree but with the cost of lower accuracy<br />
* XGBoost and scikit-learn have better performance than R’s GBM<br />
* XGBoost runs more than 10x faster than scikit-learn in learning a full tree<br />
* Column subsamples give slightly worse performance possibly due to a few important features in this dataset.<br />
<br />
=== Learning to Rank ===<br />
The results in comparing XGBoost with pGBRT are shown in Table 4.<br />
<br />
[[File: rank.png|500px|thumb|center]]<br />
<br />
* XGBoost runs exact greedy algorithm while pGBRT only supports an approximate algorithm<br />
* XGBoost runs faster<br />
* Subsampling column reduces running time and gives higher performance possibly due to preventing overfitting<br />
<br />
=== Out-of-core Experiment ===<br />
An extremely large Criteo dataset was used to evaluate the out-of-core setting. The results are shown in the figure below.<br />
<br />
[[File: outofcore.png|350px|thumb|center]]<br />
<br />
* Compression speed up the computation by a factor of 3<br />
* Sharding into 2 disks further gives 2x speed<br />
<br />
=== Distributed Experiment ===<br />
YARN cluster on EC2 with m3.2xlarge machines was used to evaluate the distributed setting. XGBoost was compared with Spark MLLib and H20.<br />
<br />
* XGBoost can switch to out-of-core setting when the memory runs out, while the baseline systems need to store the data in RAM<br />
* XGBoost runs faster than the baseline systems<br />
* The baseline systems are only able to handle a subset of the data with the given resources while XGBoost was able to scale smoothly to all 1.7B rows<br />
* XGBoost’s performance scales linearly with more machines<br />
* XGBoost is able to handle all 1.7B data with only 4 machines<br />
<br />
== Conclusion ==<br />
<br />
== References ==<br />
[1] R. Bekkerman. The present and the future of the kdd cup competition: an outsider’s perspective. <br />
<br />
[2] R. Bekkerman, M. Bilenko, and J. Langford. Scaling Up Machine Learning: Parallel and Distributed Approaches. Cambridge University Press, New York, NY, USA, 2011. <br />
<br />
[3] J. Bennett and S. Lanning. The netflix prize. In Proceedings of the KDD Cup Workshop 2007, pages 3–6, New York, Aug. 2007.<br />
<br />
[4] L. Breiman. Random forests. Maching Learning, 45(1):5–32, Oct. 2001.<br />
<br />
[5] C. Burges. From ranknet to lambdarank to lambdamart: An overview. Learning, 11:23–581, 2010.<br />
<br />
[6] O. Chapelle and Y. Chang. Yahoo! Learning to Rank Challenge Overview. Journal of Machine Learning Research - W & CP, 14:1–24, 2011.<br />
<br />
[7] T. Chen, H. Li, Q. Yang, and Y. Yu. General functional matrix factorization using gradient boosting. In Proceeding of 30th International Conference on Machine Learning (ICML’13), volume 1, pages 436–444, 2013.<br />
<br />
[8] T. Chen, S. Singh, B. Taskar, and C. Guestrin. Efficient second-order gradient boosting for conditional random fields. In Proceeding of 18th Artificial Intelligence and Statistics Conference (AISTATS’15), volume 1, 2015.<br />
<br />
[9] R.-E. Fan, K.-W. Chang, C.-J. Hsieh, X.-R. Wang, and C.-J. Lin. LIBLINEAR: A library for large linear classification. Journal of Machine Learning Research, 9:1871–1874, 2008.<br />
<br />
[10] J. Friedman. Greedy function approximation: a gradient boosting machine. Annals of Statistics, 29(5):1189–1232, 2001.<br />
<br />
[11] J. Friedman. Stochastic gradient boosting. Computational Statistics & Data Analysis, 38(4):367–378, 2002.<br />
<br />
[12] J. Friedman, T. Hastie, and R. Tibshirani. Additive logistic regression: a statistical view of boosting. Annals of Statistics, 28(2):337–407, 2000.<br />
<br />
[13] J. H. Friedman and B. E. Popescu. Importance sampled learning ensembles, 2003.<br />
<br />
[14] M. Greenwald and S. Khanna. Space-efficient online computation of quantile summaries. In Proceedings of the 2001 ACM SIGMOD International Conference on Management of Data, pages 58–66, 2001.<br />
<br />
[15] X. He, J. Pan, O. Jin, T. Xu, B. Liu, T. Xu, Y. Shi, A. Atallah, R. Herbrich, S. Bowers, and J. Q. n. Candela. Practical lessons from predicting clicks on ads at facebook. In Proceedings of the Eighth International Workshop on Data Mining for Online Advertising, ADKDD’14, 2014.<br />
<br />
[16] P. Li. Robust Logitboost and adaptive base class (ABC) Logitboost. In Proceedings of the Twenty-Sixth Conference Annual Conference on Uncertainty in Artificial Intelligence (UAI’10), pages 302–311, 2010.<br />
<br />
[17] P. Li, Q. Wu, and C. J. Burges. Mcrank: Learning to rank using multiple classification and gradient boosting. In Advances in Neural Information Processing Systems 20, pages 897–904. 2008.<br />
<br />
[18] X. Meng, J. Bradley, B. Yavuz, E. Sparks, S. Venkataraman, D. Liu, J. Freeman, D. Tsai, M. Amde, S. Owen, D. Xin, R. Xin, M. J. Franklin, R. Zadeh, M. Zaharia, and A. Talwalkar. MLlib: Machine learning in apache spark. Journal of Machine Learning Research, 17(34):1–7, 2016.<br />
<br />
[19] B. Panda, J. S. Herbach, S. Basu, and R. J. Bayardo. Planet: Massively parallel learning of tree ensembles with mapreduce. Proceeding of VLDB Endowment, 2(2):1426–1437, Aug. 2009.<br />
<br />
[20] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.<br />
<br />
[21] G. Ridgeway. Generalized Boosted Models: A guide to the gbm package.<br />
<br />
[22] S. Tyree, K. Weinberger, K. Agrawal, and J. Paykin. Parallel boosted regression trees for web search ranking. In Proceedings of the 20th international conference on World wide web, pages 387–396. ACM, 2011.<br />
<br />
[23] J. Ye, J.-H. Chow, J. Chen, and Z. Zheng. Stochastic gradient boosted distributed decision trees. In Proceedings of the 18th ACM Conference on Information and Knowledge Management, CIKM ’09.<br />
<br />
[24] Q. Zhang and W. Wang. A fast algorithm for approximate quantiles in high speed data streams. In Proceedings of the 19th International Conference on Scientific and Statistical Database Management, 2007.<br />
<br />
[25] T. Zhang and R. Johnson. Learning nonlinear functions using regularized greedy forest. IEEE Transactions on Pattern Analysis and Machine Intelligence, 36(5), 2014.</div>Cwlokehttp://wiki.math.uwaterloo.ca/statwiki/index.php?title=XGBoost&diff=51122XGBoost2021-11-29T05:11:04Z<p>Cwloke: /* Sparsity-aware Split Finding */</p>
<hr />
<div>== Presented by == <br />
* Chun Waan Loke<br />
* Peter Chong<br />
* Clarice Osmond<br />
* Zhilong Li<br />
<br />
== Introduction ==<br />
<br />
== Tree Boosting In A Nutshell ==<br />
The author reviews gradient tree boosting in this section.<br />
=== Regularized Learning Objective ===<br />
The author first gives the prediction equation (1) and the regularized objective (2).<br><br />
<br><br />
(1) The additive prediction model is given as<br><br />
<math>\hat{y_i}=\sum_{k=1}^{K}f_k(x_i), f_k \in \mathcal{F} </math> <br><br />
where each <math>f_k</math> corresponds to an independent tree structure with its weights, and <math>\mathcal{F}</math> is the "space of regression trees"<br><br />
<br><br />
(2) The regularized objective to be minimized is given as<br><br />
<math>\mathcal{L}=\sum_{i}l(\hat{y_i},y_i)+\sum_k \Omega(f_k)</math> where <math>\Omega(f)=\gamma T+\frac{1}{2}\lambda ||\omega||^2</math> <br><br />
The first term <math>l</math> is a differentiable convex loss function that calculates the measures between <math>\hat{y}</math> and <math>y</math>.<br><br />
The second term <math>\Omega</math> penalizes on the complexity of model (the <math>f_k</math>'s). For a given tree (<math>f_k</math>), <math>T</math> is the number of leaves, and <math>\omega</math> is the leaf weights.<br><br />
The L1 regularization term <math>\gamma T</math> encourages the tree to be small, and the L2 regularization term <math>\frac{1}{2}\lambda ||\omega||^2</math> encourages the tree to have small weights.<br><br />
<br />
=== Gradient Tree Boosting ===<br />
Let <math>\hat{y_i}^{(t)}</math> be the prediction of <math>y_i</math> at the t-th iteration.<br><br />
Since the prediction equation is simply additive, <math>{\hat y_i}^{(t)}=\hat{y_{i}}^{(t-1)}+f_t(x_i)</math><br><br />
Using this equation and 2nd order Taylor approximation on the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> gives <br><br />
\begin{align}<br />
\mathcal{L}^{(t)}&=\sum_{i}^{n}l(y_i,\hat{y_i}^{(t-1)}+f_t(x_i))+\Omega(f_t)\\<br />
&\simeq \sum_{i}^{n}[l(y_i,\hat{y_i}^{(t-1)})+g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
\end{align}<br />
where <math>g_i</math> and <math>h_i</math> are the first and second derivative of the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> with repspect to the term <math>\hat{y}^{(t-1)}</math><br><br />
We can simplify this objective by removing the constant term <math>l(y_i,\hat{y_i}^{(t-1)})</math>.<br><br />
Define <math>I_j=\{i|q(x_i)=j\}</math>, where <math>q</math> is the tree structure. Since every <math>x_i</math> is mapped by <math>q</math> to some leaf <math>j</math>, going through every <math>x_i</math> is equivalent to going through each leaf j of the structure.<br />
\begin{align}<br />
\tilde{\mathcal{L}}^{(t)}&= \sum_{i}^{n}[g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
&= \sum_{j=1}^{T}[(\sum_{i \in I_j}g_i)\omega_j+\frac{1}{2}(\sum_{i \in I_j}h_i+\lambda)\omega_j^2]+\gamma T<br />
\end{align}<br />
Then for a fixed structure <math>q</math>, the optimal weight of leaf <math>j</math> and the optimal objective value are given as<br><br />
\begin{align}<br />
\omega_j^{*} &= -\frac{\sum_{i \in I_j}g_i}{\sum_{i \in I_j}h_i+\lambda}\\<br />
\tilde{\mathcal{L}}^{(t)}(q) &=-\frac{1}{2}\sum_{j=1}^{T}\frac{(\sum_{i \in I_j}g_i)^2}{\sum_{i \in I_j}h_i+\lambda}+\gamma T<br />
\end{align} <br />
[[File:Structure Score Calculation.png|frame|center|alt=Alt text|Structure Score Calculation]]<br />
Instead of enumerating through all possible tree structures q, a greedy algorithm of iteratively adding branches is used.<br><br />
Let <math>I_L</math> and <math>I_R</math> be the instance sets of left and right nodes after split and let <math>I=I_L\cup I_R</math>.<br><br />
The loss reduction after split is given by<br><br />
\begin{align}<br />
\tilde{\mathcal{L}}_{\text{split}} &=\frac{1}{2}[\frac{(\sum_{i \in I_L}g_i)^2}{\sum_{i \in I_L}h_i+\lambda}+\frac{(\sum_{i \in I_R}g_i)^2}{\sum_{i \in I_R}h_i+\lambda}-\frac{(\sum_{i \in I}g_i)^2}{\sum_{i \in I}h_i+\lambda}]+\gamma<br />
\end{align}<br />
=== Shrinkage and Column Subsampling ===<br />
The author also mentioned two other methods in order to avoid over-fitting.<br><br />
(1) Shrinkage. Similar to the learning rate in stochastic optimization, a new weight is added to each tree boosting to reduce the influence of a single tree and leave space for future trees.<br><br />
(2) Column (feature) subsampling. In the paper, the author only mentioned that this technique speeds up parallel algorithm used in later sections.<br />
<br />
== Split Finding Algorithms ==<br />
<br />
It is very important to find the best split for tree learning to perform well. Here are a few split finding algorithms mentioned in the paper:<br />
<br />
=== Basic Exact Greedy Algorithm ===<br />
<br />
The basic exact greedy algorithm is a split finding algorithm that is computationally expensive because it enumerates over all the possible splits for continuous features. It is impossible to be done efficiently when the memory is not enough to hold the data needed. A way to carry out this algorithm efficiently is to sort the data according to feature values and visit the data in order to accumulate the gradient statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_1.png|center|alt=Alt text|Basic Exact Greedy Algorithm]]<br />
<br />
=== Approximate Algorithm ===<br />
<br />
The paper introduced a more efficient algorithm compared to Basic Exact Greedy Algorithm which is the Approximate Algorithm. The Approximate Algorithm first proposes candidate splitting points according to percentiles of feature distribution. It then maps the continuous features into buckets split by candidate points, aggregates the statistics and finds the best solution among proposals based on the aggregated statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_2.png|center|alt=Alt text|Approximate Algorithm]]<br />
<br />
There are also two variants to this algorithm, the global variant proposes all the candidate splits during the initial phase of tree construction and uses the same proposals for split finding at all levels. Whereas, the local variant re-proposes after each split. The global variant usually requires less proposal steps but uses more candidate points than local variant because candidates are not refined after each split. For deeper trees, usage of local variant may be more appropriate as compared to global variant. The figure below shows the a comparison in accuracy between Basic Exact Greedy and Approximate split finding algorithms with different variant over the number of iterations. We can see that the quantile strategy is able to achieve similar accuracy as the Basic Exact Greedy algorithm given a reasonable approximation level.<br />
<br />
[[File:iterations.png|center|alt=Alt text|Comparison of accuracy between different algorithms]]<br />
<br />
=== Weighted Quantile Sketch ===<br />
<br />
Proposing candidate split points is the most important step in the Approximate Algorithm, it is done by using the percentile of a feature to make candidates distribute evenly on a dataset.<br />
<br />
Formally, we have a dataset<br />
<br />
<math>D_k={(x_{1k},h_1),(x_{2k},h_2),...,(x_{nk},h_n)}</math><br />
<br />
where <math> x_i </math>'s are the feature values of each data point and <math> h_i </math>'s represents the weight of the corresponding feature <math> x_i </math>. <br />
<br />
Then, we can use the following rank function to compute <math>r_k(z)</math>, the proportion of instances whose feature value among <math> (x_i,...,x_k) </math> is smaller than data point <math> z </math>.<br />
<br />
<math>r_k(z) = \frac{1}{\sum_{(x,h) \in D_k} h} \displaystyle\sum_{(x,h) \in D_k, x<z} h,</math><br />
<br />
The objective here is to find candidate split points <math>{s_{k1}, s_{k2}, …, s_{kl}}</math>, such that:<br />
<br />
<math>|r_k(s_{k,j}) – r_k(s_{k,j+1})| < \epsilon, s_{k1} = \displaystyle\min_i x_{ik}, s_{kl} = \displaystyle\max_{i} x_{ik}, \forall i</math><br />
<br />
Where <math>\epsilon</math> is an approximation factor. Usually, it should approximately have <math>\frac{1}{\epsilon}</math> splitting points.<br />
<br />
=== Sparsity-aware Split Finding ===<br />
<br />
Typically in real world situation, it is quite common that our dataset is sparse. Some of the possible causes are:<br />
<br />
# Missing values in the data<br />
# Huge amount of zero entries present in the data<br />
# Artifacts of feature engineering (e.g. One-hot encoding)<br />
<br />
In order to solve the sparsity present in the dataset, we suggest to add a default direction in each tree node will classified into when there is a missing value in the matrix of the dataset. This is demonstrated in the figure below:<br />
<br />
[[File:defaultdirection.png|center|alt=Alt text|Default Direction for sparsity]]<br />
<br />
== System Design ==<br />
<br />
=== Column Block for Parallel Learning ===<br />
The most time consuming part of tree learning is to get the data into sorted order. To overcome this problem, XGBoost stores the data in blocks where each block performs the sorting operation in parallel. The results are then merged together.<br />
<br />
# For the exact greedy algorithm, XGBoost stores the entire dataset in a single block<br />
#:* Original spase aware algorithm costs: <math>O(Kd∥x∥_0 log(n))</math><br />
#:* Tree boosting on block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(n))</math><br />
#:* Hence, block structure helps to save an additional <math>log(n)</math> factor<br />
# For approximate algorithms, XGBoost stores the dataset in multiple blocks<br />
#:* Original algorithm with binary search costs: <math>O(Kd∥x∥_0 log(q))</math><br />
#:* With block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(B))</math><br />
#:* Hence, block structure helps to save an additional <math>log(q)</math> factor <br />
<br />
K = total number of trees<br /><br />
d = maximum depth of the tree<br /><br />
<math>∥x∥_0</math> = number of non-missing entries in the training data<br /><br />
n = number of rows in the dataset<br /><br />
q = number of proposal candidates in the dataset, usually between 32 to 100<br /><br />
B = maximum number of rows in each block<br />
<br />
[[File: columnblock.png|800px|thumb|center]]<br />
<br />
=== Cache-aware Access ===<br />
The proposed block structure optimizes the computation complexity but requires indirect fetches of gradient statistics by row index. XGBoost optimizes the process by using the following methods.<br />
<br />
# For the exact greedy algorithm, XGBoost uses a cache-aware prefetching algorithm<br />
#:* It stores Gradient and Hessians in the cache to make calculations fast<br />
#:* It runs twice as fast as the naive method when the dataset is large<br />
# For approximate algorithms, XGBoost chooses a specific block size<br />
#:* Choosing a small block size results in inefficient parallelization<br />
#:* Choosing a large block size results in cache misses<br />
#:* Various choices of block size are compared and the results are shown in Figure 9<br />
#:* XGBoost chose <math>2^{16}</math> as the block size<br />
<br />
[[File: blocksize.png|400px|thumb|center]]<br />
<br />
=== Blocks for Out-of-core Computation ===<br />
When the dataset is too large for the cache and main memory, XGBoost utilizes disk spaces as well. Since reading and writing data to the disks are slow, XGBoost optimizes the process by using the following two methods.<br />
<br />
# Block Compression<br />
#:* Blocks are compressed by columns<br />
#:* Although decompressing takes time, it is still faster than reading from the disks<br />
# Block Sharding<br />
#:* If multiple disks are available, data is split into those disks<br />
#:* When the CPU needs data, all the disks can be read at the same time<br />
<br />
== End To End Evaluations ==<br />
=== System Implementation ===<br />
XGBoost is a portable and reusable open-source package. It supports:<br />
* various weighted classification<br />
* various objective functions (rank & user defined)<br />
* popular languages (python, R, Julia)<br />
* data science pipelines (scikit-learn)<br />
* big data stacks (Flink, Spark)<br />
* cloud platform (Tianchi8)<br />
<br />
=== Dataset and Setup ===<br />
<br />
A summary of the 4 datasets used in the experiments is in table 2.<br />
<br />
[[File: table2data.png|500px|thumb|center]]<br />
<br />
The first and last datasets were used specifically to evaluate the impact of sparsity-aware algorithm and the scaling property of the system in the out-of-core and the distributed settings respectively. In all of the experiments, common settings such as maximum depth equal to 8, shrinkage equal to 0.1 and no column subsampling are applied.<br />
<br />
=== Classification ===<br />
A subset (n = 1M) of Higgs Boson dataset was used for classification. The results are shown in Table 3.<br />
<br />
[[File: classification.png|500px|thumb|center]]<br />
<br />
* R’s GBM creates a tree fast by using greedy approach that only expands one branch of a tree but with the cost of lower accuracy<br />
* XGBoost and scikit-learn have better performance than R’s GBM<br />
* XGBoost runs more than 10x faster than scikit-learn in learning a full tree<br />
* Column subsamples give slightly worse performance possibly due to a few important features in this dataset.<br />
<br />
=== Learning to Rank ===<br />
The results in comparing XGBoost with pGBRT are shown in Table 4.<br />
<br />
[[File: rank.png|500px|thumb|center]]<br />
<br />
* XGBoost runs exact greedy algorithm while pGBRT only supports an approximate algorithm<br />
* XGBoost runs faster<br />
* Subsampling column reduces running time and gives higher performance possibly due to preventing overfitting<br />
<br />
=== Out-of-core Experiment ===<br />
An extremely large Criteo dataset was used to evaluate the out-of-core setting. The results are shown in the figure below.<br />
<br />
[[File: outofcore.png|350px|thumb|center]]<br />
<br />
* Compression speed up the computation by a factor of 3<br />
* Sharding into 2 disks further gives 2x speed<br />
<br />
=== Distributed Experiment ===<br />
YARN cluster on EC2 with m3.2xlarge machines was used to evaluate the distributed setting. XGBoost was compared with Spark MLLib and H20.<br />
<br />
* XGBoost can switch to out-of-core setting when the memory runs out, while the baseline systems need to store the data in RAM<br />
* XGBoost runs faster than the baseline systems<br />
* The baseline systems are only able to handle a subset of the data with the given resources while XGBoost was able to scale smoothly to all 1.7B rows<br />
* XGBoost’s performance scales linearly with more machines<br />
* XGBoost is able to handle all 1.7B data with only 4 machines<br />
<br />
== Conclusion ==<br />
<br />
== References ==<br />
[1] R. Bekkerman. The present and the future of the kdd cup competition: an outsider’s perspective. <br />
<br />
[2] R. Bekkerman, M. Bilenko, and J. Langford. Scaling Up Machine Learning: Parallel and Distributed Approaches. Cambridge University Press, New York, NY, USA, 2011. <br />
<br />
[3] J. Bennett and S. Lanning. The netflix prize. In Proceedings of the KDD Cup Workshop 2007, pages 3–6, New York, Aug. 2007.<br />
<br />
[4] L. Breiman. Random forests. Maching Learning, 45(1):5–32, Oct. 2001.<br />
<br />
[5] C. Burges. From ranknet to lambdarank to lambdamart: An overview. Learning, 11:23–581, 2010.<br />
<br />
[6] O. Chapelle and Y. Chang. Yahoo! Learning to Rank Challenge Overview. Journal of Machine Learning Research - W & CP, 14:1–24, 2011.<br />
<br />
[7] T. Chen, H. Li, Q. Yang, and Y. Yu. General functional matrix factorization using gradient boosting. In Proceeding of 30th International Conference on Machine Learning (ICML’13), volume 1, pages 436–444, 2013.<br />
<br />
[8] T. Chen, S. Singh, B. Taskar, and C. Guestrin. Efficient second-order gradient boosting for conditional random fields. In Proceeding of 18th Artificial Intelligence and Statistics Conference (AISTATS’15), volume 1, 2015.<br />
<br />
[9] R.-E. Fan, K.-W. Chang, C.-J. Hsieh, X.-R. Wang, and C.-J. Lin. LIBLINEAR: A library for large linear classification. Journal of Machine Learning Research, 9:1871–1874, 2008.<br />
<br />
[10] J. Friedman. Greedy function approximation: a gradient boosting machine. Annals of Statistics, 29(5):1189–1232, 2001.<br />
<br />
[11] J. Friedman. Stochastic gradient boosting. Computational Statistics & Data Analysis, 38(4):367–378, 2002.<br />
<br />
[12] J. Friedman, T. Hastie, and R. Tibshirani. Additive logistic regression: a statistical view of boosting. Annals of Statistics, 28(2):337–407, 2000.<br />
<br />
[13] J. H. Friedman and B. E. Popescu. Importance sampled learning ensembles, 2003.<br />
<br />
[14] M. Greenwald and S. Khanna. Space-efficient online computation of quantile summaries. In Proceedings of the 2001 ACM SIGMOD International Conference on Management of Data, pages 58–66, 2001.<br />
<br />
[15] X. He, J. Pan, O. Jin, T. Xu, B. Liu, T. Xu, Y. Shi, A. Atallah, R. Herbrich, S. Bowers, and J. Q. n. Candela. Practical lessons from predicting clicks on ads at facebook. In Proceedings of the Eighth International Workshop on Data Mining for Online Advertising, ADKDD’14, 2014.<br />
<br />
[16] P. Li. Robust Logitboost and adaptive base class (ABC) Logitboost. In Proceedings of the Twenty-Sixth Conference Annual Conference on Uncertainty in Artificial Intelligence (UAI’10), pages 302–311, 2010.<br />
<br />
[17] P. Li, Q. Wu, and C. J. Burges. Mcrank: Learning to rank using multiple classification and gradient boosting. In Advances in Neural Information Processing Systems 20, pages 897–904. 2008.<br />
<br />
[18] X. Meng, J. Bradley, B. Yavuz, E. Sparks, S. Venkataraman, D. Liu, J. Freeman, D. Tsai, M. Amde, S. Owen, D. Xin, R. Xin, M. J. Franklin, R. Zadeh, M. Zaharia, and A. Talwalkar. MLlib: Machine learning in apache spark. Journal of Machine Learning Research, 17(34):1–7, 2016.<br />
<br />
[19] B. Panda, J. S. Herbach, S. Basu, and R. J. Bayardo. Planet: Massively parallel learning of tree ensembles with mapreduce. Proceeding of VLDB Endowment, 2(2):1426–1437, Aug. 2009.<br />
<br />
[20] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.<br />
<br />
[21] G. Ridgeway. Generalized Boosted Models: A guide to the gbm package.<br />
<br />
[22] S. Tyree, K. Weinberger, K. Agrawal, and J. Paykin. Parallel boosted regression trees for web search ranking. In Proceedings of the 20th international conference on World wide web, pages 387–396. ACM, 2011.<br />
<br />
[23] J. Ye, J.-H. Chow, J. Chen, and Z. Zheng. Stochastic gradient boosted distributed decision trees. In Proceedings of the 18th ACM Conference on Information and Knowledge Management, CIKM ’09.<br />
<br />
[24] Q. Zhang and W. Wang. A fast algorithm for approximate quantiles in high speed data streams. In Proceedings of the 19th International Conference on Scientific and Statistical Database Management, 2007.<br />
<br />
[25] T. Zhang and R. Johnson. Learning nonlinear functions using regularized greedy forest. IEEE Transactions on Pattern Analysis and Machine Intelligence, 36(5), 2014.</div>Cwlokehttp://wiki.math.uwaterloo.ca/statwiki/index.php?title=XGBoost&diff=51121XGBoost2021-11-29T05:10:58Z<p>Cwloke: /* Sparsity-aware Split Finding */</p>
<hr />
<div>== Presented by == <br />
* Chun Waan Loke<br />
* Peter Chong<br />
* Clarice Osmond<br />
* Zhilong Li<br />
<br />
== Introduction ==<br />
<br />
== Tree Boosting In A Nutshell ==<br />
The author reviews gradient tree boosting in this section.<br />
=== Regularized Learning Objective ===<br />
The author first gives the prediction equation (1) and the regularized objective (2).<br><br />
<br><br />
(1) The additive prediction model is given as<br><br />
<math>\hat{y_i}=\sum_{k=1}^{K}f_k(x_i), f_k \in \mathcal{F} </math> <br><br />
where each <math>f_k</math> corresponds to an independent tree structure with its weights, and <math>\mathcal{F}</math> is the "space of regression trees"<br><br />
<br><br />
(2) The regularized objective to be minimized is given as<br><br />
<math>\mathcal{L}=\sum_{i}l(\hat{y_i},y_i)+\sum_k \Omega(f_k)</math> where <math>\Omega(f)=\gamma T+\frac{1}{2}\lambda ||\omega||^2</math> <br><br />
The first term <math>l</math> is a differentiable convex loss function that calculates the measures between <math>\hat{y}</math> and <math>y</math>.<br><br />
The second term <math>\Omega</math> penalizes on the complexity of model (the <math>f_k</math>'s). For a given tree (<math>f_k</math>), <math>T</math> is the number of leaves, and <math>\omega</math> is the leaf weights.<br><br />
The L1 regularization term <math>\gamma T</math> encourages the tree to be small, and the L2 regularization term <math>\frac{1}{2}\lambda ||\omega||^2</math> encourages the tree to have small weights.<br><br />
<br />
=== Gradient Tree Boosting ===<br />
Let <math>\hat{y_i}^{(t)}</math> be the prediction of <math>y_i</math> at the t-th iteration.<br><br />
Since the prediction equation is simply additive, <math>{\hat y_i}^{(t)}=\hat{y_{i}}^{(t-1)}+f_t(x_i)</math><br><br />
Using this equation and 2nd order Taylor approximation on the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> gives <br><br />
\begin{align}<br />
\mathcal{L}^{(t)}&=\sum_{i}^{n}l(y_i,\hat{y_i}^{(t-1)}+f_t(x_i))+\Omega(f_t)\\<br />
&\simeq \sum_{i}^{n}[l(y_i,\hat{y_i}^{(t-1)})+g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
\end{align}<br />
where <math>g_i</math> and <math>h_i</math> are the first and second derivative of the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> with repspect to the term <math>\hat{y}^{(t-1)}</math><br><br />
We can simplify this objective by removing the constant term <math>l(y_i,\hat{y_i}^{(t-1)})</math>.<br><br />
Define <math>I_j=\{i|q(x_i)=j\}</math>, where <math>q</math> is the tree structure. Since every <math>x_i</math> is mapped by <math>q</math> to some leaf <math>j</math>, going through every <math>x_i</math> is equivalent to going through each leaf j of the structure.<br />
\begin{align}<br />
\tilde{\mathcal{L}}^{(t)}&= \sum_{i}^{n}[g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
&= \sum_{j=1}^{T}[(\sum_{i \in I_j}g_i)\omega_j+\frac{1}{2}(\sum_{i \in I_j}h_i+\lambda)\omega_j^2]+\gamma T<br />
\end{align}<br />
Then for a fixed structure <math>q</math>, the optimal weight of leaf <math>j</math> and the optimal objective value are given as<br><br />
\begin{align}<br />
\omega_j^{*} &= -\frac{\sum_{i \in I_j}g_i}{\sum_{i \in I_j}h_i+\lambda}\\<br />
\tilde{\mathcal{L}}^{(t)}(q) &=-\frac{1}{2}\sum_{j=1}^{T}\frac{(\sum_{i \in I_j}g_i)^2}{\sum_{i \in I_j}h_i+\lambda}+\gamma T<br />
\end{align} <br />
[[File:Structure Score Calculation.png|frame|center|alt=Alt text|Structure Score Calculation]]<br />
Instead of enumerating through all possible tree structures q, a greedy algorithm of iteratively adding branches is used.<br><br />
Let <math>I_L</math> and <math>I_R</math> be the instance sets of left and right nodes after split and let <math>I=I_L\cup I_R</math>.<br><br />
The loss reduction after split is given by<br><br />
\begin{align}<br />
\tilde{\mathcal{L}}_{\text{split}} &=\frac{1}{2}[\frac{(\sum_{i \in I_L}g_i)^2}{\sum_{i \in I_L}h_i+\lambda}+\frac{(\sum_{i \in I_R}g_i)^2}{\sum_{i \in I_R}h_i+\lambda}-\frac{(\sum_{i \in I}g_i)^2}{\sum_{i \in I}h_i+\lambda}]+\gamma<br />
\end{align}<br />
=== Shrinkage and Column Subsampling ===<br />
The author also mentioned two other methods in order to avoid over-fitting.<br><br />
(1) Shrinkage. Similar to the learning rate in stochastic optimization, a new weight is added to each tree boosting to reduce the influence of a single tree and leave space for future trees.<br><br />
(2) Column (feature) subsampling. In the paper, the author only mentioned that this technique speeds up parallel algorithm used in later sections.<br />
<br />
== Split Finding Algorithms ==<br />
<br />
It is very important to find the best split for tree learning to perform well. Here are a few split finding algorithms mentioned in the paper:<br />
<br />
=== Basic Exact Greedy Algorithm ===<br />
<br />
The basic exact greedy algorithm is a split finding algorithm that is computationally expensive because it enumerates over all the possible splits for continuous features. It is impossible to be done efficiently when the memory is not enough to hold the data needed. A way to carry out this algorithm efficiently is to sort the data according to feature values and visit the data in order to accumulate the gradient statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_1.png|center|alt=Alt text|Basic Exact Greedy Algorithm]]<br />
<br />
=== Approximate Algorithm ===<br />
<br />
The paper introduced a more efficient algorithm compared to Basic Exact Greedy Algorithm which is the Approximate Algorithm. The Approximate Algorithm first proposes candidate splitting points according to percentiles of feature distribution. It then maps the continuous features into buckets split by candidate points, aggregates the statistics and finds the best solution among proposals based on the aggregated statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_2.png|center|alt=Alt text|Approximate Algorithm]]<br />
<br />
There are also two variants to this algorithm, the global variant proposes all the candidate splits during the initial phase of tree construction and uses the same proposals for split finding at all levels. Whereas, the local variant re-proposes after each split. The global variant usually requires less proposal steps but uses more candidate points than local variant because candidates are not refined after each split. For deeper trees, usage of local variant may be more appropriate as compared to global variant. The figure below shows the a comparison in accuracy between Basic Exact Greedy and Approximate split finding algorithms with different variant over the number of iterations. We can see that the quantile strategy is able to achieve similar accuracy as the Basic Exact Greedy algorithm given a reasonable approximation level.<br />
<br />
[[File:iterations.png|center|alt=Alt text|Comparison of accuracy between different algorithms]]<br />
<br />
=== Weighted Quantile Sketch ===<br />
<br />
Proposing candidate split points is the most important step in the Approximate Algorithm, it is done by using the percentile of a feature to make candidates distribute evenly on a dataset.<br />
<br />
Formally, we have a dataset<br />
<br />
<math>D_k={(x_{1k},h_1),(x_{2k},h_2),...,(x_{nk},h_n)}</math><br />
<br />
where <math> x_i </math>'s are the feature values of each data point and <math> h_i </math>'s represents the weight of the corresponding feature <math> x_i </math>. <br />
<br />
Then, we can use the following rank function to compute <math>r_k(z)</math>, the proportion of instances whose feature value among <math> (x_i,...,x_k) </math> is smaller than data point <math> z </math>.<br />
<br />
<math>r_k(z) = \frac{1}{\sum_{(x,h) \in D_k} h} \displaystyle\sum_{(x,h) \in D_k, x<z} h,</math><br />
<br />
The objective here is to find candidate split points <math>{s_{k1}, s_{k2}, …, s_{kl}}</math>, such that:<br />
<br />
<math>|r_k(s_{k,j}) – r_k(s_{k,j+1})| < \epsilon, s_{k1} = \displaystyle\min_i x_{ik}, s_{kl} = \displaystyle\max_{i} x_{ik}, \forall i</math><br />
<br />
Where <math>\epsilon</math> is an approximation factor. Usually, it should approximately have <math>\frac{1}{\epsilon}</math> splitting points.<br />
<br />
=== Sparsity-aware Split Finding ===<br />
<br />
Typically in real world situation, it is quite common that our dataset is sparse. Some of the possible causes are:<br />
<br />
# Missing values in the data<br />
# Huge amount of zero entries present in the data<br />
# Artifacts of feature engineering (e.g. One-hot encoding)<br />
<br />
In order to solve the sparsity present in the dataset, we suggest to add a default direction in each tree node will classified into when there is a missing value in the matrix of the dataset. This is demonstrated in the figure below:<br />
<br />
<br />
[[File:defaultdirection.png|center|alt=Alt text|Default Direction for sparsity]]<br />
<br />
== System Design ==<br />
<br />
=== Column Block for Parallel Learning ===<br />
The most time consuming part of tree learning is to get the data into sorted order. To overcome this problem, XGBoost stores the data in blocks where each block performs the sorting operation in parallel. The results are then merged together.<br />
<br />
# For the exact greedy algorithm, XGBoost stores the entire dataset in a single block<br />
#:* Original spase aware algorithm costs: <math>O(Kd∥x∥_0 log(n))</math><br />
#:* Tree boosting on block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(n))</math><br />
#:* Hence, block structure helps to save an additional <math>log(n)</math> factor<br />
# For approximate algorithms, XGBoost stores the dataset in multiple blocks<br />
#:* Original algorithm with binary search costs: <math>O(Kd∥x∥_0 log(q))</math><br />
#:* With block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(B))</math><br />
#:* Hence, block structure helps to save an additional <math>log(q)</math> factor <br />
<br />
K = total number of trees<br /><br />
d = maximum depth of the tree<br /><br />
<math>∥x∥_0</math> = number of non-missing entries in the training data<br /><br />
n = number of rows in the dataset<br /><br />
q = number of proposal candidates in the dataset, usually between 32 to 100<br /><br />
B = maximum number of rows in each block<br />
<br />
[[File: columnblock.png|800px|thumb|center]]<br />
<br />
=== Cache-aware Access ===<br />
The proposed block structure optimizes the computation complexity but requires indirect fetches of gradient statistics by row index. XGBoost optimizes the process by using the following methods.<br />
<br />
# For the exact greedy algorithm, XGBoost uses a cache-aware prefetching algorithm<br />
#:* It stores Gradient and Hessians in the cache to make calculations fast<br />
#:* It runs twice as fast as the naive method when the dataset is large<br />
# For approximate algorithms, XGBoost chooses a specific block size<br />
#:* Choosing a small block size results in inefficient parallelization<br />
#:* Choosing a large block size results in cache misses<br />
#:* Various choices of block size are compared and the results are shown in Figure 9<br />
#:* XGBoost chose <math>2^{16}</math> as the block size<br />
<br />
[[File: blocksize.png|400px|thumb|center]]<br />
<br />
=== Blocks for Out-of-core Computation ===<br />
When the dataset is too large for the cache and main memory, XGBoost utilizes disk spaces as well. Since reading and writing data to the disks are slow, XGBoost optimizes the process by using the following two methods.<br />
<br />
# Block Compression<br />
#:* Blocks are compressed by columns<br />
#:* Although decompressing takes time, it is still faster than reading from the disks<br />
# Block Sharding<br />
#:* If multiple disks are available, data is split into those disks<br />
#:* When the CPU needs data, all the disks can be read at the same time<br />
<br />
== End To End Evaluations ==<br />
=== System Implementation ===<br />
XGBoost is a portable and reusable open-source package. It supports:<br />
* various weighted classification<br />
* various objective functions (rank & user defined)<br />
* popular languages (python, R, Julia)<br />
* data science pipelines (scikit-learn)<br />
* big data stacks (Flink, Spark)<br />
* cloud platform (Tianchi8)<br />
<br />
=== Dataset and Setup ===<br />
<br />
A summary of the 4 datasets used in the experiments is in table 2.<br />
<br />
[[File: table2data.png|500px|thumb|center]]<br />
<br />
The first and last datasets were used specifically to evaluate the impact of sparsity-aware algorithm and the scaling property of the system in the out-of-core and the distributed settings respectively. In all of the experiments, common settings such as maximum depth equal to 8, shrinkage equal to 0.1 and no column subsampling are applied.<br />
<br />
=== Classification ===<br />
A subset (n = 1M) of Higgs Boson dataset was used for classification. The results are shown in Table 3.<br />
<br />
[[File: classification.png|500px|thumb|center]]<br />
<br />
* R’s GBM creates a tree fast by using greedy approach that only expands one branch of a tree but with the cost of lower accuracy<br />
* XGBoost and scikit-learn have better performance than R’s GBM<br />
* XGBoost runs more than 10x faster than scikit-learn in learning a full tree<br />
* Column subsamples give slightly worse performance possibly due to a few important features in this dataset.<br />
<br />
=== Learning to Rank ===<br />
The results in comparing XGBoost with pGBRT are shown in Table 4.<br />
<br />
[[File: rank.png|500px|thumb|center]]<br />
<br />
* XGBoost runs exact greedy algorithm while pGBRT only supports an approximate algorithm<br />
* XGBoost runs faster<br />
* Subsampling column reduces running time and gives higher performance possibly due to preventing overfitting<br />
<br />
=== Out-of-core Experiment ===<br />
An extremely large Criteo dataset was used to evaluate the out-of-core setting. The results are shown in the figure below.<br />
<br />
[[File: outofcore.png|350px|thumb|center]]<br />
<br />
* Compression speed up the computation by a factor of 3<br />
* Sharding into 2 disks further gives 2x speed<br />
<br />
=== Distributed Experiment ===<br />
YARN cluster on EC2 with m3.2xlarge machines was used to evaluate the distributed setting. XGBoost was compared with Spark MLLib and H20.<br />
<br />
* XGBoost can switch to out-of-core setting when the memory runs out, while the baseline systems need to store the data in RAM<br />
* XGBoost runs faster than the baseline systems<br />
* The baseline systems are only able to handle a subset of the data with the given resources while XGBoost was able to scale smoothly to all 1.7B rows<br />
* XGBoost’s performance scales linearly with more machines<br />
* XGBoost is able to handle all 1.7B data with only 4 machines<br />
<br />
== Conclusion ==<br />
<br />
== References ==<br />
[1] R. Bekkerman. The present and the future of the kdd cup competition: an outsider’s perspective. <br />
<br />
[2] R. Bekkerman, M. Bilenko, and J. Langford. Scaling Up Machine Learning: Parallel and Distributed Approaches. Cambridge University Press, New York, NY, USA, 2011. <br />
<br />
[3] J. Bennett and S. Lanning. The netflix prize. In Proceedings of the KDD Cup Workshop 2007, pages 3–6, New York, Aug. 2007.<br />
<br />
[4] L. Breiman. Random forests. Maching Learning, 45(1):5–32, Oct. 2001.<br />
<br />
[5] C. Burges. From ranknet to lambdarank to lambdamart: An overview. Learning, 11:23–581, 2010.<br />
<br />
[6] O. Chapelle and Y. Chang. Yahoo! Learning to Rank Challenge Overview. Journal of Machine Learning Research - W & CP, 14:1–24, 2011.<br />
<br />
[7] T. Chen, H. Li, Q. Yang, and Y. Yu. General functional matrix factorization using gradient boosting. In Proceeding of 30th International Conference on Machine Learning (ICML’13), volume 1, pages 436–444, 2013.<br />
<br />
[8] T. Chen, S. Singh, B. Taskar, and C. Guestrin. Efficient second-order gradient boosting for conditional random fields. In Proceeding of 18th Artificial Intelligence and Statistics Conference (AISTATS’15), volume 1, 2015.<br />
<br />
[9] R.-E. Fan, K.-W. Chang, C.-J. Hsieh, X.-R. Wang, and C.-J. Lin. LIBLINEAR: A library for large linear classification. Journal of Machine Learning Research, 9:1871–1874, 2008.<br />
<br />
[10] J. Friedman. Greedy function approximation: a gradient boosting machine. Annals of Statistics, 29(5):1189–1232, 2001.<br />
<br />
[11] J. Friedman. Stochastic gradient boosting. Computational Statistics & Data Analysis, 38(4):367–378, 2002.<br />
<br />
[12] J. Friedman, T. Hastie, and R. Tibshirani. Additive logistic regression: a statistical view of boosting. Annals of Statistics, 28(2):337–407, 2000.<br />
<br />
[13] J. H. Friedman and B. E. Popescu. Importance sampled learning ensembles, 2003.<br />
<br />
[14] M. Greenwald and S. Khanna. Space-efficient online computation of quantile summaries. In Proceedings of the 2001 ACM SIGMOD International Conference on Management of Data, pages 58–66, 2001.<br />
<br />
[15] X. He, J. Pan, O. Jin, T. Xu, B. Liu, T. Xu, Y. Shi, A. Atallah, R. Herbrich, S. Bowers, and J. Q. n. Candela. Practical lessons from predicting clicks on ads at facebook. In Proceedings of the Eighth International Workshop on Data Mining for Online Advertising, ADKDD’14, 2014.<br />
<br />
[16] P. Li. Robust Logitboost and adaptive base class (ABC) Logitboost. In Proceedings of the Twenty-Sixth Conference Annual Conference on Uncertainty in Artificial Intelligence (UAI’10), pages 302–311, 2010.<br />
<br />
[17] P. Li, Q. Wu, and C. J. Burges. Mcrank: Learning to rank using multiple classification and gradient boosting. In Advances in Neural Information Processing Systems 20, pages 897–904. 2008.<br />
<br />
[18] X. Meng, J. Bradley, B. Yavuz, E. Sparks, S. Venkataraman, D. Liu, J. Freeman, D. Tsai, M. Amde, S. Owen, D. Xin, R. Xin, M. J. Franklin, R. Zadeh, M. Zaharia, and A. Talwalkar. MLlib: Machine learning in apache spark. Journal of Machine Learning Research, 17(34):1–7, 2016.<br />
<br />
[19] B. Panda, J. S. Herbach, S. Basu, and R. J. Bayardo. Planet: Massively parallel learning of tree ensembles with mapreduce. Proceeding of VLDB Endowment, 2(2):1426–1437, Aug. 2009.<br />
<br />
[20] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.<br />
<br />
[21] G. Ridgeway. Generalized Boosted Models: A guide to the gbm package.<br />
<br />
[22] S. Tyree, K. Weinberger, K. Agrawal, and J. Paykin. Parallel boosted regression trees for web search ranking. In Proceedings of the 20th international conference on World wide web, pages 387–396. ACM, 2011.<br />
<br />
[23] J. Ye, J.-H. Chow, J. Chen, and Z. Zheng. Stochastic gradient boosted distributed decision trees. In Proceedings of the 18th ACM Conference on Information and Knowledge Management, CIKM ’09.<br />
<br />
[24] Q. Zhang and W. Wang. A fast algorithm for approximate quantiles in high speed data streams. In Proceedings of the 19th International Conference on Scientific and Statistical Database Management, 2007.<br />
<br />
[25] T. Zhang and R. Johnson. Learning nonlinear functions using regularized greedy forest. IEEE Transactions on Pattern Analysis and Machine Intelligence, 36(5), 2014.</div>Cwlokehttp://wiki.math.uwaterloo.ca/statwiki/index.php?title=File:defaultdirection.png&diff=51120File:defaultdirection.png2021-11-29T05:10:36Z<p>Cwloke: </p>
<hr />
<div></div>Cwlokehttp://wiki.math.uwaterloo.ca/statwiki/index.php?title=XGBoost&diff=51119XGBoost2021-11-29T05:09:31Z<p>Cwloke: /* Sparsity-aware Split Finding */</p>
<hr />
<div>== Presented by == <br />
* Chun Waan Loke<br />
* Peter Chong<br />
* Clarice Osmond<br />
* Zhilong Li<br />
<br />
== Introduction ==<br />
<br />
== Tree Boosting In A Nutshell ==<br />
The author reviews gradient tree boosting in this section.<br />
=== Regularized Learning Objective ===<br />
The author first gives the prediction equation (1) and the regularized objective (2).<br><br />
<br><br />
(1) The additive prediction model is given as<br><br />
<math>\hat{y_i}=\sum_{k=1}^{K}f_k(x_i), f_k \in \mathcal{F} </math> <br><br />
where each <math>f_k</math> corresponds to an independent tree structure with its weights, and <math>\mathcal{F}</math> is the "space of regression trees"<br><br />
<br><br />
(2) The regularized objective to be minimized is given as<br><br />
<math>\mathcal{L}=\sum_{i}l(\hat{y_i},y_i)+\sum_k \Omega(f_k)</math> where <math>\Omega(f)=\gamma T+\frac{1}{2}\lambda ||\omega||^2</math> <br><br />
The first term <math>l</math> is a differentiable convex loss function that calculates the measures between <math>\hat{y}</math> and <math>y</math>.<br><br />
The second term <math>\Omega</math> penalizes on the complexity of model (the <math>f_k</math>'s). For a given tree (<math>f_k</math>), <math>T</math> is the number of leaves, and <math>\omega</math> is the leaf weights.<br><br />
The L1 regularization term <math>\gamma T</math> encourages the tree to be small, and the L2 regularization term <math>\frac{1}{2}\lambda ||\omega||^2</math> encourages the tree to have small weights.<br><br />
<br />
=== Gradient Tree Boosting ===<br />
Let <math>\hat{y_i}^{(t)}</math> be the prediction of <math>y_i</math> at the t-th iteration.<br><br />
Since the prediction equation is simply additive, <math>{\hat y_i}^{(t)}=\hat{y_{i}}^{(t-1)}+f_t(x_i)</math><br><br />
Using this equation and 2nd order Taylor approximation on the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> gives <br><br />
\begin{align}<br />
\mathcal{L}^{(t)}&=\sum_{i}^{n}l(y_i,\hat{y_i}^{(t-1)}+f_t(x_i))+\Omega(f_t)\\<br />
&\simeq \sum_{i}^{n}[l(y_i,\hat{y_i}^{(t-1)})+g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
\end{align}<br />
where <math>g_i</math> and <math>h_i</math> are the first and second derivative of the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> with repspect to the term <math>\hat{y}^{(t-1)}</math><br><br />
We can simplify this objective by removing the constant term <math>l(y_i,\hat{y_i}^{(t-1)})</math>.<br><br />
Define <math>I_j=\{i|q(x_i)=j\}</math>, where <math>q</math> is the tree structure. Since every <math>x_i</math> is mapped by <math>q</math> to some leaf <math>j</math>, going through every <math>x_i</math> is equivalent to going through each leaf j of the structure.<br />
\begin{align}<br />
\tilde{\mathcal{L}}^{(t)}&= \sum_{i}^{n}[g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
&= \sum_{j=1}^{T}[(\sum_{i \in I_j}g_i)\omega_j+\frac{1}{2}(\sum_{i \in I_j}h_i+\lambda)\omega_j^2]+\gamma T<br />
\end{align}<br />
Then for a fixed structure <math>q</math>, the optimal weight of leaf <math>j</math> and the optimal objective value are given as<br><br />
\begin{align}<br />
\omega_j^{*} &= -\frac{\sum_{i \in I_j}g_i}{\sum_{i \in I_j}h_i+\lambda}\\<br />
\tilde{\mathcal{L}}^{(t)}(q) &=-\frac{1}{2}\sum_{j=1}^{T}\frac{(\sum_{i \in I_j}g_i)^2}{\sum_{i \in I_j}h_i+\lambda}+\gamma T<br />
\end{align} <br />
[[File:Structure Score Calculation.png|frame|center|alt=Alt text|Structure Score Calculation]]<br />
Instead of enumerating through all possible tree structures q, a greedy algorithm of iteratively adding branches is used.<br><br />
Let <math>I_L</math> and <math>I_R</math> be the instance sets of left and right nodes after split and let <math>I=I_L\cup I_R</math>.<br><br />
The loss reduction after split is given by<br><br />
\begin{align}<br />
\tilde{\mathcal{L}}_{\text{split}} &=\frac{1}{2}[\frac{(\sum_{i \in I_L}g_i)^2}{\sum_{i \in I_L}h_i+\lambda}+\frac{(\sum_{i \in I_R}g_i)^2}{\sum_{i \in I_R}h_i+\lambda}-\frac{(\sum_{i \in I}g_i)^2}{\sum_{i \in I}h_i+\lambda}]+\gamma<br />
\end{align}<br />
=== Shrinkage and Column Subsampling ===<br />
The author also mentioned two other methods in order to avoid over-fitting.<br><br />
(1) Shrinkage. Similar to the learning rate in stochastic optimization, a new weight is added to each tree boosting to reduce the influence of a single tree and leave space for future trees.<br><br />
(2) Column (feature) subsampling. In the paper, the author only mentioned that this technique speeds up parallel algorithm used in later sections.<br />
<br />
== Split Finding Algorithms ==<br />
<br />
It is very important to find the best split for tree learning to perform well. Here are a few split finding algorithms mentioned in the paper:<br />
<br />
=== Basic Exact Greedy Algorithm ===<br />
<br />
The basic exact greedy algorithm is a split finding algorithm that is computationally expensive because it enumerates over all the possible splits for continuous features. It is impossible to be done efficiently when the memory is not enough to hold the data needed. A way to carry out this algorithm efficiently is to sort the data according to feature values and visit the data in order to accumulate the gradient statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_1.png|center|alt=Alt text|Basic Exact Greedy Algorithm]]<br />
<br />
=== Approximate Algorithm ===<br />
<br />
The paper introduced a more efficient algorithm compared to Basic Exact Greedy Algorithm which is the Approximate Algorithm. The Approximate Algorithm first proposes candidate splitting points according to percentiles of feature distribution. It then maps the continuous features into buckets split by candidate points, aggregates the statistics and finds the best solution among proposals based on the aggregated statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_2.png|center|alt=Alt text|Approximate Algorithm]]<br />
<br />
There are also two variants to this algorithm, the global variant proposes all the candidate splits during the initial phase of tree construction and uses the same proposals for split finding at all levels. Whereas, the local variant re-proposes after each split. The global variant usually requires less proposal steps but uses more candidate points than local variant because candidates are not refined after each split. For deeper trees, usage of local variant may be more appropriate as compared to global variant. The figure below shows the a comparison in accuracy between Basic Exact Greedy and Approximate split finding algorithms with different variant over the number of iterations. We can see that the quantile strategy is able to achieve similar accuracy as the Basic Exact Greedy algorithm given a reasonable approximation level.<br />
<br />
[[File:iterations.png|center|alt=Alt text|Comparison of accuracy between different algorithms]]<br />
<br />
=== Weighted Quantile Sketch ===<br />
<br />
Proposing candidate split points is the most important step in the Approximate Algorithm, it is done by using the percentile of a feature to make candidates distribute evenly on a dataset.<br />
<br />
Formally, we have a dataset<br />
<br />
<math>D_k={(x_{1k},h_1),(x_{2k},h_2),...,(x_{nk},h_n)}</math><br />
<br />
where <math> x_i </math>'s are the feature values of each data point and <math> h_i </math>'s represents the weight of the corresponding feature <math> x_i </math>. <br />
<br />
Then, we can use the following rank function to compute <math>r_k(z)</math>, the proportion of instances whose feature value among <math> (x_i,...,x_k) </math> is smaller than data point <math> z </math>.<br />
<br />
<math>r_k(z) = \frac{1}{\sum_{(x,h) \in D_k} h} \displaystyle\sum_{(x,h) \in D_k, x<z} h,</math><br />
<br />
The objective here is to find candidate split points <math>{s_{k1}, s_{k2}, …, s_{kl}}</math>, such that:<br />
<br />
<math>|r_k(s_{k,j}) – r_k(s_{k,j+1})| < \epsilon, s_{k1} = \displaystyle\min_i x_{ik}, s_{kl} = \displaystyle\max_{i} x_{ik}, \forall i</math><br />
<br />
Where <math>\epsilon</math> is an approximation factor. Usually, it should approximately have <math>\frac{1}{\epsilon}</math> splitting points.<br />
<br />
=== Sparsity-aware Split Finding ===<br />
<br />
Typically in real world situation, it is quite common that our dataset is sparse. Some of the possible causes are:<br />
<br />
# Missing values in the data<br />
# Huge amount of zero entries present in the data<br />
# Artifacts of feature engineering (e.g. One-hot encoding)<br />
<br />
In order to solve the sparsity present in the dataset, we suggest to add a default direction in each tree node will classified into when there is a missing value in the matrix of the dataset. This is demonstrated in the figure below:<br />
<br />
<br />
[[File:figure_4new.png|center|alt=Alt text|Default Direction for sparsity]]<br />
<br />
== System Design ==<br />
<br />
=== Column Block for Parallel Learning ===<br />
The most time consuming part of tree learning is to get the data into sorted order. To overcome this problem, XGBoost stores the data in blocks where each block performs the sorting operation in parallel. The results are then merged together.<br />
<br />
# For the exact greedy algorithm, XGBoost stores the entire dataset in a single block<br />
#:* Original spase aware algorithm costs: <math>O(Kd∥x∥_0 log(n))</math><br />
#:* Tree boosting on block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(n))</math><br />
#:* Hence, block structure helps to save an additional <math>log(n)</math> factor<br />
# For approximate algorithms, XGBoost stores the dataset in multiple blocks<br />
#:* Original algorithm with binary search costs: <math>O(Kd∥x∥_0 log(q))</math><br />
#:* With block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(B))</math><br />
#:* Hence, block structure helps to save an additional <math>log(q)</math> factor <br />
<br />
K = total number of trees<br /><br />
d = maximum depth of the tree<br /><br />
<math>∥x∥_0</math> = number of non-missing entries in the training data<br /><br />
n = number of rows in the dataset<br /><br />
q = number of proposal candidates in the dataset, usually between 32 to 100<br /><br />
B = maximum number of rows in each block<br />
<br />
[[File: columnblock.png|800px|thumb|center]]<br />
<br />
=== Cache-aware Access ===<br />
The proposed block structure optimizes the computation complexity but requires indirect fetches of gradient statistics by row index. XGBoost optimizes the process by using the following methods.<br />
<br />
# For the exact greedy algorithm, XGBoost uses a cache-aware prefetching algorithm<br />
#:* It stores Gradient and Hessians in the cache to make calculations fast<br />
#:* It runs twice as fast as the naive method when the dataset is large<br />
# For approximate algorithms, XGBoost chooses a specific block size<br />
#:* Choosing a small block size results in inefficient parallelization<br />
#:* Choosing a large block size results in cache misses<br />
#:* Various choices of block size are compared and the results are shown in Figure 9<br />
#:* XGBoost chose <math>2^{16}</math> as the block size<br />
<br />
[[File: blocksize.png|400px|thumb|center]]<br />
<br />
=== Blocks for Out-of-core Computation ===<br />
When the dataset is too large for the cache and main memory, XGBoost utilizes disk spaces as well. Since reading and writing data to the disks are slow, XGBoost optimizes the process by using the following two methods.<br />
<br />
# Block Compression<br />
#:* Blocks are compressed by columns<br />
#:* Although decompressing takes time, it is still faster than reading from the disks<br />
# Block Sharding<br />
#:* If multiple disks are available, data is split into those disks<br />
#:* When the CPU needs data, all the disks can be read at the same time<br />
<br />
== End To End Evaluations ==<br />
=== System Implementation ===<br />
XGBoost is a portable and reusable open-source package. It supports:<br />
* various weighted classification<br />
* various objective functions (rank & user defined)<br />
* popular languages (python, R, Julia)<br />
* data science pipelines (scikit-learn)<br />
* big data stacks (Flink, Spark)<br />
* cloud platform (Tianchi8)<br />
<br />
=== Dataset and Setup ===<br />
<br />
A summary of the 4 datasets used in the experiments is in table 2.<br />
<br />
[[File: table2data.png|500px|thumb|center]]<br />
<br />
The first and last datasets were used specifically to evaluate the impact of sparsity-aware algorithm and the scaling property of the system in the out-of-core and the distributed settings respectively. In all of the experiments, common settings such as maximum depth equal to 8, shrinkage equal to 0.1 and no column subsampling are applied.<br />
<br />
=== Classification ===<br />
A subset (n = 1M) of Higgs Boson dataset was used for classification. The results are shown in Table 3.<br />
<br />
[[File: classification.png|500px|thumb|center]]<br />
<br />
* R’s GBM creates a tree fast by using greedy approach that only expands one branch of a tree but with the cost of lower accuracy<br />
* XGBoost and scikit-learn have better performance than R’s GBM<br />
* XGBoost runs more than 10x faster than scikit-learn in learning a full tree<br />
* Column subsamples give slightly worse performance possibly due to a few important features in this dataset.<br />
<br />
=== Learning to Rank ===<br />
The results in comparing XGBoost with pGBRT are shown in Table 4.<br />
<br />
[[File: rank.png|500px|thumb|center]]<br />
<br />
* XGBoost runs exact greedy algorithm while pGBRT only supports an approximate algorithm<br />
* XGBoost runs faster<br />
* Subsampling column reduces running time and gives higher performance possibly due to preventing overfitting<br />
<br />
=== Out-of-core Experiment ===<br />
An extremely large Criteo dataset was used to evaluate the out-of-core setting. The results are shown in the figure below.<br />
<br />
[[File: outofcore.png|350px|thumb|center]]<br />
<br />
* Compression speed up the computation by a factor of 3<br />
* Sharding into 2 disks further gives 2x speed<br />
<br />
=== Distributed Experiment ===<br />
YARN cluster on EC2 with m3.2xlarge machines was used to evaluate the distributed setting. XGBoost was compared with Spark MLLib and H20.<br />
<br />
* XGBoost can switch to out-of-core setting when the memory runs out, while the baseline systems need to store the data in RAM<br />
* XGBoost runs faster than the baseline systems<br />
* The baseline systems are only able to handle a subset of the data with the given resources while XGBoost was able to scale smoothly to all 1.7B rows<br />
* XGBoost’s performance scales linearly with more machines<br />
* XGBoost is able to handle all 1.7B data with only 4 machines<br />
<br />
== Conclusion ==<br />
<br />
== References ==<br />
[1] R. Bekkerman. The present and the future of the kdd cup competition: an outsider’s perspective. <br />
<br />
[2] R. Bekkerman, M. Bilenko, and J. Langford. Scaling Up Machine Learning: Parallel and Distributed Approaches. Cambridge University Press, New York, NY, USA, 2011. <br />
<br />
[3] J. Bennett and S. Lanning. The netflix prize. In Proceedings of the KDD Cup Workshop 2007, pages 3–6, New York, Aug. 2007.<br />
<br />
[4] L. Breiman. Random forests. Maching Learning, 45(1):5–32, Oct. 2001.<br />
<br />
[5] C. Burges. From ranknet to lambdarank to lambdamart: An overview. Learning, 11:23–581, 2010.<br />
<br />
[6] O. Chapelle and Y. Chang. Yahoo! Learning to Rank Challenge Overview. Journal of Machine Learning Research - W & CP, 14:1–24, 2011.<br />
<br />
[7] T. Chen, H. Li, Q. Yang, and Y. Yu. General functional matrix factorization using gradient boosting. In Proceeding of 30th International Conference on Machine Learning (ICML’13), volume 1, pages 436–444, 2013.<br />
<br />
[8] T. Chen, S. Singh, B. Taskar, and C. Guestrin. Efficient second-order gradient boosting for conditional random fields. In Proceeding of 18th Artificial Intelligence and Statistics Conference (AISTATS’15), volume 1, 2015.<br />
<br />
[9] R.-E. Fan, K.-W. Chang, C.-J. Hsieh, X.-R. Wang, and C.-J. Lin. LIBLINEAR: A library for large linear classification. Journal of Machine Learning Research, 9:1871–1874, 2008.<br />
<br />
[10] J. Friedman. Greedy function approximation: a gradient boosting machine. Annals of Statistics, 29(5):1189–1232, 2001.<br />
<br />
[11] J. Friedman. Stochastic gradient boosting. Computational Statistics & Data Analysis, 38(4):367–378, 2002.<br />
<br />
[12] J. Friedman, T. Hastie, and R. Tibshirani. Additive logistic regression: a statistical view of boosting. Annals of Statistics, 28(2):337–407, 2000.<br />
<br />
[13] J. H. Friedman and B. E. Popescu. Importance sampled learning ensembles, 2003.<br />
<br />
[14] M. Greenwald and S. Khanna. Space-efficient online computation of quantile summaries. In Proceedings of the 2001 ACM SIGMOD International Conference on Management of Data, pages 58–66, 2001.<br />
<br />
[15] X. He, J. Pan, O. Jin, T. Xu, B. Liu, T. Xu, Y. Shi, A. Atallah, R. Herbrich, S. Bowers, and J. Q. n. Candela. Practical lessons from predicting clicks on ads at facebook. In Proceedings of the Eighth International Workshop on Data Mining for Online Advertising, ADKDD’14, 2014.<br />
<br />
[16] P. Li. Robust Logitboost and adaptive base class (ABC) Logitboost. In Proceedings of the Twenty-Sixth Conference Annual Conference on Uncertainty in Artificial Intelligence (UAI’10), pages 302–311, 2010.<br />
<br />
[17] P. Li, Q. Wu, and C. J. Burges. Mcrank: Learning to rank using multiple classification and gradient boosting. In Advances in Neural Information Processing Systems 20, pages 897–904. 2008.<br />
<br />
[18] X. Meng, J. Bradley, B. Yavuz, E. Sparks, S. Venkataraman, D. Liu, J. Freeman, D. Tsai, M. Amde, S. Owen, D. Xin, R. Xin, M. J. Franklin, R. Zadeh, M. Zaharia, and A. Talwalkar. MLlib: Machine learning in apache spark. Journal of Machine Learning Research, 17(34):1–7, 2016.<br />
<br />
[19] B. Panda, J. S. Herbach, S. Basu, and R. J. Bayardo. Planet: Massively parallel learning of tree ensembles with mapreduce. Proceeding of VLDB Endowment, 2(2):1426–1437, Aug. 2009.<br />
<br />
[20] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.<br />
<br />
[21] G. Ridgeway. Generalized Boosted Models: A guide to the gbm package.<br />
<br />
[22] S. Tyree, K. Weinberger, K. Agrawal, and J. Paykin. Parallel boosted regression trees for web search ranking. In Proceedings of the 20th international conference on World wide web, pages 387–396. ACM, 2011.<br />
<br />
[23] J. Ye, J.-H. Chow, J. Chen, and Z. Zheng. Stochastic gradient boosted distributed decision trees. In Proceedings of the 18th ACM Conference on Information and Knowledge Management, CIKM ’09.<br />
<br />
[24] Q. Zhang and W. Wang. A fast algorithm for approximate quantiles in high speed data streams. In Proceedings of the 19th International Conference on Scientific and Statistical Database Management, 2007.<br />
<br />
[25] T. Zhang and R. Johnson. Learning nonlinear functions using regularized greedy forest. IEEE Transactions on Pattern Analysis and Machine Intelligence, 36(5), 2014.</div>Cwlokehttp://wiki.math.uwaterloo.ca/statwiki/index.php?title=XGBoost&diff=51118XGBoost2021-11-29T05:09:16Z<p>Cwloke: /* Sparsity-aware Split Finding */</p>
<hr />
<div>== Presented by == <br />
* Chun Waan Loke<br />
* Peter Chong<br />
* Clarice Osmond<br />
* Zhilong Li<br />
<br />
== Introduction ==<br />
<br />
== Tree Boosting In A Nutshell ==<br />
The author reviews gradient tree boosting in this section.<br />
=== Regularized Learning Objective ===<br />
The author first gives the prediction equation (1) and the regularized objective (2).<br><br />
<br><br />
(1) The additive prediction model is given as<br><br />
<math>\hat{y_i}=\sum_{k=1}^{K}f_k(x_i), f_k \in \mathcal{F} </math> <br><br />
where each <math>f_k</math> corresponds to an independent tree structure with its weights, and <math>\mathcal{F}</math> is the "space of regression trees"<br><br />
<br><br />
(2) The regularized objective to be minimized is given as<br><br />
<math>\mathcal{L}=\sum_{i}l(\hat{y_i},y_i)+\sum_k \Omega(f_k)</math> where <math>\Omega(f)=\gamma T+\frac{1}{2}\lambda ||\omega||^2</math> <br><br />
The first term <math>l</math> is a differentiable convex loss function that calculates the measures between <math>\hat{y}</math> and <math>y</math>.<br><br />
The second term <math>\Omega</math> penalizes on the complexity of model (the <math>f_k</math>'s). For a given tree (<math>f_k</math>), <math>T</math> is the number of leaves, and <math>\omega</math> is the leaf weights.<br><br />
The L1 regularization term <math>\gamma T</math> encourages the tree to be small, and the L2 regularization term <math>\frac{1}{2}\lambda ||\omega||^2</math> encourages the tree to have small weights.<br><br />
<br />
=== Gradient Tree Boosting ===<br />
Let <math>\hat{y_i}^{(t)}</math> be the prediction of <math>y_i</math> at the t-th iteration.<br><br />
Since the prediction equation is simply additive, <math>{\hat y_i}^{(t)}=\hat{y_{i}}^{(t-1)}+f_t(x_i)</math><br><br />
Using this equation and 2nd order Taylor approximation on the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> gives <br><br />
\begin{align}<br />
\mathcal{L}^{(t)}&=\sum_{i}^{n}l(y_i,\hat{y_i}^{(t-1)}+f_t(x_i))+\Omega(f_t)\\<br />
&\simeq \sum_{i}^{n}[l(y_i,\hat{y_i}^{(t-1)})+g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
\end{align}<br />
where <math>g_i</math> and <math>h_i</math> are the first and second derivative of the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> with repspect to the term <math>\hat{y}^{(t-1)}</math><br><br />
We can simplify this objective by removing the constant term <math>l(y_i,\hat{y_i}^{(t-1)})</math>.<br><br />
Define <math>I_j=\{i|q(x_i)=j\}</math>, where <math>q</math> is the tree structure. Since every <math>x_i</math> is mapped by <math>q</math> to some leaf <math>j</math>, going through every <math>x_i</math> is equivalent to going through each leaf j of the structure.<br />
\begin{align}<br />
\tilde{\mathcal{L}}^{(t)}&= \sum_{i}^{n}[g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
&= \sum_{j=1}^{T}[(\sum_{i \in I_j}g_i)\omega_j+\frac{1}{2}(\sum_{i \in I_j}h_i+\lambda)\omega_j^2]+\gamma T<br />
\end{align}<br />
Then for a fixed structure <math>q</math>, the optimal weight of leaf <math>j</math> and the optimal objective value are given as<br><br />
\begin{align}<br />
\omega_j^{*} &= -\frac{\sum_{i \in I_j}g_i}{\sum_{i \in I_j}h_i+\lambda}\\<br />
\tilde{\mathcal{L}}^{(t)}(q) &=-\frac{1}{2}\sum_{j=1}^{T}\frac{(\sum_{i \in I_j}g_i)^2}{\sum_{i \in I_j}h_i+\lambda}+\gamma T<br />
\end{align} <br />
[[File:Structure Score Calculation.png|frame|center|alt=Alt text|Structure Score Calculation]]<br />
Instead of enumerating through all possible tree structures q, a greedy algorithm of iteratively adding branches is used.<br><br />
Let <math>I_L</math> and <math>I_R</math> be the instance sets of left and right nodes after split and let <math>I=I_L\cup I_R</math>.<br><br />
The loss reduction after split is given by<br><br />
\begin{align}<br />
\tilde{\mathcal{L}}_{\text{split}} &=\frac{1}{2}[\frac{(\sum_{i \in I_L}g_i)^2}{\sum_{i \in I_L}h_i+\lambda}+\frac{(\sum_{i \in I_R}g_i)^2}{\sum_{i \in I_R}h_i+\lambda}-\frac{(\sum_{i \in I}g_i)^2}{\sum_{i \in I}h_i+\lambda}]+\gamma<br />
\end{align}<br />
=== Shrinkage and Column Subsampling ===<br />
The author also mentioned two other methods in order to avoid over-fitting.<br><br />
(1) Shrinkage. Similar to the learning rate in stochastic optimization, a new weight is added to each tree boosting to reduce the influence of a single tree and leave space for future trees.<br><br />
(2) Column (feature) subsampling. In the paper, the author only mentioned that this technique speeds up parallel algorithm used in later sections.<br />
<br />
== Split Finding Algorithms ==<br />
<br />
It is very important to find the best split for tree learning to perform well. Here are a few split finding algorithms mentioned in the paper:<br />
<br />
=== Basic Exact Greedy Algorithm ===<br />
<br />
The basic exact greedy algorithm is a split finding algorithm that is computationally expensive because it enumerates over all the possible splits for continuous features. It is impossible to be done efficiently when the memory is not enough to hold the data needed. A way to carry out this algorithm efficiently is to sort the data according to feature values and visit the data in order to accumulate the gradient statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_1.png|center|alt=Alt text|Basic Exact Greedy Algorithm]]<br />
<br />
=== Approximate Algorithm ===<br />
<br />
The paper introduced a more efficient algorithm compared to Basic Exact Greedy Algorithm which is the Approximate Algorithm. The Approximate Algorithm first proposes candidate splitting points according to percentiles of feature distribution. It then maps the continuous features into buckets split by candidate points, aggregates the statistics and finds the best solution among proposals based on the aggregated statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_2.png|center|alt=Alt text|Approximate Algorithm]]<br />
<br />
There are also two variants to this algorithm, the global variant proposes all the candidate splits during the initial phase of tree construction and uses the same proposals for split finding at all levels. Whereas, the local variant re-proposes after each split. The global variant usually requires less proposal steps but uses more candidate points than local variant because candidates are not refined after each split. For deeper trees, usage of local variant may be more appropriate as compared to global variant. The figure below shows the a comparison in accuracy between Basic Exact Greedy and Approximate split finding algorithms with different variant over the number of iterations. We can see that the quantile strategy is able to achieve similar accuracy as the Basic Exact Greedy algorithm given a reasonable approximation level.<br />
<br />
[[File:iterations.png|center|alt=Alt text|Comparison of accuracy between different algorithms]]<br />
<br />
=== Weighted Quantile Sketch ===<br />
<br />
Proposing candidate split points is the most important step in the Approximate Algorithm, it is done by using the percentile of a feature to make candidates distribute evenly on a dataset.<br />
<br />
Formally, we have a dataset<br />
<br />
<math>D_k={(x_{1k},h_1),(x_{2k},h_2),...,(x_{nk},h_n)}</math><br />
<br />
where <math> x_i </math>'s are the feature values of each data point and <math> h_i </math>'s represents the weight of the corresponding feature <math> x_i </math>. <br />
<br />
Then, we can use the following rank function to compute <math>r_k(z)</math>, the proportion of instances whose feature value among <math> (x_i,...,x_k) </math> is smaller than data point <math> z </math>.<br />
<br />
<math>r_k(z) = \frac{1}{\sum_{(x,h) \in D_k} h} \displaystyle\sum_{(x,h) \in D_k, x<z} h,</math><br />
<br />
The objective here is to find candidate split points <math>{s_{k1}, s_{k2}, …, s_{kl}}</math>, such that:<br />
<br />
<math>|r_k(s_{k,j}) – r_k(s_{k,j+1})| < \epsilon, s_{k1} = \displaystyle\min_i x_{ik}, s_{kl} = \displaystyle\max_{i} x_{ik}, \forall i</math><br />
<br />
Where <math>\epsilon</math> is an approximation factor. Usually, it should approximately have <math>\frac{1}{\epsilon}</math> splitting points.<br />
<br />
=== Sparsity-aware Split Finding ===<br />
<br />
Typically in real world situation, it is quite common that our dataset is sparse. Some of the possible causes are:<br />
<br />
# Missing values in the data<br />
# Huge amount of zero entries present in the data<br />
# Artifacts of feature engineering (e.g. One-hot encoding)<br />
<br />
In order to solve the sparsity present in the dataset, we suggest to add a default direction in each tree node will classified into when there is a missing value in the matrix of the dataset. This is demonstrated in the figure below:<br />
<br />
<br />
[[File:figure_4.png|center|alt=Alt text|Default Direction for sparsity]]<br />
<br />
== System Design ==<br />
<br />
=== Column Block for Parallel Learning ===<br />
The most time consuming part of tree learning is to get the data into sorted order. To overcome this problem, XGBoost stores the data in blocks where each block performs the sorting operation in parallel. The results are then merged together.<br />
<br />
# For the exact greedy algorithm, XGBoost stores the entire dataset in a single block<br />
#:* Original spase aware algorithm costs: <math>O(Kd∥x∥_0 log(n))</math><br />
#:* Tree boosting on block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(n))</math><br />
#:* Hence, block structure helps to save an additional <math>log(n)</math> factor<br />
# For approximate algorithms, XGBoost stores the dataset in multiple blocks<br />
#:* Original algorithm with binary search costs: <math>O(Kd∥x∥_0 log(q))</math><br />
#:* With block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(B))</math><br />
#:* Hence, block structure helps to save an additional <math>log(q)</math> factor <br />
<br />
K = total number of trees<br /><br />
d = maximum depth of the tree<br /><br />
<math>∥x∥_0</math> = number of non-missing entries in the training data<br /><br />
n = number of rows in the dataset<br /><br />
q = number of proposal candidates in the dataset, usually between 32 to 100<br /><br />
B = maximum number of rows in each block<br />
<br />
[[File: columnblock.png|800px|thumb|center]]<br />
<br />
=== Cache-aware Access ===<br />
The proposed block structure optimizes the computation complexity but requires indirect fetches of gradient statistics by row index. XGBoost optimizes the process by using the following methods.<br />
<br />
# For the exact greedy algorithm, XGBoost uses a cache-aware prefetching algorithm<br />
#:* It stores Gradient and Hessians in the cache to make calculations fast<br />
#:* It runs twice as fast as the naive method when the dataset is large<br />
# For approximate algorithms, XGBoost chooses a specific block size<br />
#:* Choosing a small block size results in inefficient parallelization<br />
#:* Choosing a large block size results in cache misses<br />
#:* Various choices of block size are compared and the results are shown in Figure 9<br />
#:* XGBoost chose <math>2^{16}</math> as the block size<br />
<br />
[[File: blocksize.png|400px|thumb|center]]<br />
<br />
=== Blocks for Out-of-core Computation ===<br />
When the dataset is too large for the cache and main memory, XGBoost utilizes disk spaces as well. Since reading and writing data to the disks are slow, XGBoost optimizes the process by using the following two methods.<br />
<br />
# Block Compression<br />
#:* Blocks are compressed by columns<br />
#:* Although decompressing takes time, it is still faster than reading from the disks<br />
# Block Sharding<br />
#:* If multiple disks are available, data is split into those disks<br />
#:* When the CPU needs data, all the disks can be read at the same time<br />
<br />
== End To End Evaluations ==<br />
=== System Implementation ===<br />
XGBoost is a portable and reusable open-source package. It supports:<br />
* various weighted classification<br />
* various objective functions (rank & user defined)<br />
* popular languages (python, R, Julia)<br />
* data science pipelines (scikit-learn)<br />
* big data stacks (Flink, Spark)<br />
* cloud platform (Tianchi8)<br />
<br />
=== Dataset and Setup ===<br />
<br />
A summary of the 4 datasets used in the experiments is in table 2.<br />
<br />
[[File: table2data.png|500px|thumb|center]]<br />
<br />
The first and last datasets were used specifically to evaluate the impact of sparsity-aware algorithm and the scaling property of the system in the out-of-core and the distributed settings respectively. In all of the experiments, common settings such as maximum depth equal to 8, shrinkage equal to 0.1 and no column subsampling are applied.<br />
<br />
=== Classification ===<br />
A subset (n = 1M) of Higgs Boson dataset was used for classification. The results are shown in Table 3.<br />
<br />
[[File: classification.png|500px|thumb|center]]<br />
<br />
* R’s GBM creates a tree fast by using greedy approach that only expands one branch of a tree but with the cost of lower accuracy<br />
* XGBoost and scikit-learn have better performance than R’s GBM<br />
* XGBoost runs more than 10x faster than scikit-learn in learning a full tree<br />
* Column subsamples give slightly worse performance possibly due to a few important features in this dataset.<br />
<br />
=== Learning to Rank ===<br />
The results in comparing XGBoost with pGBRT are shown in Table 4.<br />
<br />
[[File: rank.png|500px|thumb|center]]<br />
<br />
* XGBoost runs exact greedy algorithm while pGBRT only supports an approximate algorithm<br />
* XGBoost runs faster<br />
* Subsampling column reduces running time and gives higher performance possibly due to preventing overfitting<br />
<br />
=== Out-of-core Experiment ===<br />
An extremely large Criteo dataset was used to evaluate the out-of-core setting. The results are shown in the figure below.<br />
<br />
[[File: outofcore.png|350px|thumb|center]]<br />
<br />
* Compression speed up the computation by a factor of 3<br />
* Sharding into 2 disks further gives 2x speed<br />
<br />
=== Distributed Experiment ===<br />
YARN cluster on EC2 with m3.2xlarge machines was used to evaluate the distributed setting. XGBoost was compared with Spark MLLib and H20.<br />
<br />
* XGBoost can switch to out-of-core setting when the memory runs out, while the baseline systems need to store the data in RAM<br />
* XGBoost runs faster than the baseline systems<br />
* The baseline systems are only able to handle a subset of the data with the given resources while XGBoost was able to scale smoothly to all 1.7B rows<br />
* XGBoost’s performance scales linearly with more machines<br />
* XGBoost is able to handle all 1.7B data with only 4 machines<br />
<br />
== Conclusion ==<br />
<br />
== References ==<br />
[1] R. Bekkerman. The present and the future of the kdd cup competition: an outsider’s perspective. <br />
<br />
[2] R. Bekkerman, M. Bilenko, and J. Langford. Scaling Up Machine Learning: Parallel and Distributed Approaches. Cambridge University Press, New York, NY, USA, 2011. <br />
<br />
[3] J. Bennett and S. Lanning. The netflix prize. In Proceedings of the KDD Cup Workshop 2007, pages 3–6, New York, Aug. 2007.<br />
<br />
[4] L. Breiman. Random forests. Maching Learning, 45(1):5–32, Oct. 2001.<br />
<br />
[5] C. Burges. From ranknet to lambdarank to lambdamart: An overview. Learning, 11:23–581, 2010.<br />
<br />
[6] O. Chapelle and Y. Chang. Yahoo! Learning to Rank Challenge Overview. Journal of Machine Learning Research - W & CP, 14:1–24, 2011.<br />
<br />
[7] T. Chen, H. Li, Q. Yang, and Y. Yu. General functional matrix factorization using gradient boosting. In Proceeding of 30th International Conference on Machine Learning (ICML’13), volume 1, pages 436–444, 2013.<br />
<br />
[8] T. Chen, S. Singh, B. Taskar, and C. Guestrin. Efficient second-order gradient boosting for conditional random fields. In Proceeding of 18th Artificial Intelligence and Statistics Conference (AISTATS’15), volume 1, 2015.<br />
<br />
[9] R.-E. Fan, K.-W. Chang, C.-J. Hsieh, X.-R. Wang, and C.-J. Lin. LIBLINEAR: A library for large linear classification. Journal of Machine Learning Research, 9:1871–1874, 2008.<br />
<br />
[10] J. Friedman. Greedy function approximation: a gradient boosting machine. Annals of Statistics, 29(5):1189–1232, 2001.<br />
<br />
[11] J. Friedman. Stochastic gradient boosting. Computational Statistics & Data Analysis, 38(4):367–378, 2002.<br />
<br />
[12] J. Friedman, T. Hastie, and R. Tibshirani. Additive logistic regression: a statistical view of boosting. Annals of Statistics, 28(2):337–407, 2000.<br />
<br />
[13] J. H. Friedman and B. E. Popescu. Importance sampled learning ensembles, 2003.<br />
<br />
[14] M. Greenwald and S. Khanna. Space-efficient online computation of quantile summaries. In Proceedings of the 2001 ACM SIGMOD International Conference on Management of Data, pages 58–66, 2001.<br />
<br />
[15] X. He, J. Pan, O. Jin, T. Xu, B. Liu, T. Xu, Y. Shi, A. Atallah, R. Herbrich, S. Bowers, and J. Q. n. Candela. Practical lessons from predicting clicks on ads at facebook. In Proceedings of the Eighth International Workshop on Data Mining for Online Advertising, ADKDD’14, 2014.<br />
<br />
[16] P. Li. Robust Logitboost and adaptive base class (ABC) Logitboost. In Proceedings of the Twenty-Sixth Conference Annual Conference on Uncertainty in Artificial Intelligence (UAI’10), pages 302–311, 2010.<br />
<br />
[17] P. Li, Q. Wu, and C. J. Burges. Mcrank: Learning to rank using multiple classification and gradient boosting. In Advances in Neural Information Processing Systems 20, pages 897–904. 2008.<br />
<br />
[18] X. Meng, J. Bradley, B. Yavuz, E. Sparks, S. Venkataraman, D. Liu, J. Freeman, D. Tsai, M. Amde, S. Owen, D. Xin, R. Xin, M. J. Franklin, R. Zadeh, M. Zaharia, and A. Talwalkar. MLlib: Machine learning in apache spark. Journal of Machine Learning Research, 17(34):1–7, 2016.<br />
<br />
[19] B. Panda, J. S. Herbach, S. Basu, and R. J. Bayardo. Planet: Massively parallel learning of tree ensembles with mapreduce. Proceeding of VLDB Endowment, 2(2):1426–1437, Aug. 2009.<br />
<br />
[20] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.<br />
<br />
[21] G. Ridgeway. Generalized Boosted Models: A guide to the gbm package.<br />
<br />
[22] S. Tyree, K. Weinberger, K. Agrawal, and J. Paykin. Parallel boosted regression trees for web search ranking. In Proceedings of the 20th international conference on World wide web, pages 387–396. ACM, 2011.<br />
<br />
[23] J. Ye, J.-H. Chow, J. Chen, and Z. Zheng. Stochastic gradient boosted distributed decision trees. In Proceedings of the 18th ACM Conference on Information and Knowledge Management, CIKM ’09.<br />
<br />
[24] Q. Zhang and W. Wang. A fast algorithm for approximate quantiles in high speed data streams. In Proceedings of the 19th International Conference on Scientific and Statistical Database Management, 2007.<br />
<br />
[25] T. Zhang and R. Johnson. Learning nonlinear functions using regularized greedy forest. IEEE Transactions on Pattern Analysis and Machine Intelligence, 36(5), 2014.</div>Cwlokehttp://wiki.math.uwaterloo.ca/statwiki/index.php?title=XGBoost&diff=51117XGBoost2021-11-29T05:09:11Z<p>Cwloke: /* Sparsity-aware Split Finding */</p>
<hr />
<div>== Presented by == <br />
* Chun Waan Loke<br />
* Peter Chong<br />
* Clarice Osmond<br />
* Zhilong Li<br />
<br />
== Introduction ==<br />
<br />
== Tree Boosting In A Nutshell ==<br />
The author reviews gradient tree boosting in this section.<br />
=== Regularized Learning Objective ===<br />
The author first gives the prediction equation (1) and the regularized objective (2).<br><br />
<br><br />
(1) The additive prediction model is given as<br><br />
<math>\hat{y_i}=\sum_{k=1}^{K}f_k(x_i), f_k \in \mathcal{F} </math> <br><br />
where each <math>f_k</math> corresponds to an independent tree structure with its weights, and <math>\mathcal{F}</math> is the "space of regression trees"<br><br />
<br><br />
(2) The regularized objective to be minimized is given as<br><br />
<math>\mathcal{L}=\sum_{i}l(\hat{y_i},y_i)+\sum_k \Omega(f_k)</math> where <math>\Omega(f)=\gamma T+\frac{1}{2}\lambda ||\omega||^2</math> <br><br />
The first term <math>l</math> is a differentiable convex loss function that calculates the measures between <math>\hat{y}</math> and <math>y</math>.<br><br />
The second term <math>\Omega</math> penalizes on the complexity of model (the <math>f_k</math>'s). For a given tree (<math>f_k</math>), <math>T</math> is the number of leaves, and <math>\omega</math> is the leaf weights.<br><br />
The L1 regularization term <math>\gamma T</math> encourages the tree to be small, and the L2 regularization term <math>\frac{1}{2}\lambda ||\omega||^2</math> encourages the tree to have small weights.<br><br />
<br />
=== Gradient Tree Boosting ===<br />
Let <math>\hat{y_i}^{(t)}</math> be the prediction of <math>y_i</math> at the t-th iteration.<br><br />
Since the prediction equation is simply additive, <math>{\hat y_i}^{(t)}=\hat{y_{i}}^{(t-1)}+f_t(x_i)</math><br><br />
Using this equation and 2nd order Taylor approximation on the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> gives <br><br />
\begin{align}<br />
\mathcal{L}^{(t)}&=\sum_{i}^{n}l(y_i,\hat{y_i}^{(t-1)}+f_t(x_i))+\Omega(f_t)\\<br />
&\simeq \sum_{i}^{n}[l(y_i,\hat{y_i}^{(t-1)})+g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
\end{align}<br />
where <math>g_i</math> and <math>h_i</math> are the first and second derivative of the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> with repspect to the term <math>\hat{y}^{(t-1)}</math><br><br />
We can simplify this objective by removing the constant term <math>l(y_i,\hat{y_i}^{(t-1)})</math>.<br><br />
Define <math>I_j=\{i|q(x_i)=j\}</math>, where <math>q</math> is the tree structure. Since every <math>x_i</math> is mapped by <math>q</math> to some leaf <math>j</math>, going through every <math>x_i</math> is equivalent to going through each leaf j of the structure.<br />
\begin{align}<br />
\tilde{\mathcal{L}}^{(t)}&= \sum_{i}^{n}[g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
&= \sum_{j=1}^{T}[(\sum_{i \in I_j}g_i)\omega_j+\frac{1}{2}(\sum_{i \in I_j}h_i+\lambda)\omega_j^2]+\gamma T<br />
\end{align}<br />
Then for a fixed structure <math>q</math>, the optimal weight of leaf <math>j</math> and the optimal objective value are given as<br><br />
\begin{align}<br />
\omega_j^{*} &= -\frac{\sum_{i \in I_j}g_i}{\sum_{i \in I_j}h_i+\lambda}\\<br />
\tilde{\mathcal{L}}^{(t)}(q) &=-\frac{1}{2}\sum_{j=1}^{T}\frac{(\sum_{i \in I_j}g_i)^2}{\sum_{i \in I_j}h_i+\lambda}+\gamma T<br />
\end{align} <br />
[[File:Structure Score Calculation.png|frame|center|alt=Alt text|Structure Score Calculation]]<br />
Instead of enumerating through all possible tree structures q, a greedy algorithm of iteratively adding branches is used.<br><br />
Let <math>I_L</math> and <math>I_R</math> be the instance sets of left and right nodes after split and let <math>I=I_L\cup I_R</math>.<br><br />
The loss reduction after split is given by<br><br />
\begin{align}<br />
\tilde{\mathcal{L}}_{\text{split}} &=\frac{1}{2}[\frac{(\sum_{i \in I_L}g_i)^2}{\sum_{i \in I_L}h_i+\lambda}+\frac{(\sum_{i \in I_R}g_i)^2}{\sum_{i \in I_R}h_i+\lambda}-\frac{(\sum_{i \in I}g_i)^2}{\sum_{i \in I}h_i+\lambda}]+\gamma<br />
\end{align}<br />
=== Shrinkage and Column Subsampling ===<br />
The author also mentioned two other methods in order to avoid over-fitting.<br><br />
(1) Shrinkage. Similar to the learning rate in stochastic optimization, a new weight is added to each tree boosting to reduce the influence of a single tree and leave space for future trees.<br><br />
(2) Column (feature) subsampling. In the paper, the author only mentioned that this technique speeds up parallel algorithm used in later sections.<br />
<br />
== Split Finding Algorithms ==<br />
<br />
It is very important to find the best split for tree learning to perform well. Here are a few split finding algorithms mentioned in the paper:<br />
<br />
=== Basic Exact Greedy Algorithm ===<br />
<br />
The basic exact greedy algorithm is a split finding algorithm that is computationally expensive because it enumerates over all the possible splits for continuous features. It is impossible to be done efficiently when the memory is not enough to hold the data needed. A way to carry out this algorithm efficiently is to sort the data according to feature values and visit the data in order to accumulate the gradient statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_1.png|center|alt=Alt text|Basic Exact Greedy Algorithm]]<br />
<br />
=== Approximate Algorithm ===<br />
<br />
The paper introduced a more efficient algorithm compared to Basic Exact Greedy Algorithm which is the Approximate Algorithm. The Approximate Algorithm first proposes candidate splitting points according to percentiles of feature distribution. It then maps the continuous features into buckets split by candidate points, aggregates the statistics and finds the best solution among proposals based on the aggregated statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_2.png|center|alt=Alt text|Approximate Algorithm]]<br />
<br />
There are also two variants to this algorithm, the global variant proposes all the candidate splits during the initial phase of tree construction and uses the same proposals for split finding at all levels. Whereas, the local variant re-proposes after each split. The global variant usually requires less proposal steps but uses more candidate points than local variant because candidates are not refined after each split. For deeper trees, usage of local variant may be more appropriate as compared to global variant. The figure below shows the a comparison in accuracy between Basic Exact Greedy and Approximate split finding algorithms with different variant over the number of iterations. We can see that the quantile strategy is able to achieve similar accuracy as the Basic Exact Greedy algorithm given a reasonable approximation level.<br />
<br />
[[File:iterations.png|center|alt=Alt text|Comparison of accuracy between different algorithms]]<br />
<br />
=== Weighted Quantile Sketch ===<br />
<br />
Proposing candidate split points is the most important step in the Approximate Algorithm, it is done by using the percentile of a feature to make candidates distribute evenly on a dataset.<br />
<br />
Formally, we have a dataset<br />
<br />
<math>D_k={(x_{1k},h_1),(x_{2k},h_2),...,(x_{nk},h_n)}</math><br />
<br />
where <math> x_i </math>'s are the feature values of each data point and <math> h_i </math>'s represents the weight of the corresponding feature <math> x_i </math>. <br />
<br />
Then, we can use the following rank function to compute <math>r_k(z)</math>, the proportion of instances whose feature value among <math> (x_i,...,x_k) </math> is smaller than data point <math> z </math>.<br />
<br />
<math>r_k(z) = \frac{1}{\sum_{(x,h) \in D_k} h} \displaystyle\sum_{(x,h) \in D_k, x<z} h,</math><br />
<br />
The objective here is to find candidate split points <math>{s_{k1}, s_{k2}, …, s_{kl}}</math>, such that:<br />
<br />
<math>|r_k(s_{k,j}) – r_k(s_{k,j+1})| < \epsilon, s_{k1} = \displaystyle\min_i x_{ik}, s_{kl} = \displaystyle\max_{i} x_{ik}, \forall i</math><br />
<br />
Where <math>\epsilon</math> is an approximation factor. Usually, it should approximately have <math>\frac{1}{\epsilon}</math> splitting points.<br />
<br />
=== Sparsity-aware Split Finding ===<br />
<br />
Typically in real world situation, it is quite common that our dataset is sparse. Some of the possible causes are:<br />
<br />
# Missing values in the data<br />
# Huge amount of zero entries present in the data<br />
# Artifacts of feature engineering (e.g. One-hot encoding)<br />
<br />
In order to solve the sparsity present in the dataset, we suggest to add a default direction in each tree node will classified into when there is a missing value in the matrix of the dataset. This is demonstrated in the figure below:<br />
<br />
== System Design ==<br />
<br />
=== Column Block for Parallel Learning ===<br />
The most time consuming part of tree learning is to get the data into sorted order. To overcome this problem, XGBoost stores the data in blocks where each block performs the sorting operation in parallel. The results are then merged together.<br />
<br />
# For the exact greedy algorithm, XGBoost stores the entire dataset in a single block<br />
#:* Original spase aware algorithm costs: <math>O(Kd∥x∥_0 log(n))</math><br />
#:* Tree boosting on block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(n))</math><br />
#:* Hence, block structure helps to save an additional <math>log(n)</math> factor<br />
# For approximate algorithms, XGBoost stores the dataset in multiple blocks<br />
#:* Original algorithm with binary search costs: <math>O(Kd∥x∥_0 log(q))</math><br />
#:* With block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(B))</math><br />
#:* Hence, block structure helps to save an additional <math>log(q)</math> factor <br />
<br />
K = total number of trees<br /><br />
d = maximum depth of the tree<br /><br />
<math>∥x∥_0</math> = number of non-missing entries in the training data<br /><br />
n = number of rows in the dataset<br /><br />
q = number of proposal candidates in the dataset, usually between 32 to 100<br /><br />
B = maximum number of rows in each block<br />
<br />
[[File: columnblock.png|800px|thumb|center]]<br />
<br />
=== Cache-aware Access ===<br />
The proposed block structure optimizes the computation complexity but requires indirect fetches of gradient statistics by row index. XGBoost optimizes the process by using the following methods.<br />
<br />
# For the exact greedy algorithm, XGBoost uses a cache-aware prefetching algorithm<br />
#:* It stores Gradient and Hessians in the cache to make calculations fast<br />
#:* It runs twice as fast as the naive method when the dataset is large<br />
# For approximate algorithms, XGBoost chooses a specific block size<br />
#:* Choosing a small block size results in inefficient parallelization<br />
#:* Choosing a large block size results in cache misses<br />
#:* Various choices of block size are compared and the results are shown in Figure 9<br />
#:* XGBoost chose <math>2^{16}</math> as the block size<br />
<br />
[[File: blocksize.png|400px|thumb|center]]<br />
<br />
=== Blocks for Out-of-core Computation ===<br />
When the dataset is too large for the cache and main memory, XGBoost utilizes disk spaces as well. Since reading and writing data to the disks are slow, XGBoost optimizes the process by using the following two methods.<br />
<br />
# Block Compression<br />
#:* Blocks are compressed by columns<br />
#:* Although decompressing takes time, it is still faster than reading from the disks<br />
# Block Sharding<br />
#:* If multiple disks are available, data is split into those disks<br />
#:* When the CPU needs data, all the disks can be read at the same time<br />
<br />
== End To End Evaluations ==<br />
=== System Implementation ===<br />
XGBoost is a portable and reusable open-source package. It supports:<br />
* various weighted classification<br />
* various objective functions (rank & user defined)<br />
* popular languages (python, R, Julia)<br />
* data science pipelines (scikit-learn)<br />
* big data stacks (Flink, Spark)<br />
* cloud platform (Tianchi8)<br />
<br />
=== Dataset and Setup ===<br />
<br />
A summary of the 4 datasets used in the experiments is in table 2.<br />
<br />
[[File: table2data.png|500px|thumb|center]]<br />
<br />
The first and last datasets were used specifically to evaluate the impact of sparsity-aware algorithm and the scaling property of the system in the out-of-core and the distributed settings respectively. In all of the experiments, common settings such as maximum depth equal to 8, shrinkage equal to 0.1 and no column subsampling are applied.<br />
<br />
=== Classification ===<br />
A subset (n = 1M) of Higgs Boson dataset was used for classification. The results are shown in Table 3.<br />
<br />
[[File: classification.png|500px|thumb|center]]<br />
<br />
* R’s GBM creates a tree fast by using greedy approach that only expands one branch of a tree but with the cost of lower accuracy<br />
* XGBoost and scikit-learn have better performance than R’s GBM<br />
* XGBoost runs more than 10x faster than scikit-learn in learning a full tree<br />
* Column subsamples give slightly worse performance possibly due to a few important features in this dataset.<br />
<br />
=== Learning to Rank ===<br />
The results in comparing XGBoost with pGBRT are shown in Table 4.<br />
<br />
[[File: rank.png|500px|thumb|center]]<br />
<br />
* XGBoost runs exact greedy algorithm while pGBRT only supports an approximate algorithm<br />
* XGBoost runs faster<br />
* Subsampling column reduces running time and gives higher performance possibly due to preventing overfitting<br />
<br />
=== Out-of-core Experiment ===<br />
An extremely large Criteo dataset was used to evaluate the out-of-core setting. The results are shown in the figure below.<br />
<br />
[[File: outofcore.png|350px|thumb|center]]<br />
<br />
* Compression speed up the computation by a factor of 3<br />
* Sharding into 2 disks further gives 2x speed<br />
<br />
=== Distributed Experiment ===<br />
YARN cluster on EC2 with m3.2xlarge machines was used to evaluate the distributed setting. XGBoost was compared with Spark MLLib and H20.<br />
<br />
* XGBoost can switch to out-of-core setting when the memory runs out, while the baseline systems need to store the data in RAM<br />
* XGBoost runs faster than the baseline systems<br />
* The baseline systems are only able to handle a subset of the data with the given resources while XGBoost was able to scale smoothly to all 1.7B rows<br />
* XGBoost’s performance scales linearly with more machines<br />
* XGBoost is able to handle all 1.7B data with only 4 machines<br />
<br />
== Conclusion ==<br />
<br />
== References ==<br />
[1] R. Bekkerman. The present and the future of the kdd cup competition: an outsider’s perspective. <br />
<br />
[2] R. Bekkerman, M. Bilenko, and J. Langford. Scaling Up Machine Learning: Parallel and Distributed Approaches. Cambridge University Press, New York, NY, USA, 2011. <br />
<br />
[3] J. Bennett and S. Lanning. The netflix prize. In Proceedings of the KDD Cup Workshop 2007, pages 3–6, New York, Aug. 2007.<br />
<br />
[4] L. Breiman. Random forests. Maching Learning, 45(1):5–32, Oct. 2001.<br />
<br />
[5] C. Burges. From ranknet to lambdarank to lambdamart: An overview. Learning, 11:23–581, 2010.<br />
<br />
[6] O. Chapelle and Y. Chang. Yahoo! Learning to Rank Challenge Overview. Journal of Machine Learning Research - W & CP, 14:1–24, 2011.<br />
<br />
[7] T. Chen, H. Li, Q. Yang, and Y. Yu. General functional matrix factorization using gradient boosting. In Proceeding of 30th International Conference on Machine Learning (ICML’13), volume 1, pages 436–444, 2013.<br />
<br />
[8] T. Chen, S. Singh, B. Taskar, and C. Guestrin. Efficient second-order gradient boosting for conditional random fields. In Proceeding of 18th Artificial Intelligence and Statistics Conference (AISTATS’15), volume 1, 2015.<br />
<br />
[9] R.-E. Fan, K.-W. Chang, C.-J. Hsieh, X.-R. Wang, and C.-J. Lin. LIBLINEAR: A library for large linear classification. Journal of Machine Learning Research, 9:1871–1874, 2008.<br />
<br />
[10] J. Friedman. Greedy function approximation: a gradient boosting machine. Annals of Statistics, 29(5):1189–1232, 2001.<br />
<br />
[11] J. Friedman. Stochastic gradient boosting. Computational Statistics & Data Analysis, 38(4):367–378, 2002.<br />
<br />
[12] J. Friedman, T. Hastie, and R. Tibshirani. Additive logistic regression: a statistical view of boosting. Annals of Statistics, 28(2):337–407, 2000.<br />
<br />
[13] J. H. Friedman and B. E. Popescu. Importance sampled learning ensembles, 2003.<br />
<br />
[14] M. Greenwald and S. Khanna. Space-efficient online computation of quantile summaries. In Proceedings of the 2001 ACM SIGMOD International Conference on Management of Data, pages 58–66, 2001.<br />
<br />
[15] X. He, J. Pan, O. Jin, T. Xu, B. Liu, T. Xu, Y. Shi, A. Atallah, R. Herbrich, S. Bowers, and J. Q. n. Candela. Practical lessons from predicting clicks on ads at facebook. In Proceedings of the Eighth International Workshop on Data Mining for Online Advertising, ADKDD’14, 2014.<br />
<br />
[16] P. Li. Robust Logitboost and adaptive base class (ABC) Logitboost. In Proceedings of the Twenty-Sixth Conference Annual Conference on Uncertainty in Artificial Intelligence (UAI’10), pages 302–311, 2010.<br />
<br />
[17] P. Li, Q. Wu, and C. J. Burges. Mcrank: Learning to rank using multiple classification and gradient boosting. In Advances in Neural Information Processing Systems 20, pages 897–904. 2008.<br />
<br />
[18] X. Meng, J. Bradley, B. Yavuz, E. Sparks, S. Venkataraman, D. Liu, J. Freeman, D. Tsai, M. Amde, S. Owen, D. Xin, R. Xin, M. J. Franklin, R. Zadeh, M. Zaharia, and A. Talwalkar. MLlib: Machine learning in apache spark. Journal of Machine Learning Research, 17(34):1–7, 2016.<br />
<br />
[19] B. Panda, J. S. Herbach, S. Basu, and R. J. Bayardo. Planet: Massively parallel learning of tree ensembles with mapreduce. Proceeding of VLDB Endowment, 2(2):1426–1437, Aug. 2009.<br />
<br />
[20] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.<br />
<br />
[21] G. Ridgeway. Generalized Boosted Models: A guide to the gbm package.<br />
<br />
[22] S. Tyree, K. Weinberger, K. Agrawal, and J. Paykin. Parallel boosted regression trees for web search ranking. In Proceedings of the 20th international conference on World wide web, pages 387–396. ACM, 2011.<br />
<br />
[23] J. Ye, J.-H. Chow, J. Chen, and Z. Zheng. Stochastic gradient boosted distributed decision trees. In Proceedings of the 18th ACM Conference on Information and Knowledge Management, CIKM ’09.<br />
<br />
[24] Q. Zhang and W. Wang. A fast algorithm for approximate quantiles in high speed data streams. In Proceedings of the 19th International Conference on Scientific and Statistical Database Management, 2007.<br />
<br />
[25] T. Zhang and R. Johnson. Learning nonlinear functions using regularized greedy forest. IEEE Transactions on Pattern Analysis and Machine Intelligence, 36(5), 2014.</div>Cwlokehttp://wiki.math.uwaterloo.ca/statwiki/index.php?title=XGBoost&diff=51116XGBoost2021-11-29T05:08:16Z<p>Cwloke: /* Sparsity-aware Split Finding */</p>
<hr />
<div>== Presented by == <br />
* Chun Waan Loke<br />
* Peter Chong<br />
* Clarice Osmond<br />
* Zhilong Li<br />
<br />
== Introduction ==<br />
<br />
== Tree Boosting In A Nutshell ==<br />
The author reviews gradient tree boosting in this section.<br />
=== Regularized Learning Objective ===<br />
The author first gives the prediction equation (1) and the regularized objective (2).<br><br />
<br><br />
(1) The additive prediction model is given as<br><br />
<math>\hat{y_i}=\sum_{k=1}^{K}f_k(x_i), f_k \in \mathcal{F} </math> <br><br />
where each <math>f_k</math> corresponds to an independent tree structure with its weights, and <math>\mathcal{F}</math> is the "space of regression trees"<br><br />
<br><br />
(2) The regularized objective to be minimized is given as<br><br />
<math>\mathcal{L}=\sum_{i}l(\hat{y_i},y_i)+\sum_k \Omega(f_k)</math> where <math>\Omega(f)=\gamma T+\frac{1}{2}\lambda ||\omega||^2</math> <br><br />
The first term <math>l</math> is a differentiable convex loss function that calculates the measures between <math>\hat{y}</math> and <math>y</math>.<br><br />
The second term <math>\Omega</math> penalizes on the complexity of model (the <math>f_k</math>'s). For a given tree (<math>f_k</math>), <math>T</math> is the number of leaves, and <math>\omega</math> is the leaf weights.<br><br />
The L1 regularization term <math>\gamma T</math> encourages the tree to be small, and the L2 regularization term <math>\frac{1}{2}\lambda ||\omega||^2</math> encourages the tree to have small weights.<br><br />
<br />
=== Gradient Tree Boosting ===<br />
Let <math>\hat{y_i}^{(t)}</math> be the prediction of <math>y_i</math> at the t-th iteration.<br><br />
Since the prediction equation is simply additive, <math>{\hat y_i}^{(t)}=\hat{y_{i}}^{(t-1)}+f_t(x_i)</math><br><br />
Using this equation and 2nd order Taylor approximation on the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> gives <br><br />
\begin{align}<br />
\mathcal{L}^{(t)}&=\sum_{i}^{n}l(y_i,\hat{y_i}^{(t-1)}+f_t(x_i))+\Omega(f_t)\\<br />
&\simeq \sum_{i}^{n}[l(y_i,\hat{y_i}^{(t-1)})+g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
\end{align}<br />
where <math>g_i</math> and <math>h_i</math> are the first and second derivative of the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> with repspect to the term <math>\hat{y}^{(t-1)}</math><br><br />
We can simplify this objective by removing the constant term <math>l(y_i,\hat{y_i}^{(t-1)})</math>.<br><br />
Define <math>I_j=\{i|q(x_i)=j\}</math>, where <math>q</math> is the tree structure. Since every <math>x_i</math> is mapped by <math>q</math> to some leaf <math>j</math>, going through every <math>x_i</math> is equivalent to going through each leaf j of the structure.<br />
\begin{align}<br />
\tilde{\mathcal{L}}^{(t)}&= \sum_{i}^{n}[g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
&= \sum_{j=1}^{T}[(\sum_{i \in I_j}g_i)\omega_j+\frac{1}{2}(\sum_{i \in I_j}h_i+\lambda)\omega_j^2]+\gamma T<br />
\end{align}<br />
Then for a fixed structure <math>q</math>, the optimal weight of leaf <math>j</math> and the optimal objective value are given as<br><br />
\begin{align}<br />
\omega_j^{*} &= -\frac{\sum_{i \in I_j}g_i}{\sum_{i \in I_j}h_i+\lambda}\\<br />
\tilde{\mathcal{L}}^{(t)}(q) &=-\frac{1}{2}\sum_{j=1}^{T}\frac{(\sum_{i \in I_j}g_i)^2}{\sum_{i \in I_j}h_i+\lambda}+\gamma T<br />
\end{align} <br />
[[File:Structure Score Calculation.png|frame|center|alt=Alt text|Structure Score Calculation]]<br />
Instead of enumerating through all possible tree structures q, a greedy algorithm of iteratively adding branches is used.<br><br />
Let <math>I_L</math> and <math>I_R</math> be the instance sets of left and right nodes after split and let <math>I=I_L\cup I_R</math>.<br><br />
The loss reduction after split is given by<br><br />
\begin{align}<br />
\tilde{\mathcal{L}}_{\text{split}} &=\frac{1}{2}[\frac{(\sum_{i \in I_L}g_i)^2}{\sum_{i \in I_L}h_i+\lambda}+\frac{(\sum_{i \in I_R}g_i)^2}{\sum_{i \in I_R}h_i+\lambda}-\frac{(\sum_{i \in I}g_i)^2}{\sum_{i \in I}h_i+\lambda}]+\gamma<br />
\end{align}<br />
=== Shrinkage and Column Subsampling ===<br />
The author also mentioned two other methods in order to avoid over-fitting.<br><br />
(1) Shrinkage. Similar to the learning rate in stochastic optimization, a new weight is added to each tree boosting to reduce the influence of a single tree and leave space for future trees.<br><br />
(2) Column (feature) subsampling. In the paper, the author only mentioned that this technique speeds up parallel algorithm used in later sections.<br />
<br />
== Split Finding Algorithms ==<br />
<br />
It is very important to find the best split for tree learning to perform well. Here are a few split finding algorithms mentioned in the paper:<br />
<br />
=== Basic Exact Greedy Algorithm ===<br />
<br />
The basic exact greedy algorithm is a split finding algorithm that is computationally expensive because it enumerates over all the possible splits for continuous features. It is impossible to be done efficiently when the memory is not enough to hold the data needed. A way to carry out this algorithm efficiently is to sort the data according to feature values and visit the data in order to accumulate the gradient statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_1.png|center|alt=Alt text|Basic Exact Greedy Algorithm]]<br />
<br />
=== Approximate Algorithm ===<br />
<br />
The paper introduced a more efficient algorithm compared to Basic Exact Greedy Algorithm which is the Approximate Algorithm. The Approximate Algorithm first proposes candidate splitting points according to percentiles of feature distribution. It then maps the continuous features into buckets split by candidate points, aggregates the statistics and finds the best solution among proposals based on the aggregated statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_2.png|center|alt=Alt text|Approximate Algorithm]]<br />
<br />
There are also two variants to this algorithm, the global variant proposes all the candidate splits during the initial phase of tree construction and uses the same proposals for split finding at all levels. Whereas, the local variant re-proposes after each split. The global variant usually requires less proposal steps but uses more candidate points than local variant because candidates are not refined after each split. For deeper trees, usage of local variant may be more appropriate as compared to global variant. The figure below shows the a comparison in accuracy between Basic Exact Greedy and Approximate split finding algorithms with different variant over the number of iterations. We can see that the quantile strategy is able to achieve similar accuracy as the Basic Exact Greedy algorithm given a reasonable approximation level.<br />
<br />
[[File:iterations.png|center|alt=Alt text|Comparison of accuracy between different algorithms]]<br />
<br />
=== Weighted Quantile Sketch ===<br />
<br />
Proposing candidate split points is the most important step in the Approximate Algorithm, it is done by using the percentile of a feature to make candidates distribute evenly on a dataset.<br />
<br />
Formally, we have a dataset<br />
<br />
<math>D_k={(x_{1k},h_1),(x_{2k},h_2),...,(x_{nk},h_n)}</math><br />
<br />
where <math> x_i </math>'s are the feature values of each data point and <math> h_i </math>'s represents the weight of the corresponding feature <math> x_i </math>. <br />
<br />
Then, we can use the following rank function to compute <math>r_k(z)</math>, the proportion of instances whose feature value among <math> (x_i,...,x_k) </math> is smaller than data point <math> z </math>.<br />
<br />
<math>r_k(z) = \frac{1}{\sum_{(x,h) \in D_k} h} \displaystyle\sum_{(x,h) \in D_k, x<z} h,</math><br />
<br />
The objective here is to find candidate split points <math>{s_{k1}, s_{k2}, …, s_{kl}}</math>, such that:<br />
<br />
<math>|r_k(s_{k,j}) – r_k(s_{k,j+1})| < \epsilon, s_{k1} = \displaystyle\min_i x_{ik}, s_{kl} = \displaystyle\max_{i} x_{ik}, \forall i</math><br />
<br />
Where <math>\epsilon</math> is an approximation factor. Usually, it should approximately have <math>\frac{1}{\epsilon}</math> splitting points.<br />
<br />
=== Sparsity-aware Split Finding ===<br />
<br />
Typically in real world situation, it is quite common that our dataset is sparse. Some of the possible causes are:<br />
<br />
# Missing values in the data<br />
# Huge amount of zero entries present in the data<br />
# Artifacts of feature engineering (e.g. One-hot encoding)<br />
<br />
In order to solve the sparsity present in the dataset, we suggest to add a default direction in each tree node will classified into when there is a missing value in the matrix of the dataset. This is demonstrated in the figure below:<br />
<br />
[[File:figure_4.png|center|alt=Alt text|Default Direction for sparsity]]<br />
<br />
== System Design ==<br />
<br />
=== Column Block for Parallel Learning ===<br />
The most time consuming part of tree learning is to get the data into sorted order. To overcome this problem, XGBoost stores the data in blocks where each block performs the sorting operation in parallel. The results are then merged together.<br />
<br />
# For the exact greedy algorithm, XGBoost stores the entire dataset in a single block<br />
#:* Original spase aware algorithm costs: <math>O(Kd∥x∥_0 log(n))</math><br />
#:* Tree boosting on block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(n))</math><br />
#:* Hence, block structure helps to save an additional <math>log(n)</math> factor<br />
# For approximate algorithms, XGBoost stores the dataset in multiple blocks<br />
#:* Original algorithm with binary search costs: <math>O(Kd∥x∥_0 log(q))</math><br />
#:* With block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(B))</math><br />
#:* Hence, block structure helps to save an additional <math>log(q)</math> factor <br />
<br />
K = total number of trees<br /><br />
d = maximum depth of the tree<br /><br />
<math>∥x∥_0</math> = number of non-missing entries in the training data<br /><br />
n = number of rows in the dataset<br /><br />
q = number of proposal candidates in the dataset, usually between 32 to 100<br /><br />
B = maximum number of rows in each block<br />
<br />
[[File: columnblock.png|800px|thumb|center]]<br />
<br />
=== Cache-aware Access ===<br />
The proposed block structure optimizes the computation complexity but requires indirect fetches of gradient statistics by row index. XGBoost optimizes the process by using the following methods.<br />
<br />
# For the exact greedy algorithm, XGBoost uses a cache-aware prefetching algorithm<br />
#:* It stores Gradient and Hessians in the cache to make calculations fast<br />
#:* It runs twice as fast as the naive method when the dataset is large<br />
# For approximate algorithms, XGBoost chooses a specific block size<br />
#:* Choosing a small block size results in inefficient parallelization<br />
#:* Choosing a large block size results in cache misses<br />
#:* Various choices of block size are compared and the results are shown in Figure 9<br />
#:* XGBoost chose <math>2^{16}</math> as the block size<br />
<br />
[[File: blocksize.png|400px|thumb|center]]<br />
<br />
=== Blocks for Out-of-core Computation ===<br />
When the dataset is too large for the cache and main memory, XGBoost utilizes disk spaces as well. Since reading and writing data to the disks are slow, XGBoost optimizes the process by using the following two methods.<br />
<br />
# Block Compression<br />
#:* Blocks are compressed by columns<br />
#:* Although decompressing takes time, it is still faster than reading from the disks<br />
# Block Sharding<br />
#:* If multiple disks are available, data is split into those disks<br />
#:* When the CPU needs data, all the disks can be read at the same time<br />
<br />
== End To End Evaluations ==<br />
=== System Implementation ===<br />
XGBoost is a portable and reusable open-source package. It supports:<br />
* various weighted classification<br />
* various objective functions (rank & user defined)<br />
* popular languages (python, R, Julia)<br />
* data science pipelines (scikit-learn)<br />
* big data stacks (Flink, Spark)<br />
* cloud platform (Tianchi8)<br />
<br />
=== Dataset and Setup ===<br />
<br />
A summary of the 4 datasets used in the experiments is in table 2.<br />
<br />
[[File: table2data.png|500px|thumb|center]]<br />
<br />
The first and last datasets were used specifically to evaluate the impact of sparsity-aware algorithm and the scaling property of the system in the out-of-core and the distributed settings respectively. In all of the experiments, common settings such as maximum depth equal to 8, shrinkage equal to 0.1 and no column subsampling are applied.<br />
<br />
=== Classification ===<br />
A subset (n = 1M) of Higgs Boson dataset was used for classification. The results are shown in Table 3.<br />
<br />
[[File: classification.png|500px|thumb|center]]<br />
<br />
* R’s GBM creates a tree fast by using greedy approach that only expands one branch of a tree but with the cost of lower accuracy<br />
* XGBoost and scikit-learn have better performance than R’s GBM<br />
* XGBoost runs more than 10x faster than scikit-learn in learning a full tree<br />
* Column subsamples give slightly worse performance possibly due to a few important features in this dataset.<br />
<br />
=== Learning to Rank ===<br />
The results in comparing XGBoost with pGBRT are shown in Table 4.<br />
<br />
[[File: rank.png|500px|thumb|center]]<br />
<br />
* XGBoost runs exact greedy algorithm while pGBRT only supports an approximate algorithm<br />
* XGBoost runs faster<br />
* Subsampling column reduces running time and gives higher performance possibly due to preventing overfitting<br />
<br />
=== Out-of-core Experiment ===<br />
An extremely large Criteo dataset was used to evaluate the out-of-core setting. The results are shown in the figure below.<br />
<br />
[[File: outofcore.png|350px|thumb|center]]<br />
<br />
* Compression speed up the computation by a factor of 3<br />
* Sharding into 2 disks further gives 2x speed<br />
<br />
=== Distributed Experiment ===<br />
YARN cluster on EC2 with m3.2xlarge machines was used to evaluate the distributed setting. XGBoost was compared with Spark MLLib and H20.<br />
<br />
* XGBoost can switch to out-of-core setting when the memory runs out, while the baseline systems need to store the data in RAM<br />
* XGBoost runs faster than the baseline systems<br />
* The baseline systems are only able to handle a subset of the data with the given resources while XGBoost was able to scale smoothly to all 1.7B rows<br />
* XGBoost’s performance scales linearly with more machines<br />
* XGBoost is able to handle all 1.7B data with only 4 machines<br />
<br />
== Conclusion ==<br />
<br />
== References ==<br />
[1] R. Bekkerman. The present and the future of the kdd cup competition: an outsider’s perspective. <br />
<br />
[2] R. Bekkerman, M. Bilenko, and J. Langford. Scaling Up Machine Learning: Parallel and Distributed Approaches. Cambridge University Press, New York, NY, USA, 2011. <br />
<br />
[3] J. Bennett and S. Lanning. The netflix prize. In Proceedings of the KDD Cup Workshop 2007, pages 3–6, New York, Aug. 2007.<br />
<br />
[4] L. Breiman. Random forests. Maching Learning, 45(1):5–32, Oct. 2001.<br />
<br />
[5] C. Burges. From ranknet to lambdarank to lambdamart: An overview. Learning, 11:23–581, 2010.<br />
<br />
[6] O. Chapelle and Y. Chang. Yahoo! Learning to Rank Challenge Overview. Journal of Machine Learning Research - W & CP, 14:1–24, 2011.<br />
<br />
[7] T. Chen, H. Li, Q. Yang, and Y. Yu. General functional matrix factorization using gradient boosting. In Proceeding of 30th International Conference on Machine Learning (ICML’13), volume 1, pages 436–444, 2013.<br />
<br />
[8] T. Chen, S. Singh, B. Taskar, and C. Guestrin. Efficient second-order gradient boosting for conditional random fields. In Proceeding of 18th Artificial Intelligence and Statistics Conference (AISTATS’15), volume 1, 2015.<br />
<br />
[9] R.-E. Fan, K.-W. Chang, C.-J. Hsieh, X.-R. Wang, and C.-J. Lin. LIBLINEAR: A library for large linear classification. Journal of Machine Learning Research, 9:1871–1874, 2008.<br />
<br />
[10] J. Friedman. Greedy function approximation: a gradient boosting machine. Annals of Statistics, 29(5):1189–1232, 2001.<br />
<br />
[11] J. Friedman. Stochastic gradient boosting. Computational Statistics & Data Analysis, 38(4):367–378, 2002.<br />
<br />
[12] J. Friedman, T. Hastie, and R. Tibshirani. Additive logistic regression: a statistical view of boosting. Annals of Statistics, 28(2):337–407, 2000.<br />
<br />
[13] J. H. Friedman and B. E. Popescu. Importance sampled learning ensembles, 2003.<br />
<br />
[14] M. Greenwald and S. Khanna. Space-efficient online computation of quantile summaries. In Proceedings of the 2001 ACM SIGMOD International Conference on Management of Data, pages 58–66, 2001.<br />
<br />
[15] X. He, J. Pan, O. Jin, T. Xu, B. Liu, T. Xu, Y. Shi, A. Atallah, R. Herbrich, S. Bowers, and J. Q. n. Candela. Practical lessons from predicting clicks on ads at facebook. In Proceedings of the Eighth International Workshop on Data Mining for Online Advertising, ADKDD’14, 2014.<br />
<br />
[16] P. Li. Robust Logitboost and adaptive base class (ABC) Logitboost. In Proceedings of the Twenty-Sixth Conference Annual Conference on Uncertainty in Artificial Intelligence (UAI’10), pages 302–311, 2010.<br />
<br />
[17] P. Li, Q. Wu, and C. J. Burges. Mcrank: Learning to rank using multiple classification and gradient boosting. In Advances in Neural Information Processing Systems 20, pages 897–904. 2008.<br />
<br />
[18] X. Meng, J. Bradley, B. Yavuz, E. Sparks, S. Venkataraman, D. Liu, J. Freeman, D. Tsai, M. Amde, S. Owen, D. Xin, R. Xin, M. J. Franklin, R. Zadeh, M. Zaharia, and A. Talwalkar. MLlib: Machine learning in apache spark. Journal of Machine Learning Research, 17(34):1–7, 2016.<br />
<br />
[19] B. Panda, J. S. Herbach, S. Basu, and R. J. Bayardo. Planet: Massively parallel learning of tree ensembles with mapreduce. Proceeding of VLDB Endowment, 2(2):1426–1437, Aug. 2009.<br />
<br />
[20] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.<br />
<br />
[21] G. Ridgeway. Generalized Boosted Models: A guide to the gbm package.<br />
<br />
[22] S. Tyree, K. Weinberger, K. Agrawal, and J. Paykin. Parallel boosted regression trees for web search ranking. In Proceedings of the 20th international conference on World wide web, pages 387–396. ACM, 2011.<br />
<br />
[23] J. Ye, J.-H. Chow, J. Chen, and Z. Zheng. Stochastic gradient boosted distributed decision trees. In Proceedings of the 18th ACM Conference on Information and Knowledge Management, CIKM ’09.<br />
<br />
[24] Q. Zhang and W. Wang. A fast algorithm for approximate quantiles in high speed data streams. In Proceedings of the 19th International Conference on Scientific and Statistical Database Management, 2007.<br />
<br />
[25] T. Zhang and R. Johnson. Learning nonlinear functions using regularized greedy forest. IEEE Transactions on Pattern Analysis and Machine Intelligence, 36(5), 2014.</div>Cwlokehttp://wiki.math.uwaterloo.ca/statwiki/index.php?title=XGBoost&diff=51115XGBoost2021-11-29T05:07:31Z<p>Cwloke: /* Sparsity-aware Split Finding */</p>
<hr />
<div>== Presented by == <br />
* Chun Waan Loke<br />
* Peter Chong<br />
* Clarice Osmond<br />
* Zhilong Li<br />
<br />
== Introduction ==<br />
<br />
== Tree Boosting In A Nutshell ==<br />
The author reviews gradient tree boosting in this section.<br />
=== Regularized Learning Objective ===<br />
The author first gives the prediction equation (1) and the regularized objective (2).<br><br />
<br><br />
(1) The additive prediction model is given as<br><br />
<math>\hat{y_i}=\sum_{k=1}^{K}f_k(x_i), f_k \in \mathcal{F} </math> <br><br />
where each <math>f_k</math> corresponds to an independent tree structure with its weights, and <math>\mathcal{F}</math> is the "space of regression trees"<br><br />
<br><br />
(2) The regularized objective to be minimized is given as<br><br />
<math>\mathcal{L}=\sum_{i}l(\hat{y_i},y_i)+\sum_k \Omega(f_k)</math> where <math>\Omega(f)=\gamma T+\frac{1}{2}\lambda ||\omega||^2</math> <br><br />
The first term <math>l</math> is a differentiable convex loss function that calculates the measures between <math>\hat{y}</math> and <math>y</math>.<br><br />
The second term <math>\Omega</math> penalizes on the complexity of model (the <math>f_k</math>'s). For a given tree (<math>f_k</math>), <math>T</math> is the number of leaves, and <math>\omega</math> is the leaf weights.<br><br />
The L1 regularization term <math>\gamma T</math> encourages the tree to be small, and the L2 regularization term <math>\frac{1}{2}\lambda ||\omega||^2</math> encourages the tree to have small weights.<br><br />
<br />
=== Gradient Tree Boosting ===<br />
Let <math>\hat{y_i}^{(t)}</math> be the prediction of <math>y_i</math> at the t-th iteration.<br><br />
Since the prediction equation is simply additive, <math>{\hat y_i}^{(t)}=\hat{y_{i}}^{(t-1)}+f_t(x_i)</math><br><br />
Using this equation and 2nd order Taylor approximation on the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> gives <br><br />
\begin{align}<br />
\mathcal{L}^{(t)}&=\sum_{i}^{n}l(y_i,\hat{y_i}^{(t-1)}+f_t(x_i))+\Omega(f_t)\\<br />
&\simeq \sum_{i}^{n}[l(y_i,\hat{y_i}^{(t-1)})+g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
\end{align}<br />
where <math>g_i</math> and <math>h_i</math> are the first and second derivative of the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> with repspect to the term <math>\hat{y}^{(t-1)}</math><br><br />
We can simplify this objective by removing the constant term <math>l(y_i,\hat{y_i}^{(t-1)})</math>.<br><br />
Define <math>I_j=\{i|q(x_i)=j\}</math>, where <math>q</math> is the tree structure. Since every <math>x_i</math> is mapped by <math>q</math> to some leaf <math>j</math>, going through every <math>x_i</math> is equivalent to going through each leaf j of the structure.<br />
\begin{align}<br />
\tilde{\mathcal{L}}^{(t)}&= \sum_{i}^{n}[g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
&= \sum_{j=1}^{T}[(\sum_{i \in I_j}g_i)\omega_j+\frac{1}{2}(\sum_{i \in I_j}h_i+\lambda)\omega_j^2]+\gamma T<br />
\end{align}<br />
Then for a fixed structure <math>q</math>, the optimal weight of leaf <math>j</math> and the optimal objective value are given as<br><br />
\begin{align}<br />
\omega_j^{*} &= -\frac{\sum_{i \in I_j}g_i}{\sum_{i \in I_j}h_i+\lambda}\\<br />
\tilde{\mathcal{L}}^{(t)}(q) &=-\frac{1}{2}\sum_{j=1}^{T}\frac{(\sum_{i \in I_j}g_i)^2}{\sum_{i \in I_j}h_i+\lambda}+\gamma T<br />
\end{align} <br />
[[File:Structure Score Calculation.png|frame|center|alt=Alt text|Structure Score Calculation]]<br />
Instead of enumerating through all possible tree structures q, a greedy algorithm of iteratively adding branches is used.<br><br />
Let <math>I_L</math> and <math>I_R</math> be the instance sets of left and right nodes after split and let <math>I=I_L\cup I_R</math>.<br><br />
The loss reduction after split is given by<br><br />
\begin{align}<br />
\tilde{\mathcal{L}}_{\text{split}} &=\frac{1}{2}[\frac{(\sum_{i \in I_L}g_i)^2}{\sum_{i \in I_L}h_i+\lambda}+\frac{(\sum_{i \in I_R}g_i)^2}{\sum_{i \in I_R}h_i+\lambda}-\frac{(\sum_{i \in I}g_i)^2}{\sum_{i \in I}h_i+\lambda}]+\gamma<br />
\end{align}<br />
=== Shrinkage and Column Subsampling ===<br />
The author also mentioned two other methods in order to avoid over-fitting.<br><br />
(1) Shrinkage. Similar to the learning rate in stochastic optimization, a new weight is added to each tree boosting to reduce the influence of a single tree and leave space for future trees.<br><br />
(2) Column (feature) subsampling. In the paper, the author only mentioned that this technique speeds up parallel algorithm used in later sections.<br />
<br />
== Split Finding Algorithms ==<br />
<br />
It is very important to find the best split for tree learning to perform well. Here are a few split finding algorithms mentioned in the paper:<br />
<br />
=== Basic Exact Greedy Algorithm ===<br />
<br />
The basic exact greedy algorithm is a split finding algorithm that is computationally expensive because it enumerates over all the possible splits for continuous features. It is impossible to be done efficiently when the memory is not enough to hold the data needed. A way to carry out this algorithm efficiently is to sort the data according to feature values and visit the data in order to accumulate the gradient statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_1.png|center|alt=Alt text|Basic Exact Greedy Algorithm]]<br />
<br />
=== Approximate Algorithm ===<br />
<br />
The paper introduced a more efficient algorithm compared to Basic Exact Greedy Algorithm which is the Approximate Algorithm. The Approximate Algorithm first proposes candidate splitting points according to percentiles of feature distribution. It then maps the continuous features into buckets split by candidate points, aggregates the statistics and finds the best solution among proposals based on the aggregated statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_2.png|center|alt=Alt text|Approximate Algorithm]]<br />
<br />
There are also two variants to this algorithm, the global variant proposes all the candidate splits during the initial phase of tree construction and uses the same proposals for split finding at all levels. Whereas, the local variant re-proposes after each split. The global variant usually requires less proposal steps but uses more candidate points than local variant because candidates are not refined after each split. For deeper trees, usage of local variant may be more appropriate as compared to global variant. The figure below shows the a comparison in accuracy between Basic Exact Greedy and Approximate split finding algorithms with different variant over the number of iterations. We can see that the quantile strategy is able to achieve similar accuracy as the Basic Exact Greedy algorithm given a reasonable approximation level.<br />
<br />
[[File:iterations.png|center|alt=Alt text|Comparison of accuracy between different algorithms]]<br />
<br />
=== Weighted Quantile Sketch ===<br />
<br />
Proposing candidate split points is the most important step in the Approximate Algorithm, it is done by using the percentile of a feature to make candidates distribute evenly on a dataset.<br />
<br />
Formally, we have a dataset<br />
<br />
<math>D_k={(x_{1k},h_1),(x_{2k},h_2),...,(x_{nk},h_n)}</math><br />
<br />
where <math> x_i </math>'s are the feature values of each data point and <math> h_i </math>'s represents the weight of the corresponding feature <math> x_i </math>. <br />
<br />
Then, we can use the following rank function to compute <math>r_k(z)</math>, the proportion of instances whose feature value among <math> (x_i,...,x_k) </math> is smaller than data point <math> z </math>.<br />
<br />
<math>r_k(z) = \frac{1}{\sum_{(x,h) \in D_k} h} \displaystyle\sum_{(x,h) \in D_k, x<z} h,</math><br />
<br />
The objective here is to find candidate split points <math>{s_{k1}, s_{k2}, …, s_{kl}}</math>, such that:<br />
<br />
<math>|r_k(s_{k,j}) – r_k(s_{k,j+1})| < \epsilon, s_{k1} = \displaystyle\min_i x_{ik}, s_{kl} = \displaystyle\max_{i} x_{ik}, \forall i</math><br />
<br />
Where <math>\epsilon</math> is an approximation factor. Usually, it should approximately have <math>\frac{1}{\epsilon}</math> splitting points.<br />
<br />
=== Sparsity-aware Split Finding ===<br />
<br />
Typically in real world situation, it is quite common that our dataset is sparse. Some of the possible causes are:<br />
<br />
# Missing values in the data<br />
# Huge amount of zero entries present in the data<br />
# Artifacts of feature engineering (e.g. One-hot encoding)<br />
<br />
In order to solve the sparsity present in the dataset, we suggest to add a default direction in each tree node will classified into when there is a missing value in the matrix of the dataset. This is demonstrated in the figure below:<br />
<br />
== System Design ==<br />
<br />
=== Column Block for Parallel Learning ===<br />
The most time consuming part of tree learning is to get the data into sorted order. To overcome this problem, XGBoost stores the data in blocks where each block performs the sorting operation in parallel. The results are then merged together.<br />
<br />
# For the exact greedy algorithm, XGBoost stores the entire dataset in a single block<br />
#:* Original spase aware algorithm costs: <math>O(Kd∥x∥_0 log(n))</math><br />
#:* Tree boosting on block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(n))</math><br />
#:* Hence, block structure helps to save an additional <math>log(n)</math> factor<br />
# For approximate algorithms, XGBoost stores the dataset in multiple blocks<br />
#:* Original algorithm with binary search costs: <math>O(Kd∥x∥_0 log(q))</math><br />
#:* With block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(B))</math><br />
#:* Hence, block structure helps to save an additional <math>log(q)</math> factor <br />
<br />
K = total number of trees<br /><br />
d = maximum depth of the tree<br /><br />
<math>∥x∥_0</math> = number of non-missing entries in the training data<br /><br />
n = number of rows in the dataset<br /><br />
q = number of proposal candidates in the dataset, usually between 32 to 100<br /><br />
B = maximum number of rows in each block<br />
<br />
[[File: columnblock.png|800px|thumb|center]]<br />
<br />
=== Cache-aware Access ===<br />
The proposed block structure optimizes the computation complexity but requires indirect fetches of gradient statistics by row index. XGBoost optimizes the process by using the following methods.<br />
<br />
# For the exact greedy algorithm, XGBoost uses a cache-aware prefetching algorithm<br />
#:* It stores Gradient and Hessians in the cache to make calculations fast<br />
#:* It runs twice as fast as the naive method when the dataset is large<br />
# For approximate algorithms, XGBoost chooses a specific block size<br />
#:* Choosing a small block size results in inefficient parallelization<br />
#:* Choosing a large block size results in cache misses<br />
#:* Various choices of block size are compared and the results are shown in Figure 9<br />
#:* XGBoost chose <math>2^{16}</math> as the block size<br />
<br />
[[File: blocksize.png|400px|thumb|center]]<br />
<br />
=== Blocks for Out-of-core Computation ===<br />
When the dataset is too large for the cache and main memory, XGBoost utilizes disk spaces as well. Since reading and writing data to the disks are slow, XGBoost optimizes the process by using the following two methods.<br />
<br />
# Block Compression<br />
#:* Blocks are compressed by columns<br />
#:* Although decompressing takes time, it is still faster than reading from the disks<br />
# Block Sharding<br />
#:* If multiple disks are available, data is split into those disks<br />
#:* When the CPU needs data, all the disks can be read at the same time<br />
<br />
== End To End Evaluations ==<br />
=== System Implementation ===<br />
XGBoost is a portable and reusable open-source package. It supports:<br />
* various weighted classification<br />
* various objective functions (rank & user defined)<br />
* popular languages (python, R, Julia)<br />
* data science pipelines (scikit-learn)<br />
* big data stacks (Flink, Spark)<br />
* cloud platform (Tianchi8)<br />
<br />
=== Dataset and Setup ===<br />
<br />
A summary of the 4 datasets used in the experiments is in table 2.<br />
<br />
[[File: table2data.png|500px|thumb|center]]<br />
<br />
The first and last datasets were used specifically to evaluate the impact of sparsity-aware algorithm and the scaling property of the system in the out-of-core and the distributed settings respectively. In all of the experiments, common settings such as maximum depth equal to 8, shrinkage equal to 0.1 and no column subsampling are applied.<br />
<br />
=== Classification ===<br />
A subset (n = 1M) of Higgs Boson dataset was used for classification. The results are shown in Table 3.<br />
<br />
[[File: classification.png|500px|thumb|center]]<br />
<br />
* R’s GBM creates a tree fast by using greedy approach that only expands one branch of a tree but with the cost of lower accuracy<br />
* XGBoost and scikit-learn have better performance than R’s GBM<br />
* XGBoost runs more than 10x faster than scikit-learn in learning a full tree<br />
* Column subsamples give slightly worse performance possibly due to a few important features in this dataset.<br />
<br />
=== Learning to Rank ===<br />
The results in comparing XGBoost with pGBRT are shown in Table 4.<br />
<br />
[[File: rank.png|500px|thumb|center]]<br />
<br />
* XGBoost runs exact greedy algorithm while pGBRT only supports an approximate algorithm<br />
* XGBoost runs faster<br />
* Subsampling column reduces running time and gives higher performance possibly due to preventing overfitting<br />
<br />
=== Out-of-core Experiment ===<br />
An extremely large Criteo dataset was used to evaluate the out-of-core setting. The results are shown in the figure below.<br />
<br />
[[File: outofcore.png|350px|thumb|center]]<br />
<br />
* Compression speed up the computation by a factor of 3<br />
* Sharding into 2 disks further gives 2x speed<br />
<br />
=== Distributed Experiment ===<br />
YARN cluster on EC2 with m3.2xlarge machines was used to evaluate the distributed setting. XGBoost was compared with Spark MLLib and H20.<br />
<br />
* XGBoost can switch to out-of-core setting when the memory runs out, while the baseline systems need to store the data in RAM<br />
* XGBoost runs faster than the baseline systems<br />
* The baseline systems are only able to handle a subset of the data with the given resources while XGBoost was able to scale smoothly to all 1.7B rows<br />
* XGBoost’s performance scales linearly with more machines<br />
* XGBoost is able to handle all 1.7B data with only 4 machines<br />
<br />
== Conclusion ==<br />
<br />
== References ==<br />
[1] R. Bekkerman. The present and the future of the kdd cup competition: an outsider’s perspective. <br />
<br />
[2] R. Bekkerman, M. Bilenko, and J. Langford. Scaling Up Machine Learning: Parallel and Distributed Approaches. Cambridge University Press, New York, NY, USA, 2011. <br />
<br />
[3] J. Bennett and S. Lanning. The netflix prize. In Proceedings of the KDD Cup Workshop 2007, pages 3–6, New York, Aug. 2007.<br />
<br />
[4] L. Breiman. Random forests. Maching Learning, 45(1):5–32, Oct. 2001.<br />
<br />
[5] C. Burges. From ranknet to lambdarank to lambdamart: An overview. Learning, 11:23–581, 2010.<br />
<br />
[6] O. Chapelle and Y. Chang. Yahoo! Learning to Rank Challenge Overview. Journal of Machine Learning Research - W & CP, 14:1–24, 2011.<br />
<br />
[7] T. Chen, H. Li, Q. Yang, and Y. Yu. General functional matrix factorization using gradient boosting. In Proceeding of 30th International Conference on Machine Learning (ICML’13), volume 1, pages 436–444, 2013.<br />
<br />
[8] T. Chen, S. Singh, B. Taskar, and C. Guestrin. Efficient second-order gradient boosting for conditional random fields. In Proceeding of 18th Artificial Intelligence and Statistics Conference (AISTATS’15), volume 1, 2015.<br />
<br />
[9] R.-E. Fan, K.-W. Chang, C.-J. Hsieh, X.-R. Wang, and C.-J. Lin. LIBLINEAR: A library for large linear classification. Journal of Machine Learning Research, 9:1871–1874, 2008.<br />
<br />
[10] J. Friedman. Greedy function approximation: a gradient boosting machine. Annals of Statistics, 29(5):1189–1232, 2001.<br />
<br />
[11] J. Friedman. Stochastic gradient boosting. Computational Statistics & Data Analysis, 38(4):367–378, 2002.<br />
<br />
[12] J. Friedman, T. Hastie, and R. Tibshirani. Additive logistic regression: a statistical view of boosting. Annals of Statistics, 28(2):337–407, 2000.<br />
<br />
[13] J. H. Friedman and B. E. Popescu. Importance sampled learning ensembles, 2003.<br />
<br />
[14] M. Greenwald and S. Khanna. Space-efficient online computation of quantile summaries. In Proceedings of the 2001 ACM SIGMOD International Conference on Management of Data, pages 58–66, 2001.<br />
<br />
[15] X. He, J. Pan, O. Jin, T. Xu, B. Liu, T. Xu, Y. Shi, A. Atallah, R. Herbrich, S. Bowers, and J. Q. n. Candela. Practical lessons from predicting clicks on ads at facebook. In Proceedings of the Eighth International Workshop on Data Mining for Online Advertising, ADKDD’14, 2014.<br />
<br />
[16] P. Li. Robust Logitboost and adaptive base class (ABC) Logitboost. In Proceedings of the Twenty-Sixth Conference Annual Conference on Uncertainty in Artificial Intelligence (UAI’10), pages 302–311, 2010.<br />
<br />
[17] P. Li, Q. Wu, and C. J. Burges. Mcrank: Learning to rank using multiple classification and gradient boosting. In Advances in Neural Information Processing Systems 20, pages 897–904. 2008.<br />
<br />
[18] X. Meng, J. Bradley, B. Yavuz, E. Sparks, S. Venkataraman, D. Liu, J. Freeman, D. Tsai, M. Amde, S. Owen, D. Xin, R. Xin, M. J. Franklin, R. Zadeh, M. Zaharia, and A. Talwalkar. MLlib: Machine learning in apache spark. Journal of Machine Learning Research, 17(34):1–7, 2016.<br />
<br />
[19] B. Panda, J. S. Herbach, S. Basu, and R. J. Bayardo. Planet: Massively parallel learning of tree ensembles with mapreduce. Proceeding of VLDB Endowment, 2(2):1426–1437, Aug. 2009.<br />
<br />
[20] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.<br />
<br />
[21] G. Ridgeway. Generalized Boosted Models: A guide to the gbm package.<br />
<br />
[22] S. Tyree, K. Weinberger, K. Agrawal, and J. Paykin. Parallel boosted regression trees for web search ranking. In Proceedings of the 20th international conference on World wide web, pages 387–396. ACM, 2011.<br />
<br />
[23] J. Ye, J.-H. Chow, J. Chen, and Z. Zheng. Stochastic gradient boosted distributed decision trees. In Proceedings of the 18th ACM Conference on Information and Knowledge Management, CIKM ’09.<br />
<br />
[24] Q. Zhang and W. Wang. A fast algorithm for approximate quantiles in high speed data streams. In Proceedings of the 19th International Conference on Scientific and Statistical Database Management, 2007.<br />
<br />
[25] T. Zhang and R. Johnson. Learning nonlinear functions using regularized greedy forest. IEEE Transactions on Pattern Analysis and Machine Intelligence, 36(5), 2014.</div>Cwlokehttp://wiki.math.uwaterloo.ca/statwiki/index.php?title=XGBoost&diff=51114XGBoost2021-11-29T05:03:34Z<p>Cwloke: /* Sparsity-aware Split Finding */</p>
<hr />
<div>== Presented by == <br />
* Chun Waan Loke<br />
* Peter Chong<br />
* Clarice Osmond<br />
* Zhilong Li<br />
<br />
== Introduction ==<br />
<br />
== Tree Boosting In A Nutshell ==<br />
The author reviews gradient tree boosting in this section.<br />
=== Regularized Learning Objective ===<br />
The author first gives the prediction equation (1) and the regularized objective (2).<br><br />
<br><br />
(1) The additive prediction model is given as<br><br />
<math>\hat{y_i}=\sum_{k=1}^{K}f_k(x_i), f_k \in \mathcal{F} </math> <br><br />
where each <math>f_k</math> corresponds to an independent tree structure with its weights, and <math>\mathcal{F}</math> is the "space of regression trees"<br><br />
<br><br />
(2) The regularized objective to be minimized is given as<br><br />
<math>\mathcal{L}=\sum_{i}l(\hat{y_i},y_i)+\sum_k \Omega(f_k)</math> where <math>\Omega(f)=\gamma T+\frac{1}{2}\lambda ||\omega||^2</math> <br><br />
The first term <math>l</math> is a differentiable convex loss function that calculates the measures between <math>\hat{y}</math> and <math>y</math>.<br><br />
The second term <math>\Omega</math> penalizes on the complexity of model (the <math>f_k</math>'s). For a given tree (<math>f_k</math>), <math>T</math> is the number of leaves, and <math>\omega</math> is the leaf weights.<br><br />
The L1 regularization term <math>\gamma T</math> encourages the tree to be small, and the L2 regularization term <math>\frac{1}{2}\lambda ||\omega||^2</math> encourages the tree to have small weights.<br><br />
<br />
=== Gradient Tree Boosting ===<br />
Let <math>\hat{y_i}^{(t)}</math> be the prediction of <math>y_i</math> at the t-th iteration.<br><br />
Since the prediction equation is simply additive, <math>{\hat y_i}^{(t)}=\hat{y_{i}}^{(t-1)}+f_t(x_i)</math><br><br />
Using this equation and 2nd order Taylor approximation on the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> gives <br><br />
\begin{align}<br />
\mathcal{L}^{(t)}&=\sum_{i}^{n}l(y_i,\hat{y_i}^{(t-1)}+f_t(x_i))+\Omega(f_t)\\<br />
&\simeq \sum_{i}^{n}[l(y_i,\hat{y_i}^{(t-1)})+g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
\end{align}<br />
where <math>g_i</math> and <math>h_i</math> are the first and second derivative of the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> with repspect to the term <math>\hat{y}^{(t-1)}</math><br><br />
We can simplify this objective by removing the constant term <math>l(y_i,\hat{y_i}^{(t-1)})</math>.<br><br />
Define <math>I_j=\{i|q(x_i)=j\}</math>, where <math>q</math> is the tree structure. Since every <math>x_i</math> is mapped by <math>q</math> to some leaf <math>j</math>, going through every <math>x_i</math> is equivalent to going through each leaf j of the structure.<br />
\begin{align}<br />
\tilde{\mathcal{L}}^{(t)}&= \sum_{i}^{n}[g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
&= \sum_{j=1}^{T}[(\sum_{i \in I_j}g_i)\omega_j+\frac{1}{2}(\sum_{i \in I_j}h_i+\lambda)\omega_j^2]+\gamma T<br />
\end{align}<br />
Then for a fixed structure <math>q</math>, the optimal weight of leaf <math>j</math> and the optimal objective value are given as<br><br />
\begin{align}<br />
\omega_j^{*} &= -\frac{\sum_{i \in I_j}g_i}{\sum_{i \in I_j}h_i+\lambda}\\<br />
\tilde{\mathcal{L}}^{(t)}(q) &=-\frac{1}{2}\sum_{j=1}^{T}\frac{(\sum_{i \in I_j}g_i)^2}{\sum_{i \in I_j}h_i+\lambda}+\gamma T<br />
\end{align} <br />
[[File:Structure Score Calculation.png|frame|center|alt=Alt text|Structure Score Calculation]]<br />
Instead of enumerating through all possible tree structures q, a greedy algorithm of iteratively adding branches is used.<br><br />
Let <math>I_L</math> and <math>I_R</math> be the instance sets of left and right nodes after split and let <math>I=I_L\cup I_R</math>.<br><br />
The loss reduction after split is given by<br><br />
\begin{align}<br />
\tilde{\mathcal{L}}_{\text{split}} &=\frac{1}{2}[\frac{(\sum_{i \in I_L}g_i)^2}{\sum_{i \in I_L}h_i+\lambda}+\frac{(\sum_{i \in I_R}g_i)^2}{\sum_{i \in I_R}h_i+\lambda}-\frac{(\sum_{i \in I}g_i)^2}{\sum_{i \in I}h_i+\lambda}]+\gamma<br />
\end{align}<br />
=== Shrinkage and Column Subsampling ===<br />
The author also mentioned two other methods in order to avoid over-fitting.<br><br />
(1) Shrinkage. Similar to the learning rate in stochastic optimization, a new weight is added to each tree boosting to reduce the influence of a single tree and leave space for future trees.<br><br />
(2) Column (feature) subsampling. In the paper, the author only mentioned that this technique speeds up parallel algorithm used in later sections.<br />
<br />
== Split Finding Algorithms ==<br />
<br />
It is very important to find the best split for tree learning to perform well. Here are a few split finding algorithms mentioned in the paper:<br />
<br />
=== Basic Exact Greedy Algorithm ===<br />
<br />
The basic exact greedy algorithm is a split finding algorithm that is computationally expensive because it enumerates over all the possible splits for continuous features. It is impossible to be done efficiently when the memory is not enough to hold the data needed. A way to carry out this algorithm efficiently is to sort the data according to feature values and visit the data in order to accumulate the gradient statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_1.png|center|alt=Alt text|Basic Exact Greedy Algorithm]]<br />
<br />
=== Approximate Algorithm ===<br />
<br />
The paper introduced a more efficient algorithm compared to Basic Exact Greedy Algorithm which is the Approximate Algorithm. The Approximate Algorithm first proposes candidate splitting points according to percentiles of feature distribution. It then maps the continuous features into buckets split by candidate points, aggregates the statistics and finds the best solution among proposals based on the aggregated statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_2.png|center|alt=Alt text|Approximate Algorithm]]<br />
<br />
There are also two variants to this algorithm, the global variant proposes all the candidate splits during the initial phase of tree construction and uses the same proposals for split finding at all levels. Whereas, the local variant re-proposes after each split. The global variant usually requires less proposal steps but uses more candidate points than local variant because candidates are not refined after each split. For deeper trees, usage of local variant may be more appropriate as compared to global variant. The figure below shows the a comparison in accuracy between Basic Exact Greedy and Approximate split finding algorithms with different variant over the number of iterations. We can see that the quantile strategy is able to achieve similar accuracy as the Basic Exact Greedy algorithm given a reasonable approximation level.<br />
<br />
[[File:iterations.png|center|alt=Alt text|Comparison of accuracy between different algorithms]]<br />
<br />
=== Weighted Quantile Sketch ===<br />
<br />
Proposing candidate split points is the most important step in the Approximate Algorithm, it is done by using the percentile of a feature to make candidates distribute evenly on a dataset.<br />
<br />
Formally, we have a dataset<br />
<br />
<math>D_k={(x_{1k},h_1),(x_{2k},h_2),...,(x_{nk},h_n)}</math><br />
<br />
where <math> x_i </math>'s are the feature values of each data point and <math> h_i </math>'s represents the weight of the corresponding feature <math> x_i </math>. <br />
<br />
Then, we can use the following rank function to compute <math>r_k(z)</math>, the proportion of instances whose feature value among <math> (x_i,...,x_k) </math> is smaller than data point <math> z </math>.<br />
<br />
<math>r_k(z) = \frac{1}{\sum_{(x,h) \in D_k} h} \displaystyle\sum_{(x,h) \in D_k, x<z} h,</math><br />
<br />
The objective here is to find candidate split points <math>{s_{k1}, s_{k2}, …, s_{kl}}</math>, such that:<br />
<br />
<math>|r_k(s_{k,j}) – r_k(s_{k,j+1})| < \epsilon, s_{k1} = \displaystyle\min_i x_{ik}, s_{kl} = \displaystyle\max_{i} x_{ik}, \forall i</math><br />
<br />
Where <math>\epsilon</math> is an approximation factor. Usually, it should approximately have <math>\frac{1}{\epsilon}</math> splitting points.<br />
<br />
=== Sparsity-aware Split Finding ===<br />
<br />
Typically in real world situation, it is quite common that our data set is sparse. Some of the possible causes are:<br />
<br />
# Missing values in the data<br />
# Huge amount of zero entries present in the data<br />
#<br />
<br />
== System Design ==<br />
<br />
=== Column Block for Parallel Learning ===<br />
The most time consuming part of tree learning is to get the data into sorted order. To overcome this problem, XGBoost stores the data in blocks where each block performs the sorting operation in parallel. The results are then merged together.<br />
<br />
# For the exact greedy algorithm, XGBoost stores the entire dataset in a single block<br />
#:* Original spase aware algorithm costs: <math>O(Kd∥x∥_0 log(n))</math><br />
#:* Tree boosting on block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(n))</math><br />
#:* Hence, block structure helps to save an additional <math>log(n)</math> factor<br />
# For approximate algorithms, XGBoost stores the dataset in multiple blocks<br />
#:* Original algorithm with binary search costs: <math>O(Kd∥x∥_0 log(q))</math><br />
#:* With block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(B))</math><br />
#:* Hence, block structure helps to save an additional <math>log(q)</math> factor <br />
<br />
K = total number of trees<br /><br />
d = maximum depth of the tree<br /><br />
<math>∥x∥_0</math> = number of non-missing entries in the training data<br /><br />
n = number of rows in the dataset<br /><br />
q = number of proposal candidates in the dataset, usually between 32 to 100<br /><br />
B = maximum number of rows in each block<br />
<br />
[[File: columnblock.png|800px|thumb|center]]<br />
<br />
=== Cache-aware Access ===<br />
The proposed block structure optimizes the computation complexity but requires indirect fetches of gradient statistics by row index. XGBoost optimizes the process by using the following methods.<br />
<br />
# For the exact greedy algorithm, XGBoost uses a cache-aware prefetching algorithm<br />
#:* It stores Gradient and Hessians in the cache to make calculations fast<br />
#:* It runs twice as fast as the naive method when the dataset is large<br />
# For approximate algorithms, XGBoost chooses a specific block size<br />
#:* Choosing a small block size results in inefficient parallelization<br />
#:* Choosing a large block size results in cache misses<br />
#:* Various choices of block size are compared and the results are shown in Figure 9<br />
#:* XGBoost chose <math>2^{16}</math> as the block size<br />
<br />
[[File: blocksize.png|400px|thumb|center]]<br />
<br />
=== Blocks for Out-of-core Computation ===<br />
When the dataset is too large for the cache and main memory, XGBoost utilizes disk spaces as well. Since reading and writing data to the disks are slow, XGBoost optimizes the process by using the following two methods.<br />
<br />
# Block Compression<br />
#:* Blocks are compressed by columns<br />
#:* Although decompressing takes time, it is still faster than reading from the disks<br />
# Block Sharding<br />
#:* If multiple disks are available, data is split into those disks<br />
#:* When the CPU needs data, all the disks can be read at the same time<br />
<br />
== End To End Evaluations ==<br />
=== System Implementation ===<br />
XGBoost is a portable and reusable open-source package. It supports:<br />
* various weighted classification<br />
* various objective functions (rank & user defined)<br />
* popular languages (python, R, Julia)<br />
* data science pipelines (scikit-learn)<br />
* big data stacks (Flink, Spark)<br />
* cloud platform (Tianchi8)<br />
<br />
=== Dataset and Setup ===<br />
<br />
A summary of the 4 datasets used in the experiments is in table 2.<br />
<br />
[[File: table2data.png|500px|thumb|center]]<br />
<br />
The first and last datasets were used specifically to evaluate the impact of sparsity-aware algorithm and the scaling property of the system in the out-of-core and the distributed settings respectively. In all of the experiments, common settings such as maximum depth equal to 8, shrinkage equal to 0.1 and no column subsampling are applied.<br />
<br />
=== Classification ===<br />
A subset (n = 1M) of Higgs Boson dataset was used for classification. The results are shown in Table 3.<br />
<br />
[[File: classification.png|500px|thumb|center]]<br />
<br />
* R’s GBM creates a tree fast by using greedy approach that only expands one branch of a tree but with the cost of lower accuracy<br />
* XGBoost and scikit-learn have better performance than R’s GBM<br />
* XGBoost runs more than 10x faster than scikit-learn in learning a full tree<br />
* Column subsamples give slightly worse performance possibly due to a few important features in this dataset.<br />
<br />
=== Learning to Rank ===<br />
The results in comparing XGBoost with pGBRT are shown in Table 4.<br />
<br />
[[File: rank.png|500px|thumb|center]]<br />
<br />
* XGBoost runs exact greedy algorithm while pGBRT only supports an approximate algorithm<br />
* XGBoost runs faster<br />
* Subsampling column reduces running time and gives higher performance possibly due to preventing overfitting<br />
<br />
=== Out-of-core Experiment ===<br />
An extremely large Criteo dataset was used to evaluate the out-of-core setting. The results are shown in the figure below.<br />
<br />
[[File: outofcore.png|350px|thumb|center]]<br />
<br />
* Compression speed up the computation by a factor of 3<br />
* Sharding into 2 disks further gives 2x speed<br />
<br />
=== Distributed Experiment ===<br />
YARN cluster on EC2 with m3.2xlarge machines was used to evaluate the distributed setting. XGBoost was compared with Spark MLLib and H20.<br />
<br />
* XGBoost can switch to out-of-core setting when the memory runs out, while the baseline systems need to store the data in RAM<br />
* XGBoost runs faster than the baseline systems<br />
* The baseline systems are only able to handle a subset of the data with the given resources while XGBoost was able to scale smoothly to all 1.7B rows<br />
* XGBoost’s performance scales linearly with more machines<br />
* XGBoost is able to handle all 1.7B data with only 4 machines<br />
<br />
== Conclusion ==<br />
<br />
== References ==<br />
[1] R. Bekkerman. The present and the future of the kdd cup competition: an outsider’s perspective. <br />
<br />
[2] R. Bekkerman, M. Bilenko, and J. Langford. Scaling Up Machine Learning: Parallel and Distributed Approaches. Cambridge University Press, New York, NY, USA, 2011. <br />
<br />
[3] J. Bennett and S. Lanning. The netflix prize. In Proceedings of the KDD Cup Workshop 2007, pages 3–6, New York, Aug. 2007.<br />
<br />
[4] L. Breiman. Random forests. Maching Learning, 45(1):5–32, Oct. 2001.<br />
<br />
[5] C. Burges. From ranknet to lambdarank to lambdamart: An overview. Learning, 11:23–581, 2010.<br />
<br />
[6] O. Chapelle and Y. Chang. Yahoo! Learning to Rank Challenge Overview. Journal of Machine Learning Research - W & CP, 14:1–24, 2011.<br />
<br />
[7] T. Chen, H. Li, Q. Yang, and Y. Yu. General functional matrix factorization using gradient boosting. In Proceeding of 30th International Conference on Machine Learning (ICML’13), volume 1, pages 436–444, 2013.<br />
<br />
[8] T. Chen, S. Singh, B. Taskar, and C. Guestrin. Efficient second-order gradient boosting for conditional random fields. In Proceeding of 18th Artificial Intelligence and Statistics Conference (AISTATS’15), volume 1, 2015.<br />
<br />
[9] R.-E. Fan, K.-W. Chang, C.-J. Hsieh, X.-R. Wang, and C.-J. Lin. LIBLINEAR: A library for large linear classification. Journal of Machine Learning Research, 9:1871–1874, 2008.<br />
<br />
[10] J. Friedman. Greedy function approximation: a gradient boosting machine. Annals of Statistics, 29(5):1189–1232, 2001.<br />
<br />
[11] J. Friedman. Stochastic gradient boosting. Computational Statistics & Data Analysis, 38(4):367–378, 2002.<br />
<br />
[12] J. Friedman, T. Hastie, and R. Tibshirani. Additive logistic regression: a statistical view of boosting. Annals of Statistics, 28(2):337–407, 2000.<br />
<br />
[13] J. H. Friedman and B. E. Popescu. Importance sampled learning ensembles, 2003.<br />
<br />
[14] M. Greenwald and S. Khanna. Space-efficient online computation of quantile summaries. In Proceedings of the 2001 ACM SIGMOD International Conference on Management of Data, pages 58–66, 2001.<br />
<br />
[15] X. He, J. Pan, O. Jin, T. Xu, B. Liu, T. Xu, Y. Shi, A. Atallah, R. Herbrich, S. Bowers, and J. Q. n. Candela. Practical lessons from predicting clicks on ads at facebook. In Proceedings of the Eighth International Workshop on Data Mining for Online Advertising, ADKDD’14, 2014.<br />
<br />
[16] P. Li. Robust Logitboost and adaptive base class (ABC) Logitboost. In Proceedings of the Twenty-Sixth Conference Annual Conference on Uncertainty in Artificial Intelligence (UAI’10), pages 302–311, 2010.<br />
<br />
[17] P. Li, Q. Wu, and C. J. Burges. Mcrank: Learning to rank using multiple classification and gradient boosting. In Advances in Neural Information Processing Systems 20, pages 897–904. 2008.<br />
<br />
[18] X. Meng, J. Bradley, B. Yavuz, E. Sparks, S. Venkataraman, D. Liu, J. Freeman, D. Tsai, M. Amde, S. Owen, D. Xin, R. Xin, M. J. Franklin, R. Zadeh, M. Zaharia, and A. Talwalkar. MLlib: Machine learning in apache spark. Journal of Machine Learning Research, 17(34):1–7, 2016.<br />
<br />
[19] B. Panda, J. S. Herbach, S. Basu, and R. J. Bayardo. Planet: Massively parallel learning of tree ensembles with mapreduce. Proceeding of VLDB Endowment, 2(2):1426–1437, Aug. 2009.<br />
<br />
[20] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.<br />
<br />
[21] G. Ridgeway. Generalized Boosted Models: A guide to the gbm package.<br />
<br />
[22] S. Tyree, K. Weinberger, K. Agrawal, and J. Paykin. Parallel boosted regression trees for web search ranking. In Proceedings of the 20th international conference on World wide web, pages 387–396. ACM, 2011.<br />
<br />
[23] J. Ye, J.-H. Chow, J. Chen, and Z. Zheng. Stochastic gradient boosted distributed decision trees. In Proceedings of the 18th ACM Conference on Information and Knowledge Management, CIKM ’09.<br />
<br />
[24] Q. Zhang and W. Wang. A fast algorithm for approximate quantiles in high speed data streams. In Proceedings of the 19th International Conference on Scientific and Statistical Database Management, 2007.<br />
<br />
[25] T. Zhang and R. Johnson. Learning nonlinear functions using regularized greedy forest. IEEE Transactions on Pattern Analysis and Machine Intelligence, 36(5), 2014.</div>Cwlokehttp://wiki.math.uwaterloo.ca/statwiki/index.php?title=XGBoost&diff=51113XGBoost2021-11-29T05:03:12Z<p>Cwloke: /* Sparsity-aware Split Finding */</p>
<hr />
<div>== Presented by == <br />
* Chun Waan Loke<br />
* Peter Chong<br />
* Clarice Osmond<br />
* Zhilong Li<br />
<br />
== Introduction ==<br />
<br />
== Tree Boosting In A Nutshell ==<br />
The author reviews gradient tree boosting in this section.<br />
=== Regularized Learning Objective ===<br />
The author first gives the prediction equation (1) and the regularized objective (2).<br><br />
<br><br />
(1) The additive prediction model is given as<br><br />
<math>\hat{y_i}=\sum_{k=1}^{K}f_k(x_i), f_k \in \mathcal{F} </math> <br><br />
where each <math>f_k</math> corresponds to an independent tree structure with its weights, and <math>\mathcal{F}</math> is the "space of regression trees"<br><br />
<br><br />
(2) The regularized objective to be minimized is given as<br><br />
<math>\mathcal{L}=\sum_{i}l(\hat{y_i},y_i)+\sum_k \Omega(f_k)</math> where <math>\Omega(f)=\gamma T+\frac{1}{2}\lambda ||\omega||^2</math> <br><br />
The first term <math>l</math> is a differentiable convex loss function that calculates the measures between <math>\hat{y}</math> and <math>y</math>.<br><br />
The second term <math>\Omega</math> penalizes on the complexity of model (the <math>f_k</math>'s). For a given tree (<math>f_k</math>), <math>T</math> is the number of leaves, and <math>\omega</math> is the leaf weights.<br><br />
The L1 regularization term <math>\gamma T</math> encourages the tree to be small, and the L2 regularization term <math>\frac{1}{2}\lambda ||\omega||^2</math> encourages the tree to have small weights.<br><br />
<br />
=== Gradient Tree Boosting ===<br />
Let <math>\hat{y_i}^{(t)}</math> be the prediction of <math>y_i</math> at the t-th iteration.<br><br />
Since the prediction equation is simply additive, <math>{\hat y_i}^{(t)}=\hat{y_{i}}^{(t-1)}+f_t(x_i)</math><br><br />
Using this equation and 2nd order Taylor approximation on the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> gives <br><br />
\begin{align}<br />
\mathcal{L}^{(t)}&=\sum_{i}^{n}l(y_i,\hat{y_i}^{(t-1)}+f_t(x_i))+\Omega(f_t)\\<br />
&\simeq \sum_{i}^{n}[l(y_i,\hat{y_i}^{(t-1)})+g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
\end{align}<br />
where <math>g_i</math> and <math>h_i</math> are the first and second derivative of the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> with repspect to the term <math>\hat{y}^{(t-1)}</math><br><br />
We can simplify this objective by removing the constant term <math>l(y_i,\hat{y_i}^{(t-1)})</math>.<br><br />
Define <math>I_j=\{i|q(x_i)=j\}</math>, where <math>q</math> is the tree structure. Since every <math>x_i</math> is mapped by <math>q</math> to some leaf <math>j</math>, going through every <math>x_i</math> is equivalent to going through each leaf j of the structure.<br />
\begin{align}<br />
\tilde{\mathcal{L}}^{(t)}&= \sum_{i}^{n}[g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
&= \sum_{j=1}^{T}[(\sum_{i \in I_j}g_i)\omega_j+\frac{1}{2}(\sum_{i \in I_j}h_i+\lambda)\omega_j^2]+\gamma T<br />
\end{align}<br />
Then for a fixed structure <math>q</math>, the optimal weight of leaf <math>j</math> and the optimal objective value are given as<br><br />
\begin{align}<br />
\omega_j^{*} &= -\frac{\sum_{i \in I_j}g_i}{\sum_{i \in I_j}h_i+\lambda}\\<br />
\tilde{\mathcal{L}}^{(t)}(q) &=-\frac{1}{2}\sum_{j=1}^{T}\frac{(\sum_{i \in I_j}g_i)^2}{\sum_{i \in I_j}h_i+\lambda}+\gamma T<br />
\end{align} <br />
[[File:Structure Score Calculation.png|frame|center|alt=Alt text|Structure Score Calculation]]<br />
Instead of enumerating through all possible tree structures q, a greedy algorithm of iteratively adding branches is used.<br><br />
Let <math>I_L</math> and <math>I_R</math> be the instance sets of left and right nodes after split and let <math>I=I_L\cup I_R</math>.<br><br />
The loss reduction after split is given by<br><br />
\begin{align}<br />
\tilde{\mathcal{L}}_{\text{split}} &=\frac{1}{2}[\frac{(\sum_{i \in I_L}g_i)^2}{\sum_{i \in I_L}h_i+\lambda}+\frac{(\sum_{i \in I_R}g_i)^2}{\sum_{i \in I_R}h_i+\lambda}-\frac{(\sum_{i \in I}g_i)^2}{\sum_{i \in I}h_i+\lambda}]+\gamma<br />
\end{align}<br />
=== Shrinkage and Column Subsampling ===<br />
The author also mentioned two other methods in order to avoid over-fitting.<br><br />
(1) Shrinkage. Similar to the learning rate in stochastic optimization, a new weight is added to each tree boosting to reduce the influence of a single tree and leave space for future trees.<br><br />
(2) Column (feature) subsampling. In the paper, the author only mentioned that this technique speeds up parallel algorithm used in later sections.<br />
<br />
== Split Finding Algorithms ==<br />
<br />
It is very important to find the best split for tree learning to perform well. Here are a few split finding algorithms mentioned in the paper:<br />
<br />
=== Basic Exact Greedy Algorithm ===<br />
<br />
The basic exact greedy algorithm is a split finding algorithm that is computationally expensive because it enumerates over all the possible splits for continuous features. It is impossible to be done efficiently when the memory is not enough to hold the data needed. A way to carry out this algorithm efficiently is to sort the data according to feature values and visit the data in order to accumulate the gradient statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_1.png|center|alt=Alt text|Basic Exact Greedy Algorithm]]<br />
<br />
=== Approximate Algorithm ===<br />
<br />
The paper introduced a more efficient algorithm compared to Basic Exact Greedy Algorithm which is the Approximate Algorithm. The Approximate Algorithm first proposes candidate splitting points according to percentiles of feature distribution. It then maps the continuous features into buckets split by candidate points, aggregates the statistics and finds the best solution among proposals based on the aggregated statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_2.png|center|alt=Alt text|Approximate Algorithm]]<br />
<br />
There are also two variants to this algorithm, the global variant proposes all the candidate splits during the initial phase of tree construction and uses the same proposals for split finding at all levels. Whereas, the local variant re-proposes after each split. The global variant usually requires less proposal steps but uses more candidate points than local variant because candidates are not refined after each split. For deeper trees, usage of local variant may be more appropriate as compared to global variant. The figure below shows the a comparison in accuracy between Basic Exact Greedy and Approximate split finding algorithms with different variant over the number of iterations. We can see that the quantile strategy is able to achieve similar accuracy as the Basic Exact Greedy algorithm given a reasonable approximation level.<br />
<br />
[[File:iterations.png|center|alt=Alt text|Comparison of accuracy between different algorithms]]<br />
<br />
=== Weighted Quantile Sketch ===<br />
<br />
Proposing candidate split points is the most important step in the Approximate Algorithm, it is done by using the percentile of a feature to make candidates distribute evenly on a dataset.<br />
<br />
Formally, we have a dataset<br />
<br />
<math>D_k={(x_{1k},h_1),(x_{2k},h_2),...,(x_{nk},h_n)}</math><br />
<br />
where <math> x_i </math>'s are the feature values of each data point and <math> h_i </math>'s represents the weight of the corresponding feature <math> x_i </math>. <br />
<br />
Then, we can use the following rank function to compute <math>r_k(z)</math>, the proportion of instances whose feature value among <math> (x_i,...,x_k) </math> is smaller than data point <math> z </math>.<br />
<br />
<math>r_k(z) = \frac{1}{\sum_{(x,h) \in D_k} h} \displaystyle\sum_{(x,h) \in D_k, x<z} h,</math><br />
<br />
The objective here is to find candidate split points <math>{s_{k1}, s_{k2}, …, s_{kl}}</math>, such that:<br />
<br />
<math>|r_k(s_{k,j}) – r_k(s_{k,j+1})| < \epsilon, s_{k1} = \displaystyle\min_i x_{ik}, s_{kl} = \displaystyle\max_{i} x_{ik}, \forall i</math><br />
<br />
Where <math>\epsilon</math> is an approximation factor. Usually, it should approximately have <math>\frac{1}{\epsilon}</math> splitting points.<br />
<br />
=== Sparsity-aware Split Finding ===<br />
<br />
Typically in real world situation, it is quite common that our data set is sparse. Some of the possible causes are:<br />
<br />
1. Missing values in the data<br />
2. Huge amount of zero entries present in the data<br />
3.<br />
<br />
== System Design ==<br />
<br />
=== Column Block for Parallel Learning ===<br />
The most time consuming part of tree learning is to get the data into sorted order. To overcome this problem, XGBoost stores the data in blocks where each block performs the sorting operation in parallel. The results are then merged together.<br />
<br />
# For the exact greedy algorithm, XGBoost stores the entire dataset in a single block<br />
#:* Original spase aware algorithm costs: <math>O(Kd∥x∥_0 log(n))</math><br />
#:* Tree boosting on block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(n))</math><br />
#:* Hence, block structure helps to save an additional <math>log(n)</math> factor<br />
# For approximate algorithms, XGBoost stores the dataset in multiple blocks<br />
#:* Original algorithm with binary search costs: <math>O(Kd∥x∥_0 log(q))</math><br />
#:* With block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(B))</math><br />
#:* Hence, block structure helps to save an additional <math>log(q)</math> factor <br />
<br />
K = total number of trees<br /><br />
d = maximum depth of the tree<br /><br />
<math>∥x∥_0</math> = number of non-missing entries in the training data<br /><br />
n = number of rows in the dataset<br /><br />
q = number of proposal candidates in the dataset, usually between 32 to 100<br /><br />
B = maximum number of rows in each block<br />
<br />
[[File: columnblock.png|800px|thumb|center]]<br />
<br />
=== Cache-aware Access ===<br />
The proposed block structure optimizes the computation complexity but requires indirect fetches of gradient statistics by row index. XGBoost optimizes the process by using the following methods.<br />
<br />
# For the exact greedy algorithm, XGBoost uses a cache-aware prefetching algorithm<br />
#:* It stores Gradient and Hessians in the cache to make calculations fast<br />
#:* It runs twice as fast as the naive method when the dataset is large<br />
# For approximate algorithms, XGBoost chooses a specific block size<br />
#:* Choosing a small block size results in inefficient parallelization<br />
#:* Choosing a large block size results in cache misses<br />
#:* Various choices of block size are compared and the results are shown in Figure 9<br />
#:* XGBoost chose <math>2^{16}</math> as the block size<br />
<br />
[[File: blocksize.png|400px|thumb|center]]<br />
<br />
=== Blocks for Out-of-core Computation ===<br />
When the dataset is too large for the cache and main memory, XGBoost utilizes disk spaces as well. Since reading and writing data to the disks are slow, XGBoost optimizes the process by using the following two methods.<br />
<br />
# Block Compression<br />
#:* Blocks are compressed by columns<br />
#:* Although decompressing takes time, it is still faster than reading from the disks<br />
# Block Sharding<br />
#:* If multiple disks are available, data is split into those disks<br />
#:* When the CPU needs data, all the disks can be read at the same time<br />
<br />
== End To End Evaluations ==<br />
=== System Implementation ===<br />
XGBoost is a portable and reusable open-source package. It supports:<br />
* various weighted classification<br />
* various objective functions (rank & user defined)<br />
* popular languages (python, R, Julia)<br />
* data science pipelines (scikit-learn)<br />
* big data stacks (Flink, Spark)<br />
* cloud platform (Tianchi8)<br />
<br />
=== Dataset and Setup ===<br />
<br />
A summary of the 4 datasets used in the experiments is in table 2.<br />
<br />
[[File: table2data.png|500px|thumb|center]]<br />
<br />
The first and last datasets were used specifically to evaluate the impact of sparsity-aware algorithm and the scaling property of the system in the out-of-core and the distributed settings respectively. In all of the experiments, common settings such as maximum depth equal to 8, shrinkage equal to 0.1 and no column subsampling are applied.<br />
<br />
=== Classification ===<br />
A subset (n = 1M) of Higgs Boson dataset was used for classification. The results are shown in Table 3.<br />
<br />
[[File: classification.png|500px|thumb|center]]<br />
<br />
* R’s GBM creates a tree fast by using greedy approach that only expands one branch of a tree but with the cost of lower accuracy<br />
* XGBoost and scikit-learn have better performance than R’s GBM<br />
* XGBoost runs more than 10x faster than scikit-learn in learning a full tree<br />
* Column subsamples give slightly worse performance possibly due to a few important features in this dataset.<br />
<br />
=== Learning to Rank ===<br />
The results in comparing XGBoost with pGBRT are shown in Table 4.<br />
<br />
[[File: rank.png|500px|thumb|center]]<br />
<br />
* XGBoost runs exact greedy algorithm while pGBRT only supports an approximate algorithm<br />
* XGBoost runs faster<br />
* Subsampling column reduces running time and gives higher performance possibly due to preventing overfitting<br />
<br />
=== Out-of-core Experiment ===<br />
An extremely large Criteo dataset was used to evaluate the out-of-core setting. The results are shown in the figure below.<br />
<br />
[[File: outofcore.png|350px|thumb|center]]<br />
<br />
* Compression speed up the computation by a factor of 3<br />
* Sharding into 2 disks further gives 2x speed<br />
<br />
=== Distributed Experiment ===<br />
YARN cluster on EC2 with m3.2xlarge machines was used to evaluate the distributed setting. XGBoost was compared with Spark MLLib and H20.<br />
<br />
* XGBoost can switch to out-of-core setting when the memory runs out, while the baseline systems need to store the data in RAM<br />
* XGBoost runs faster than the baseline systems<br />
* The baseline systems are only able to handle a subset of the data with the given resources while XGBoost was able to scale smoothly to all 1.7B rows<br />
* XGBoost’s performance scales linearly with more machines<br />
* XGBoost is able to handle all 1.7B data with only 4 machines<br />
<br />
== Conclusion ==<br />
<br />
== References ==<br />
[1] R. Bekkerman. The present and the future of the kdd cup competition: an outsider’s perspective. <br />
<br />
[2] R. Bekkerman, M. Bilenko, and J. Langford. Scaling Up Machine Learning: Parallel and Distributed Approaches. Cambridge University Press, New York, NY, USA, 2011. <br />
<br />
[3] J. Bennett and S. Lanning. The netflix prize. In Proceedings of the KDD Cup Workshop 2007, pages 3–6, New York, Aug. 2007.<br />
<br />
[4] L. Breiman. Random forests. Maching Learning, 45(1):5–32, Oct. 2001.<br />
<br />
[5] C. Burges. From ranknet to lambdarank to lambdamart: An overview. Learning, 11:23–581, 2010.<br />
<br />
[6] O. Chapelle and Y. Chang. Yahoo! Learning to Rank Challenge Overview. Journal of Machine Learning Research - W & CP, 14:1–24, 2011.<br />
<br />
[7] T. Chen, H. Li, Q. Yang, and Y. Yu. General functional matrix factorization using gradient boosting. In Proceeding of 30th International Conference on Machine Learning (ICML’13), volume 1, pages 436–444, 2013.<br />
<br />
[8] T. Chen, S. Singh, B. Taskar, and C. Guestrin. Efficient second-order gradient boosting for conditional random fields. In Proceeding of 18th Artificial Intelligence and Statistics Conference (AISTATS’15), volume 1, 2015.<br />
<br />
[9] R.-E. Fan, K.-W. Chang, C.-J. Hsieh, X.-R. Wang, and C.-J. Lin. LIBLINEAR: A library for large linear classification. Journal of Machine Learning Research, 9:1871–1874, 2008.<br />
<br />
[10] J. Friedman. Greedy function approximation: a gradient boosting machine. Annals of Statistics, 29(5):1189–1232, 2001.<br />
<br />
[11] J. Friedman. Stochastic gradient boosting. Computational Statistics & Data Analysis, 38(4):367–378, 2002.<br />
<br />
[12] J. Friedman, T. Hastie, and R. Tibshirani. Additive logistic regression: a statistical view of boosting. Annals of Statistics, 28(2):337–407, 2000.<br />
<br />
[13] J. H. Friedman and B. E. Popescu. Importance sampled learning ensembles, 2003.<br />
<br />
[14] M. Greenwald and S. Khanna. Space-efficient online computation of quantile summaries. In Proceedings of the 2001 ACM SIGMOD International Conference on Management of Data, pages 58–66, 2001.<br />
<br />
[15] X. He, J. Pan, O. Jin, T. Xu, B. Liu, T. Xu, Y. Shi, A. Atallah, R. Herbrich, S. Bowers, and J. Q. n. Candela. Practical lessons from predicting clicks on ads at facebook. In Proceedings of the Eighth International Workshop on Data Mining for Online Advertising, ADKDD’14, 2014.<br />
<br />
[16] P. Li. Robust Logitboost and adaptive base class (ABC) Logitboost. In Proceedings of the Twenty-Sixth Conference Annual Conference on Uncertainty in Artificial Intelligence (UAI’10), pages 302–311, 2010.<br />
<br />
[17] P. Li, Q. Wu, and C. J. Burges. Mcrank: Learning to rank using multiple classification and gradient boosting. In Advances in Neural Information Processing Systems 20, pages 897–904. 2008.<br />
<br />
[18] X. Meng, J. Bradley, B. Yavuz, E. Sparks, S. Venkataraman, D. Liu, J. Freeman, D. Tsai, M. Amde, S. Owen, D. Xin, R. Xin, M. J. Franklin, R. Zadeh, M. Zaharia, and A. Talwalkar. MLlib: Machine learning in apache spark. Journal of Machine Learning Research, 17(34):1–7, 2016.<br />
<br />
[19] B. Panda, J. S. Herbach, S. Basu, and R. J. Bayardo. Planet: Massively parallel learning of tree ensembles with mapreduce. Proceeding of VLDB Endowment, 2(2):1426–1437, Aug. 2009.<br />
<br />
[20] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.<br />
<br />
[21] G. Ridgeway. Generalized Boosted Models: A guide to the gbm package.<br />
<br />
[22] S. Tyree, K. Weinberger, K. Agrawal, and J. Paykin. Parallel boosted regression trees for web search ranking. In Proceedings of the 20th international conference on World wide web, pages 387–396. ACM, 2011.<br />
<br />
[23] J. Ye, J.-H. Chow, J. Chen, and Z. Zheng. Stochastic gradient boosted distributed decision trees. In Proceedings of the 18th ACM Conference on Information and Knowledge Management, CIKM ’09.<br />
<br />
[24] Q. Zhang and W. Wang. A fast algorithm for approximate quantiles in high speed data streams. In Proceedings of the 19th International Conference on Scientific and Statistical Database Management, 2007.<br />
<br />
[25] T. Zhang and R. Johnson. Learning nonlinear functions using regularized greedy forest. IEEE Transactions on Pattern Analysis and Machine Intelligence, 36(5), 2014.</div>Cwlokehttp://wiki.math.uwaterloo.ca/statwiki/index.php?title=XGBoost&diff=51112XGBoost2021-11-29T04:38:39Z<p>Cwloke: /* Weighted Quantile Sketch */</p>
<hr />
<div>== Presented by == <br />
* Chun Waan Loke<br />
* Peter Chong<br />
* Clarice Osmond<br />
* Zhilong Li<br />
<br />
== Introduction ==<br />
<br />
== Tree Boosting In A Nutshell ==<br />
The author reviews gradient tree boosting in this section.<br />
=== Regularized Learning Objective ===<br />
The author first gives the prediction equation (1) and the regularized objective (2).<br><br />
<br><br />
(1) The additive prediction model is given as<br><br />
<math>\hat{y_i}=\sum_{k=1}^{K}f_k(x_i), f_k \in \mathcal{F} </math> <br><br />
where each <math>f_k</math> corresponds to an independent tree structure with its weights, and <math>\mathcal{F}</math> is the "space of regression trees"<br><br />
<br><br />
(2) The regularized objective to be minimized is given as<br><br />
<math>\mathcal{L}=\sum_{i}l(\hat{y_i},y_i)+\sum_k \Omega(f_k)</math> where <math>\Omega(f)=\gamma T+\frac{1}{2}\lambda ||\omega||^2</math> <br><br />
The first term <math>l</math> is a differentiable convex loss function that calculates the measures between <math>\hat{y}</math> and <math>y</math>.<br><br />
The second term <math>\Omega</math> penalizes on the complexity of model (the <math>f_k</math>'s). For a given tree (<math>f_k</math>), <math>T</math> is the number of leaves, and <math>\omega</math> is the leaf weights.<br><br />
The L1 regularization term <math>\gamma T</math> encourages the tree to be small, and the L2 regularization term <math>\frac{1}{2}\lambda ||\omega||^2</math> encourages the tree to have small weights.<br><br />
<br />
=== Gradient Tree Boosting ===<br />
Let <math>\hat{y_i}^{(t)}</math> be the prediction of <math>y_i</math> at the t-th iteration.<br><br />
Since the prediction equation is simply additive, <math>{\hat y_i}^{(t)}=\hat{y_{i}}^{(t-1)}+f_t(x_i)</math><br><br />
Using this equation and 2nd order Taylor approximation on the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> gives <br><br />
\begin{align}<br />
\mathcal{L}^{(t)}&=\sum_{i}^{n}l(y_i,\hat{y_i}^{(t-1)}+f_t(x_i))+\Omega(f_t)\\<br />
&\simeq \sum_{i}^{n}[l(y_i,\hat{y_i}^{(t-1)})+g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
\end{align}<br />
where <math>g_i</math> and <math>h_i</math> are the first and second derivative of the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> with repspect to the term <math>\hat{y}^{(t-1)}</math><br><br />
We can simplify this objective by removing the constant term <math>l(y_i,\hat{y_i}^{(t-1)})</math>.<br><br />
Define <math>I_j=\{i|q(x_i)=j\}</math>, where <math>q</math> is the tree structure. Since every <math>x_i</math> is mapped by <math>q</math> to some leaf <math>j</math>, going through every <math>x_i</math> is equivalent to going through each leaf j of the structure.<br />
\begin{align}<br />
\tilde{\mathcal{L}}^{(t)}&= \sum_{i}^{n}[g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
&= \sum_{j=1}^{T}[(\sum_{i \in I_j}g_i)\omega_j+\frac{1}{2}(\sum_{i \in I_j}h_i+\lambda)\omega_j^2]+\gamma T<br />
\end{align}<br />
Then for a fixed structure <math>q</math>, the optimal weight of leaf <math>j</math> and the optimal objective value are given as<br><br />
\begin{align}<br />
\omega_j^{*} &= -\frac{\sum_{i \in I_j}g_i}{\sum_{i \in I_j}h_i+\lambda}\\<br />
\tilde{\mathcal{L}}^{(t)}(q) &=-\frac{1}{2}\sum_{j=1}^{T}\frac{(\sum_{i \in I_j}g_i)^2}{\sum_{i \in I_j}h_i+\lambda}+\gamma T<br />
\end{align} <br />
[[File:Structure Score Calculation.png|frame|center|alt=Alt text|Structure Score Calculation]]<br />
Instead of enumerating through all possible tree structures q, a greedy algorithm of iteratively adding branches is used.<br><br />
Let <math>I_L</math> and <math>I_R</math> be the instance sets of left and right nodes after split and let <math>I=I_L\cup I_R</math>.<br><br />
The loss reduction after split is given by<br><br />
\begin{align}<br />
\tilde{\mathcal{L}}_{\text{split}} &=\frac{1}{2}[\frac{(\sum_{i \in I_L}g_i)^2}{\sum_{i \in I_L}h_i+\lambda}+\frac{(\sum_{i \in I_R}g_i)^2}{\sum_{i \in I_R}h_i+\lambda}-\frac{(\sum_{i \in I}g_i)^2}{\sum_{i \in I}h_i+\lambda}]+\gamma<br />
\end{align}<br />
=== Shrinkage and Column Subsampling ===<br />
The author also mentioned two other methods in order to avoid over-fitting.<br><br />
(1) Shrinkage. Similar to the learning rate in stochastic optimization, a new weight is added to each tree boosting to reduce the influence of a single tree and leave space for future trees.<br><br />
(2) Column (feature) subsampling. In the paper, the author only mentioned that this technique speeds up parallel algorithm used in later sections.<br />
<br />
== Split Finding Algorithms ==<br />
<br />
It is very important to find the best split for tree learning to perform well. Here are a few split finding algorithms mentioned in the paper:<br />
<br />
=== Basic Exact Greedy Algorithm ===<br />
<br />
The basic exact greedy algorithm is a split finding algorithm that is computationally expensive because it enumerates over all the possible splits for continuous features. It is impossible to be done efficiently when the memory is not enough to hold the data needed. A way to carry out this algorithm efficiently is to sort the data according to feature values and visit the data in order to accumulate the gradient statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_1.png|center|alt=Alt text|Basic Exact Greedy Algorithm]]<br />
<br />
=== Approximate Algorithm ===<br />
<br />
The paper introduced a more efficient algorithm compared to Basic Exact Greedy Algorithm which is the Approximate Algorithm. The Approximate Algorithm first proposes candidate splitting points according to percentiles of feature distribution. It then maps the continuous features into buckets split by candidate points, aggregates the statistics and finds the best solution among proposals based on the aggregated statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_2.png|center|alt=Alt text|Approximate Algorithm]]<br />
<br />
There are also two variants to this algorithm, the global variant proposes all the candidate splits during the initial phase of tree construction and uses the same proposals for split finding at all levels. Whereas, the local variant re-proposes after each split. The global variant usually requires less proposal steps but uses more candidate points than local variant because candidates are not refined after each split. For deeper trees, usage of local variant may be more appropriate as compared to global variant. The figure below shows the a comparison in accuracy between Basic Exact Greedy and Approximate split finding algorithms with different variant over the number of iterations. We can see that the quantile strategy is able to achieve similar accuracy as the Basic Exact Greedy algorithm given a reasonable approximation level.<br />
<br />
[[File:iterations.png|center|alt=Alt text|Comparison of accuracy between different algorithms]]<br />
<br />
=== Weighted Quantile Sketch ===<br />
<br />
Proposing candidate split points is the most important step in the Approximate Algorithm, it is done by using the percentile of a feature to make candidates distribute evenly on a dataset.<br />
<br />
Formally, we have a dataset<br />
<br />
<math>D_k={(x_{1k},h_1),(x_{2k},h_2),...,(x_{nk},h_n)}</math><br />
<br />
where <math> x_i </math>'s are the feature values of each data point and <math> h_i </math>'s represents the weight of the corresponding feature <math> x_i </math>. <br />
<br />
Then, we can use the following rank function to compute <math>r_k(z)</math>, the proportion of instances whose feature value among <math> (x_i,...,x_k) </math> is smaller than data point <math> z </math>.<br />
<br />
<math>r_k(z) = \frac{1}{\sum_{(x,h) \in D_k} h} \displaystyle\sum_{(x,h) \in D_k, x<z} h,</math><br />
<br />
The objective here is to find candidate split points <math>{s_{k1}, s_{k2}, …, s_{kl}}</math>, such that:<br />
<br />
<math>|r_k(s_{k,j}) – r_k(s_{k,j+1})| < \epsilon, s_{k1} = \displaystyle\min_i x_{ik}, s_{kl} = \displaystyle\max_{i} x_{ik}, \forall i</math><br />
<br />
Where <math>\epsilon</math> is an approximation factor. Usually, it should approximately have <math>\frac{1}{\epsilon}</math> splitting points.<br />
<br />
=== Sparsity-aware Split Finding ===<br />
<br />
== System Design ==<br />
<br />
=== Column Block for Parallel Learning ===<br />
The most time consuming part of tree learning is to get the data into sorted order. To overcome this problem, XGBoost stores the data in blocks where each block performs the sorting operation in parallel. The results are then merged together.<br />
<br />
# For the exact greedy algorithm, XGBoost stores the entire dataset in a single block<br />
#:* Original spase aware algorithm costs: <math>O(Kd∥x∥_0 log(n))</math><br />
#:* Tree boosting on block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(n))</math><br />
#:* Hence, block structure helps to save an additional <math>log(n)</math> factor<br />
# For approximate algorithms, XGBoost stores the dataset in multiple blocks<br />
#:* Original algorithm with binary search costs: <math>O(Kd∥x∥_0 log(q))</math><br />
#:* With block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(B))</math><br />
#:* Hence, block structure helps to save an additional <math>log(q)</math> factor <br />
<br />
K = total number of trees<br /><br />
d = maximum depth of the tree<br /><br />
<math>∥x∥_0</math> = number of non-missing entries in the training data<br /><br />
n = number of rows in the dataset<br /><br />
q = number of proposal candidates in the dataset, usually between 32 to 100<br /><br />
B = maximum number of rows in each block<br />
<br />
[[File: columnblock.png|800px|thumb|center]]<br />
<br />
=== Cache-aware Access ===<br />
The proposed block structure optimizes the computation complexity but requires indirect fetches of gradient statistics by row index. XGBoost optimizes the process by using the following methods.<br />
<br />
# For the exact greedy algorithm, XGBoost uses a cache-aware prefetching algorithm<br />
#:* It stores Gradient and Hessians in the cache to make calculations fast<br />
#:* It runs twice as fast as the naive method when the dataset is large<br />
# For approximate algorithms, XGBoost chooses a specific block size<br />
#:* Choosing a small block size results in inefficient parallelization<br />
#:* Choosing a large block size results in cache misses<br />
#:* Various choices of block size are compared and the results are shown in Figure 9<br />
#:* XGBoost chose <math>2^{16}</math> as the block size<br />
<br />
[[File: blocksize.png|400px|thumb|center]]<br />
<br />
=== Blocks for Out-of-core Computation ===<br />
When the dataset is too large for the cache and main memory, XGBoost utilizes disk spaces as well. Since reading and writing data to the disks are slow, XGBoost optimizes the process by using the following two methods.<br />
<br />
# Block Compression<br />
#:* Blocks are compressed by columns<br />
#:* Although decompressing takes time, it is still faster than reading from the disks<br />
# Block Sharding<br />
#:* If multiple disks are available, data is split into those disks<br />
#:* When the CPU needs data, all the disks can be read at the same time<br />
<br />
== End To End Evaluations ==<br />
=== System Implementation ===<br />
XGBoost is a portable and reusable open-source package. It supports:<br />
* various weighted classification<br />
* various objective functions (rank & user defined)<br />
* popular languages (python, R, Julia)<br />
* data science pipelines (scikit-learn)<br />
* big data stacks (Flink, Spark)<br />
* cloud platform (Tianchi8)<br />
<br />
=== Dataset and Setup ===<br />
<br />
A summary of the 4 datasets used in the experiments is in table 2.<br />
<br />
[[File: table2data.png|500px|thumb|center]]<br />
<br />
The first and last datasets were used specifically to evaluate the impact of sparsity-aware algorithm and the scaling property of the system in the out-of-core and the distributed settings respectively. In all of the experiments, common settings such as maximum depth equal to 8, shrinkage equal to 0.1 and no column subsampling are applied.<br />
<br />
=== Classification ===<br />
A subset (n = 1M) of Higgs Boson dataset was used for classification. The results are shown in Table 3.<br />
<br />
[[File: classification.png|500px|thumb|center]]<br />
<br />
* R’s GBM creates a tree fast by using greedy approach that only expands one branch of a tree but with the cost of lower accuracy<br />
* XGBoost and scikit-learn have better performance than R’s GBM<br />
* XGBoost runs more than 10x faster than scikit-learn in learning a full tree<br />
* Column subsamples give slightly worse performance possibly due to a few important features in this dataset.<br />
<br />
=== Learning to Rank ===<br />
The results in comparing XGBoost with pGBRT are shown in Table 4.<br />
<br />
[[File: rank.png|500px|thumb|center]]<br />
<br />
* XGBoost runs exact greedy algorithm while pGBRT only supports an approximate algorithm<br />
* XGBoost runs faster<br />
* Subsampling column reduces running time and gives higher performance possibly due to preventing overfitting<br />
<br />
=== Out-of-core Experiment ===<br />
An extremely large Criteo dataset was used to evaluate the out-of-core setting. The results are shown in the figure below.<br />
<br />
[[File: outofcore.png|350px|thumb|center]]<br />
<br />
* Compression speed up the computation by a factor of 3<br />
* Sharding into 2 disks further gives 2x speed<br />
<br />
=== Distributed Experiment ===<br />
YARN cluster on EC2 with m3.2xlarge machines was used to evaluate the distributed setting. XGBoost was compared with Spark MLLib and H20.<br />
<br />
* XGBoost can switch to out-of-core setting when the memory runs out, while the baseline systems need to store the data in RAM<br />
* XGBoost runs faster than the baseline systems<br />
* The baseline systems are only able to handle a subset of the data with the given resources while XGBoost was able to scale smoothly to all 1.7B rows<br />
* XGBoost’s performance scales linearly with more machines<br />
* XGBoost is able to handle all 1.7B data with only 4 machines<br />
<br />
== Conclusion ==<br />
<br />
== References ==<br />
[1] R. Bekkerman. The present and the future of the kdd cup competition: an outsider’s perspective. <br />
<br />
[2] R. Bekkerman, M. Bilenko, and J. Langford. Scaling Up Machine Learning: Parallel and Distributed Approaches. Cambridge University Press, New York, NY, USA, 2011. <br />
<br />
[3] J. Bennett and S. Lanning. The netflix prize. In Proceedings of the KDD Cup Workshop 2007, pages 3–6, New York, Aug. 2007.<br />
<br />
[4] L. Breiman. Random forests. Maching Learning, 45(1):5–32, Oct. 2001.<br />
<br />
[5] C. Burges. From ranknet to lambdarank to lambdamart: An overview. Learning, 11:23–581, 2010.<br />
<br />
[6] O. Chapelle and Y. Chang. Yahoo! Learning to Rank Challenge Overview. Journal of Machine Learning Research - W & CP, 14:1–24, 2011.<br />
<br />
[7] T. Chen, H. Li, Q. Yang, and Y. Yu. General functional matrix factorization using gradient boosting. In Proceeding of 30th International Conference on Machine Learning (ICML’13), volume 1, pages 436–444, 2013.<br />
<br />
[8] T. Chen, S. Singh, B. Taskar, and C. Guestrin. Efficient second-order gradient boosting for conditional random fields. In Proceeding of 18th Artificial Intelligence and Statistics Conference (AISTATS’15), volume 1, 2015.<br />
<br />
[9] R.-E. Fan, K.-W. Chang, C.-J. Hsieh, X.-R. Wang, and C.-J. Lin. LIBLINEAR: A library for large linear classification. Journal of Machine Learning Research, 9:1871–1874, 2008.<br />
<br />
[10] J. Friedman. Greedy function approximation: a gradient boosting machine. Annals of Statistics, 29(5):1189–1232, 2001.<br />
<br />
[11] J. Friedman. Stochastic gradient boosting. Computational Statistics & Data Analysis, 38(4):367–378, 2002.<br />
<br />
[12] J. Friedman, T. Hastie, and R. Tibshirani. Additive logistic regression: a statistical view of boosting. Annals of Statistics, 28(2):337–407, 2000.<br />
<br />
[13] J. H. Friedman and B. E. Popescu. Importance sampled learning ensembles, 2003.<br />
<br />
[14] M. Greenwald and S. Khanna. Space-efficient online computation of quantile summaries. In Proceedings of the 2001 ACM SIGMOD International Conference on Management of Data, pages 58–66, 2001.<br />
<br />
[15] X. He, J. Pan, O. Jin, T. Xu, B. Liu, T. Xu, Y. Shi, A. Atallah, R. Herbrich, S. Bowers, and J. Q. n. Candela. Practical lessons from predicting clicks on ads at facebook. In Proceedings of the Eighth International Workshop on Data Mining for Online Advertising, ADKDD’14, 2014.<br />
<br />
[16] P. Li. Robust Logitboost and adaptive base class (ABC) Logitboost. In Proceedings of the Twenty-Sixth Conference Annual Conference on Uncertainty in Artificial Intelligence (UAI’10), pages 302–311, 2010.<br />
<br />
[17] P. Li, Q. Wu, and C. J. Burges. Mcrank: Learning to rank using multiple classification and gradient boosting. In Advances in Neural Information Processing Systems 20, pages 897–904. 2008.<br />
<br />
[18] X. Meng, J. Bradley, B. Yavuz, E. Sparks, S. Venkataraman, D. Liu, J. Freeman, D. Tsai, M. Amde, S. Owen, D. Xin, R. Xin, M. J. Franklin, R. Zadeh, M. Zaharia, and A. Talwalkar. MLlib: Machine learning in apache spark. Journal of Machine Learning Research, 17(34):1–7, 2016.<br />
<br />
[19] B. Panda, J. S. Herbach, S. Basu, and R. J. Bayardo. Planet: Massively parallel learning of tree ensembles with mapreduce. Proceeding of VLDB Endowment, 2(2):1426–1437, Aug. 2009.<br />
<br />
[20] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.<br />
<br />
[21] G. Ridgeway. Generalized Boosted Models: A guide to the gbm package.<br />
<br />
[22] S. Tyree, K. Weinberger, K. Agrawal, and J. Paykin. Parallel boosted regression trees for web search ranking. In Proceedings of the 20th international conference on World wide web, pages 387–396. ACM, 2011.<br />
<br />
[23] J. Ye, J.-H. Chow, J. Chen, and Z. Zheng. Stochastic gradient boosted distributed decision trees. In Proceedings of the 18th ACM Conference on Information and Knowledge Management, CIKM ’09.<br />
<br />
[24] Q. Zhang and W. Wang. A fast algorithm for approximate quantiles in high speed data streams. In Proceedings of the 19th International Conference on Scientific and Statistical Database Management, 2007.<br />
<br />
[25] T. Zhang and R. Johnson. Learning nonlinear functions using regularized greedy forest. IEEE Transactions on Pattern Analysis and Machine Intelligence, 36(5), 2014.</div>Cwlokehttp://wiki.math.uwaterloo.ca/statwiki/index.php?title=XGBoost&diff=51111XGBoost2021-11-29T04:37:30Z<p>Cwloke: /* Weighted Quantile Sketch */</p>
<hr />
<div>== Presented by == <br />
* Chun Waan Loke<br />
* Peter Chong<br />
* Clarice Osmond<br />
* Zhilong Li<br />
<br />
== Introduction ==<br />
<br />
== Tree Boosting In A Nutshell ==<br />
The author reviews gradient tree boosting in this section.<br />
=== Regularized Learning Objective ===<br />
The author first gives the prediction equation (1) and the regularized objective (2).<br><br />
<br><br />
(1) The additive prediction model is given as<br><br />
<math>\hat{y_i}=\sum_{k=1}^{K}f_k(x_i), f_k \in \mathcal{F} </math> <br><br />
where each <math>f_k</math> corresponds to an independent tree structure with its weights, and <math>\mathcal{F}</math> is the "space of regression trees"<br><br />
<br><br />
(2) The regularized objective to be minimized is given as<br><br />
<math>\mathcal{L}=\sum_{i}l(\hat{y_i},y_i)+\sum_k \Omega(f_k)</math> where <math>\Omega(f)=\gamma T+\frac{1}{2}\lambda ||\omega||^2</math> <br><br />
The first term <math>l</math> is a differentiable convex loss function that calculates the measures between <math>\hat{y}</math> and <math>y</math>.<br><br />
The second term <math>\Omega</math> penalizes on the complexity of model (the <math>f_k</math>'s). For a given tree (<math>f_k</math>), <math>T</math> is the number of leaves, and <math>\omega</math> is the leaf weights.<br><br />
The L1 regularization term <math>\gamma T</math> encourages the tree to be small, and the L2 regularization term <math>\frac{1}{2}\lambda ||\omega||^2</math> encourages the tree to have small weights.<br><br />
<br />
=== Gradient Tree Boosting ===<br />
Let <math>\hat{y_i}^{(t)}</math> be the prediction of <math>y_i</math> at the t-th iteration.<br><br />
Since the prediction equation is simply additive, <math>{\hat y_i}^{(t)}=\hat{y_{i}}^{(t-1)}+f_t(x_i)</math><br><br />
Using this equation and 2nd order Taylor approximation on the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> gives <br><br />
\begin{align}<br />
\mathcal{L}^{(t)}&=\sum_{i}^{n}l(y_i,\hat{y_i}^{(t-1)}+f_t(x_i))+\Omega(f_t)\\<br />
&\simeq \sum_{i}^{n}[l(y_i,\hat{y_i}^{(t-1)})+g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
\end{align}<br />
where <math>g_i</math> and <math>h_i</math> are the first and second derivative of the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> with repspect to the term <math>\hat{y}^{(t-1)}</math><br><br />
We can simplify this objective by removing the constant term <math>l(y_i,\hat{y_i}^{(t-1)})</math>.<br><br />
Define <math>I_j=\{i|q(x_i)=j\}</math>, where <math>q</math> is the tree structure. Since every <math>x_i</math> is mapped by <math>q</math> to some leaf <math>j</math>, going through every <math>x_i</math> is equivalent to going through each leaf j of the structure.<br />
\begin{align}<br />
\tilde{\mathcal{L}}^{(t)}&= \sum_{i}^{n}[g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
&= \sum_{j=1}^{T}[(\sum_{i \in I_j}g_i)\omega_j+\frac{1}{2}(\sum_{i \in I_j}h_i+\lambda)\omega_j^2]+\gamma T<br />
\end{align}<br />
Then for a fixed structure <math>q</math>, the optimal weight of leaf <math>j</math> and the optimal objective value are given as<br><br />
\begin{align}<br />
\omega_j^{*} &= -\frac{\sum_{i \in I_j}g_i}{\sum_{i \in I_j}h_i+\lambda}\\<br />
\tilde{\mathcal{L}}^{(t)}(q) &=-\frac{1}{2}\sum_{j=1}^{T}\frac{(\sum_{i \in I_j}g_i)^2}{\sum_{i \in I_j}h_i+\lambda}+\gamma T<br />
\end{align} <br />
[[File:Structure Score Calculation.png|frame|center|alt=Alt text|Structure Score Calculation]]<br />
Instead of enumerating through all possible tree structures q, a greedy algorithm of iteratively adding branches is used.<br><br />
Let <math>I_L</math> and <math>I_R</math> be the instance sets of left and right nodes after split and let <math>I=I_L\cup I_R</math>.<br><br />
The loss reduction after split is given by<br><br />
\begin{align}<br />
\tilde{\mathcal{L}}_{\text{split}} &=\frac{1}{2}[\frac{(\sum_{i \in I_L}g_i)^2}{\sum_{i \in I_L}h_i+\lambda}+\frac{(\sum_{i \in I_R}g_i)^2}{\sum_{i \in I_R}h_i+\lambda}-\frac{(\sum_{i \in I}g_i)^2}{\sum_{i \in I}h_i+\lambda}]+\gamma<br />
\end{align}<br />
=== Shrinkage and Column Subsampling ===<br />
The author also mentioned two other methods in order to avoid over-fitting.<br><br />
(1) Shrinkage. Similar to the learning rate in stochastic optimization, a new weight is added to each tree boosting to reduce the influence of a single tree and leave space for future trees.<br><br />
(2) Column (feature) subsampling. In the paper, the author only mentioned that this technique speeds up parallel algorithm used in later sections.<br />
<br />
== Split Finding Algorithms ==<br />
<br />
It is very important to find the best split for tree learning to perform well. Here are a few split finding algorithms mentioned in the paper:<br />
<br />
=== Basic Exact Greedy Algorithm ===<br />
<br />
The basic exact greedy algorithm is a split finding algorithm that is computationally expensive because it enumerates over all the possible splits for continuous features. It is impossible to be done efficiently when the memory is not enough to hold the data needed. A way to carry out this algorithm efficiently is to sort the data according to feature values and visit the data in order to accumulate the gradient statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_1.png|center|alt=Alt text|Basic Exact Greedy Algorithm]]<br />
<br />
=== Approximate Algorithm ===<br />
<br />
The paper introduced a more efficient algorithm compared to Basic Exact Greedy Algorithm which is the Approximate Algorithm. The Approximate Algorithm first proposes candidate splitting points according to percentiles of feature distribution. It then maps the continuous features into buckets split by candidate points, aggregates the statistics and finds the best solution among proposals based on the aggregated statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_2.png|center|alt=Alt text|Approximate Algorithm]]<br />
<br />
There are also two variants to this algorithm, the global variant proposes all the candidate splits during the initial phase of tree construction and uses the same proposals for split finding at all levels. Whereas, the local variant re-proposes after each split. The global variant usually requires less proposal steps but uses more candidate points than local variant because candidates are not refined after each split. For deeper trees, usage of local variant may be more appropriate as compared to global variant. The figure below shows the a comparison in accuracy between Basic Exact Greedy and Approximate split finding algorithms with different variant over the number of iterations. We can see that the quantile strategy is able to achieve similar accuracy as the Basic Exact Greedy algorithm given a reasonable approximation level.<br />
<br />
[[File:iterations.png|center|alt=Alt text|Comparison of accuracy between different algorithms]]<br />
<br />
=== Weighted Quantile Sketch ===<br />
<br />
Proposing candidate split points is the most important step in the Approximate Algorithm, it is done by using the percentile of a feature to make candidates distribute evenly on a dataset.<br />
<br />
Formally, we have a dataset<br />
<br />
<math>D_k={(x_{1k},h_1),(x_{2k},h_2),...,(x_{nk},h_n)}</math><br />
<br />
where <math> x_i </math>'s are the feature values of each data point and <math> h_i </math>'s represents the weight of the corresponding feature <math> x_i </math>. <br />
<br />
Then, we can use the following rank function to compute <math>r_k(z)</math>, the proportion of instances whose feature value among <math> (x_i,...,x_k) </math> is smaller than data point <math> z </math>.<br />
<br />
<math>r_k(z) = \frac{1}{\sum_{(x,h) \in D_k} h} \displaystyle\sum_{(x,h) \in D_k, x<z} h,</math><br />
<br />
The objective here is to find candidate split points <math>{s_{k1}, s_{k2}, …, s_{kl}}</math>, such that:<br />
<br />
<math>|r_k(s_{k,j}) – r_k(s_{k,j+1})| < \epsilon, s_{k1} = \displaystyle\min_i x_{ik}, s_{kl} = \displaystyle\max_{i} x_{ik}, \forall i</math><br />
<br />
=== Sparsity-aware Split Finding ===<br />
<br />
== System Design ==<br />
<br />
=== Column Block for Parallel Learning ===<br />
The most time consuming part of tree learning is to get the data into sorted order. To overcome this problem, XGBoost stores the data in blocks where each block performs the sorting operation in parallel. The results are then merged together.<br />
<br />
# For the exact greedy algorithm, XGBoost stores the entire dataset in a single block<br />
#:* Original spase aware algorithm costs: <math>O(Kd∥x∥_0 log(n))</math><br />
#:* Tree boosting on block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(n))</math><br />
#:* Hence, block structure helps to save an additional <math>log(n)</math> factor<br />
# For approximate algorithms, XGBoost stores the dataset in multiple blocks<br />
#:* Original algorithm with binary search costs: <math>O(Kd∥x∥_0 log(q))</math><br />
#:* With block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(B))</math><br />
#:* Hence, block structure helps to save an additional <math>log(q)</math> factor <br />
<br />
K = total number of trees<br /><br />
d = maximum depth of the tree<br /><br />
<math>∥x∥_0</math> = number of non-missing entries in the training data<br /><br />
n = number of rows in the dataset<br /><br />
q = number of proposal candidates in the dataset, usually between 32 to 100<br /><br />
B = maximum number of rows in each block<br />
<br />
[[File: columnblock.png|800px|thumb|center]]<br />
<br />
=== Cache-aware Access ===<br />
The proposed block structure optimizes the computation complexity but requires indirect fetches of gradient statistics by row index. XGBoost optimizes the process by using the following methods.<br />
<br />
# For the exact greedy algorithm, XGBoost uses a cache-aware prefetching algorithm<br />
#:* It stores Gradient and Hessians in the cache to make calculations fast<br />
#:* It runs twice as fast as the naive method when the dataset is large<br />
# For approximate algorithms, XGBoost chooses a specific block size<br />
#:* Choosing a small block size results in inefficient parallelization<br />
#:* Choosing a large block size results in cache misses<br />
#:* Various choices of block size are compared and the results are shown in Figure 9<br />
#:* XGBoost chose <math>2^{16}</math> as the block size<br />
<br />
[[File: blocksize.png|400px|thumb|center]]<br />
<br />
=== Blocks for Out-of-core Computation ===<br />
When the dataset is too large for the cache and main memory, XGBoost utilizes disk spaces as well. Since reading and writing data to the disks are slow, XGBoost optimizes the process by using the following two methods.<br />
<br />
# Block Compression<br />
#:* Blocks are compressed by columns<br />
#:* Although decompressing takes time, it is still faster than reading from the disks<br />
# Block Sharding<br />
#:* If multiple disks are available, data is split into those disks<br />
#:* When the CPU needs data, all the disks can be read at the same time<br />
<br />
== End To End Evaluations ==<br />
=== System Implementation ===<br />
XGBoost is a portable and reusable open-source package. It supports:<br />
* various weighted classification<br />
* various objective functions (rank & user defined)<br />
* popular languages (python, R, Julia)<br />
* data science pipelines (scikit-learn)<br />
* big data stacks (Flink, Spark)<br />
* cloud platform (Tianchi8)<br />
<br />
=== Dataset and Setup ===<br />
<br />
A summary of the 4 datasets used in the experiments is in table 2.<br />
<br />
[[File: table2data.png|500px|thumb|center]]<br />
<br />
The first and last datasets were used specifically to evaluate the impact of sparsity-aware algorithm and the scaling property of the system in the out-of-core and the distributed settings respectively. In all of the experiments, common settings such as maximum depth equal to 8, shrinkage equal to 0.1 and no column subsampling are applied.<br />
<br />
=== Classification ===<br />
A subset (n = 1M) of Higgs Boson dataset was used for classification. The results are shown in Table 3.<br />
<br />
[[File: classification.png|500px|thumb|center]]<br />
<br />
* R’s GBM creates a tree fast by using greedy approach that only expands one branch of a tree but with the cost of lower accuracy<br />
* XGBoost and scikit-learn have better performance than R’s GBM<br />
* XGBoost runs more than 10x faster than scikit-learn in learning a full tree<br />
* Column subsamples give slightly worse performance possibly due to a few important features in this dataset.<br />
<br />
=== Learning to Rank ===<br />
The results in comparing XGBoost with pGBRT are shown in Table 4.<br />
<br />
[[File: rank.png|500px|thumb|center]]<br />
<br />
* XGBoost runs exact greedy algorithm while pGBRT only supports an approximate algorithm<br />
* XGBoost runs faster<br />
* Subsampling column reduces running time and gives higher performance possibly due to preventing overfitting<br />
<br />
=== Out-of-core Experiment ===<br />
An extremely large Criteo dataset was used to evaluate the out-of-core setting. The results are shown in the figure below.<br />
<br />
[[File: outofcore.png|350px|thumb|center]]<br />
<br />
* Compression speed up the computation by a factor of 3<br />
* Sharding into 2 disks further gives 2x speed<br />
<br />
=== Distributed Experiment ===<br />
YARN cluster on EC2 with m3.2xlarge machines was used to evaluate the distributed setting. XGBoost was compared with Spark MLLib and H20.<br />
<br />
* XGBoost can switch to out-of-core setting when the memory runs out, while the baseline systems need to store the data in RAM<br />
* XGBoost runs faster than the baseline systems<br />
* The baseline systems are only able to handle a subset of the data with the given resources while XGBoost was able to scale smoothly to all 1.7B rows<br />
* XGBoost’s performance scales linearly with more machines<br />
* XGBoost is able to handle all 1.7B data with only 4 machines<br />
<br />
== Conclusion ==<br />
<br />
== References ==<br />
[1] R. Bekkerman. The present and the future of the kdd cup competition: an outsider’s perspective. <br />
<br />
[2] R. Bekkerman, M. Bilenko, and J. Langford. Scaling Up Machine Learning: Parallel and Distributed Approaches. Cambridge University Press, New York, NY, USA, 2011. <br />
<br />
[3] J. Bennett and S. Lanning. The netflix prize. In Proceedings of the KDD Cup Workshop 2007, pages 3–6, New York, Aug. 2007.<br />
<br />
[4] L. Breiman. Random forests. Maching Learning, 45(1):5–32, Oct. 2001.<br />
<br />
[5] C. Burges. From ranknet to lambdarank to lambdamart: An overview. Learning, 11:23–581, 2010.<br />
<br />
[6] O. Chapelle and Y. Chang. Yahoo! Learning to Rank Challenge Overview. Journal of Machine Learning Research - W & CP, 14:1–24, 2011.<br />
<br />
[7] T. Chen, H. Li, Q. Yang, and Y. Yu. General functional matrix factorization using gradient boosting. In Proceeding of 30th International Conference on Machine Learning (ICML’13), volume 1, pages 436–444, 2013.<br />
<br />
[8] T. Chen, S. Singh, B. Taskar, and C. Guestrin. Efficient second-order gradient boosting for conditional random fields. In Proceeding of 18th Artificial Intelligence and Statistics Conference (AISTATS’15), volume 1, 2015.<br />
<br />
[9] R.-E. Fan, K.-W. Chang, C.-J. Hsieh, X.-R. Wang, and C.-J. Lin. LIBLINEAR: A library for large linear classification. Journal of Machine Learning Research, 9:1871–1874, 2008.<br />
<br />
[10] J. Friedman. Greedy function approximation: a gradient boosting machine. Annals of Statistics, 29(5):1189–1232, 2001.<br />
<br />
[11] J. Friedman. Stochastic gradient boosting. Computational Statistics & Data Analysis, 38(4):367–378, 2002.<br />
<br />
[12] J. Friedman, T. Hastie, and R. Tibshirani. Additive logistic regression: a statistical view of boosting. Annals of Statistics, 28(2):337–407, 2000.<br />
<br />
[13] J. H. Friedman and B. E. Popescu. Importance sampled learning ensembles, 2003.<br />
<br />
[14] M. Greenwald and S. Khanna. Space-efficient online computation of quantile summaries. In Proceedings of the 2001 ACM SIGMOD International Conference on Management of Data, pages 58–66, 2001.<br />
<br />
[15] X. He, J. Pan, O. Jin, T. Xu, B. Liu, T. Xu, Y. Shi, A. Atallah, R. Herbrich, S. Bowers, and J. Q. n. Candela. Practical lessons from predicting clicks on ads at facebook. In Proceedings of the Eighth International Workshop on Data Mining for Online Advertising, ADKDD’14, 2014.<br />
<br />
[16] P. Li. Robust Logitboost and adaptive base class (ABC) Logitboost. In Proceedings of the Twenty-Sixth Conference Annual Conference on Uncertainty in Artificial Intelligence (UAI’10), pages 302–311, 2010.<br />
<br />
[17] P. Li, Q. Wu, and C. J. Burges. Mcrank: Learning to rank using multiple classification and gradient boosting. In Advances in Neural Information Processing Systems 20, pages 897–904. 2008.<br />
<br />
[18] X. Meng, J. Bradley, B. Yavuz, E. Sparks, S. Venkataraman, D. Liu, J. Freeman, D. Tsai, M. Amde, S. Owen, D. Xin, R. Xin, M. J. Franklin, R. Zadeh, M. Zaharia, and A. Talwalkar. MLlib: Machine learning in apache spark. Journal of Machine Learning Research, 17(34):1–7, 2016.<br />
<br />
[19] B. Panda, J. S. Herbach, S. Basu, and R. J. Bayardo. Planet: Massively parallel learning of tree ensembles with mapreduce. Proceeding of VLDB Endowment, 2(2):1426–1437, Aug. 2009.<br />
<br />
[20] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.<br />
<br />
[21] G. Ridgeway. Generalized Boosted Models: A guide to the gbm package.<br />
<br />
[22] S. Tyree, K. Weinberger, K. Agrawal, and J. Paykin. Parallel boosted regression trees for web search ranking. In Proceedings of the 20th international conference on World wide web, pages 387–396. ACM, 2011.<br />
<br />
[23] J. Ye, J.-H. Chow, J. Chen, and Z. Zheng. Stochastic gradient boosted distributed decision trees. In Proceedings of the 18th ACM Conference on Information and Knowledge Management, CIKM ’09.<br />
<br />
[24] Q. Zhang and W. Wang. A fast algorithm for approximate quantiles in high speed data streams. In Proceedings of the 19th International Conference on Scientific and Statistical Database Management, 2007.<br />
<br />
[25] T. Zhang and R. Johnson. Learning nonlinear functions using regularized greedy forest. IEEE Transactions on Pattern Analysis and Machine Intelligence, 36(5), 2014.</div>Cwlokehttp://wiki.math.uwaterloo.ca/statwiki/index.php?title=XGBoost&diff=51110XGBoost2021-11-29T04:36:57Z<p>Cwloke: /* Weighted Quantile Sketch */</p>
<hr />
<div>== Presented by == <br />
* Chun Waan Loke<br />
* Peter Chong<br />
* Clarice Osmond<br />
* Zhilong Li<br />
<br />
== Introduction ==<br />
<br />
== Tree Boosting In A Nutshell ==<br />
The author reviews gradient tree boosting in this section.<br />
=== Regularized Learning Objective ===<br />
The author first gives the prediction equation (1) and the regularized objective (2).<br><br />
<br><br />
(1) The additive prediction model is given as<br><br />
<math>\hat{y_i}=\sum_{k=1}^{K}f_k(x_i), f_k \in \mathcal{F} </math> <br><br />
where each <math>f_k</math> corresponds to an independent tree structure with its weights, and <math>\mathcal{F}</math> is the "space of regression trees"<br><br />
<br><br />
(2) The regularized objective to be minimized is given as<br><br />
<math>\mathcal{L}=\sum_{i}l(\hat{y_i},y_i)+\sum_k \Omega(f_k)</math> where <math>\Omega(f)=\gamma T+\frac{1}{2}\lambda ||\omega||^2</math> <br><br />
The first term <math>l</math> is a differentiable convex loss function that calculates the measures between <math>\hat{y}</math> and <math>y</math>.<br><br />
The second term <math>\Omega</math> penalizes on the complexity of model (the <math>f_k</math>'s). For a given tree (<math>f_k</math>), <math>T</math> is the number of leaves, and <math>\omega</math> is the leaf weights.<br><br />
The L1 regularization term <math>\gamma T</math> encourages the tree to be small, and the L2 regularization term <math>\frac{1}{2}\lambda ||\omega||^2</math> encourages the tree to have small weights.<br><br />
<br />
=== Gradient Tree Boosting ===<br />
Let <math>\hat{y_i}^{(t)}</math> be the prediction of <math>y_i</math> at the t-th iteration.<br><br />
Since the prediction equation is simply additive, <math>{\hat y_i}^{(t)}=\hat{y_{i}}^{(t-1)}+f_t(x_i)</math><br><br />
Using this equation and 2nd order Taylor approximation on the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> gives <br><br />
\begin{align}<br />
\mathcal{L}^{(t)}&=\sum_{i}^{n}l(y_i,\hat{y_i}^{(t-1)}+f_t(x_i))+\Omega(f_t)\\<br />
&\simeq \sum_{i}^{n}[l(y_i,\hat{y_i}^{(t-1)})+g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
\end{align}<br />
where <math>g_i</math> and <math>h_i</math> are the first and second derivative of the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> with repspect to the term <math>\hat{y}^{(t-1)}</math><br><br />
We can simplify this objective by removing the constant term <math>l(y_i,\hat{y_i}^{(t-1)})</math>.<br><br />
Define <math>I_j=\{i|q(x_i)=j\}</math>, where <math>q</math> is the tree structure. Since every <math>x_i</math> is mapped by <math>q</math> to some leaf <math>j</math>, going through every <math>x_i</math> is equivalent to going through each leaf j of the structure.<br />
\begin{align}<br />
\tilde{\mathcal{L}}^{(t)}&= \sum_{i}^{n}[g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
&= \sum_{j=1}^{T}[(\sum_{i \in I_j}g_i)\omega_j+\frac{1}{2}(\sum_{i \in I_j}h_i+\lambda)\omega_j^2]+\gamma T<br />
\end{align}<br />
Then for a fixed structure <math>q</math>, the optimal weight of leaf <math>j</math> and the optimal objective value are given as<br><br />
\begin{align}<br />
\omega_j^{*} &= -\frac{\sum_{i \in I_j}g_i}{\sum_{i \in I_j}h_i+\lambda}\\<br />
\tilde{\mathcal{L}}^{(t)}(q) &=-\frac{1}{2}\sum_{j=1}^{T}\frac{(\sum_{i \in I_j}g_i)^2}{\sum_{i \in I_j}h_i+\lambda}+\gamma T<br />
\end{align} <br />
[[File:Structure Score Calculation.png|frame|center|alt=Alt text|Structure Score Calculation]]<br />
Instead of enumerating through all possible tree structures q, a greedy algorithm of iteratively adding branches is used.<br><br />
Let <math>I_L</math> and <math>I_R</math> be the instance sets of left and right nodes after split and let <math>I=I_L\cup I_R</math>.<br><br />
The loss reduction after split is given by<br><br />
\begin{align}<br />
\tilde{\mathcal{L}}_{\text{split}} &=\frac{1}{2}[\frac{(\sum_{i \in I_L}g_i)^2}{\sum_{i \in I_L}h_i+\lambda}+\frac{(\sum_{i \in I_R}g_i)^2}{\sum_{i \in I_R}h_i+\lambda}-\frac{(\sum_{i \in I}g_i)^2}{\sum_{i \in I}h_i+\lambda}]+\gamma<br />
\end{align}<br />
=== Shrinkage and Column Subsampling ===<br />
The author also mentioned two other methods in order to avoid over-fitting.<br><br />
(1) Shrinkage. Similar to the learning rate in stochastic optimization, a new weight is added to each tree boosting to reduce the influence of a single tree and leave space for future trees.<br><br />
(2) Column (feature) subsampling. In the paper, the author only mentioned that this technique speeds up parallel algorithm used in later sections.<br />
<br />
== Split Finding Algorithms ==<br />
<br />
It is very important to find the best split for tree learning to perform well. Here are a few split finding algorithms mentioned in the paper:<br />
<br />
=== Basic Exact Greedy Algorithm ===<br />
<br />
The basic exact greedy algorithm is a split finding algorithm that is computationally expensive because it enumerates over all the possible splits for continuous features. It is impossible to be done efficiently when the memory is not enough to hold the data needed. A way to carry out this algorithm efficiently is to sort the data according to feature values and visit the data in order to accumulate the gradient statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_1.png|center|alt=Alt text|Basic Exact Greedy Algorithm]]<br />
<br />
=== Approximate Algorithm ===<br />
<br />
The paper introduced a more efficient algorithm compared to Basic Exact Greedy Algorithm which is the Approximate Algorithm. The Approximate Algorithm first proposes candidate splitting points according to percentiles of feature distribution. It then maps the continuous features into buckets split by candidate points, aggregates the statistics and finds the best solution among proposals based on the aggregated statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_2.png|center|alt=Alt text|Approximate Algorithm]]<br />
<br />
There are also two variants to this algorithm, the global variant proposes all the candidate splits during the initial phase of tree construction and uses the same proposals for split finding at all levels. Whereas, the local variant re-proposes after each split. The global variant usually requires less proposal steps but uses more candidate points than local variant because candidates are not refined after each split. For deeper trees, usage of local variant may be more appropriate as compared to global variant. The figure below shows the a comparison in accuracy between Basic Exact Greedy and Approximate split finding algorithms with different variant over the number of iterations. We can see that the quantile strategy is able to achieve similar accuracy as the Basic Exact Greedy algorithm given a reasonable approximation level.<br />
<br />
[[File:iterations.png|center|alt=Alt text|Comparison of accuracy between different algorithms]]<br />
<br />
=== Weighted Quantile Sketch ===<br />
<br />
Proposing candidate split points is the most important step in the Approximate Algorithm, it is done by using the percentile of a feature to make candidates distribute evenly on a dataset.<br />
<br />
Formally, we have a dataset<br />
<br />
<math>D_k={(x_{1k},h_1),(x_{2k},h_2),...,(x_{nk},h_n)}</math><br />
<br />
where <math> x_i </math>'s are the feature values of each data point and <math> h_i </math>'s represents the weight of the corresponding feature <math> x_i </math>. <br />
<br />
Then, we can use the following rank function to compute <math>r_k(z)</math>, the proportion of instances whose feature value among <math> (x_i,...,x_k) </math> is smaller than data point <math> z </math>.<br />
<br />
<math>r_k(z) = \frac{1}{\sum_{(x,h) \in D_k} h} \displaystyle\sum_{(x,h) \in D_k, x<z} h,</math><br />
<br />
The objective here is to find candidate split points <math>{s_{k1}, s_{k2}, …, s_{kl}}</math>, such that:<br />
<br />
<math>|r_k(s_{k,j}) – r_k(s_{k,j+1})| < \epsilon, s_{k1} = \min_i x_{ik}, s_{kl} = \max_{i} x_{ik}, \forall i</math><br />
<br />
=== Sparsity-aware Split Finding ===<br />
<br />
== System Design ==<br />
<br />
=== Column Block for Parallel Learning ===<br />
The most time consuming part of tree learning is to get the data into sorted order. To overcome this problem, XGBoost stores the data in blocks where each block performs the sorting operation in parallel. The results are then merged together.<br />
<br />
# For the exact greedy algorithm, XGBoost stores the entire dataset in a single block<br />
#:* Original spase aware algorithm costs: <math>O(Kd∥x∥_0 log(n))</math><br />
#:* Tree boosting on block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(n))</math><br />
#:* Hence, block structure helps to save an additional <math>log(n)</math> factor<br />
# For approximate algorithms, XGBoost stores the dataset in multiple blocks<br />
#:* Original algorithm with binary search costs: <math>O(Kd∥x∥_0 log(q))</math><br />
#:* With block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(B))</math><br />
#:* Hence, block structure helps to save an additional <math>log(q)</math> factor <br />
<br />
K = total number of trees<br /><br />
d = maximum depth of the tree<br /><br />
<math>∥x∥_0</math> = number of non-missing entries in the training data<br /><br />
n = number of rows in the dataset<br /><br />
q = number of proposal candidates in the dataset, usually between 32 to 100<br /><br />
B = maximum number of rows in each block<br />
<br />
[[File: columnblock.png|800px|thumb|center]]<br />
<br />
=== Cache-aware Access ===<br />
The proposed block structure optimizes the computation complexity but requires indirect fetches of gradient statistics by row index. XGBoost optimizes the process by using the following methods.<br />
<br />
# For the exact greedy algorithm, XGBoost uses a cache-aware prefetching algorithm<br />
#:* It stores Gradient and Hessians in the cache to make calculations fast<br />
#:* It runs twice as fast as the naive method when the dataset is large<br />
# For approximate algorithms, XGBoost chooses a specific block size<br />
#:* Choosing a small block size results in inefficient parallelization<br />
#:* Choosing a large block size results in cache misses<br />
#:* Various choices of block size are compared and the results are shown in Figure 9<br />
#:* XGBoost chose <math>2^{16}</math> as the block size<br />
<br />
[[File: blocksize.png|400px|thumb|center]]<br />
<br />
=== Blocks for Out-of-core Computation ===<br />
When the dataset is too large for the cache and main memory, XGBoost utilizes disk spaces as well. Since reading and writing data to the disks are slow, XGBoost optimizes the process by using the following two methods.<br />
<br />
# Block Compression<br />
#:* Blocks are compressed by columns<br />
#:* Although decompressing takes time, it is still faster than reading from the disks<br />
# Block Sharding<br />
#:* If multiple disks are available, data is split into those disks<br />
#:* When the CPU needs data, all the disks can be read at the same time<br />
<br />
== End To End Evaluations ==<br />
=== System Implementation ===<br />
XGBoost is a portable and reusable open-source package. It supports:<br />
* various weighted classification<br />
* various objective functions (rank & user defined)<br />
* popular languages (python, R, Julia)<br />
* data science pipelines (scikit-learn)<br />
* big data stacks (Flink, Spark)<br />
* cloud platform (Tianchi8)<br />
<br />
=== Dataset and Setup ===<br />
<br />
A summary of the 4 datasets used in the experiments is in table 2.<br />
<br />
[[File: table2data.png|500px|thumb|center]]<br />
<br />
The first and last datasets were used specifically to evaluate the impact of sparsity-aware algorithm and the scaling property of the system in the out-of-core and the distributed settings respectively. In all of the experiments, common settings such as maximum depth equal to 8, shrinkage equal to 0.1 and no column subsampling are applied.<br />
<br />
=== Classification ===<br />
A subset (n = 1M) of Higgs Boson dataset was used for classification. The results are shown in Table 3.<br />
<br />
[[File: classification.png|500px|thumb|center]]<br />
<br />
* R’s GBM creates a tree fast by using greedy approach that only expands one branch of a tree but with the cost of lower accuracy<br />
* XGBoost and scikit-learn have better performance than R’s GBM<br />
* XGBoost runs more than 10x faster than scikit-learn in learning a full tree<br />
* Column subsamples give slightly worse performance possibly due to a few important features in this dataset.<br />
<br />
=== Learning to Rank ===<br />
The results in comparing XGBoost with pGBRT are shown in Table 4.<br />
<br />
[[File: rank.png|500px|thumb|center]]<br />
<br />
* XGBoost runs exact greedy algorithm while pGBRT only supports an approximate algorithm<br />
* XGBoost runs faster<br />
* Subsampling column reduces running time and gives higher performance possibly due to preventing overfitting<br />
<br />
=== Out-of-core Experiment ===<br />
An extremely large Criteo dataset was used to evaluate the out-of-core setting. The results are shown in the figure below.<br />
<br />
[[File: outofcore.png|350px|thumb|center]]<br />
<br />
* Compression speed up the computation by a factor of 3<br />
* Sharding into 2 disks further gives 2x speed<br />
<br />
=== Distributed Experiment ===<br />
YARN cluster on EC2 with m3.2xlarge machines was used to evaluate the distributed setting. XGBoost was compared with Spark MLLib and H20.<br />
<br />
* XGBoost can switch to out-of-core setting when the memory runs out, while the baseline systems need to store the data in RAM<br />
* XGBoost runs faster than the baseline systems<br />
* The baseline systems are only able to handle a subset of the data with the given resources while XGBoost was able to scale smoothly to all 1.7B rows<br />
* XGBoost’s performance scales linearly with more machines<br />
* XGBoost is able to handle all 1.7B data with only 4 machines<br />
<br />
== Conclusion ==<br />
<br />
== References ==<br />
[1] R. Bekkerman. The present and the future of the kdd cup competition: an outsider’s perspective. <br />
<br />
[2] R. Bekkerman, M. Bilenko, and J. Langford. Scaling Up Machine Learning: Parallel and Distributed Approaches. Cambridge University Press, New York, NY, USA, 2011. <br />
<br />
[3] J. Bennett and S. Lanning. The netflix prize. In Proceedings of the KDD Cup Workshop 2007, pages 3–6, New York, Aug. 2007.<br />
<br />
[4] L. Breiman. Random forests. Maching Learning, 45(1):5–32, Oct. 2001.<br />
<br />
[5] C. Burges. From ranknet to lambdarank to lambdamart: An overview. Learning, 11:23–581, 2010.<br />
<br />
[6] O. Chapelle and Y. Chang. Yahoo! Learning to Rank Challenge Overview. Journal of Machine Learning Research - W & CP, 14:1–24, 2011.<br />
<br />
[7] T. Chen, H. Li, Q. Yang, and Y. Yu. General functional matrix factorization using gradient boosting. In Proceeding of 30th International Conference on Machine Learning (ICML’13), volume 1, pages 436–444, 2013.<br />
<br />
[8] T. Chen, S. Singh, B. Taskar, and C. Guestrin. Efficient second-order gradient boosting for conditional random fields. In Proceeding of 18th Artificial Intelligence and Statistics Conference (AISTATS’15), volume 1, 2015.<br />
<br />
[9] R.-E. Fan, K.-W. Chang, C.-J. Hsieh, X.-R. Wang, and C.-J. Lin. LIBLINEAR: A library for large linear classification. Journal of Machine Learning Research, 9:1871–1874, 2008.<br />
<br />
[10] J. Friedman. Greedy function approximation: a gradient boosting machine. Annals of Statistics, 29(5):1189–1232, 2001.<br />
<br />
[11] J. Friedman. Stochastic gradient boosting. Computational Statistics & Data Analysis, 38(4):367–378, 2002.<br />
<br />
[12] J. Friedman, T. Hastie, and R. Tibshirani. Additive logistic regression: a statistical view of boosting. Annals of Statistics, 28(2):337–407, 2000.<br />
<br />
[13] J. H. Friedman and B. E. Popescu. Importance sampled learning ensembles, 2003.<br />
<br />
[14] M. Greenwald and S. Khanna. Space-efficient online computation of quantile summaries. In Proceedings of the 2001 ACM SIGMOD International Conference on Management of Data, pages 58–66, 2001.<br />
<br />
[15] X. He, J. Pan, O. Jin, T. Xu, B. Liu, T. Xu, Y. Shi, A. Atallah, R. Herbrich, S. Bowers, and J. Q. n. Candela. Practical lessons from predicting clicks on ads at facebook. In Proceedings of the Eighth International Workshop on Data Mining for Online Advertising, ADKDD’14, 2014.<br />
<br />
[16] P. Li. Robust Logitboost and adaptive base class (ABC) Logitboost. In Proceedings of the Twenty-Sixth Conference Annual Conference on Uncertainty in Artificial Intelligence (UAI’10), pages 302–311, 2010.<br />
<br />
[17] P. Li, Q. Wu, and C. J. Burges. Mcrank: Learning to rank using multiple classification and gradient boosting. In Advances in Neural Information Processing Systems 20, pages 897–904. 2008.<br />
<br />
[18] X. Meng, J. Bradley, B. Yavuz, E. Sparks, S. Venkataraman, D. Liu, J. Freeman, D. Tsai, M. Amde, S. Owen, D. Xin, R. Xin, M. J. Franklin, R. Zadeh, M. Zaharia, and A. Talwalkar. MLlib: Machine learning in apache spark. Journal of Machine Learning Research, 17(34):1–7, 2016.<br />
<br />
[19] B. Panda, J. S. Herbach, S. Basu, and R. J. Bayardo. Planet: Massively parallel learning of tree ensembles with mapreduce. Proceeding of VLDB Endowment, 2(2):1426–1437, Aug. 2009.<br />
<br />
[20] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.<br />
<br />
[21] G. Ridgeway. Generalized Boosted Models: A guide to the gbm package.<br />
<br />
[22] S. Tyree, K. Weinberger, K. Agrawal, and J. Paykin. Parallel boosted regression trees for web search ranking. In Proceedings of the 20th international conference on World wide web, pages 387–396. ACM, 2011.<br />
<br />
[23] J. Ye, J.-H. Chow, J. Chen, and Z. Zheng. Stochastic gradient boosted distributed decision trees. In Proceedings of the 18th ACM Conference on Information and Knowledge Management, CIKM ’09.<br />
<br />
[24] Q. Zhang and W. Wang. A fast algorithm for approximate quantiles in high speed data streams. In Proceedings of the 19th International Conference on Scientific and Statistical Database Management, 2007.<br />
<br />
[25] T. Zhang and R. Johnson. Learning nonlinear functions using regularized greedy forest. IEEE Transactions on Pattern Analysis and Machine Intelligence, 36(5), 2014.</div>Cwlokehttp://wiki.math.uwaterloo.ca/statwiki/index.php?title=XGBoost&diff=51109XGBoost2021-11-29T04:35:59Z<p>Cwloke: /* Weighted Quantile Sketch */</p>
<hr />
<div>== Presented by == <br />
* Chun Waan Loke<br />
* Peter Chong<br />
* Clarice Osmond<br />
* Zhilong Li<br />
<br />
== Introduction ==<br />
<br />
== Tree Boosting In A Nutshell ==<br />
The author reviews gradient tree boosting in this section.<br />
=== Regularized Learning Objective ===<br />
The author first gives the prediction equation (1) and the regularized objective (2).<br><br />
<br><br />
(1) The additive prediction model is given as<br><br />
<math>\hat{y_i}=\sum_{k=1}^{K}f_k(x_i), f_k \in \mathcal{F} </math> <br><br />
where each <math>f_k</math> corresponds to an independent tree structure with its weights, and <math>\mathcal{F}</math> is the "space of regression trees"<br><br />
<br><br />
(2) The regularized objective to be minimized is given as<br><br />
<math>\mathcal{L}=\sum_{i}l(\hat{y_i},y_i)+\sum_k \Omega(f_k)</math> where <math>\Omega(f)=\gamma T+\frac{1}{2}\lambda ||\omega||^2</math> <br><br />
The first term <math>l</math> is a differentiable convex loss function that calculates the measures between <math>\hat{y}</math> and <math>y</math>.<br><br />
The second term <math>\Omega</math> penalizes on the complexity of model (the <math>f_k</math>'s). For a given tree (<math>f_k</math>), <math>T</math> is the number of leaves, and <math>\omega</math> is the leaf weights.<br><br />
The L1 regularization term <math>\gamma T</math> encourages the tree to be small, and the L2 regularization term <math>\frac{1}{2}\lambda ||\omega||^2</math> encourages the tree to have small weights.<br><br />
<br />
=== Gradient Tree Boosting ===<br />
Let <math>\hat{y_i}^{(t)}</math> be the prediction of <math>y_i</math> at the t-th iteration.<br><br />
Since the prediction equation is simply additive, <math>{\hat y_i}^{(t)}=\hat{y_{i}}^{(t-1)}+f_t(x_i)</math><br><br />
Using this equation and 2nd order Taylor approximation on the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> gives <br><br />
\begin{align}<br />
\mathcal{L}^{(t)}&=\sum_{i}^{n}l(y_i,\hat{y_i}^{(t-1)}+f_t(x_i))+\Omega(f_t)\\<br />
&\simeq \sum_{i}^{n}[l(y_i,\hat{y_i}^{(t-1)})+g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
\end{align}<br />
where <math>g_i</math> and <math>h_i</math> are the first and second derivative of the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> with repspect to the term <math>\hat{y}^{(t-1)}</math><br><br />
We can simplify this objective by removing the constant term <math>l(y_i,\hat{y_i}^{(t-1)})</math>.<br><br />
Define <math>I_j=\{i|q(x_i)=j\}</math>, where <math>q</math> is the tree structure. Since every <math>x_i</math> is mapped by <math>q</math> to some leaf <math>j</math>, going through every <math>x_i</math> is equivalent to going through each leaf j of the structure.<br />
\begin{align}<br />
\tilde{\mathcal{L}}^{(t)}&= \sum_{i}^{n}[g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
&= \sum_{j=1}^{T}[(\sum_{i \in I_j}g_i)\omega_j+\frac{1}{2}(\sum_{i \in I_j}h_i+\lambda)\omega_j^2]+\gamma T<br />
\end{align}<br />
Then for a fixed structure <math>q</math>, the optimal weight of leaf <math>j</math> and the optimal objective value are given as<br><br />
\begin{align}<br />
\omega_j^{*} &= -\frac{\sum_{i \in I_j}g_i}{\sum_{i \in I_j}h_i+\lambda}\\<br />
\tilde{\mathcal{L}}^{(t)}(q) &=-\frac{1}{2}\sum_{j=1}^{T}\frac{(\sum_{i \in I_j}g_i)^2}{\sum_{i \in I_j}h_i+\lambda}+\gamma T<br />
\end{align} <br />
[[File:Structure Score Calculation.png|frame|center|alt=Alt text|Structure Score Calculation]]<br />
Instead of enumerating through all possible tree structures q, a greedy algorithm of iteratively adding branches is used.<br><br />
Let <math>I_L</math> and <math>I_R</math> be the instance sets of left and right nodes after split and let <math>I=I_L\cup I_R</math>.<br><br />
The loss reduction after split is given by<br><br />
\begin{align}<br />
\tilde{\mathcal{L}}_{\text{split}} &=\frac{1}{2}[\frac{(\sum_{i \in I_L}g_i)^2}{\sum_{i \in I_L}h_i+\lambda}+\frac{(\sum_{i \in I_R}g_i)^2}{\sum_{i \in I_R}h_i+\lambda}-\frac{(\sum_{i \in I}g_i)^2}{\sum_{i \in I}h_i+\lambda}]+\gamma<br />
\end{align}<br />
=== Shrinkage and Column Subsampling ===<br />
The author also mentioned two other methods in order to avoid over-fitting.<br><br />
(1) Shrinkage. Similar to the learning rate in stochastic optimization, a new weight is added to each tree boosting to reduce the influence of a single tree and leave space for future trees.<br><br />
(2) Column (feature) subsampling. In the paper, the author only mentioned that this technique speeds up parallel algorithm used in later sections.<br />
<br />
== Split Finding Algorithms ==<br />
<br />
It is very important to find the best split for tree learning to perform well. Here are a few split finding algorithms mentioned in the paper:<br />
<br />
=== Basic Exact Greedy Algorithm ===<br />
<br />
The basic exact greedy algorithm is a split finding algorithm that is computationally expensive because it enumerates over all the possible splits for continuous features. It is impossible to be done efficiently when the memory is not enough to hold the data needed. A way to carry out this algorithm efficiently is to sort the data according to feature values and visit the data in order to accumulate the gradient statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_1.png|center|alt=Alt text|Basic Exact Greedy Algorithm]]<br />
<br />
=== Approximate Algorithm ===<br />
<br />
The paper introduced a more efficient algorithm compared to Basic Exact Greedy Algorithm which is the Approximate Algorithm. The Approximate Algorithm first proposes candidate splitting points according to percentiles of feature distribution. It then maps the continuous features into buckets split by candidate points, aggregates the statistics and finds the best solution among proposals based on the aggregated statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_2.png|center|alt=Alt text|Approximate Algorithm]]<br />
<br />
There are also two variants to this algorithm, the global variant proposes all the candidate splits during the initial phase of tree construction and uses the same proposals for split finding at all levels. Whereas, the local variant re-proposes after each split. The global variant usually requires less proposal steps but uses more candidate points than local variant because candidates are not refined after each split. For deeper trees, usage of local variant may be more appropriate as compared to global variant. The figure below shows the a comparison in accuracy between Basic Exact Greedy and Approximate split finding algorithms with different variant over the number of iterations. We can see that the quantile strategy is able to achieve similar accuracy as the Basic Exact Greedy algorithm given a reasonable approximation level.<br />
<br />
[[File:iterations.png|center|alt=Alt text|Comparison of accuracy between different algorithms]]<br />
<br />
=== Weighted Quantile Sketch ===<br />
<br />
Proposing candidate split points is the most important step in the Approximate Algorithm, it is done by using the percentile of a feature to make candidates distribute evenly on a dataset.<br />
<br />
Formally, we have a dataset<br />
<br />
<math>D_k={(x_{1k},h_1),(x_{2k},h_2),...,(x_{nk},h_n)}</math><br />
<br />
where <math> x_i </math>'s are the feature values of each data point and <math> h_i </math>'s represents the weight of the corresponding feature <math> x_i </math>. <br />
<br />
Then, we can use the following rank function to compute <math>r_k(z)</math>, the proportion of instances whose feature value among <math> (x_i,...,x_k) </math> is smaller than data point <math> z </math>.<br />
<br />
<math>r_k(z) = \frac{1}{\sum_{(x,h) \in D_k} h} \displaystyle\sum_{(x,h) \in D_k, x<z} h,</math><br />
<br />
The objective here is to find candidate split points <math>{s_{k1}, s_{k2}, …, s_{kl}}</math>, such that:<br />
<br />
<math>|r_k(s_{k,j}) – r_k(s_{k,j+1})| < \epsilon, s_{k1} = \min_{\{i}} x_{ik}, s_{kl} = \max_{i} x_{ik}, \forall i</math><br />
<br />
=== Sparsity-aware Split Finding ===<br />
<br />
== System Design ==<br />
<br />
=== Column Block for Parallel Learning ===<br />
The most time consuming part of tree learning is to get the data into sorted order. To overcome this problem, XGBoost stores the data in blocks where each block performs the sorting operation in parallel. The results are then merged together.<br />
<br />
# For the exact greedy algorithm, XGBoost stores the entire dataset in a single block<br />
#:* Original spase aware algorithm costs: <math>O(Kd∥x∥_0 log(n))</math><br />
#:* Tree boosting on block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(n))</math><br />
#:* Hence, block structure helps to save an additional <math>log(n)</math> factor<br />
# For approximate algorithms, XGBoost stores the dataset in multiple blocks<br />
#:* Original algorithm with binary search costs: <math>O(Kd∥x∥_0 log(q))</math><br />
#:* With block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(B))</math><br />
#:* Hence, block structure helps to save an additional <math>log(q)</math> factor <br />
<br />
K = total number of trees<br /><br />
d = maximum depth of the tree<br /><br />
<math>∥x∥_0</math> = number of non-missing entries in the training data<br /><br />
n = number of rows in the dataset<br /><br />
q = number of proposal candidates in the dataset, usually between 32 to 100<br /><br />
B = maximum number of rows in each block<br />
<br />
[[File: columnblock.png|800px|thumb|center]]<br />
<br />
=== Cache-aware Access ===<br />
The proposed block structure optimizes the computation complexity but requires indirect fetches of gradient statistics by row index. XGBoost optimizes the process by using the following methods.<br />
<br />
# For the exact greedy algorithm, XGBoost uses a cache-aware prefetching algorithm<br />
#:* It stores Gradient and Hessians in the cache to make calculations fast<br />
#:* It runs twice as fast as the naive method when the dataset is large<br />
# For approximate algorithms, XGBoost chooses a specific block size<br />
#:* Choosing a small block size results in inefficient parallelization<br />
#:* Choosing a large block size results in cache misses<br />
#:* Various choices of block size are compared and the results are shown in Figure 9<br />
#:* XGBoost chose <math>2^{16}</math> as the block size<br />
<br />
[[File: blocksize.png|400px|thumb|center]]<br />
<br />
=== Blocks for Out-of-core Computation ===<br />
When the dataset is too large for the cache and main memory, XGBoost utilizes disk spaces as well. Since reading and writing data to the disks are slow, XGBoost optimizes the process by using the following two methods.<br />
<br />
# Block Compression<br />
#:* Blocks are compressed by columns<br />
#:* Although decompressing takes time, it is still faster than reading from the disks<br />
# Block Sharding<br />
#:* If multiple disks are available, data is split into those disks<br />
#:* When the CPU needs data, all the disks can be read at the same time<br />
<br />
== End To End Evaluations ==<br />
=== System Implementation ===<br />
XGBoost is a portable and reusable open-source package. It supports:<br />
* various weighted classification<br />
* various objective functions (rank & user defined)<br />
* popular languages (python, R, Julia)<br />
* data science pipelines (scikit-learn)<br />
* big data stacks (Flink, Spark)<br />
* cloud platform (Tianchi8)<br />
<br />
=== Dataset and Setup ===<br />
<br />
A summary of the 4 datasets used in the experiments is in table 2.<br />
<br />
[[File: table2data.png|500px|thumb|center]]<br />
<br />
The first and last datasets were used specifically to evaluate the impact of sparsity-aware algorithm and the scaling property of the system in the out-of-core and the distributed settings respectively. In all of the experiments, common settings such as maximum depth equal to 8, shrinkage equal to 0.1 and no column subsampling are applied.<br />
<br />
=== Classification ===<br />
A subset (n = 1M) of Higgs Boson dataset was used for classification. The results are shown in Table 3.<br />
<br />
[[File: classification.png|500px|thumb|center]]<br />
<br />
* R’s GBM creates a tree fast by using greedy approach that only expands one branch of a tree but with the cost of lower accuracy<br />
* XGBoost and scikit-learn have better performance than R’s GBM<br />
* XGBoost runs more than 10x faster than scikit-learn in learning a full tree<br />
* Column subsamples give slightly worse performance possibly due to a few important features in this dataset.<br />
<br />
=== Learning to Rank ===<br />
The results in comparing XGBoost with pGBRT are shown in Table 4.<br />
<br />
[[File: rank.png|500px|thumb|center]]<br />
<br />
* XGBoost runs exact greedy algorithm while pGBRT only supports an approximate algorithm<br />
* XGBoost runs faster<br />
* Subsampling column reduces running time and gives higher performance possibly due to preventing overfitting<br />
<br />
=== Out-of-core Experiment ===<br />
An extremely large Criteo dataset was used to evaluate the out-of-core setting. The results are shown in the figure below.<br />
<br />
[[File: outofcore.png|350px|thumb|center]]<br />
<br />
* Compression speed up the computation by a factor of 3<br />
* Sharding into 2 disks further gives 2x speed<br />
<br />
=== Distributed Experiment ===<br />
YARN cluster on EC2 with m3.2xlarge machines was used to evaluate the distributed setting. XGBoost was compared with Spark MLLib and H20.<br />
<br />
* XGBoost can switch to out-of-core setting when the memory runs out, while the baseline systems need to store the data in RAM<br />
* XGBoost runs faster than the baseline systems<br />
* The baseline systems are only able to handle a subset of the data with the given resources while XGBoost was able to scale smoothly to all 1.7B rows<br />
* XGBoost’s performance scales linearly with more machines<br />
* XGBoost is able to handle all 1.7B data with only 4 machines<br />
<br />
== Conclusion ==<br />
<br />
== References ==<br />
[1] R. Bekkerman. The present and the future of the kdd cup competition: an outsider’s perspective. <br />
<br />
[2] R. Bekkerman, M. Bilenko, and J. Langford. Scaling Up Machine Learning: Parallel and Distributed Approaches. Cambridge University Press, New York, NY, USA, 2011. <br />
<br />
[3] J. Bennett and S. Lanning. The netflix prize. In Proceedings of the KDD Cup Workshop 2007, pages 3–6, New York, Aug. 2007.<br />
<br />
[4] L. Breiman. Random forests. Maching Learning, 45(1):5–32, Oct. 2001.<br />
<br />
[5] C. Burges. From ranknet to lambdarank to lambdamart: An overview. Learning, 11:23–581, 2010.<br />
<br />
[6] O. Chapelle and Y. Chang. Yahoo! Learning to Rank Challenge Overview. Journal of Machine Learning Research - W & CP, 14:1–24, 2011.<br />
<br />
[7] T. Chen, H. Li, Q. Yang, and Y. Yu. General functional matrix factorization using gradient boosting. In Proceeding of 30th International Conference on Machine Learning (ICML’13), volume 1, pages 436–444, 2013.<br />
<br />
[8] T. Chen, S. Singh, B. Taskar, and C. Guestrin. Efficient second-order gradient boosting for conditional random fields. In Proceeding of 18th Artificial Intelligence and Statistics Conference (AISTATS’15), volume 1, 2015.<br />
<br />
[9] R.-E. Fan, K.-W. Chang, C.-J. Hsieh, X.-R. Wang, and C.-J. Lin. LIBLINEAR: A library for large linear classification. Journal of Machine Learning Research, 9:1871–1874, 2008.<br />
<br />
[10] J. Friedman. Greedy function approximation: a gradient boosting machine. Annals of Statistics, 29(5):1189–1232, 2001.<br />
<br />
[11] J. Friedman. Stochastic gradient boosting. Computational Statistics & Data Analysis, 38(4):367–378, 2002.<br />
<br />
[12] J. Friedman, T. Hastie, and R. Tibshirani. Additive logistic regression: a statistical view of boosting. Annals of Statistics, 28(2):337–407, 2000.<br />
<br />
[13] J. H. Friedman and B. E. Popescu. Importance sampled learning ensembles, 2003.<br />
<br />
[14] M. Greenwald and S. Khanna. Space-efficient online computation of quantile summaries. In Proceedings of the 2001 ACM SIGMOD International Conference on Management of Data, pages 58–66, 2001.<br />
<br />
[15] X. He, J. Pan, O. Jin, T. Xu, B. Liu, T. Xu, Y. Shi, A. Atallah, R. Herbrich, S. Bowers, and J. Q. n. Candela. Practical lessons from predicting clicks on ads at facebook. In Proceedings of the Eighth International Workshop on Data Mining for Online Advertising, ADKDD’14, 2014.<br />
<br />
[16] P. Li. Robust Logitboost and adaptive base class (ABC) Logitboost. In Proceedings of the Twenty-Sixth Conference Annual Conference on Uncertainty in Artificial Intelligence (UAI’10), pages 302–311, 2010.<br />
<br />
[17] P. Li, Q. Wu, and C. J. Burges. Mcrank: Learning to rank using multiple classification and gradient boosting. In Advances in Neural Information Processing Systems 20, pages 897–904. 2008.<br />
<br />
[18] X. Meng, J. Bradley, B. Yavuz, E. Sparks, S. Venkataraman, D. Liu, J. Freeman, D. Tsai, M. Amde, S. Owen, D. Xin, R. Xin, M. J. Franklin, R. Zadeh, M. Zaharia, and A. Talwalkar. MLlib: Machine learning in apache spark. Journal of Machine Learning Research, 17(34):1–7, 2016.<br />
<br />
[19] B. Panda, J. S. Herbach, S. Basu, and R. J. Bayardo. Planet: Massively parallel learning of tree ensembles with mapreduce. Proceeding of VLDB Endowment, 2(2):1426–1437, Aug. 2009.<br />
<br />
[20] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.<br />
<br />
[21] G. Ridgeway. Generalized Boosted Models: A guide to the gbm package.<br />
<br />
[22] S. Tyree, K. Weinberger, K. Agrawal, and J. Paykin. Parallel boosted regression trees for web search ranking. In Proceedings of the 20th international conference on World wide web, pages 387–396. ACM, 2011.<br />
<br />
[23] J. Ye, J.-H. Chow, J. Chen, and Z. Zheng. Stochastic gradient boosted distributed decision trees. In Proceedings of the 18th ACM Conference on Information and Knowledge Management, CIKM ’09.<br />
<br />
[24] Q. Zhang and W. Wang. A fast algorithm for approximate quantiles in high speed data streams. In Proceedings of the 19th International Conference on Scientific and Statistical Database Management, 2007.<br />
<br />
[25] T. Zhang and R. Johnson. Learning nonlinear functions using regularized greedy forest. IEEE Transactions on Pattern Analysis and Machine Intelligence, 36(5), 2014.</div>Cwlokehttp://wiki.math.uwaterloo.ca/statwiki/index.php?title=XGBoost&diff=51108XGBoost2021-11-29T04:35:42Z<p>Cwloke: /* Weighted Quantile Sketch */</p>
<hr />
<div>== Presented by == <br />
* Chun Waan Loke<br />
* Peter Chong<br />
* Clarice Osmond<br />
* Zhilong Li<br />
<br />
== Introduction ==<br />
<br />
== Tree Boosting In A Nutshell ==<br />
The author reviews gradient tree boosting in this section.<br />
=== Regularized Learning Objective ===<br />
The author first gives the prediction equation (1) and the regularized objective (2).<br><br />
<br><br />
(1) The additive prediction model is given as<br><br />
<math>\hat{y_i}=\sum_{k=1}^{K}f_k(x_i), f_k \in \mathcal{F} </math> <br><br />
where each <math>f_k</math> corresponds to an independent tree structure with its weights, and <math>\mathcal{F}</math> is the "space of regression trees"<br><br />
<br><br />
(2) The regularized objective to be minimized is given as<br><br />
<math>\mathcal{L}=\sum_{i}l(\hat{y_i},y_i)+\sum_k \Omega(f_k)</math> where <math>\Omega(f)=\gamma T+\frac{1}{2}\lambda ||\omega||^2</math> <br><br />
The first term <math>l</math> is a differentiable convex loss function that calculates the measures between <math>\hat{y}</math> and <math>y</math>.<br><br />
The second term <math>\Omega</math> penalizes on the complexity of model (the <math>f_k</math>'s). For a given tree (<math>f_k</math>), <math>T</math> is the number of leaves, and <math>\omega</math> is the leaf weights.<br><br />
The L1 regularization term <math>\gamma T</math> encourages the tree to be small, and the L2 regularization term <math>\frac{1}{2}\lambda ||\omega||^2</math> encourages the tree to have small weights.<br><br />
<br />
=== Gradient Tree Boosting ===<br />
Let <math>\hat{y_i}^{(t)}</math> be the prediction of <math>y_i</math> at the t-th iteration.<br><br />
Since the prediction equation is simply additive, <math>{\hat y_i}^{(t)}=\hat{y_{i}}^{(t-1)}+f_t(x_i)</math><br><br />
Using this equation and 2nd order Taylor approximation on the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> gives <br><br />
\begin{align}<br />
\mathcal{L}^{(t)}&=\sum_{i}^{n}l(y_i,\hat{y_i}^{(t-1)}+f_t(x_i))+\Omega(f_t)\\<br />
&\simeq \sum_{i}^{n}[l(y_i,\hat{y_i}^{(t-1)})+g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
\end{align}<br />
where <math>g_i</math> and <math>h_i</math> are the first and second derivative of the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> with repspect to the term <math>\hat{y}^{(t-1)}</math><br><br />
We can simplify this objective by removing the constant term <math>l(y_i,\hat{y_i}^{(t-1)})</math>.<br><br />
Define <math>I_j=\{i|q(x_i)=j\}</math>, where <math>q</math> is the tree structure. Since every <math>x_i</math> is mapped by <math>q</math> to some leaf <math>j</math>, going through every <math>x_i</math> is equivalent to going through each leaf j of the structure.<br />
\begin{align}<br />
\tilde{\mathcal{L}}^{(t)}&= \sum_{i}^{n}[g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
&= \sum_{j=1}^{T}[(\sum_{i \in I_j}g_i)\omega_j+\frac{1}{2}(\sum_{i \in I_j}h_i+\lambda)\omega_j^2]+\gamma T<br />
\end{align}<br />
Then for a fixed structure <math>q</math>, the optimal weight of leaf <math>j</math> and the optimal objective value are given as<br><br />
\begin{align}<br />
\omega_j^{*} &= -\frac{\sum_{i \in I_j}g_i}{\sum_{i \in I_j}h_i+\lambda}\\<br />
\tilde{\mathcal{L}}^{(t)}(q) &=-\frac{1}{2}\sum_{j=1}^{T}\frac{(\sum_{i \in I_j}g_i)^2}{\sum_{i \in I_j}h_i+\lambda}+\gamma T<br />
\end{align} <br />
[[File:Structure Score Calculation.png|frame|center|alt=Alt text|Structure Score Calculation]]<br />
Instead of enumerating through all possible tree structures q, a greedy algorithm of iteratively adding branches is used.<br><br />
Let <math>I_L</math> and <math>I_R</math> be the instance sets of left and right nodes after split and let <math>I=I_L\cup I_R</math>.<br><br />
The loss reduction after split is given by<br><br />
\begin{align}<br />
\tilde{\mathcal{L}}_{\text{split}} &=\frac{1}{2}[\frac{(\sum_{i \in I_L}g_i)^2}{\sum_{i \in I_L}h_i+\lambda}+\frac{(\sum_{i \in I_R}g_i)^2}{\sum_{i \in I_R}h_i+\lambda}-\frac{(\sum_{i \in I}g_i)^2}{\sum_{i \in I}h_i+\lambda}]+\gamma<br />
\end{align}<br />
=== Shrinkage and Column Subsampling ===<br />
The author also mentioned two other methods in order to avoid over-fitting.<br><br />
(1) Shrinkage. Similar to the learning rate in stochastic optimization, a new weight is added to each tree boosting to reduce the influence of a single tree and leave space for future trees.<br><br />
(2) Column (feature) subsampling. In the paper, the author only mentioned that this technique speeds up parallel algorithm used in later sections.<br />
<br />
== Split Finding Algorithms ==<br />
<br />
It is very important to find the best split for tree learning to perform well. Here are a few split finding algorithms mentioned in the paper:<br />
<br />
=== Basic Exact Greedy Algorithm ===<br />
<br />
The basic exact greedy algorithm is a split finding algorithm that is computationally expensive because it enumerates over all the possible splits for continuous features. It is impossible to be done efficiently when the memory is not enough to hold the data needed. A way to carry out this algorithm efficiently is to sort the data according to feature values and visit the data in order to accumulate the gradient statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_1.png|center|alt=Alt text|Basic Exact Greedy Algorithm]]<br />
<br />
=== Approximate Algorithm ===<br />
<br />
The paper introduced a more efficient algorithm compared to Basic Exact Greedy Algorithm which is the Approximate Algorithm. The Approximate Algorithm first proposes candidate splitting points according to percentiles of feature distribution. It then maps the continuous features into buckets split by candidate points, aggregates the statistics and finds the best solution among proposals based on the aggregated statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_2.png|center|alt=Alt text|Approximate Algorithm]]<br />
<br />
There are also two variants to this algorithm, the global variant proposes all the candidate splits during the initial phase of tree construction and uses the same proposals for split finding at all levels. Whereas, the local variant re-proposes after each split. The global variant usually requires less proposal steps but uses more candidate points than local variant because candidates are not refined after each split. For deeper trees, usage of local variant may be more appropriate as compared to global variant. The figure below shows the a comparison in accuracy between Basic Exact Greedy and Approximate split finding algorithms with different variant over the number of iterations. We can see that the quantile strategy is able to achieve similar accuracy as the Basic Exact Greedy algorithm given a reasonable approximation level.<br />
<br />
[[File:iterations.png|center|alt=Alt text|Comparison of accuracy between different algorithms]]<br />
<br />
=== Weighted Quantile Sketch ===<br />
<br />
Proposing candidate split points is the most important step in the Approximate Algorithm, it is done by using the percentile of a feature to make candidates distribute evenly on a dataset.<br />
<br />
Formally, we have a dataset<br />
<br />
<math>D_k={(x_{1k},h_1),(x_{2k},h_2),...,(x_{nk},h_n)}</math><br />
<br />
where <math> x_i </math>'s are the feature values of each data point and <math> h_i </math>'s represents the weight of the corresponding feature <math> x_i </math>. <br />
<br />
Then, we can use the following rank function to compute <math>r_k(z)</math>, the proportion of instances whose feature value among <math> (x_i,...,x_k) </math> is smaller than data point <math> z </math>.<br />
<br />
<math>r_k(z) = \frac{1}{\sum_{(x,h) \in D_k} h} \displaystyle\sum_{(x,h) \in D_k, x<z} h,</math><br />
<br />
The objective here is to find candidate split points <math>{s_{k1}, s_{k2}, …, s_{kl}}</math>, such that:<br />
<br />
<math>|r_k(s_{k,j}) – r_k(s_{k,j+1})| < \epsilon, s_{k1} = \min_{i} x_{ik}, s_{kl} = \max_{i} x_{ik}, \forall i</math><br />
<br />
=== Sparsity-aware Split Finding ===<br />
<br />
== System Design ==<br />
<br />
=== Column Block for Parallel Learning ===<br />
The most time consuming part of tree learning is to get the data into sorted order. To overcome this problem, XGBoost stores the data in blocks where each block performs the sorting operation in parallel. The results are then merged together.<br />
<br />
# For the exact greedy algorithm, XGBoost stores the entire dataset in a single block<br />
#:* Original spase aware algorithm costs: <math>O(Kd∥x∥_0 log(n))</math><br />
#:* Tree boosting on block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(n))</math><br />
#:* Hence, block structure helps to save an additional <math>log(n)</math> factor<br />
# For approximate algorithms, XGBoost stores the dataset in multiple blocks<br />
#:* Original algorithm with binary search costs: <math>O(Kd∥x∥_0 log(q))</math><br />
#:* With block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(B))</math><br />
#:* Hence, block structure helps to save an additional <math>log(q)</math> factor <br />
<br />
K = total number of trees<br /><br />
d = maximum depth of the tree<br /><br />
<math>∥x∥_0</math> = number of non-missing entries in the training data<br /><br />
n = number of rows in the dataset<br /><br />
q = number of proposal candidates in the dataset, usually between 32 to 100<br /><br />
B = maximum number of rows in each block<br />
<br />
[[File: columnblock.png|800px|thumb|center]]<br />
<br />
=== Cache-aware Access ===<br />
The proposed block structure optimizes the computation complexity but requires indirect fetches of gradient statistics by row index. XGBoost optimizes the process by using the following methods.<br />
<br />
# For the exact greedy algorithm, XGBoost uses a cache-aware prefetching algorithm<br />
#:* It stores Gradient and Hessians in the cache to make calculations fast<br />
#:* It runs twice as fast as the naive method when the dataset is large<br />
# For approximate algorithms, XGBoost chooses a specific block size<br />
#:* Choosing a small block size results in inefficient parallelization<br />
#:* Choosing a large block size results in cache misses<br />
#:* Various choices of block size are compared and the results are shown in Figure 9<br />
#:* XGBoost chose <math>2^{16}</math> as the block size<br />
<br />
[[File: blocksize.png|400px|thumb|center]]<br />
<br />
=== Blocks for Out-of-core Computation ===<br />
When the dataset is too large for the cache and main memory, XGBoost utilizes disk spaces as well. Since reading and writing data to the disks are slow, XGBoost optimizes the process by using the following two methods.<br />
<br />
# Block Compression<br />
#:* Blocks are compressed by columns<br />
#:* Although decompressing takes time, it is still faster than reading from the disks<br />
# Block Sharding<br />
#:* If multiple disks are available, data is split into those disks<br />
#:* When the CPU needs data, all the disks can be read at the same time<br />
<br />
== End To End Evaluations ==<br />
=== System Implementation ===<br />
XGBoost is a portable and reusable open-source package. It supports:<br />
* various weighted classification<br />
* various objective functions (rank & user defined)<br />
* popular languages (python, R, Julia)<br />
* data science pipelines (scikit-learn)<br />
* big data stacks (Flink, Spark)<br />
* cloud platform (Tianchi8)<br />
<br />
=== Dataset and Setup ===<br />
<br />
A summary of the 4 datasets used in the experiments is in table 2.<br />
<br />
[[File: table2data.png|500px|thumb|center]]<br />
<br />
The first and last datasets were used specifically to evaluate the impact of sparsity-aware algorithm and the scaling property of the system in the out-of-core and the distributed settings respectively. In all of the experiments, common settings such as maximum depth equal to 8, shrinkage equal to 0.1 and no column subsampling are applied.<br />
<br />
=== Classification ===<br />
A subset (n = 1M) of Higgs Boson dataset was used for classification. The results are shown in Table 3.<br />
<br />
[[File: classification.png|500px|thumb|center]]<br />
<br />
* R’s GBM creates a tree fast by using greedy approach that only expands one branch of a tree but with the cost of lower accuracy<br />
* XGBoost and scikit-learn have better performance than R’s GBM<br />
* XGBoost runs more than 10x faster than scikit-learn in learning a full tree<br />
* Column subsamples give slightly worse performance possibly due to a few important features in this dataset.<br />
<br />
=== Learning to Rank ===<br />
The results in comparing XGBoost with pGBRT are shown in Table 4.<br />
<br />
[[File: rank.png|500px|thumb|center]]<br />
<br />
* XGBoost runs exact greedy algorithm while pGBRT only supports an approximate algorithm<br />
* XGBoost runs faster<br />
* Subsampling column reduces running time and gives higher performance possibly due to preventing overfitting<br />
<br />
=== Out-of-core Experiment ===<br />
An extremely large Criteo dataset was used to evaluate the out-of-core setting. The results are shown in the figure below.<br />
<br />
[[File: outofcore.png|350px|thumb|center]]<br />
<br />
* Compression speed up the computation by a factor of 3<br />
* Sharding into 2 disks further gives 2x speed<br />
<br />
=== Distributed Experiment ===<br />
YARN cluster on EC2 with m3.2xlarge machines was used to evaluate the distributed setting. XGBoost was compared with Spark MLLib and H20.<br />
<br />
* XGBoost can switch to out-of-core setting when the memory runs out, while the baseline systems need to store the data in RAM<br />
* XGBoost runs faster than the baseline systems<br />
* The baseline systems are only able to handle a subset of the data with the given resources while XGBoost was able to scale smoothly to all 1.7B rows<br />
* XGBoost’s performance scales linearly with more machines<br />
* XGBoost is able to handle all 1.7B data with only 4 machines<br />
<br />
== Conclusion ==<br />
<br />
== References ==<br />
[1] R. Bekkerman. The present and the future of the kdd cup competition: an outsider’s perspective. <br />
<br />
[2] R. Bekkerman, M. Bilenko, and J. Langford. Scaling Up Machine Learning: Parallel and Distributed Approaches. Cambridge University Press, New York, NY, USA, 2011. <br />
<br />
[3] J. Bennett and S. Lanning. The netflix prize. In Proceedings of the KDD Cup Workshop 2007, pages 3–6, New York, Aug. 2007.<br />
<br />
[4] L. Breiman. Random forests. Maching Learning, 45(1):5–32, Oct. 2001.<br />
<br />
[5] C. Burges. From ranknet to lambdarank to lambdamart: An overview. Learning, 11:23–581, 2010.<br />
<br />
[6] O. Chapelle and Y. Chang. Yahoo! Learning to Rank Challenge Overview. Journal of Machine Learning Research - W & CP, 14:1–24, 2011.<br />
<br />
[7] T. Chen, H. Li, Q. Yang, and Y. Yu. General functional matrix factorization using gradient boosting. In Proceeding of 30th International Conference on Machine Learning (ICML’13), volume 1, pages 436–444, 2013.<br />
<br />
[8] T. Chen, S. Singh, B. Taskar, and C. Guestrin. Efficient second-order gradient boosting for conditional random fields. In Proceeding of 18th Artificial Intelligence and Statistics Conference (AISTATS’15), volume 1, 2015.<br />
<br />
[9] R.-E. Fan, K.-W. Chang, C.-J. Hsieh, X.-R. Wang, and C.-J. Lin. LIBLINEAR: A library for large linear classification. Journal of Machine Learning Research, 9:1871–1874, 2008.<br />
<br />
[10] J. Friedman. Greedy function approximation: a gradient boosting machine. Annals of Statistics, 29(5):1189–1232, 2001.<br />
<br />
[11] J. Friedman. Stochastic gradient boosting. Computational Statistics & Data Analysis, 38(4):367–378, 2002.<br />
<br />
[12] J. Friedman, T. Hastie, and R. Tibshirani. Additive logistic regression: a statistical view of boosting. Annals of Statistics, 28(2):337–407, 2000.<br />
<br />
[13] J. H. Friedman and B. E. Popescu. Importance sampled learning ensembles, 2003.<br />
<br />
[14] M. Greenwald and S. Khanna. Space-efficient online computation of quantile summaries. In Proceedings of the 2001 ACM SIGMOD International Conference on Management of Data, pages 58–66, 2001.<br />
<br />
[15] X. He, J. Pan, O. Jin, T. Xu, B. Liu, T. Xu, Y. Shi, A. Atallah, R. Herbrich, S. Bowers, and J. Q. n. Candela. Practical lessons from predicting clicks on ads at facebook. In Proceedings of the Eighth International Workshop on Data Mining for Online Advertising, ADKDD’14, 2014.<br />
<br />
[16] P. Li. Robust Logitboost and adaptive base class (ABC) Logitboost. In Proceedings of the Twenty-Sixth Conference Annual Conference on Uncertainty in Artificial Intelligence (UAI’10), pages 302–311, 2010.<br />
<br />
[17] P. Li, Q. Wu, and C. J. Burges. Mcrank: Learning to rank using multiple classification and gradient boosting. In Advances in Neural Information Processing Systems 20, pages 897–904. 2008.<br />
<br />
[18] X. Meng, J. Bradley, B. Yavuz, E. Sparks, S. Venkataraman, D. Liu, J. Freeman, D. Tsai, M. Amde, S. Owen, D. Xin, R. Xin, M. J. Franklin, R. Zadeh, M. Zaharia, and A. Talwalkar. MLlib: Machine learning in apache spark. Journal of Machine Learning Research, 17(34):1–7, 2016.<br />
<br />
[19] B. Panda, J. S. Herbach, S. Basu, and R. J. Bayardo. Planet: Massively parallel learning of tree ensembles with mapreduce. Proceeding of VLDB Endowment, 2(2):1426–1437, Aug. 2009.<br />
<br />
[20] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.<br />
<br />
[21] G. Ridgeway. Generalized Boosted Models: A guide to the gbm package.<br />
<br />
[22] S. Tyree, K. Weinberger, K. Agrawal, and J. Paykin. Parallel boosted regression trees for web search ranking. In Proceedings of the 20th international conference on World wide web, pages 387–396. ACM, 2011.<br />
<br />
[23] J. Ye, J.-H. Chow, J. Chen, and Z. Zheng. Stochastic gradient boosted distributed decision trees. In Proceedings of the 18th ACM Conference on Information and Knowledge Management, CIKM ’09.<br />
<br />
[24] Q. Zhang and W. Wang. A fast algorithm for approximate quantiles in high speed data streams. In Proceedings of the 19th International Conference on Scientific and Statistical Database Management, 2007.<br />
<br />
[25] T. Zhang and R. Johnson. Learning nonlinear functions using regularized greedy forest. IEEE Transactions on Pattern Analysis and Machine Intelligence, 36(5), 2014.</div>Cwlokehttp://wiki.math.uwaterloo.ca/statwiki/index.php?title=XGBoost&diff=51107XGBoost2021-11-29T04:35:15Z<p>Cwloke: /* Weighted Quantile Sketch */</p>
<hr />
<div>== Presented by == <br />
* Chun Waan Loke<br />
* Peter Chong<br />
* Clarice Osmond<br />
* Zhilong Li<br />
<br />
== Introduction ==<br />
<br />
== Tree Boosting In A Nutshell ==<br />
The author reviews gradient tree boosting in this section.<br />
=== Regularized Learning Objective ===<br />
The author first gives the prediction equation (1) and the regularized objective (2).<br><br />
<br><br />
(1) The additive prediction model is given as<br><br />
<math>\hat{y_i}=\sum_{k=1}^{K}f_k(x_i), f_k \in \mathcal{F} </math> <br><br />
where each <math>f_k</math> corresponds to an independent tree structure with its weights, and <math>\mathcal{F}</math> is the "space of regression trees"<br><br />
<br><br />
(2) The regularized objective to be minimized is given as<br><br />
<math>\mathcal{L}=\sum_{i}l(\hat{y_i},y_i)+\sum_k \Omega(f_k)</math> where <math>\Omega(f)=\gamma T+\frac{1}{2}\lambda ||\omega||^2</math> <br><br />
The first term <math>l</math> is a differentiable convex loss function that calculates the measures between <math>\hat{y}</math> and <math>y</math>.<br><br />
The second term <math>\Omega</math> penalizes on the complexity of model (the <math>f_k</math>'s). For a given tree (<math>f_k</math>), <math>T</math> is the number of leaves, and <math>\omega</math> is the leaf weights.<br><br />
The L1 regularization term <math>\gamma T</math> encourages the tree to be small, and the L2 regularization term <math>\frac{1}{2}\lambda ||\omega||^2</math> encourages the tree to have small weights.<br><br />
<br />
=== Gradient Tree Boosting ===<br />
Let <math>\hat{y_i}^{(t)}</math> be the prediction of <math>y_i</math> at the t-th iteration.<br><br />
Since the prediction equation is simply additive, <math>{\hat y_i}^{(t)}=\hat{y_{i}}^{(t-1)}+f_t(x_i)</math><br><br />
Using this equation and 2nd order Taylor approximation on the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> gives <br><br />
\begin{align}<br />
\mathcal{L}^{(t)}&=\sum_{i}^{n}l(y_i,\hat{y_i}^{(t-1)}+f_t(x_i))+\Omega(f_t)\\<br />
&\simeq \sum_{i}^{n}[l(y_i,\hat{y_i}^{(t-1)})+g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
\end{align}<br />
where <math>g_i</math> and <math>h_i</math> are the first and second derivative of the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> with repspect to the term <math>\hat{y}^{(t-1)}</math><br><br />
We can simplify this objective by removing the constant term <math>l(y_i,\hat{y_i}^{(t-1)})</math>.<br><br />
Define <math>I_j=\{i|q(x_i)=j\}</math>, where <math>q</math> is the tree structure. Since every <math>x_i</math> is mapped by <math>q</math> to some leaf <math>j</math>, going through every <math>x_i</math> is equivalent to going through each leaf j of the structure.<br />
\begin{align}<br />
\tilde{\mathcal{L}}^{(t)}&= \sum_{i}^{n}[g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
&= \sum_{j=1}^{T}[(\sum_{i \in I_j}g_i)\omega_j+\frac{1}{2}(\sum_{i \in I_j}h_i+\lambda)\omega_j^2]+\gamma T<br />
\end{align}<br />
Then for a fixed structure <math>q</math>, the optimal weight of leaf <math>j</math> and the optimal objective value are given as<br><br />
\begin{align}<br />
\omega_j^{*} &= -\frac{\sum_{i \in I_j}g_i}{\sum_{i \in I_j}h_i+\lambda}\\<br />
\tilde{\mathcal{L}}^{(t)}(q) &=-\frac{1}{2}\sum_{j=1}^{T}\frac{(\sum_{i \in I_j}g_i)^2}{\sum_{i \in I_j}h_i+\lambda}+\gamma T<br />
\end{align} <br />
[[File:Structure Score Calculation.png|frame|center|alt=Alt text|Structure Score Calculation]]<br />
Instead of enumerating through all possible tree structures q, a greedy algorithm of iteratively adding branches is used.<br><br />
Let <math>I_L</math> and <math>I_R</math> be the instance sets of left and right nodes after split and let <math>I=I_L\cup I_R</math>.<br><br />
The loss reduction after split is given by<br><br />
\begin{align}<br />
\tilde{\mathcal{L}}_{\text{split}} &=\frac{1}{2}[\frac{(\sum_{i \in I_L}g_i)^2}{\sum_{i \in I_L}h_i+\lambda}+\frac{(\sum_{i \in I_R}g_i)^2}{\sum_{i \in I_R}h_i+\lambda}-\frac{(\sum_{i \in I}g_i)^2}{\sum_{i \in I}h_i+\lambda}]+\gamma<br />
\end{align}<br />
=== Shrinkage and Column Subsampling ===<br />
The author also mentioned two other methods in order to avoid over-fitting.<br><br />
(1) Shrinkage. Similar to the learning rate in stochastic optimization, a new weight is added to each tree boosting to reduce the influence of a single tree and leave space for future trees.<br><br />
(2) Column (feature) subsampling. In the paper, the author only mentioned that this technique speeds up parallel algorithm used in later sections.<br />
<br />
== Split Finding Algorithms ==<br />
<br />
It is very important to find the best split for tree learning to perform well. Here are a few split finding algorithms mentioned in the paper:<br />
<br />
=== Basic Exact Greedy Algorithm ===<br />
<br />
The basic exact greedy algorithm is a split finding algorithm that is computationally expensive because it enumerates over all the possible splits for continuous features. It is impossible to be done efficiently when the memory is not enough to hold the data needed. A way to carry out this algorithm efficiently is to sort the data according to feature values and visit the data in order to accumulate the gradient statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_1.png|center|alt=Alt text|Basic Exact Greedy Algorithm]]<br />
<br />
=== Approximate Algorithm ===<br />
<br />
The paper introduced a more efficient algorithm compared to Basic Exact Greedy Algorithm which is the Approximate Algorithm. The Approximate Algorithm first proposes candidate splitting points according to percentiles of feature distribution. It then maps the continuous features into buckets split by candidate points, aggregates the statistics and finds the best solution among proposals based on the aggregated statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_2.png|center|alt=Alt text|Approximate Algorithm]]<br />
<br />
There are also two variants to this algorithm, the global variant proposes all the candidate splits during the initial phase of tree construction and uses the same proposals for split finding at all levels. Whereas, the local variant re-proposes after each split. The global variant usually requires less proposal steps but uses more candidate points than local variant because candidates are not refined after each split. For deeper trees, usage of local variant may be more appropriate as compared to global variant. The figure below shows the a comparison in accuracy between Basic Exact Greedy and Approximate split finding algorithms with different variant over the number of iterations. We can see that the quantile strategy is able to achieve similar accuracy as the Basic Exact Greedy algorithm given a reasonable approximation level.<br />
<br />
[[File:iterations.png|center|alt=Alt text|Comparison of accuracy between different algorithms]]<br />
<br />
=== Weighted Quantile Sketch ===<br />
<br />
Proposing candidate split points is the most important step in the Approximate Algorithm, it is done by using the percentile of a feature to make candidates distribute evenly on a dataset.<br />
<br />
Formally, we have a dataset<br />
<br />
<math>D_k={(x_{1k},h_1),(x_{2k},h_2),...,(x_{nk},h_n)}</math><br />
<br />
where <math> x_i </math>'s are the feature values of each data point and <math> h_i </math>'s represents the weight of the corresponding feature <math> x_i </math>. <br />
<br />
Then, we can use the following rank function to compute <math>r_k(z)</math>, the proportion of instances whose feature value among <math> (x_i,...,x_k) </math> is smaller than data point <math> z </math>.<br />
<br />
<math>r_k(z) = \frac{1}{\sum_{(x,h) \in D_k} h} \displaystyle\sum_{(x,h) \in D_k, x<z} h,</math><br />
<br />
The objective here is to find candidate split points <math>{s_{k1}, s_{k2}, …, s_{kl}}</math>, such that:<br />
<br />
<math>|r_k(s_{k,j}) – r_k(s_{k,j+1})| < \epsilon, s_{k1} = \min_{\i} x_{ik}, s_{kl} = \max_{\i} x_{ik}, \forall i</math><br />
<br />
=== Sparsity-aware Split Finding ===<br />
<br />
== System Design ==<br />
<br />
=== Column Block for Parallel Learning ===<br />
The most time consuming part of tree learning is to get the data into sorted order. To overcome this problem, XGBoost stores the data in blocks where each block performs the sorting operation in parallel. The results are then merged together.<br />
<br />
# For the exact greedy algorithm, XGBoost stores the entire dataset in a single block<br />
#:* Original spase aware algorithm costs: <math>O(Kd∥x∥_0 log(n))</math><br />
#:* Tree boosting on block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(n))</math><br />
#:* Hence, block structure helps to save an additional <math>log(n)</math> factor<br />
# For approximate algorithms, XGBoost stores the dataset in multiple blocks<br />
#:* Original algorithm with binary search costs: <math>O(Kd∥x∥_0 log(q))</math><br />
#:* With block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(B))</math><br />
#:* Hence, block structure helps to save an additional <math>log(q)</math> factor <br />
<br />
K = total number of trees<br /><br />
d = maximum depth of the tree<br /><br />
<math>∥x∥_0</math> = number of non-missing entries in the training data<br /><br />
n = number of rows in the dataset<br /><br />
q = number of proposal candidates in the dataset, usually between 32 to 100<br /><br />
B = maximum number of rows in each block<br />
<br />
[[File: columnblock.png|800px|thumb|center]]<br />
<br />
=== Cache-aware Access ===<br />
The proposed block structure optimizes the computation complexity but requires indirect fetches of gradient statistics by row index. XGBoost optimizes the process by using the following methods.<br />
<br />
# For the exact greedy algorithm, XGBoost uses a cache-aware prefetching algorithm<br />
#:* It stores Gradient and Hessians in the cache to make calculations fast<br />
#:* It runs twice as fast as the naive method when the dataset is large<br />
# For approximate algorithms, XGBoost chooses a specific block size<br />
#:* Choosing a small block size results in inefficient parallelization<br />
#:* Choosing a large block size results in cache misses<br />
#:* Various choices of block size are compared and the results are shown in Figure 9<br />
#:* XGBoost chose <math>2^{16}</math> as the block size<br />
<br />
[[File: blocksize.png|400px|thumb|center]]<br />
<br />
=== Blocks for Out-of-core Computation ===<br />
When the dataset is too large for the cache and main memory, XGBoost utilizes disk spaces as well. Since reading and writing data to the disks are slow, XGBoost optimizes the process by using the following two methods.<br />
<br />
# Block Compression<br />
#:* Blocks are compressed by columns<br />
#:* Although decompressing takes time, it is still faster than reading from the disks<br />
# Block Sharding<br />
#:* If multiple disks are available, data is split into those disks<br />
#:* When the CPU needs data, all the disks can be read at the same time<br />
<br />
== End To End Evaluations ==<br />
=== System Implementation ===<br />
XGBoost is a portable and reusable open-source package. It supports:<br />
* various weighted classification<br />
* various objective functions (rank & user defined)<br />
* popular languages (python, R, Julia)<br />
* data science pipelines (scikit-learn)<br />
* big data stacks (Flink, Spark)<br />
* cloud platform (Tianchi8)<br />
<br />
=== Dataset and Setup ===<br />
<br />
A summary of the 4 datasets used in the experiments is in table 2.<br />
<br />
[[File: table2data.png|500px|thumb|center]]<br />
<br />
The first and last datasets were used specifically to evaluate the impact of sparsity-aware algorithm and the scaling property of the system in the out-of-core and the distributed settings respectively. In all of the experiments, common settings such as maximum depth equal to 8, shrinkage equal to 0.1 and no column subsampling are applied.<br />
<br />
=== Classification ===<br />
A subset (n = 1M) of Higgs Boson dataset was used for classification. The results are shown in Table 3.<br />
<br />
[[File: classification.png|500px|thumb|center]]<br />
<br />
* R’s GBM creates a tree fast by using greedy approach that only expands one branch of a tree but with the cost of lower accuracy<br />
* XGBoost and scikit-learn have better performance than R’s GBM<br />
* XGBoost runs more than 10x faster than scikit-learn in learning a full tree<br />
* Column subsamples give slightly worse performance possibly due to a few important features in this dataset.<br />
<br />
=== Learning to Rank ===<br />
The results in comparing XGBoost with pGBRT are shown in Table 4.<br />
<br />
[[File: rank.png|500px|thumb|center]]<br />
<br />
* XGBoost runs exact greedy algorithm while pGBRT only supports an approximate algorithm<br />
* XGBoost runs faster<br />
* Subsampling column reduces running time and gives higher performance possibly due to preventing overfitting<br />
<br />
=== Out-of-core Experiment ===<br />
An extremely large Criteo dataset was used to evaluate the out-of-core setting. The results are shown in the figure below.<br />
<br />
[[File: outofcore.png|350px|thumb|center]]<br />
<br />
* Compression speed up the computation by a factor of 3<br />
* Sharding into 2 disks further gives 2x speed<br />
<br />
=== Distributed Experiment ===<br />
YARN cluster on EC2 with m3.2xlarge machines was used to evaluate the distributed setting. XGBoost was compared with Spark MLLib and H20.<br />
<br />
* XGBoost can switch to out-of-core setting when the memory runs out, while the baseline systems need to store the data in RAM<br />
* XGBoost runs faster than the baseline systems<br />
* The baseline systems are only able to handle a subset of the data with the given resources while XGBoost was able to scale smoothly to all 1.7B rows<br />
* XGBoost’s performance scales linearly with more machines<br />
* XGBoost is able to handle all 1.7B data with only 4 machines<br />
<br />
== Conclusion ==<br />
<br />
== References ==<br />
[1] R. Bekkerman. The present and the future of the kdd cup competition: an outsider’s perspective. <br />
<br />
[2] R. Bekkerman, M. Bilenko, and J. Langford. Scaling Up Machine Learning: Parallel and Distributed Approaches. Cambridge University Press, New York, NY, USA, 2011. <br />
<br />
[3] J. Bennett and S. Lanning. The netflix prize. In Proceedings of the KDD Cup Workshop 2007, pages 3–6, New York, Aug. 2007.<br />
<br />
[4] L. Breiman. Random forests. Maching Learning, 45(1):5–32, Oct. 2001.<br />
<br />
[5] C. Burges. From ranknet to lambdarank to lambdamart: An overview. Learning, 11:23–581, 2010.<br />
<br />
[6] O. Chapelle and Y. Chang. Yahoo! Learning to Rank Challenge Overview. Journal of Machine Learning Research - W & CP, 14:1–24, 2011.<br />
<br />
[7] T. Chen, H. Li, Q. Yang, and Y. Yu. General functional matrix factorization using gradient boosting. In Proceeding of 30th International Conference on Machine Learning (ICML’13), volume 1, pages 436–444, 2013.<br />
<br />
[8] T. Chen, S. Singh, B. Taskar, and C. Guestrin. Efficient second-order gradient boosting for conditional random fields. In Proceeding of 18th Artificial Intelligence and Statistics Conference (AISTATS’15), volume 1, 2015.<br />
<br />
[9] R.-E. Fan, K.-W. Chang, C.-J. Hsieh, X.-R. Wang, and C.-J. Lin. LIBLINEAR: A library for large linear classification. Journal of Machine Learning Research, 9:1871–1874, 2008.<br />
<br />
[10] J. Friedman. Greedy function approximation: a gradient boosting machine. Annals of Statistics, 29(5):1189–1232, 2001.<br />
<br />
[11] J. Friedman. Stochastic gradient boosting. Computational Statistics & Data Analysis, 38(4):367–378, 2002.<br />
<br />
[12] J. Friedman, T. Hastie, and R. Tibshirani. Additive logistic regression: a statistical view of boosting. Annals of Statistics, 28(2):337–407, 2000.<br />
<br />
[13] J. H. Friedman and B. E. Popescu. Importance sampled learning ensembles, 2003.<br />
<br />
[14] M. Greenwald and S. Khanna. Space-efficient online computation of quantile summaries. In Proceedings of the 2001 ACM SIGMOD International Conference on Management of Data, pages 58–66, 2001.<br />
<br />
[15] X. He, J. Pan, O. Jin, T. Xu, B. Liu, T. Xu, Y. Shi, A. Atallah, R. Herbrich, S. Bowers, and J. Q. n. Candela. Practical lessons from predicting clicks on ads at facebook. In Proceedings of the Eighth International Workshop on Data Mining for Online Advertising, ADKDD’14, 2014.<br />
<br />
[16] P. Li. Robust Logitboost and adaptive base class (ABC) Logitboost. In Proceedings of the Twenty-Sixth Conference Annual Conference on Uncertainty in Artificial Intelligence (UAI’10), pages 302–311, 2010.<br />
<br />
[17] P. Li, Q. Wu, and C. J. Burges. Mcrank: Learning to rank using multiple classification and gradient boosting. In Advances in Neural Information Processing Systems 20, pages 897–904. 2008.<br />
<br />
[18] X. Meng, J. Bradley, B. Yavuz, E. Sparks, S. Venkataraman, D. Liu, J. Freeman, D. Tsai, M. Amde, S. Owen, D. Xin, R. Xin, M. J. Franklin, R. Zadeh, M. Zaharia, and A. Talwalkar. MLlib: Machine learning in apache spark. Journal of Machine Learning Research, 17(34):1–7, 2016.<br />
<br />
[19] B. Panda, J. S. Herbach, S. Basu, and R. J. Bayardo. Planet: Massively parallel learning of tree ensembles with mapreduce. Proceeding of VLDB Endowment, 2(2):1426–1437, Aug. 2009.<br />
<br />
[20] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.<br />
<br />
[21] G. Ridgeway. Generalized Boosted Models: A guide to the gbm package.<br />
<br />
[22] S. Tyree, K. Weinberger, K. Agrawal, and J. Paykin. Parallel boosted regression trees for web search ranking. In Proceedings of the 20th international conference on World wide web, pages 387–396. ACM, 2011.<br />
<br />
[23] J. Ye, J.-H. Chow, J. Chen, and Z. Zheng. Stochastic gradient boosted distributed decision trees. In Proceedings of the 18th ACM Conference on Information and Knowledge Management, CIKM ’09.<br />
<br />
[24] Q. Zhang and W. Wang. A fast algorithm for approximate quantiles in high speed data streams. In Proceedings of the 19th International Conference on Scientific and Statistical Database Management, 2007.<br />
<br />
[25] T. Zhang and R. Johnson. Learning nonlinear functions using regularized greedy forest. IEEE Transactions on Pattern Analysis and Machine Intelligence, 36(5), 2014.</div>Cwlokehttp://wiki.math.uwaterloo.ca/statwiki/index.php?title=XGBoost&diff=51106XGBoost2021-11-29T04:33:42Z<p>Cwloke: /* Weighted Quantile Sketch */</p>
<hr />
<div>== Presented by == <br />
* Chun Waan Loke<br />
* Peter Chong<br />
* Clarice Osmond<br />
* Zhilong Li<br />
<br />
== Introduction ==<br />
<br />
== Tree Boosting In A Nutshell ==<br />
The author reviews gradient tree boosting in this section.<br />
=== Regularized Learning Objective ===<br />
The author first gives the prediction equation (1) and the regularized objective (2).<br><br />
<br><br />
(1) The additive prediction model is given as<br><br />
<math>\hat{y_i}=\sum_{k=1}^{K}f_k(x_i), f_k \in \mathcal{F} </math> <br><br />
where each <math>f_k</math> corresponds to an independent tree structure with its weights, and <math>\mathcal{F}</math> is the "space of regression trees"<br><br />
<br><br />
(2) The regularized objective to be minimized is given as<br><br />
<math>\mathcal{L}=\sum_{i}l(\hat{y_i},y_i)+\sum_k \Omega(f_k)</math> where <math>\Omega(f)=\gamma T+\frac{1}{2}\lambda ||\omega||^2</math> <br><br />
The first term <math>l</math> is a differentiable convex loss function that calculates the measures between <math>\hat{y}</math> and <math>y</math>.<br><br />
The second term <math>\Omega</math> penalizes on the complexity of model (the <math>f_k</math>'s). For a given tree (<math>f_k</math>), <math>T</math> is the number of leaves, and <math>\omega</math> is the leaf weights.<br><br />
The L1 regularization term <math>\gamma T</math> encourages the tree to be small, and the L2 regularization term <math>\frac{1}{2}\lambda ||\omega||^2</math> encourages the tree to have small weights.<br><br />
<br />
=== Gradient Tree Boosting ===<br />
Let <math>\hat{y_i}^{(t)}</math> be the prediction of <math>y_i</math> at the t-th iteration.<br><br />
Since the prediction equation is simply additive, <math>{\hat y_i}^{(t)}=\hat{y_{i}}^{(t-1)}+f_t(x_i)</math><br><br />
Using this equation and 2nd order Taylor approximation on the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> gives <br><br />
\begin{align}<br />
\mathcal{L}^{(t)}&=\sum_{i}^{n}l(y_i,\hat{y_i}^{(t-1)}+f_t(x_i))+\Omega(f_t)\\<br />
&\simeq \sum_{i}^{n}[l(y_i,\hat{y_i}^{(t-1)})+g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
\end{align}<br />
where <math>g_i</math> and <math>h_i</math> are the first and second derivative of the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> with repspect to the term <math>\hat{y}^{(t-1)}</math><br><br />
We can simplify this objective by removing the constant term <math>l(y_i,\hat{y_i}^{(t-1)})</math>.<br><br />
Define <math>I_j=\{i|q(x_i)=j\}</math>, where <math>q</math> is the tree structure. Since every <math>x_i</math> is mapped by <math>q</math> to some leaf <math>j</math>, going through every <math>x_i</math> is equivalent to going through each leaf j of the structure.<br />
\begin{align}<br />
\tilde{\mathcal{L}}^{(t)}&= \sum_{i}^{n}[g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
&= \sum_{j=1}^{T}[(\sum_{i \in I_j}g_i)\omega_j+\frac{1}{2}(\sum_{i \in I_j}h_i+\lambda)\omega_j^2]+\gamma T<br />
\end{align}<br />
Then for a fixed structure <math>q</math>, the optimal weight of leaf <math>j</math> and the optimal objective value are given as<br><br />
\begin{align}<br />
\omega_j^{*} &= -\frac{\sum_{i \in I_j}g_i}{\sum_{i \in I_j}h_i+\lambda}\\<br />
\tilde{\mathcal{L}}^{(t)}(q) &=-\frac{1}{2}\sum_{j=1}^{T}\frac{(\sum_{i \in I_j}g_i)^2}{\sum_{i \in I_j}h_i+\lambda}+\gamma T<br />
\end{align} <br />
[[File:Structure Score Calculation.png|frame|center|alt=Alt text|Structure Score Calculation]]<br />
Instead of enumerating through all possible tree structures q, a greedy algorithm of iteratively adding branches is used.<br><br />
Let <math>I_L</math> and <math>I_R</math> be the instance sets of left and right nodes after split and let <math>I=I_L\cup I_R</math>.<br><br />
The loss reduction after split is given by<br><br />
\begin{align}<br />
\tilde{\mathcal{L}}_{\text{split}} &=\frac{1}{2}[\frac{(\sum_{i \in I_L}g_i)^2}{\sum_{i \in I_L}h_i+\lambda}+\frac{(\sum_{i \in I_R}g_i)^2}{\sum_{i \in I_R}h_i+\lambda}-\frac{(\sum_{i \in I}g_i)^2}{\sum_{i \in I}h_i+\lambda}]+\gamma<br />
\end{align}<br />
=== Shrinkage and Column Subsampling ===<br />
The author also mentioned two other methods in order to avoid over-fitting.<br><br />
(1) Shrinkage. Similar to the learning rate in stochastic optimization, a new weight is added to each tree boosting to reduce the influence of a single tree and leave space for future trees.<br><br />
(2) Column (feature) subsampling. In the paper, the author only mentioned that this technique speeds up parallel algorithm used in later sections.<br />
<br />
== Split Finding Algorithms ==<br />
<br />
It is very important to find the best split for tree learning to perform well. Here are a few split finding algorithms mentioned in the paper:<br />
<br />
=== Basic Exact Greedy Algorithm ===<br />
<br />
The basic exact greedy algorithm is a split finding algorithm that is computationally expensive because it enumerates over all the possible splits for continuous features. It is impossible to be done efficiently when the memory is not enough to hold the data needed. A way to carry out this algorithm efficiently is to sort the data according to feature values and visit the data in order to accumulate the gradient statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_1.png|center|alt=Alt text|Basic Exact Greedy Algorithm]]<br />
<br />
=== Approximate Algorithm ===<br />
<br />
The paper introduced a more efficient algorithm compared to Basic Exact Greedy Algorithm which is the Approximate Algorithm. The Approximate Algorithm first proposes candidate splitting points according to percentiles of feature distribution. It then maps the continuous features into buckets split by candidate points, aggregates the statistics and finds the best solution among proposals based on the aggregated statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_2.png|center|alt=Alt text|Approximate Algorithm]]<br />
<br />
There are also two variants to this algorithm, the global variant proposes all the candidate splits during the initial phase of tree construction and uses the same proposals for split finding at all levels. Whereas, the local variant re-proposes after each split. The global variant usually requires less proposal steps but uses more candidate points than local variant because candidates are not refined after each split. For deeper trees, usage of local variant may be more appropriate as compared to global variant. The figure below shows the a comparison in accuracy between Basic Exact Greedy and Approximate split finding algorithms with different variant over the number of iterations. We can see that the quantile strategy is able to achieve similar accuracy as the Basic Exact Greedy algorithm given a reasonable approximation level.<br />
<br />
[[File:iterations.png|center|alt=Alt text|Comparison of accuracy between different algorithms]]<br />
<br />
=== Weighted Quantile Sketch ===<br />
<br />
Proposing candidate split points is the most important step in the Approximate Algorithm, it is done by using the percentile of a feature to make candidates distribute evenly on a dataset.<br />
<br />
Formally, we have a dataset<br />
<br />
<math>D_k={(x_{1k},h_1),(x_{2k},h_2),...,(x_{nk},h_n)}</math><br />
<br />
where <math> x_i </math>'s are the feature values of each data point and <math> h_i </math>'s represents the weight of the corresponding feature <math> x_i </math>. <br />
<br />
Then, we can use the following rank function to compute <math>r_k(z)</math>, the proportion of instances whose feature value among <math> (x_i,...,x_k) </math> is smaller than data point <math> z </math>.<br />
<br />
<math>r_k(z) = \frac{1}{\sum_{(x,h) \in D_k} h} \displaystyle\sum_{(x,h) \in D_k, x<z} h,</math><br />
<br />
The objective here is to find candidate split points <math>{s_{k1}, s_{k2}, …, s_{kl}}</math>, such that:<br />
<br />
<math>|r_k(s_{k,j}) – r_k(s_{k,j+1})| < \epsilon, s_{k1} = \min_i x_{ik}, s_{kl} = \max_i x_{ik}, \forall i</math><br />
<br />
=== Sparsity-aware Split Finding ===<br />
<br />
== System Design ==<br />
<br />
=== Column Block for Parallel Learning ===<br />
The most time consuming part of tree learning is to get the data into sorted order. To overcome this problem, XGBoost stores the data in blocks where each block performs the sorting operation in parallel. The results are then merged together.<br />
<br />
# For the exact greedy algorithm, XGBoost stores the entire dataset in a single block<br />
#:* Original spase aware algorithm costs: <math>O(Kd∥x∥_0 log(n))</math><br />
#:* Tree boosting on block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(n))</math><br />
#:* Hence, block structure helps to save an additional <math>log(n)</math> factor<br />
# For approximate algorithms, XGBoost stores the dataset in multiple blocks<br />
#:* Original algorithm with binary search costs: <math>O(Kd∥x∥_0 log(q))</math><br />
#:* With block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(B))</math><br />
#:* Hence, block structure helps to save an additional <math>log(q)</math> factor <br />
<br />
K = total number of trees<br /><br />
d = maximum depth of the tree<br /><br />
<math>∥x∥_0</math> = number of non-missing entries in the training data<br /><br />
n = number of rows in the dataset<br /><br />
q = number of proposal candidates in the dataset, usually between 32 to 100<br /><br />
B = maximum number of rows in each block<br />
<br />
[[File: columnblock.png|800px|thumb|center]]<br />
<br />
=== Cache-aware Access ===<br />
The proposed block structure optimizes the computation complexity but requires indirect fetches of gradient statistics by row index. XGBoost optimizes the process by using the following methods.<br />
<br />
# For the exact greedy algorithm, XGBoost uses a cache-aware prefetching algorithm<br />
#:* It stores Gradient and Hessians in the cache to make calculations fast<br />
#:* It runs twice as fast as the naive method when the dataset is large<br />
# For approximate algorithms, XGBoost chooses a specific block size<br />
#:* Choosing a small block size results in inefficient parallelization<br />
#:* Choosing a large block size results in cache misses<br />
#:* Various choices of block size are compared and the results are shown in Figure 9<br />
#:* XGBoost chose <math>2^{16}</math> as the block size<br />
<br />
[[File: blocksize.png|400px|thumb|center]]<br />
<br />
=== Blocks for Out-of-core Computation ===<br />
When the dataset is too large for the cache and main memory, XGBoost utilizes disk spaces as well. Since reading and writing data to the disks are slow, XGBoost optimizes the process by using the following two methods.<br />
<br />
# Block Compression<br />
#:* Blocks are compressed by columns<br />
#:* Although decompressing takes time, it is still faster than reading from the disks<br />
# Block Sharding<br />
#:* If multiple disks are available, data is split into those disks<br />
#:* When the CPU needs data, all the disks can be read at the same time<br />
<br />
== End To End Evaluations ==<br />
=== System Implementation ===<br />
XGBoost is a portable and reusable open-source package. It supports:<br />
* various weighted classification<br />
* various objective functions (rank & user defined)<br />
* popular languages (python, R, Julia)<br />
* data science pipelines (scikit-learn)<br />
* big data stacks (Flink, Spark)<br />
* cloud platform (Tianchi8)<br />
<br />
=== Dataset and Setup ===<br />
<br />
A summary of the 4 datasets used in the experiments is in table 2.<br />
<br />
[[File: table2data.png|500px|thumb|center]]<br />
<br />
The first and last datasets were used specifically to evaluate the impact of sparsity-aware algorithm and the scaling property of the system in the out-of-core and the distributed settings respectively. In all of the experiments, common settings such as maximum depth equal to 8, shrinkage equal to 0.1 and no column subsampling are applied.<br />
<br />
=== Classification ===<br />
A subset (n = 1M) of Higgs Boson dataset was used for classification. The results are shown in Table 3.<br />
<br />
[[File: classification.png|500px|thumb|center]]<br />
<br />
* R’s GBM creates a tree fast by using greedy approach that only expands one branch of a tree but with the cost of lower accuracy<br />
* XGBoost and scikit-learn have better performance than R’s GBM<br />
* XGBoost runs more than 10x faster than scikit-learn in learning a full tree<br />
* Column subsamples give slightly worse performance possibly due to a few important features in this dataset.<br />
<br />
=== Learning to Rank ===<br />
The results in comparing XGBoost with pGBRT are shown in Table 4.<br />
<br />
[[File: rank.png|500px|thumb|center]]<br />
<br />
* XGBoost runs exact greedy algorithm while pGBRT only supports an approximate algorithm<br />
* XGBoost runs faster<br />
* Subsampling column reduces running time and gives higher performance possibly due to preventing overfitting<br />
<br />
=== Out-of-core Experiment ===<br />
An extremely large Criteo dataset was used to evaluate the out-of-core setting. The results are shown in the figure below.<br />
<br />
[[File: outofcore.png|350px|thumb|center]]<br />
<br />
* Compression speed up the computation by a factor of 3<br />
* Sharding into 2 disks further gives 2x speed<br />
<br />
=== Distributed Experiment ===<br />
YARN cluster on EC2 with m3.2xlarge machines was used to evaluate the distributed setting. XGBoost was compared with Spark MLLib and H20.<br />
<br />
* XGBoost can switch to out-of-core setting when the memory runs out, while the baseline systems need to store the data in RAM<br />
* XGBoost runs faster than the baseline systems<br />
* The baseline systems are only able to handle a subset of the data with the given resources while XGBoost was able to scale smoothly to all 1.7B rows<br />
* XGBoost’s performance scales linearly with more machines<br />
* XGBoost is able to handle all 1.7B data with only 4 machines<br />
<br />
== Conclusion ==<br />
<br />
== References ==<br />
[1] R. Bekkerman. The present and the future of the kdd cup competition: an outsider’s perspective. <br />
<br />
[2] R. Bekkerman, M. Bilenko, and J. Langford. Scaling Up Machine Learning: Parallel and Distributed Approaches. Cambridge University Press, New York, NY, USA, 2011. <br />
<br />
[3] J. Bennett and S. Lanning. The netflix prize. In Proceedings of the KDD Cup Workshop 2007, pages 3–6, New York, Aug. 2007.<br />
<br />
[4] L. Breiman. Random forests. Maching Learning, 45(1):5–32, Oct. 2001.<br />
<br />
[5] C. Burges. From ranknet to lambdarank to lambdamart: An overview. Learning, 11:23–581, 2010.<br />
<br />
[6] O. Chapelle and Y. Chang. Yahoo! Learning to Rank Challenge Overview. Journal of Machine Learning Research - W & CP, 14:1–24, 2011.<br />
<br />
[7] T. Chen, H. Li, Q. Yang, and Y. Yu. General functional matrix factorization using gradient boosting. In Proceeding of 30th International Conference on Machine Learning (ICML’13), volume 1, pages 436–444, 2013.<br />
<br />
[8] T. Chen, S. Singh, B. Taskar, and C. Guestrin. Efficient second-order gradient boosting for conditional random fields. In Proceeding of 18th Artificial Intelligence and Statistics Conference (AISTATS’15), volume 1, 2015.<br />
<br />
[9] R.-E. Fan, K.-W. Chang, C.-J. Hsieh, X.-R. Wang, and C.-J. Lin. LIBLINEAR: A library for large linear classification. Journal of Machine Learning Research, 9:1871–1874, 2008.<br />
<br />
[10] J. Friedman. Greedy function approximation: a gradient boosting machine. Annals of Statistics, 29(5):1189–1232, 2001.<br />
<br />
[11] J. Friedman. Stochastic gradient boosting. Computational Statistics & Data Analysis, 38(4):367–378, 2002.<br />
<br />
[12] J. Friedman, T. Hastie, and R. Tibshirani. Additive logistic regression: a statistical view of boosting. Annals of Statistics, 28(2):337–407, 2000.<br />
<br />
[13] J. H. Friedman and B. E. Popescu. Importance sampled learning ensembles, 2003.<br />
<br />
[14] M. Greenwald and S. Khanna. Space-efficient online computation of quantile summaries. In Proceedings of the 2001 ACM SIGMOD International Conference on Management of Data, pages 58–66, 2001.<br />
<br />
[15] X. He, J. Pan, O. Jin, T. Xu, B. Liu, T. Xu, Y. Shi, A. Atallah, R. Herbrich, S. Bowers, and J. Q. n. Candela. Practical lessons from predicting clicks on ads at facebook. In Proceedings of the Eighth International Workshop on Data Mining for Online Advertising, ADKDD’14, 2014.<br />
<br />
[16] P. Li. Robust Logitboost and adaptive base class (ABC) Logitboost. In Proceedings of the Twenty-Sixth Conference Annual Conference on Uncertainty in Artificial Intelligence (UAI’10), pages 302–311, 2010.<br />
<br />
[17] P. Li, Q. Wu, and C. J. Burges. Mcrank: Learning to rank using multiple classification and gradient boosting. In Advances in Neural Information Processing Systems 20, pages 897–904. 2008.<br />
<br />
[18] X. Meng, J. Bradley, B. Yavuz, E. Sparks, S. Venkataraman, D. Liu, J. Freeman, D. Tsai, M. Amde, S. Owen, D. Xin, R. Xin, M. J. Franklin, R. Zadeh, M. Zaharia, and A. Talwalkar. MLlib: Machine learning in apache spark. Journal of Machine Learning Research, 17(34):1–7, 2016.<br />
<br />
[19] B. Panda, J. S. Herbach, S. Basu, and R. J. Bayardo. Planet: Massively parallel learning of tree ensembles with mapreduce. Proceeding of VLDB Endowment, 2(2):1426–1437, Aug. 2009.<br />
<br />
[20] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.<br />
<br />
[21] G. Ridgeway. Generalized Boosted Models: A guide to the gbm package.<br />
<br />
[22] S. Tyree, K. Weinberger, K. Agrawal, and J. Paykin. Parallel boosted regression trees for web search ranking. In Proceedings of the 20th international conference on World wide web, pages 387–396. ACM, 2011.<br />
<br />
[23] J. Ye, J.-H. Chow, J. Chen, and Z. Zheng. Stochastic gradient boosted distributed decision trees. In Proceedings of the 18th ACM Conference on Information and Knowledge Management, CIKM ’09.<br />
<br />
[24] Q. Zhang and W. Wang. A fast algorithm for approximate quantiles in high speed data streams. In Proceedings of the 19th International Conference on Scientific and Statistical Database Management, 2007.<br />
<br />
[25] T. Zhang and R. Johnson. Learning nonlinear functions using regularized greedy forest. IEEE Transactions on Pattern Analysis and Machine Intelligence, 36(5), 2014.</div>Cwlokehttp://wiki.math.uwaterloo.ca/statwiki/index.php?title=XGBoost&diff=51105XGBoost2021-11-29T04:31:52Z<p>Cwloke: /* Weighted Quantile Sketch */</p>
<hr />
<div>== Presented by == <br />
* Chun Waan Loke<br />
* Peter Chong<br />
* Clarice Osmond<br />
* Zhilong Li<br />
<br />
== Introduction ==<br />
<br />
== Tree Boosting In A Nutshell ==<br />
The author reviews gradient tree boosting in this section.<br />
=== Regularized Learning Objective ===<br />
The author first gives the prediction equation (1) and the regularized objective (2).<br><br />
<br><br />
(1) The additive prediction model is given as<br><br />
<math>\hat{y_i}=\sum_{k=1}^{K}f_k(x_i), f_k \in \mathcal{F} </math> <br><br />
where each <math>f_k</math> corresponds to an independent tree structure with its weights, and <math>\mathcal{F}</math> is the "space of regression trees"<br><br />
<br><br />
(2) The regularized objective to be minimized is given as<br><br />
<math>\mathcal{L}=\sum_{i}l(\hat{y_i},y_i)+\sum_k \Omega(f_k)</math> where <math>\Omega(f)=\gamma T+\frac{1}{2}\lambda ||\omega||^2</math> <br><br />
The first term <math>l</math> is a differentiable convex loss function that calculates the measures between <math>\hat{y}</math> and <math>y</math>.<br><br />
The second term <math>\Omega</math> penalizes on the complexity of model (the <math>f_k</math>'s). For a given tree (<math>f_k</math>), <math>T</math> is the number of leaves, and <math>\omega</math> is the leaf weights.<br><br />
The L1 regularization term <math>\gamma T</math> encourages the tree to be small, and the L2 regularization term <math>\frac{1}{2}\lambda ||\omega||^2</math> encourages the tree to have small weights.<br><br />
<br />
=== Gradient Tree Boosting ===<br />
Let <math>\hat{y_i}^{(t)}</math> be the prediction of <math>y_i</math> at the t-th iteration.<br><br />
Since the prediction equation is simply additive, <math>{\hat y_i}^{(t)}=\hat{y_{i}}^{(t-1)}+f_t(x_i)</math><br><br />
Using this equation and 2nd order Taylor approximation on the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> gives <br><br />
\begin{align}<br />
\mathcal{L}^{(t)}&=\sum_{i}^{n}l(y_i,\hat{y_i}^{(t-1)}+f_t(x_i))+\Omega(f_t)\\<br />
&\simeq \sum_{i}^{n}[l(y_i,\hat{y_i}^{(t-1)})+g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
\end{align}<br />
where <math>g_i</math> and <math>h_i</math> are the first and second derivative of the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> with repspect to the term <math>\hat{y}^{(t-1)}</math><br><br />
We can simplify this objective by removing the constant term <math>l(y_i,\hat{y_i}^{(t-1)})</math>.<br><br />
Define <math>I_j=\{i|q(x_i)=j\}</math>, where <math>q</math> is the tree structure. Since every <math>x_i</math> is mapped by <math>q</math> to some leaf <math>j</math>, going through every <math>x_i</math> is equivalent to going through each leaf j of the structure.<br />
\begin{align}<br />
\tilde{\mathcal{L}}^{(t)}&= \sum_{i}^{n}[g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
&= \sum_{j=1}^{T}[(\sum_{i \in I_j}g_i)\omega_j+\frac{1}{2}(\sum_{i \in I_j}h_i+\lambda)\omega_j^2]+\gamma T<br />
\end{align}<br />
Then for a fixed structure <math>q</math>, the optimal weight of leaf <math>j</math> and the optimal objective value are given as<br><br />
\begin{align}<br />
\omega_j^{*} &= -\frac{\sum_{i \in I_j}g_i}{\sum_{i \in I_j}h_i+\lambda}\\<br />
\tilde{\mathcal{L}}^{(t)}(q) &=-\frac{1}{2}\sum_{j=1}^{T}\frac{(\sum_{i \in I_j}g_i)^2}{\sum_{i \in I_j}h_i+\lambda}+\gamma T<br />
\end{align} <br />
[[File:Structure Score Calculation.png|frame|center|alt=Alt text|Structure Score Calculation]]<br />
Instead of enumerating through all possible tree structures q, a greedy algorithm of iteratively adding branches is used.<br><br />
Let <math>I_L</math> and <math>I_R</math> be the instance sets of left and right nodes after split and let <math>I=I_L\cup I_R</math>.<br><br />
The loss reduction after split is given by<br><br />
\begin{align}<br />
\tilde{\mathcal{L}}_{\text{split}} &=\frac{1}{2}[\frac{(\sum_{i \in I_L}g_i)^2}{\sum_{i \in I_L}h_i+\lambda}+\frac{(\sum_{i \in I_R}g_i)^2}{\sum_{i \in I_R}h_i+\lambda}-\frac{(\sum_{i \in I}g_i)^2}{\sum_{i \in I}h_i+\lambda}]+\gamma<br />
\end{align}<br />
=== Shrinkage and Column Subsampling ===<br />
The author also mentioned two other methods in order to avoid over-fitting.<br><br />
(1) Shrinkage. Similar to the learning rate in stochastic optimization, a new weight is added to each tree boosting to reduce the influence of a single tree and leave space for future trees.<br><br />
(2) Column (feature) subsampling. In the paper, the author only mentioned that this technique speeds up parallel algorithm used in later sections.<br />
<br />
== Split Finding Algorithms ==<br />
<br />
It is very important to find the best split for tree learning to perform well. Here are a few split finding algorithms mentioned in the paper:<br />
<br />
=== Basic Exact Greedy Algorithm ===<br />
<br />
The basic exact greedy algorithm is a split finding algorithm that is computationally expensive because it enumerates over all the possible splits for continuous features. It is impossible to be done efficiently when the memory is not enough to hold the data needed. A way to carry out this algorithm efficiently is to sort the data according to feature values and visit the data in order to accumulate the gradient statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_1.png|center|alt=Alt text|Basic Exact Greedy Algorithm]]<br />
<br />
=== Approximate Algorithm ===<br />
<br />
The paper introduced a more efficient algorithm compared to Basic Exact Greedy Algorithm which is the Approximate Algorithm. The Approximate Algorithm first proposes candidate splitting points according to percentiles of feature distribution. It then maps the continuous features into buckets split by candidate points, aggregates the statistics and finds the best solution among proposals based on the aggregated statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_2.png|center|alt=Alt text|Approximate Algorithm]]<br />
<br />
There are also two variants to this algorithm, the global variant proposes all the candidate splits during the initial phase of tree construction and uses the same proposals for split finding at all levels. Whereas, the local variant re-proposes after each split. The global variant usually requires less proposal steps but uses more candidate points than local variant because candidates are not refined after each split. For deeper trees, usage of local variant may be more appropriate as compared to global variant. The figure below shows the a comparison in accuracy between Basic Exact Greedy and Approximate split finding algorithms with different variant over the number of iterations. We can see that the quantile strategy is able to achieve similar accuracy as the Basic Exact Greedy algorithm given a reasonable approximation level.<br />
<br />
[[File:iterations.png|center|alt=Alt text|Comparison of accuracy between different algorithms]]<br />
<br />
=== Weighted Quantile Sketch ===<br />
<br />
Proposing candidate split points is the most important step in the Approximate Algorithm, it is done by using the percentile of a feature to make candidates distribute evenly on a dataset.<br />
<br />
Formally, we have a dataset<br />
<br />
<math>D_k={(x_{1k},h_1),(x_{2k},h_2),...,(x_{nk},h_n)}</math><br />
<br />
where <math> x_i </math>'s are the feature values of each data point and <math> h_i </math>'s represents the weight of the corresponding feature <math> x_i </math>. <br />
<br />
Then, we can use the following rank function to compute <math>r_k(z)</math>, the proportion of instances whose feature value among <math> (x_i,...,x_k) </math> is smaller than data point <math> z </math>.<br />
<br />
<math>r_k(z) = \frac{1}{\sum_{(x,h) \in D_k} h} \displaystyle\sum_{(x,h) \in D_k, x<z} h,</math><br />
<br />
The objective here is to find candidate split points <math>{s_{k1}, s_{k2}, …, s_{kl}}</math>, such that:<br />
<br />
<math>|r_k(s_{k,j}) – r_k(s_{k,j+1})| < \epsilon, s_{k1} = min (x_{ik}), s_{kl} = max (x_{ik}), \forall i</math><br />
<br />
=== Sparsity-aware Split Finding ===<br />
<br />
== System Design ==<br />
<br />
=== Column Block for Parallel Learning ===<br />
The most time consuming part of tree learning is to get the data into sorted order. To overcome this problem, XGBoost stores the data in blocks where each block performs the sorting operation in parallel. The results are then merged together.<br />
<br />
# For the exact greedy algorithm, XGBoost stores the entire dataset in a single block<br />
#:* Original spase aware algorithm costs: <math>O(Kd∥x∥_0 log(n))</math><br />
#:* Tree boosting on block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(n))</math><br />
#:* Hence, block structure helps to save an additional <math>log(n)</math> factor<br />
# For approximate algorithms, XGBoost stores the dataset in multiple blocks<br />
#:* Original algorithm with binary search costs: <math>O(Kd∥x∥_0 log(q))</math><br />
#:* With block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(B))</math><br />
#:* Hence, block structure helps to save an additional <math>log(q)</math> factor <br />
<br />
K = total number of trees<br /><br />
d = maximum depth of the tree<br /><br />
<math>∥x∥_0</math> = number of non-missing entries in the training data<br /><br />
n = number of rows in the dataset<br /><br />
q = number of proposal candidates in the dataset, usually between 32 to 100<br /><br />
B = maximum number of rows in each block<br />
<br />
[[File: columnblock.png|800px|thumb|center]]<br />
<br />
=== Cache-aware Access ===<br />
The proposed block structure optimizes the computation complexity but requires indirect fetches of gradient statistics by row index. XGBoost optimizes the process by using the following methods.<br />
<br />
# For the exact greedy algorithm, XGBoost uses a cache-aware prefetching algorithm<br />
#:* It stores Gradient and Hessians in the cache to make calculations fast<br />
#:* It runs twice as fast as the naive method when the dataset is large<br />
# For approximate algorithms, XGBoost chooses a specific block size<br />
#:* Choosing a small block size results in inefficient parallelization<br />
#:* Choosing a large block size results in cache misses<br />
#:* Various choices of block size are compared and the results are shown in Figure 9<br />
#:* XGBoost chose <math>2^{16}</math> as the block size<br />
<br />
[[File: blocksize.png|400px|thumb|center]]<br />
<br />
=== Blocks for Out-of-core Computation ===<br />
When the dataset is too large for the cache and main memory, XGBoost utilizes disk spaces as well. Since reading and writing data to the disks are slow, XGBoost optimizes the process by using the following two methods.<br />
<br />
# Block Compression<br />
#:* Blocks are compressed by columns<br />
#:* Although decompressing takes time, it is still faster than reading from the disks<br />
# Block Sharding<br />
#:* If multiple disks are available, data is split into those disks<br />
#:* When the CPU needs data, all the disks can be read at the same time<br />
<br />
== End To End Evaluations ==<br />
=== System Implementation ===<br />
XGBoost is a portable and reusable open-source package. It supports:<br />
* various weighted classification<br />
* various objective functions (rank & user defined)<br />
* popular languages (python, R, Julia)<br />
* data science pipelines (scikit-learn)<br />
* big data stacks (Flink, Spark)<br />
* cloud platform (Tianchi8)<br />
<br />
=== Dataset and Setup ===<br />
<br />
A summary of the 4 datasets used in the experiments is in table 2.<br />
<br />
[[File: table2data.png|500px|thumb|center]]<br />
<br />
The first and last datasets were used specifically to evaluate the impact of sparsity-aware algorithm and the scaling property of the system in the out-of-core and the distributed settings respectively. In all of the experiments, common settings such as maximum depth equal to 8, shrinkage equal to 0.1 and no column subsampling are applied.<br />
<br />
=== Classification ===<br />
A subset (n = 1M) of Higgs Boson dataset was used for classification. The results are shown in Table 3.<br />
<br />
[[File: classification.png|500px|thumb|center]]<br />
<br />
* R’s GBM creates a tree fast by using greedy approach that only expands one branch of a tree but with the cost of lower accuracy<br />
* XGBoost and scikit-learn have better performance than R’s GBM<br />
* XGBoost runs more than 10x faster than scikit-learn in learning a full tree<br />
* Column subsamples give slightly worse performance possibly due to a few important features in this dataset.<br />
<br />
=== Learning to Rank ===<br />
The results in comparing XGBoost with pGBRT are shown in Table 4.<br />
<br />
[[File: rank.png|500px|thumb|center]]<br />
<br />
* XGBoost runs exact greedy algorithm while pGBRT only supports an approximate algorithm<br />
* XGBoost runs faster<br />
* Subsampling column reduces running time and gives higher performance possibly due to preventing overfitting<br />
<br />
=== Out-of-core Experiment ===<br />
An extremely large Criteo dataset was used to evaluate the out-of-core setting. The results are shown in the figure below.<br />
<br />
[[File: outofcore.png|350px|thumb|center]]<br />
<br />
* Compression speed up the computation by a factor of 3<br />
* Sharding into 2 disks further gives 2x speed<br />
<br />
=== Distributed Experiment ===<br />
YARN cluster on EC2 with m3.2xlarge machines was used to evaluate the distributed setting. XGBoost was compared with Spark MLLib and H20.<br />
<br />
* XGBoost can switch to out-of-core setting when the memory runs out, while the baseline systems need to store the data in RAM<br />
* XGBoost runs faster than the baseline systems<br />
* The baseline systems are only able to handle a subset of the data with the given resources while XGBoost was able to scale smoothly to all 1.7B rows<br />
* XGBoost’s performance scales linearly with more machines<br />
* XGBoost is able to handle all 1.7B data with only 4 machines<br />
<br />
== Conclusion ==<br />
<br />
== References ==<br />
[1] R. Bekkerman. The present and the future of the kdd cup competition: an outsider’s perspective. <br />
<br />
[2] R. Bekkerman, M. Bilenko, and J. Langford. Scaling Up Machine Learning: Parallel and Distributed Approaches. Cambridge University Press, New York, NY, USA, 2011. <br />
<br />
[3] J. Bennett and S. Lanning. The netflix prize. In Proceedings of the KDD Cup Workshop 2007, pages 3–6, New York, Aug. 2007.<br />
<br />
[4] L. Breiman. Random forests. Maching Learning, 45(1):5–32, Oct. 2001.<br />
<br />
[5] C. Burges. From ranknet to lambdarank to lambdamart: An overview. Learning, 11:23–581, 2010.<br />
<br />
[6] O. Chapelle and Y. Chang. Yahoo! Learning to Rank Challenge Overview. Journal of Machine Learning Research - W & CP, 14:1–24, 2011.<br />
<br />
[7] T. Chen, H. Li, Q. Yang, and Y. Yu. General functional matrix factorization using gradient boosting. In Proceeding of 30th International Conference on Machine Learning (ICML’13), volume 1, pages 436–444, 2013.<br />
<br />
[8] T. Chen, S. Singh, B. Taskar, and C. Guestrin. Efficient second-order gradient boosting for conditional random fields. In Proceeding of 18th Artificial Intelligence and Statistics Conference (AISTATS’15), volume 1, 2015.<br />
<br />
[9] R.-E. Fan, K.-W. Chang, C.-J. Hsieh, X.-R. Wang, and C.-J. Lin. LIBLINEAR: A library for large linear classification. Journal of Machine Learning Research, 9:1871–1874, 2008.<br />
<br />
[10] J. Friedman. Greedy function approximation: a gradient boosting machine. Annals of Statistics, 29(5):1189–1232, 2001.<br />
<br />
[11] J. Friedman. Stochastic gradient boosting. Computational Statistics & Data Analysis, 38(4):367–378, 2002.<br />
<br />
[12] J. Friedman, T. Hastie, and R. Tibshirani. Additive logistic regression: a statistical view of boosting. Annals of Statistics, 28(2):337–407, 2000.<br />
<br />
[13] J. H. Friedman and B. E. Popescu. Importance sampled learning ensembles, 2003.<br />
<br />
[14] M. Greenwald and S. Khanna. Space-efficient online computation of quantile summaries. In Proceedings of the 2001 ACM SIGMOD International Conference on Management of Data, pages 58–66, 2001.<br />
<br />
[15] X. He, J. Pan, O. Jin, T. Xu, B. Liu, T. Xu, Y. Shi, A. Atallah, R. Herbrich, S. Bowers, and J. Q. n. Candela. Practical lessons from predicting clicks on ads at facebook. In Proceedings of the Eighth International Workshop on Data Mining for Online Advertising, ADKDD’14, 2014.<br />
<br />
[16] P. Li. Robust Logitboost and adaptive base class (ABC) Logitboost. In Proceedings of the Twenty-Sixth Conference Annual Conference on Uncertainty in Artificial Intelligence (UAI’10), pages 302–311, 2010.<br />
<br />
[17] P. Li, Q. Wu, and C. J. Burges. Mcrank: Learning to rank using multiple classification and gradient boosting. In Advances in Neural Information Processing Systems 20, pages 897–904. 2008.<br />
<br />
[18] X. Meng, J. Bradley, B. Yavuz, E. Sparks, S. Venkataraman, D. Liu, J. Freeman, D. Tsai, M. Amde, S. Owen, D. Xin, R. Xin, M. J. Franklin, R. Zadeh, M. Zaharia, and A. Talwalkar. MLlib: Machine learning in apache spark. Journal of Machine Learning Research, 17(34):1–7, 2016.<br />
<br />
[19] B. Panda, J. S. Herbach, S. Basu, and R. J. Bayardo. Planet: Massively parallel learning of tree ensembles with mapreduce. Proceeding of VLDB Endowment, 2(2):1426–1437, Aug. 2009.<br />
<br />
[20] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.<br />
<br />
[21] G. Ridgeway. Generalized Boosted Models: A guide to the gbm package.<br />
<br />
[22] S. Tyree, K. Weinberger, K. Agrawal, and J. Paykin. Parallel boosted regression trees for web search ranking. In Proceedings of the 20th international conference on World wide web, pages 387–396. ACM, 2011.<br />
<br />
[23] J. Ye, J.-H. Chow, J. Chen, and Z. Zheng. Stochastic gradient boosted distributed decision trees. In Proceedings of the 18th ACM Conference on Information and Knowledge Management, CIKM ’09.<br />
<br />
[24] Q. Zhang and W. Wang. A fast algorithm for approximate quantiles in high speed data streams. In Proceedings of the 19th International Conference on Scientific and Statistical Database Management, 2007.<br />
<br />
[25] T. Zhang and R. Johnson. Learning nonlinear functions using regularized greedy forest. IEEE Transactions on Pattern Analysis and Machine Intelligence, 36(5), 2014.</div>Cwlokehttp://wiki.math.uwaterloo.ca/statwiki/index.php?title=XGBoost&diff=51104XGBoost2021-11-29T04:30:37Z<p>Cwloke: /* Weighted Quantile Sketch */</p>
<hr />
<div>== Presented by == <br />
* Chun Waan Loke<br />
* Peter Chong<br />
* Clarice Osmond<br />
* Zhilong Li<br />
<br />
== Introduction ==<br />
<br />
== Tree Boosting In A Nutshell ==<br />
The author reviews gradient tree boosting in this section.<br />
=== Regularized Learning Objective ===<br />
The author first gives the prediction equation (1) and the regularized objective (2).<br><br />
<br><br />
(1) The additive prediction model is given as<br><br />
<math>\hat{y_i}=\sum_{k=1}^{K}f_k(x_i), f_k \in \mathcal{F} </math> <br><br />
where each <math>f_k</math> corresponds to an independent tree structure with its weights, and <math>\mathcal{F}</math> is the "space of regression trees"<br><br />
<br><br />
(2) The regularized objective to be minimized is given as<br><br />
<math>\mathcal{L}=\sum_{i}l(\hat{y_i},y_i)+\sum_k \Omega(f_k)</math> where <math>\Omega(f)=\gamma T+\frac{1}{2}\lambda ||\omega||^2</math> <br><br />
The first term <math>l</math> is a differentiable convex loss function that calculates the measures between <math>\hat{y}</math> and <math>y</math>.<br><br />
The second term <math>\Omega</math> penalizes on the complexity of model (the <math>f_k</math>'s). For a given tree (<math>f_k</math>), <math>T</math> is the number of leaves, and <math>\omega</math> is the leaf weights.<br><br />
The L1 regularization term <math>\gamma T</math> encourages the tree to be small, and the L2 regularization term <math>\frac{1}{2}\lambda ||\omega||^2</math> encourages the tree to have small weights.<br><br />
<br />
=== Gradient Tree Boosting ===<br />
Let <math>\hat{y_i}^{(t)}</math> be the prediction of <math>y_i</math> at the t-th iteration.<br><br />
Since the prediction equation is simply additive, <math>{\hat y_i}^{(t)}=\hat{y_{i}}^{(t-1)}+f_t(x_i)</math><br><br />
Using this equation and 2nd order Taylor approximation on the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> gives <br><br />
\begin{align}<br />
\mathcal{L}^{(t)}&=\sum_{i}^{n}l(y_i,\hat{y_i}^{(t-1)}+f_t(x_i))+\Omega(f_t)\\<br />
&\simeq \sum_{i}^{n}[l(y_i,\hat{y_i}^{(t-1)})+g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
\end{align}<br />
where <math>g_i</math> and <math>h_i</math> are the first and second derivative of the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> with repspect to the term <math>\hat{y}^{(t-1)}</math><br><br />
We can simplify this objective by removing the constant term <math>l(y_i,\hat{y_i}^{(t-1)})</math>.<br><br />
Define <math>I_j=\{i|q(x_i)=j\}</math>, where <math>q</math> is the tree structure. Since every <math>x_i</math> is mapped by <math>q</math> to some leaf <math>j</math>, going through every <math>x_i</math> is equivalent to going through each leaf j of the structure.<br />
\begin{align}<br />
\tilde{\mathcal{L}}^{(t)}&= \sum_{i}^{n}[g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
&= \sum_{j=1}^{T}[(\sum_{i \in I_j}g_i)\omega_j+\frac{1}{2}(\sum_{i \in I_j}h_i+\lambda)\omega_j^2]+\gamma T<br />
\end{align}<br />
Then for a fixed structure <math>q</math>, the optimal weight of leaf <math>j</math> and the optimal objective value are given as<br><br />
\begin{align}<br />
\omega_j^{*} &= -\frac{\sum_{i \in I_j}g_i}{\sum_{i \in I_j}h_i+\lambda}\\<br />
\tilde{\mathcal{L}}^{(t)}(q) &=-\frac{1}{2}\sum_{j=1}^{T}\frac{(\sum_{i \in I_j}g_i)^2}{\sum_{i \in I_j}h_i+\lambda}+\gamma T<br />
\end{align} <br />
[[File:Structure Score Calculation.png|frame|center|alt=Alt text|Structure Score Calculation]]<br />
Instead of enumerating through all possible tree structures q, a greedy algorithm of iteratively adding branches is used.<br><br />
Let <math>I_L</math> and <math>I_R</math> be the instance sets of left and right nodes after split and let <math>I=I_L\cup I_R</math>.<br><br />
The loss reduction after split is given by<br><br />
\begin{align}<br />
\tilde{\mathcal{L}}_{\text{split}} &=\frac{1}{2}[\frac{(\sum_{i \in I_L}g_i)^2}{\sum_{i \in I_L}h_i+\lambda}+\frac{(\sum_{i \in I_R}g_i)^2}{\sum_{i \in I_R}h_i+\lambda}-\frac{(\sum_{i \in I}g_i)^2}{\sum_{i \in I}h_i+\lambda}]+\gamma<br />
\end{align}<br />
=== Shrinkage and Column Subsampling ===<br />
The author also mentioned two other methods in order to avoid over-fitting.<br><br />
(1) Shrinkage. Similar to the learning rate in stochastic optimization, a new weight is added to each tree boosting to reduce the influence of a single tree and leave space for future trees.<br><br />
(2) Column (feature) subsampling. In the paper, the author only mentioned that this technique speeds up parallel algorithm used in later sections.<br />
<br />
== Split Finding Algorithms ==<br />
<br />
It is very important to find the best split for tree learning to perform well. Here are a few split finding algorithms mentioned in the paper:<br />
<br />
=== Basic Exact Greedy Algorithm ===<br />
<br />
The basic exact greedy algorithm is a split finding algorithm that is computationally expensive because it enumerates over all the possible splits for continuous features. It is impossible to be done efficiently when the memory is not enough to hold the data needed. A way to carry out this algorithm efficiently is to sort the data according to feature values and visit the data in order to accumulate the gradient statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_1.png|center|alt=Alt text|Basic Exact Greedy Algorithm]]<br />
<br />
=== Approximate Algorithm ===<br />
<br />
The paper introduced a more efficient algorithm compared to Basic Exact Greedy Algorithm which is the Approximate Algorithm. The Approximate Algorithm first proposes candidate splitting points according to percentiles of feature distribution. It then maps the continuous features into buckets split by candidate points, aggregates the statistics and finds the best solution among proposals based on the aggregated statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_2.png|center|alt=Alt text|Approximate Algorithm]]<br />
<br />
There are also two variants to this algorithm, the global variant proposes all the candidate splits during the initial phase of tree construction and uses the same proposals for split finding at all levels. Whereas, the local variant re-proposes after each split. The global variant usually requires less proposal steps but uses more candidate points than local variant because candidates are not refined after each split. For deeper trees, usage of local variant may be more appropriate as compared to global variant. The figure below shows the a comparison in accuracy between Basic Exact Greedy and Approximate split finding algorithms with different variant over the number of iterations. We can see that the quantile strategy is able to achieve similar accuracy as the Basic Exact Greedy algorithm given a reasonable approximation level.<br />
<br />
[[File:iterations.png|center|alt=Alt text|Comparison of accuracy between different algorithms]]<br />
<br />
=== Weighted Quantile Sketch ===<br />
<br />
Proposing candidate split points is the most important step in the Approximate Algorithm, it is done by using the percentile of a feature to make candidates distribute evenly on a dataset.<br />
<br />
Formally, we have a dataset<br />
<br />
<math>D_k={(x_{1k},h_1),(x_{2k},h_2),...,(x_{nk},h_n)}</math><br />
<br />
where <math> x_i </math>'s are the feature values of each data point and <math> h_i </math>'s represents the weight of the corresponding feature <math> x_i </math>. <br />
<br />
Then, we can use the following rank function to compute <math>r_k(z)</math>, the proportion of instances whose feature value among <math> (x_i,...,x_k) </math> is smaller than data point <math> z </math>.<br />
<br />
<math>r_k(z) = \frac{1}{\sum_{(x,h) \in D_k} h} \displaystyle\sum_{(x,h) \in D_k, x<z} h,</math><br />
<br />
=== Sparsity-aware Split Finding ===<br />
<br />
== System Design ==<br />
<br />
=== Column Block for Parallel Learning ===<br />
The most time consuming part of tree learning is to get the data into sorted order. To overcome this problem, XGBoost stores the data in blocks where each block performs the sorting operation in parallel. The results are then merged together.<br />
<br />
# For the exact greedy algorithm, XGBoost stores the entire dataset in a single block<br />
#:* Original spase aware algorithm costs: <math>O(Kd∥x∥_0 log(n))</math><br />
#:* Tree boosting on block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(n))</math><br />
#:* Hence, block structure helps to save an additional <math>log(n)</math> factor<br />
# For approximate algorithms, XGBoost stores the dataset in multiple blocks<br />
#:* Original algorithm with binary search costs: <math>O(Kd∥x∥_0 log(q))</math><br />
#:* With block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(B))</math><br />
#:* Hence, block structure helps to save an additional <math>log(q)</math> factor <br />
<br />
K = total number of trees<br /><br />
d = maximum depth of the tree<br /><br />
<math>∥x∥_0</math> = number of non-missing entries in the training data<br /><br />
n = number of rows in the dataset<br /><br />
q = number of proposal candidates in the dataset, usually between 32 to 100<br /><br />
B = maximum number of rows in each block<br />
<br />
[[File: columnblock.png|800px|thumb|center]]<br />
<br />
=== Cache-aware Access ===<br />
The proposed block structure optimizes the computation complexity but requires indirect fetches of gradient statistics by row index. XGBoost optimizes the process by using the following methods.<br />
<br />
# For the exact greedy algorithm, XGBoost uses a cache-aware prefetching algorithm<br />
#:* It stores Gradient and Hessians in the cache to make calculations fast<br />
#:* It runs twice as fast as the naive method when the dataset is large<br />
# For approximate algorithms, XGBoost chooses a specific block size<br />
#:* Choosing a small block size results in inefficient parallelization<br />
#:* Choosing a large block size results in cache misses<br />
#:* Various choices of block size are compared and the results are shown in Figure 9<br />
#:* XGBoost chose <math>2^{16}</math> as the block size<br />
<br />
[[File: blocksize.png|400px|thumb|center]]<br />
<br />
=== Blocks for Out-of-core Computation ===<br />
When the dataset is too large for the cache and main memory, XGBoost utilizes disk spaces as well. Since reading and writing data to the disks are slow, XGBoost optimizes the process by using the following two methods.<br />
<br />
# Block Compression<br />
#:* Blocks are compressed by columns<br />
#:* Although decompressing takes time, it is still faster than reading from the disks<br />
# Block Sharding<br />
#:* If multiple disks are available, data is split into those disks<br />
#:* When the CPU needs data, all the disks can be read at the same time<br />
<br />
== End To End Evaluations ==<br />
=== System Implementation ===<br />
XGBoost is a portable and reusable open-source package. It supports:<br />
* various weighted classification<br />
* various objective functions (rank & user defined)<br />
* popular languages (python, R, Julia)<br />
* data science pipelines (scikit-learn)<br />
* big data stacks (Flink, Spark)<br />
* cloud platform (Tianchi8)<br />
<br />
=== Dataset and Setup ===<br />
<br />
A summary of the 4 datasets used in the experiments is in table 2.<br />
<br />
[[File: table2data.png|500px|thumb|center]]<br />
<br />
The first and last datasets were used specifically to evaluate the impact of sparsity-aware algorithm and the scaling property of the system in the out-of-core and the distributed settings respectively. In all of the experiments, common settings such as maximum depth equal to 8, shrinkage equal to 0.1 and no column subsampling are applied.<br />
<br />
=== Classification ===<br />
A subset (n = 1M) of Higgs Boson dataset was used for classification. The results are shown in Table 3.<br />
<br />
[[File: classification.png|500px|thumb|center]]<br />
<br />
* R’s GBM creates a tree fast by using greedy approach that only expands one branch of a tree but with the cost of lower accuracy<br />
* XGBoost and scikit-learn have better performance than R’s GBM<br />
* XGBoost runs more than 10x faster than scikit-learn in learning a full tree<br />
* Column subsamples give slightly worse performance possibly due to a few important features in this dataset.<br />
<br />
=== Learning to Rank ===<br />
The results in comparing XGBoost with pGBRT are shown in Table 4.<br />
<br />
[[File: rank.png|500px|thumb|center]]<br />
<br />
* XGBoost runs exact greedy algorithm while pGBRT only supports an approximate algorithm<br />
* XGBoost runs faster<br />
* Subsampling column reduces running time and gives higher performance possibly due to preventing overfitting<br />
<br />
=== Out-of-core Experiment ===<br />
An extremely large Criteo dataset was used to evaluate the out-of-core setting. The results are shown in the figure below.<br />
<br />
[[File: outofcore.png|350px|thumb|center]]<br />
<br />
* Compression speed up the computation by a factor of 3<br />
* Sharding into 2 disks further gives 2x speed<br />
<br />
=== Distributed Experiment ===<br />
YARN cluster on EC2 with m3.2xlarge machines was used to evaluate the distributed setting. XGBoost was compared with Spark MLLib and H20.<br />
<br />
* XGBoost can switch to out-of-core setting when the memory runs out, while the baseline systems need to store the data in RAM<br />
* XGBoost runs faster than the baseline systems<br />
* The baseline systems are only able to handle a subset of the data with the given resources while XGBoost was able to scale smoothly to all 1.7B rows<br />
* XGBoost’s performance scales linearly with more machines<br />
* XGBoost is able to handle all 1.7B data with only 4 machines<br />
<br />
== Conclusion ==<br />
<br />
== References ==<br />
[1] R. Bekkerman. The present and the future of the kdd cup competition: an outsider’s perspective. <br />
<br />
[2] R. Bekkerman, M. Bilenko, and J. Langford. Scaling Up Machine Learning: Parallel and Distributed Approaches. Cambridge University Press, New York, NY, USA, 2011. <br />
<br />
[3] J. Bennett and S. Lanning. The netflix prize. In Proceedings of the KDD Cup Workshop 2007, pages 3–6, New York, Aug. 2007.<br />
<br />
[4] L. Breiman. Random forests. Maching Learning, 45(1):5–32, Oct. 2001.<br />
<br />
[5] C. Burges. From ranknet to lambdarank to lambdamart: An overview. Learning, 11:23–581, 2010.<br />
<br />
[6] O. Chapelle and Y. Chang. Yahoo! Learning to Rank Challenge Overview. Journal of Machine Learning Research - W & CP, 14:1–24, 2011.<br />
<br />
[7] T. Chen, H. Li, Q. Yang, and Y. Yu. General functional matrix factorization using gradient boosting. In Proceeding of 30th International Conference on Machine Learning (ICML’13), volume 1, pages 436–444, 2013.<br />
<br />
[8] T. Chen, S. Singh, B. Taskar, and C. Guestrin. Efficient second-order gradient boosting for conditional random fields. In Proceeding of 18th Artificial Intelligence and Statistics Conference (AISTATS’15), volume 1, 2015.<br />
<br />
[9] R.-E. Fan, K.-W. Chang, C.-J. Hsieh, X.-R. Wang, and C.-J. Lin. LIBLINEAR: A library for large linear classification. Journal of Machine Learning Research, 9:1871–1874, 2008.<br />
<br />
[10] J. Friedman. Greedy function approximation: a gradient boosting machine. Annals of Statistics, 29(5):1189–1232, 2001.<br />
<br />
[11] J. Friedman. Stochastic gradient boosting. Computational Statistics & Data Analysis, 38(4):367–378, 2002.<br />
<br />
[12] J. Friedman, T. Hastie, and R. Tibshirani. Additive logistic regression: a statistical view of boosting. Annals of Statistics, 28(2):337–407, 2000.<br />
<br />
[13] J. H. Friedman and B. E. Popescu. Importance sampled learning ensembles, 2003.<br />
<br />
[14] M. Greenwald and S. Khanna. Space-efficient online computation of quantile summaries. In Proceedings of the 2001 ACM SIGMOD International Conference on Management of Data, pages 58–66, 2001.<br />
<br />
[15] X. He, J. Pan, O. Jin, T. Xu, B. Liu, T. Xu, Y. Shi, A. Atallah, R. Herbrich, S. Bowers, and J. Q. n. Candela. Practical lessons from predicting clicks on ads at facebook. In Proceedings of the Eighth International Workshop on Data Mining for Online Advertising, ADKDD’14, 2014.<br />
<br />
[16] P. Li. Robust Logitboost and adaptive base class (ABC) Logitboost. In Proceedings of the Twenty-Sixth Conference Annual Conference on Uncertainty in Artificial Intelligence (UAI’10), pages 302–311, 2010.<br />
<br />
[17] P. Li, Q. Wu, and C. J. Burges. Mcrank: Learning to rank using multiple classification and gradient boosting. In Advances in Neural Information Processing Systems 20, pages 897–904. 2008.<br />
<br />
[18] X. Meng, J. Bradley, B. Yavuz, E. Sparks, S. Venkataraman, D. Liu, J. Freeman, D. Tsai, M. Amde, S. Owen, D. Xin, R. Xin, M. J. Franklin, R. Zadeh, M. Zaharia, and A. Talwalkar. MLlib: Machine learning in apache spark. Journal of Machine Learning Research, 17(34):1–7, 2016.<br />
<br />
[19] B. Panda, J. S. Herbach, S. Basu, and R. J. Bayardo. Planet: Massively parallel learning of tree ensembles with mapreduce. Proceeding of VLDB Endowment, 2(2):1426–1437, Aug. 2009.<br />
<br />
[20] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.<br />
<br />
[21] G. Ridgeway. Generalized Boosted Models: A guide to the gbm package.<br />
<br />
[22] S. Tyree, K. Weinberger, K. Agrawal, and J. Paykin. Parallel boosted regression trees for web search ranking. In Proceedings of the 20th international conference on World wide web, pages 387–396. ACM, 2011.<br />
<br />
[23] J. Ye, J.-H. Chow, J. Chen, and Z. Zheng. Stochastic gradient boosted distributed decision trees. In Proceedings of the 18th ACM Conference on Information and Knowledge Management, CIKM ’09.<br />
<br />
[24] Q. Zhang and W. Wang. A fast algorithm for approximate quantiles in high speed data streams. In Proceedings of the 19th International Conference on Scientific and Statistical Database Management, 2007.<br />
<br />
[25] T. Zhang and R. Johnson. Learning nonlinear functions using regularized greedy forest. IEEE Transactions on Pattern Analysis and Machine Intelligence, 36(5), 2014.</div>Cwlokehttp://wiki.math.uwaterloo.ca/statwiki/index.php?title=XGBoost&diff=51103XGBoost2021-11-29T04:28:40Z<p>Cwloke: /* Weighted Quantile Sketch */</p>
<hr />
<div>== Presented by == <br />
* Chun Waan Loke<br />
* Peter Chong<br />
* Clarice Osmond<br />
* Zhilong Li<br />
<br />
== Introduction ==<br />
<br />
== Tree Boosting In A Nutshell ==<br />
The author reviews gradient tree boosting in this section.<br />
=== Regularized Learning Objective ===<br />
The author first gives the prediction equation (1) and the regularized objective (2).<br><br />
<br><br />
(1) The additive prediction model is given as<br><br />
<math>\hat{y_i}=\sum_{k=1}^{K}f_k(x_i), f_k \in \mathcal{F} </math> <br><br />
where each <math>f_k</math> corresponds to an independent tree structure with its weights, and <math>\mathcal{F}</math> is the "space of regression trees"<br><br />
<br><br />
(2) The regularized objective to be minimized is given as<br><br />
<math>\mathcal{L}=\sum_{i}l(\hat{y_i},y_i)+\sum_k \Omega(f_k)</math> where <math>\Omega(f)=\gamma T+\frac{1}{2}\lambda ||\omega||^2</math> <br><br />
The first term <math>l</math> is a differentiable convex loss function that calculates the measures between <math>\hat{y}</math> and <math>y</math>.<br><br />
The second term <math>\Omega</math> penalizes on the complexity of model (the <math>f_k</math>'s). For a given tree (<math>f_k</math>), <math>T</math> is the number of leaves, and <math>\omega</math> is the leaf weights.<br><br />
The L1 regularization term <math>\gamma T</math> encourages the tree to be small, and the L2 regularization term <math>\frac{1}{2}\lambda ||\omega||^2</math> encourages the tree to have small weights.<br><br />
<br />
=== Gradient Tree Boosting ===<br />
Let <math>\hat{y_i}^{(t)}</math> be the prediction of <math>y_i</math> at the t-th iteration.<br><br />
Since the prediction equation is simply additive, <math>{\hat y_i}^{(t)}=\hat{y_{i}}^{(t-1)}+f_t(x_i)</math><br><br />
Using this equation and 2nd order Taylor approximation on the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> gives <br><br />
\begin{align}<br />
\mathcal{L}^{(t)}&=\sum_{i}^{n}l(y_i,\hat{y_i}^{(t-1)}+f_t(x_i))+\Omega(f_t)\\<br />
&\simeq \sum_{i}^{n}[l(y_i,\hat{y_i}^{(t-1)})+g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
\end{align}<br />
where <math>g_i</math> and <math>h_i</math> are the first and second derivative of the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> with repspect to the term <math>\hat{y}^{(t-1)}</math><br><br />
We can simplify this objective by removing the constant term <math>l(y_i,\hat{y_i}^{(t-1)})</math>.<br><br />
Define <math>I_j=\{i|q(x_i)=j\}</math>, where <math>q</math> is the tree structure. Since every <math>x_i</math> is mapped by <math>q</math> to some leaf <math>j</math>, going through every <math>x_i</math> is equivalent to going through each leaf j of the structure.<br />
\begin{align}<br />
\tilde{\mathcal{L}}^{(t)}&= \sum_{i}^{n}[g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
&= \sum_{j=1}^{T}[(\sum_{i \in I_j}g_i)\omega_j+\frac{1}{2}(\sum_{i \in I_j}h_i+\lambda)\omega_j^2]+\gamma T<br />
\end{align}<br />
Then for a fixed structure <math>q</math>, the optimal weight of leaf <math>j</math> and the optimal objective value are given as<br><br />
\begin{align}<br />
\omega_j^{*} &= -\frac{\sum_{i \in I_j}g_i}{\sum_{i \in I_j}h_i+\lambda}\\<br />
\tilde{\mathcal{L}}^{(t)}(q) &=-\frac{1}{2}\sum_{j=1}^{T}\frac{(\sum_{i \in I_j}g_i)^2}{\sum_{i \in I_j}h_i+\lambda}+\gamma T<br />
\end{align} <br />
[[File:Structure Score Calculation.png|frame|center|alt=Alt text|Structure Score Calculation]]<br />
Instead of enumerating through all possible tree structures q, a greedy algorithm of iteratively adding branches is used.<br><br />
Let <math>I_L</math> and <math>I_R</math> be the instance sets of left and right nodes after split and let <math>I=I_L\cup I_R</math>.<br><br />
The loss reduction after split is given by<br><br />
\begin{align}<br />
\tilde{\mathcal{L}}_{\text{split}} &=\frac{1}{2}[\frac{(\sum_{i \in I_L}g_i)^2}{\sum_{i \in I_L}h_i+\lambda}+\frac{(\sum_{i \in I_R}g_i)^2}{\sum_{i \in I_R}h_i+\lambda}-\frac{(\sum_{i \in I}g_i)^2}{\sum_{i \in I}h_i+\lambda}]+\gamma<br />
\end{align}<br />
=== Shrinkage and Column Subsampling ===<br />
The author also mentioned two other methods in order to avoid over-fitting.<br><br />
(1) Shrinkage. Similar to the learning rate in stochastic optimization, a new weight is added to each tree boosting to reduce the influence of a single tree and leave space for future trees.<br><br />
(2) Column (feature) subsampling. In the paper, the author only mentioned that this technique speeds up parallel algorithm used in later sections.<br />
<br />
== Split Finding Algorithms ==<br />
<br />
It is very important to find the best split for tree learning to perform well. Here are a few split finding algorithms mentioned in the paper:<br />
<br />
=== Basic Exact Greedy Algorithm ===<br />
<br />
The basic exact greedy algorithm is a split finding algorithm that is computationally expensive because it enumerates over all the possible splits for continuous features. It is impossible to be done efficiently when the memory is not enough to hold the data needed. A way to carry out this algorithm efficiently is to sort the data according to feature values and visit the data in order to accumulate the gradient statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_1.png|center|alt=Alt text|Basic Exact Greedy Algorithm]]<br />
<br />
=== Approximate Algorithm ===<br />
<br />
The paper introduced a more efficient algorithm compared to Basic Exact Greedy Algorithm which is the Approximate Algorithm. The Approximate Algorithm first proposes candidate splitting points according to percentiles of feature distribution. It then maps the continuous features into buckets split by candidate points, aggregates the statistics and finds the best solution among proposals based on the aggregated statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_2.png|center|alt=Alt text|Approximate Algorithm]]<br />
<br />
There are also two variants to this algorithm, the global variant proposes all the candidate splits during the initial phase of tree construction and uses the same proposals for split finding at all levels. Whereas, the local variant re-proposes after each split. The global variant usually requires less proposal steps but uses more candidate points than local variant because candidates are not refined after each split. For deeper trees, usage of local variant may be more appropriate as compared to global variant. The figure below shows the a comparison in accuracy between Basic Exact Greedy and Approximate split finding algorithms with different variant over the number of iterations. We can see that the quantile strategy is able to achieve similar accuracy as the Basic Exact Greedy algorithm given a reasonable approximation level.<br />
<br />
[[File:iterations.png|center|alt=Alt text|Comparison of accuracy between different algorithms]]<br />
<br />
=== Weighted Quantile Sketch ===<br />
<br />
Proposing candidate split points is the most important step in the Approximate Algorithm, it is done by using the percentile of a feature to make candidates distribute evenly on a dataset.<br />
<br />
Formally, we have a dataset<br />
<br />
<math>D_k={(x_{1k},h_1),(x_{2k},h_2),...,(x_{nk},h_n)}</math><br />
<br />
where <math> x_i </math>'s are the feature values of each data point and <math> h_i </math>'s represents the weight of the corresponding feature <math> x_i </math>. <br />
<br />
Then, we can use the following rank function to compute <math>r_k(z)</math>, the proportion of instances whose feature value among <math> (x_i,...,x_k) </math> is smaller than data point <math> z </math>.<br />
<br />
<math>r_k(z) = \frac{1}{\sum_{(x,h) \in D_k} h} \sum_{(x,h) \in D_k, x<z} h,</math><br />
<br />
=== Sparsity-aware Split Finding ===<br />
<br />
== System Design ==<br />
<br />
=== Column Block for Parallel Learning ===<br />
The most time consuming part of tree learning is to get the data into sorted order. To overcome this problem, XGBoost stores the data in blocks where each block performs the sorting operation in parallel. The results are then merged together.<br />
<br />
# For the exact greedy algorithm, XGBoost stores the entire dataset in a single block<br />
#:* Original spase aware algorithm costs: <math>O(Kd∥x∥_0 log(n))</math><br />
#:* Tree boosting on block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(n))</math><br />
#:* Hence, block structure helps to save an additional <math>log(n)</math> factor<br />
# For approximate algorithms, XGBoost stores the dataset in multiple blocks<br />
#:* Original algorithm with binary search costs: <math>O(Kd∥x∥_0 log(q))</math><br />
#:* With block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(B))</math><br />
#:* Hence, block structure helps to save an additional <math>log(q)</math> factor <br />
<br />
K = total number of trees<br /><br />
d = maximum depth of the tree<br /><br />
<math>∥x∥_0</math> = number of non-missing entries in the training data<br /><br />
n = number of rows in the dataset<br /><br />
q = number of proposal candidates in the dataset, usually between 32 to 100<br /><br />
B = maximum number of rows in each block<br />
<br />
[[File: columnblock.png|800px|thumb|center]]<br />
<br />
=== Cache-aware Access ===<br />
The proposed block structure optimizes the computation complexity but requires indirect fetches of gradient statistics by row index. XGBoost optimizes the process by using the following methods.<br />
<br />
# For the exact greedy algorithm, XGBoost uses a cache-aware prefetching algorithm<br />
#:* It stores Gradient and Hessians in the cache to make calculations fast<br />
#:* It runs twice as fast as the naive method when the dataset is large<br />
# For approximate algorithms, XGBoost chooses a specific block size<br />
#:* Choosing a small block size results in inefficient parallelization<br />
#:* Choosing a large block size results in cache misses<br />
#:* Various choices of block size are compared and the results are shown in Figure 9<br />
#:* XGBoost chose <math>2^{16}</math> as the block size<br />
<br />
[[File: blocksize.png|400px|thumb|center]]<br />
<br />
=== Blocks for Out-of-core Computation ===<br />
When the dataset is too large for the cache and main memory, XGBoost utilizes disk spaces as well. Since reading and writing data to the disks are slow, XGBoost optimizes the process by using the following two methods.<br />
<br />
# Block Compression<br />
#:* Blocks are compressed by columns<br />
#:* Although decompressing takes time, it is still faster than reading from the disks<br />
# Block Sharding<br />
#:* If multiple disks are available, data is split into those disks<br />
#:* When the CPU needs data, all the disks can be read at the same time<br />
<br />
== End To End Evaluations ==<br />
=== System Implementation ===<br />
XGBoost is a portable and reusable open-source package. It supports:<br />
* various weighted classification<br />
* various objective functions (rank & user defined)<br />
* popular languages (python, R, Julia)<br />
* data science pipelines (scikit-learn)<br />
* big data stacks (Flink, Spark)<br />
* cloud platform (Tianchi8)<br />
<br />
=== Dataset and Setup ===<br />
<br />
A summary of the 4 datasets used in the experiments is in table 2.<br />
<br />
[[File: table2data.png|500px|thumb|center]]<br />
<br />
The first and last datasets were used specifically to evaluate the impact of sparsity-aware algorithm and the scaling property of the system in the out-of-core and the distributed settings respectively. In all of the experiments, common settings such as maximum depth equal to 8, shrinkage equal to 0.1 and no column subsampling are applied.<br />
<br />
=== Classification ===<br />
A subset (n = 1M) of Higgs Boson dataset was used for classification. The results are shown in Table 3.<br />
<br />
[[File: classification.png|500px|thumb|center]]<br />
<br />
* R’s GBM creates a tree fast by using greedy approach that only expands one branch of a tree but with the cost of lower accuracy<br />
* XGBoost and scikit-learn have better performance than R’s GBM<br />
* XGBoost runs more than 10x faster than scikit-learn in learning a full tree<br />
* Column subsamples give slightly worse performance possibly due to a few important features in this dataset.<br />
<br />
=== Learning to Rank ===<br />
The results in comparing XGBoost with pGBRT are shown in Table 4.<br />
<br />
[[File: rank.png|500px|thumb|center]]<br />
<br />
* XGBoost runs exact greedy algorithm while pGBRT only supports an approximate algorithm<br />
* XGBoost runs faster<br />
* Subsampling column reduces running time and gives higher performance possibly due to preventing overfitting<br />
<br />
=== Out-of-core Experiment ===<br />
An extremely large Criteo dataset was used to evaluate the out-of-core setting. The results are shown in the figure below.<br />
<br />
[[File: outofcore.png|350px|thumb|center]]<br />
<br />
* Compression speed up the computation by a factor of 3<br />
* Sharding into 2 disks further gives 2x speed<br />
<br />
=== Distributed Experiment ===<br />
YARN cluster on EC2 with m3.2xlarge machines was used to evaluate the distributed setting. XGBoost was compared with Spark MLLib and H20.<br />
<br />
* XGBoost can switch to out-of-core setting when the memory runs out, while the baseline systems need to store the data in RAM<br />
* XGBoost runs faster than the baseline systems<br />
* The baseline systems are only able to handle a subset of the data with the given resources while XGBoost was able to scale smoothly to all 1.7B rows<br />
* XGBoost’s performance scales linearly with more machines<br />
* XGBoost is able to handle all 1.7B data with only 4 machines<br />
<br />
== Conclusion ==<br />
<br />
== References ==<br />
[1] R. Bekkerman. The present and the future of the kdd cup competition: an outsider’s perspective. <br />
<br />
[2] R. Bekkerman, M. Bilenko, and J. Langford. Scaling Up Machine Learning: Parallel and Distributed Approaches. Cambridge University Press, New York, NY, USA, 2011. <br />
<br />
[3] J. Bennett and S. Lanning. The netflix prize. In Proceedings of the KDD Cup Workshop 2007, pages 3–6, New York, Aug. 2007.<br />
<br />
[4] L. Breiman. Random forests. Maching Learning, 45(1):5–32, Oct. 2001.<br />
<br />
[5] C. Burges. From ranknet to lambdarank to lambdamart: An overview. Learning, 11:23–581, 2010.<br />
<br />
[6] O. Chapelle and Y. Chang. Yahoo! Learning to Rank Challenge Overview. Journal of Machine Learning Research - W & CP, 14:1–24, 2011.<br />
<br />
[7] T. Chen, H. Li, Q. Yang, and Y. Yu. General functional matrix factorization using gradient boosting. In Proceeding of 30th International Conference on Machine Learning (ICML’13), volume 1, pages 436–444, 2013.<br />
<br />
[8] T. Chen, S. Singh, B. Taskar, and C. Guestrin. Efficient second-order gradient boosting for conditional random fields. In Proceeding of 18th Artificial Intelligence and Statistics Conference (AISTATS’15), volume 1, 2015.<br />
<br />
[9] R.-E. Fan, K.-W. Chang, C.-J. Hsieh, X.-R. Wang, and C.-J. Lin. LIBLINEAR: A library for large linear classification. Journal of Machine Learning Research, 9:1871–1874, 2008.<br />
<br />
[10] J. Friedman. Greedy function approximation: a gradient boosting machine. Annals of Statistics, 29(5):1189–1232, 2001.<br />
<br />
[11] J. Friedman. Stochastic gradient boosting. Computational Statistics & Data Analysis, 38(4):367–378, 2002.<br />
<br />
[12] J. Friedman, T. Hastie, and R. Tibshirani. Additive logistic regression: a statistical view of boosting. Annals of Statistics, 28(2):337–407, 2000.<br />
<br />
[13] J. H. Friedman and B. E. Popescu. Importance sampled learning ensembles, 2003.<br />
<br />
[14] M. Greenwald and S. Khanna. Space-efficient online computation of quantile summaries. In Proceedings of the 2001 ACM SIGMOD International Conference on Management of Data, pages 58–66, 2001.<br />
<br />
[15] X. He, J. Pan, O. Jin, T. Xu, B. Liu, T. Xu, Y. Shi, A. Atallah, R. Herbrich, S. Bowers, and J. Q. n. Candela. Practical lessons from predicting clicks on ads at facebook. In Proceedings of the Eighth International Workshop on Data Mining for Online Advertising, ADKDD’14, 2014.<br />
<br />
[16] P. Li. Robust Logitboost and adaptive base class (ABC) Logitboost. In Proceedings of the Twenty-Sixth Conference Annual Conference on Uncertainty in Artificial Intelligence (UAI’10), pages 302–311, 2010.<br />
<br />
[17] P. Li, Q. Wu, and C. J. Burges. Mcrank: Learning to rank using multiple classification and gradient boosting. In Advances in Neural Information Processing Systems 20, pages 897–904. 2008.<br />
<br />
[18] X. Meng, J. Bradley, B. Yavuz, E. Sparks, S. Venkataraman, D. Liu, J. Freeman, D. Tsai, M. Amde, S. Owen, D. Xin, R. Xin, M. J. Franklin, R. Zadeh, M. Zaharia, and A. Talwalkar. MLlib: Machine learning in apache spark. Journal of Machine Learning Research, 17(34):1–7, 2016.<br />
<br />
[19] B. Panda, J. S. Herbach, S. Basu, and R. J. Bayardo. Planet: Massively parallel learning of tree ensembles with mapreduce. Proceeding of VLDB Endowment, 2(2):1426–1437, Aug. 2009.<br />
<br />
[20] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.<br />
<br />
[21] G. Ridgeway. Generalized Boosted Models: A guide to the gbm package.<br />
<br />
[22] S. Tyree, K. Weinberger, K. Agrawal, and J. Paykin. Parallel boosted regression trees for web search ranking. In Proceedings of the 20th international conference on World wide web, pages 387–396. ACM, 2011.<br />
<br />
[23] J. Ye, J.-H. Chow, J. Chen, and Z. Zheng. Stochastic gradient boosted distributed decision trees. In Proceedings of the 18th ACM Conference on Information and Knowledge Management, CIKM ’09.<br />
<br />
[24] Q. Zhang and W. Wang. A fast algorithm for approximate quantiles in high speed data streams. In Proceedings of the 19th International Conference on Scientific and Statistical Database Management, 2007.<br />
<br />
[25] T. Zhang and R. Johnson. Learning nonlinear functions using regularized greedy forest. IEEE Transactions on Pattern Analysis and Machine Intelligence, 36(5), 2014.</div>Cwlokehttp://wiki.math.uwaterloo.ca/statwiki/index.php?title=XGBoost&diff=51102XGBoost2021-11-29T04:23:31Z<p>Cwloke: /* Weighted Quantile Sketch */</p>
<hr />
<div>== Presented by == <br />
* Chun Waan Loke<br />
* Peter Chong<br />
* Clarice Osmond<br />
* Zhilong Li<br />
<br />
== Introduction ==<br />
<br />
== Tree Boosting In A Nutshell ==<br />
The author reviews gradient tree boosting in this section.<br />
=== Regularized Learning Objective ===<br />
The author first gives the prediction equation (1) and the regularized objective (2).<br><br />
<br><br />
(1) The additive prediction model is given as<br><br />
<math>\hat{y_i}=\sum_{k=1}^{K}f_k(x_i), f_k \in \mathcal{F} </math> <br><br />
where each <math>f_k</math> corresponds to an independent tree structure with its weights, and <math>\mathcal{F}</math> is the "space of regression trees"<br><br />
<br><br />
(2) The regularized objective to be minimized is given as<br><br />
<math>\mathcal{L}=\sum_{i}l(\hat{y_i},y_i)+\sum_k \Omega(f_k)</math> where <math>\Omega(f)=\gamma T+\frac{1}{2}\lambda ||\omega||^2</math> <br><br />
The first term <math>l</math> is a differentiable convex loss function that calculates the measures between <math>\hat{y}</math> and <math>y</math>.<br><br />
The second term <math>\Omega</math> penalizes on the complexity of model (the <math>f_k</math>'s). For a given tree (<math>f_k</math>), <math>T</math> is the number of leaves, and <math>\omega</math> is the leaf weights.<br><br />
The L1 regularization term <math>\gamma T</math> encourages the tree to be small, and the L2 regularization term <math>\frac{1}{2}\lambda ||\omega||^2</math> encourages the tree to have small weights.<br><br />
<br />
=== Gradient Tree Boosting ===<br />
Let <math>\hat{y_i}^{(t)}</math> be the prediction of <math>y_i</math> at the t-th iteration.<br><br />
Since the prediction equation is simply additive, <math>{\hat y_i}^{(t)}=\hat{y_{i}}^{(t-1)}+f_t(x_i)</math><br><br />
Using this equation and 2nd order Taylor approximation on the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> gives <br><br />
\begin{align}<br />
\mathcal{L}^{(t)}&=\sum_{i}^{n}l(y_i,\hat{y_i}^{(t-1)}+f_t(x_i))+\Omega(f_t)\\<br />
&\simeq \sum_{i}^{n}[l(y_i,\hat{y_i}^{(t-1)})+g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
\end{align}<br />
where <math>g_i</math> and <math>h_i</math> are the first and second derivative of the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> with repspect to the term <math>\hat{y}^{(t-1)}</math><br><br />
We can simplify this objective by removing the constant term <math>l(y_i,\hat{y_i}^{(t-1)})</math>.<br><br />
Define <math>I_j=\{i|q(x_i)=j\}</math>, where <math>q</math> is the tree structure. Since every <math>x_i</math> is mapped by <math>q</math> to some leaf <math>j</math>, going through every <math>x_i</math> is equivalent to going through each leaf j of the structure.<br />
\begin{align}<br />
\tilde{\mathcal{L}}^{(t)}&= \sum_{i}^{n}[g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
&= \sum_{j=1}^{T}[(\sum_{i \in I_j}g_i)\omega_j+\frac{1}{2}(\sum_{i \in I_j}h_i+\lambda)\omega_j^2]+\gamma T<br />
\end{align}<br />
Then for a fixed structure <math>q</math>, the optimal weight of leaf <math>j</math> and the optimal objective value are given as<br><br />
\begin{align}<br />
\omega_j^{*} &= -\frac{\sum_{i \in I_j}g_i}{\sum_{i \in I_j}h_i+\lambda}\\<br />
\tilde{\mathcal{L}}^{(t)}(q) &=-\frac{1}{2}\sum_{j=1}^{T}\frac{(\sum_{i \in I_j}g_i)^2}{\sum_{i \in I_j}h_i+\lambda}+\gamma T<br />
\end{align} <br />
[[File:Structure Score Calculation.png|frame|center|alt=Alt text|Structure Score Calculation]]<br />
Instead of enumerating through all possible tree structures q, a greedy algorithm of iteratively adding branches is used.<br><br />
Let <math>I_L</math> and <math>I_R</math> be the instance sets of left and right nodes after split and let <math>I=I_L\cup I_R</math>.<br><br />
The loss reduction after split is given by<br><br />
\begin{align}<br />
\tilde{\mathcal{L}}_{\text{split}} &=\frac{1}{2}[\frac{(\sum_{i \in I_L}g_i)^2}{\sum_{i \in I_L}h_i+\lambda}+\frac{(\sum_{i \in I_R}g_i)^2}{\sum_{i \in I_R}h_i+\lambda}-\frac{(\sum_{i \in I}g_i)^2}{\sum_{i \in I}h_i+\lambda}]+\gamma<br />
\end{align}<br />
=== Shrinkage and Column Subsampling ===<br />
The author also mentioned two other methods in order to avoid over-fitting.<br><br />
(1) Shrinkage. Similar to the learning rate in stochastic optimization, a new weight is added to each tree boosting to reduce the influence of a single tree and leave space for future trees.<br><br />
(2) Column (feature) subsampling. In the paper, the author only mentioned that this technique speeds up parallel algorithm used in later sections.<br />
<br />
== Split Finding Algorithms ==<br />
<br />
It is very important to find the best split for tree learning to perform well. Here are a few split finding algorithms mentioned in the paper:<br />
<br />
=== Basic Exact Greedy Algorithm ===<br />
<br />
The basic exact greedy algorithm is a split finding algorithm that is computationally expensive because it enumerates over all the possible splits for continuous features. It is impossible to be done efficiently when the memory is not enough to hold the data needed. A way to carry out this algorithm efficiently is to sort the data according to feature values and visit the data in order to accumulate the gradient statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_1.png|center|alt=Alt text|Basic Exact Greedy Algorithm]]<br />
<br />
=== Approximate Algorithm ===<br />
<br />
The paper introduced a more efficient algorithm compared to Basic Exact Greedy Algorithm which is the Approximate Algorithm. The Approximate Algorithm first proposes candidate splitting points according to percentiles of feature distribution. It then maps the continuous features into buckets split by candidate points, aggregates the statistics and finds the best solution among proposals based on the aggregated statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_2.png|center|alt=Alt text|Approximate Algorithm]]<br />
<br />
There are also two variants to this algorithm, the global variant proposes all the candidate splits during the initial phase of tree construction and uses the same proposals for split finding at all levels. Whereas, the local variant re-proposes after each split. The global variant usually requires less proposal steps but uses more candidate points than local variant because candidates are not refined after each split. For deeper trees, usage of local variant may be more appropriate as compared to global variant. The figure below shows the a comparison in accuracy between Basic Exact Greedy and Approximate split finding algorithms with different variant over the number of iterations. We can see that the quantile strategy is able to achieve similar accuracy as the Basic Exact Greedy algorithm given a reasonable approximation level.<br />
<br />
[[File:iterations.png|center|alt=Alt text|Comparison of accuracy between different algorithms]]<br />
<br />
=== Weighted Quantile Sketch ===<br />
<br />
Proposing candidate split points is the most important step in the Approximate Algorithm, it is done by using the percentile of a feature to make candidates distribute evenly on a dataset.<br />
<br />
Formally, we have a dataset<br />
<br />
<math>D_k={(x_{1k},h_1),(x_{2k},h_2),...,(x_{nk},h_n)}</math><br />
<br />
where <math> x_i </math>'<math>s</math> are the feature values of each data point and <math> h_i </math>'<math>s</math> represents the weight of the corresponding feature <math> x_i </math>.<br />
<br />
=== Sparsity-aware Split Finding ===<br />
<br />
== System Design ==<br />
<br />
=== Column Block for Parallel Learning ===<br />
The most time consuming part of tree learning is to get the data into sorted order. To overcome this problem, XGBoost stores the data in blocks where each block performs the sorting operation in parallel. The results are then merged together.<br />
<br />
# For the exact greedy algorithm, XGBoost stores the entire dataset in a single block<br />
#:* Original spase aware algorithm costs: <math>O(Kd∥x∥_0 log(n))</math><br />
#:* Tree boosting on block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(n))</math><br />
#:* Hence, block structure helps to save an additional <math>log(n)</math> factor<br />
# For approximate algorithms, XGBoost stores the dataset in multiple blocks<br />
#:* Original algorithm with binary search costs: <math>O(Kd∥x∥_0 log(q))</math><br />
#:* With block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(B))</math><br />
#:* Hence, block structure helps to save an additional <math>log(q)</math> factor <br />
<br />
K = total number of trees<br /><br />
d = maximum depth of the tree<br /><br />
<math>∥x∥_0</math> = number of non-missing entries in the training data<br /><br />
n = number of rows in the dataset<br /><br />
q = number of proposal candidates in the dataset, usually between 32 to 100<br /><br />
B = maximum number of rows in each block<br />
<br />
[[File: columnblock.png|800px|thumb|center]]<br />
<br />
=== Cache-aware Access ===<br />
The proposed block structure optimizes the computation complexity but requires indirect fetches of gradient statistics by row index. XGBoost optimizes the process by using the following methods.<br />
<br />
# For the exact greedy algorithm, XGBoost uses a cache-aware prefetching algorithm<br />
#:* It stores Gradient and Hessians in the cache to make calculations fast<br />
#:* It runs twice as fast as the naive method when the dataset is large<br />
# For approximate algorithms, XGBoost chooses a specific block size<br />
#:* Choosing a small block size results in inefficient parallelization<br />
#:* Choosing a large block size results in cache misses<br />
#:* Various choices of block size are compared and the results are shown in Figure 9<br />
#:* XGBoost chose <math>2^{16}</math> as the block size<br />
<br />
[[File: blocksize.png|400px|thumb|center]]<br />
<br />
=== Blocks for Out-of-core Computation ===<br />
When the dataset is too large for the cache and main memory, XGBoost utilizes disk spaces as well. Since reading and writing data to the disks are slow, XGBoost optimizes the process by using the following two methods.<br />
<br />
# Block Compression<br />
#:* Blocks are compressed by columns<br />
#:* Although decompressing takes time, it is still faster than reading from the disks<br />
# Block Sharding<br />
#:* If multiple disks are available, data is split into those disks<br />
#:* When the CPU needs data, all the disks can be read at the same time<br />
<br />
== End To End Evaluations ==<br />
=== System Implementation ===<br />
XGBoost is a portable and reusable open-source package. It supports:<br />
* various weighted classification<br />
* various objective functions (rank & user defined)<br />
* popular languages (python, R, Julia)<br />
* data science pipelines (scikit-learn)<br />
* big data stacks (Flink, Spark)<br />
* cloud platform (Tianchi8)<br />
<br />
=== Dataset and Setup ===<br />
<br />
A summary of the 4 datasets used in the experiments is in table 2.<br />
<br />
[[File: table2data.png|500px|thumb|center]]<br />
<br />
The first and last datasets were used specifically to evaluate the impact of sparsity-aware algorithm and the scaling property of the system in the out-of-core and the distributed settings respectively. In all of the experiments, common settings such as maximum depth equal to 8, shrinkage equal to 0.1 and no column subsampling are applied.<br />
<br />
=== Classification ===<br />
A subset (n = 1M) of Higgs Boson dataset was used for classification. The results are shown in Table 3.<br />
<br />
[[File: classification.png|500px|thumb|center]]<br />
<br />
* R’s GBM creates a tree fast by using greedy approach that only expands one branch of a tree but with the cost of lower accuracy<br />
* XGBoost and scikit-learn have better performance than R’s GBM<br />
* XGBoost runs more than 10x faster than scikit-learn in learning a full tree<br />
* Column subsamples give slightly worse performance possibly due to a few important features in this dataset.<br />
<br />
=== Learning to Rank ===<br />
The results in comparing XGBoost with pGBRT are shown in Table 4.<br />
<br />
[[File: rank.png|500px|thumb|center]]<br />
<br />
* XGBoost runs exact greedy algorithm while pGBRT only supports an approximate algorithm<br />
* XGBoost runs faster<br />
* Subsampling column reduces running time and gives higher performance possibly due to preventing overfitting<br />
<br />
=== Out-of-core Experiment ===<br />
An extremely large Criteo dataset was used to evaluate the out-of-core setting. The results are shown in the figure below.<br />
<br />
[[File: outofcore.png|350px|thumb|center]]<br />
<br />
* Compression speed up the computation by a factor of 3<br />
* Sharding into 2 disks further gives 2x speed<br />
<br />
=== Distributed Experiment ===<br />
YARN cluster on EC2 with m3.2xlarge machines was used to evaluate the distributed setting. XGBoost was compared with Spark MLLib and H20.<br />
<br />
* XGBoost can switch to out-of-core setting when the memory runs out, while the baseline systems need to store the data in RAM<br />
* XGBoost runs faster than the baseline systems<br />
* The baseline systems are only able to handle a subset of the data with the given resources while XGBoost was able to scale smoothly to all 1.7B rows<br />
* XGBoost’s performance scales linearly with more machines<br />
* XGBoost is able to handle all 1.7B data with only 4 machines<br />
<br />
== Conclusion ==<br />
<br />
== References ==<br />
[1] R. Bekkerman. The present and the future of the kdd cup competition: an outsider’s perspective. <br />
<br />
[2] R. Bekkerman, M. Bilenko, and J. Langford. Scaling Up Machine Learning: Parallel and Distributed Approaches. Cambridge University Press, New York, NY, USA, 2011. <br />
<br />
[3] J. Bennett and S. Lanning. The netflix prize. In Proceedings of the KDD Cup Workshop 2007, pages 3–6, New York, Aug. 2007.<br />
<br />
[4] L. Breiman. Random forests. Maching Learning, 45(1):5–32, Oct. 2001.<br />
<br />
[5] C. Burges. From ranknet to lambdarank to lambdamart: An overview. Learning, 11:23–581, 2010.<br />
<br />
[6] O. Chapelle and Y. Chang. Yahoo! Learning to Rank Challenge Overview. Journal of Machine Learning Research - W & CP, 14:1–24, 2011.<br />
<br />
[7] T. Chen, H. Li, Q. Yang, and Y. Yu. General functional matrix factorization using gradient boosting. In Proceeding of 30th International Conference on Machine Learning (ICML’13), volume 1, pages 436–444, 2013.<br />
<br />
[8] T. Chen, S. Singh, B. Taskar, and C. Guestrin. Efficient second-order gradient boosting for conditional random fields. In Proceeding of 18th Artificial Intelligence and Statistics Conference (AISTATS’15), volume 1, 2015.<br />
<br />
[9] R.-E. Fan, K.-W. Chang, C.-J. Hsieh, X.-R. Wang, and C.-J. Lin. LIBLINEAR: A library for large linear classification. Journal of Machine Learning Research, 9:1871–1874, 2008.<br />
<br />
[10] J. Friedman. Greedy function approximation: a gradient boosting machine. Annals of Statistics, 29(5):1189–1232, 2001.<br />
<br />
[11] J. Friedman. Stochastic gradient boosting. Computational Statistics & Data Analysis, 38(4):367–378, 2002.<br />
<br />
[12] J. Friedman, T. Hastie, and R. Tibshirani. Additive logistic regression: a statistical view of boosting. Annals of Statistics, 28(2):337–407, 2000.<br />
<br />
[13] J. H. Friedman and B. E. Popescu. Importance sampled learning ensembles, 2003.<br />
<br />
[14] M. Greenwald and S. Khanna. Space-efficient online computation of quantile summaries. In Proceedings of the 2001 ACM SIGMOD International Conference on Management of Data, pages 58–66, 2001.<br />
<br />
[15] X. He, J. Pan, O. Jin, T. Xu, B. Liu, T. Xu, Y. Shi, A. Atallah, R. Herbrich, S. Bowers, and J. Q. n. Candela. Practical lessons from predicting clicks on ads at facebook. In Proceedings of the Eighth International Workshop on Data Mining for Online Advertising, ADKDD’14, 2014.<br />
<br />
[16] P. Li. Robust Logitboost and adaptive base class (ABC) Logitboost. In Proceedings of the Twenty-Sixth Conference Annual Conference on Uncertainty in Artificial Intelligence (UAI’10), pages 302–311, 2010.<br />
<br />
[17] P. Li, Q. Wu, and C. J. Burges. Mcrank: Learning to rank using multiple classification and gradient boosting. In Advances in Neural Information Processing Systems 20, pages 897–904. 2008.<br />
<br />
[18] X. Meng, J. Bradley, B. Yavuz, E. Sparks, S. Venkataraman, D. Liu, J. Freeman, D. Tsai, M. Amde, S. Owen, D. Xin, R. Xin, M. J. Franklin, R. Zadeh, M. Zaharia, and A. Talwalkar. MLlib: Machine learning in apache spark. Journal of Machine Learning Research, 17(34):1–7, 2016.<br />
<br />
[19] B. Panda, J. S. Herbach, S. Basu, and R. J. Bayardo. Planet: Massively parallel learning of tree ensembles with mapreduce. Proceeding of VLDB Endowment, 2(2):1426–1437, Aug. 2009.<br />
<br />
[20] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.<br />
<br />
[21] G. Ridgeway. Generalized Boosted Models: A guide to the gbm package.<br />
<br />
[22] S. Tyree, K. Weinberger, K. Agrawal, and J. Paykin. Parallel boosted regression trees for web search ranking. In Proceedings of the 20th international conference on World wide web, pages 387–396. ACM, 2011.<br />
<br />
[23] J. Ye, J.-H. Chow, J. Chen, and Z. Zheng. Stochastic gradient boosted distributed decision trees. In Proceedings of the 18th ACM Conference on Information and Knowledge Management, CIKM ’09.<br />
<br />
[24] Q. Zhang and W. Wang. A fast algorithm for approximate quantiles in high speed data streams. In Proceedings of the 19th International Conference on Scientific and Statistical Database Management, 2007.<br />
<br />
[25] T. Zhang and R. Johnson. Learning nonlinear functions using regularized greedy forest. IEEE Transactions on Pattern Analysis and Machine Intelligence, 36(5), 2014.</div>Cwlokehttp://wiki.math.uwaterloo.ca/statwiki/index.php?title=XGBoost&diff=51101XGBoost2021-11-29T04:23:09Z<p>Cwloke: /* Weighted Quantile Sketch */</p>
<hr />
<div>== Presented by == <br />
* Chun Waan Loke<br />
* Peter Chong<br />
* Clarice Osmond<br />
* Zhilong Li<br />
<br />
== Introduction ==<br />
<br />
== Tree Boosting In A Nutshell ==<br />
The author reviews gradient tree boosting in this section.<br />
=== Regularized Learning Objective ===<br />
The author first gives the prediction equation (1) and the regularized objective (2).<br><br />
<br><br />
(1) The additive prediction model is given as<br><br />
<math>\hat{y_i}=\sum_{k=1}^{K}f_k(x_i), f_k \in \mathcal{F} </math> <br><br />
where each <math>f_k</math> corresponds to an independent tree structure with its weights, and <math>\mathcal{F}</math> is the "space of regression trees"<br><br />
<br><br />
(2) The regularized objective to be minimized is given as<br><br />
<math>\mathcal{L}=\sum_{i}l(\hat{y_i},y_i)+\sum_k \Omega(f_k)</math> where <math>\Omega(f)=\gamma T+\frac{1}{2}\lambda ||\omega||^2</math> <br><br />
The first term <math>l</math> is a differentiable convex loss function that calculates the measures between <math>\hat{y}</math> and <math>y</math>.<br><br />
The second term <math>\Omega</math> penalizes on the complexity of model (the <math>f_k</math>'s). For a given tree (<math>f_k</math>), <math>T</math> is the number of leaves, and <math>\omega</math> is the leaf weights.<br><br />
The L1 regularization term <math>\gamma T</math> encourages the tree to be small, and the L2 regularization term <math>\frac{1}{2}\lambda ||\omega||^2</math> encourages the tree to have small weights.<br><br />
<br />
=== Gradient Tree Boosting ===<br />
Let <math>\hat{y_i}^{(t)}</math> be the prediction of <math>y_i</math> at the t-th iteration.<br><br />
Since the prediction equation is simply additive, <math>{\hat y_i}^{(t)}=\hat{y_{i}}^{(t-1)}+f_t(x_i)</math><br><br />
Using this equation and 2nd order Taylor approximation on the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> gives <br><br />
\begin{align}<br />
\mathcal{L}^{(t)}&=\sum_{i}^{n}l(y_i,\hat{y_i}^{(t-1)}+f_t(x_i))+\Omega(f_t)\\<br />
&\simeq \sum_{i}^{n}[l(y_i,\hat{y_i}^{(t-1)})+g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
\end{align}<br />
where <math>g_i</math> and <math>h_i</math> are the first and second derivative of the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> with repspect to the term <math>\hat{y}^{(t-1)}</math><br><br />
We can simplify this objective by removing the constant term <math>l(y_i,\hat{y_i}^{(t-1)})</math>.<br><br />
Define <math>I_j=\{i|q(x_i)=j\}</math>, where <math>q</math> is the tree structure. Since every <math>x_i</math> is mapped by <math>q</math> to some leaf <math>j</math>, going through every <math>x_i</math> is equivalent to going through each leaf j of the structure.<br />
\begin{align}<br />
\tilde{\mathcal{L}}^{(t)}&= \sum_{i}^{n}[g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
&= \sum_{j=1}^{T}[(\sum_{i \in I_j}g_i)\omega_j+\frac{1}{2}(\sum_{i \in I_j}h_i+\lambda)\omega_j^2]+\gamma T<br />
\end{align}<br />
Then for a fixed structure <math>q</math>, the optimal weight of leaf <math>j</math> and the optimal objective value are given as<br><br />
\begin{align}<br />
\omega_j^{*} &= -\frac{\sum_{i \in I_j}g_i}{\sum_{i \in I_j}h_i+\lambda}\\<br />
\tilde{\mathcal{L}}^{(t)}(q) &=-\frac{1}{2}\sum_{j=1}^{T}\frac{(\sum_{i \in I_j}g_i)^2}{\sum_{i \in I_j}h_i+\lambda}+\gamma T<br />
\end{align} <br />
[[File:Structure Score Calculation.png|frame|center|alt=Alt text|Structure Score Calculation]]<br />
Instead of enumerating through all possible tree structures q, a greedy algorithm of iteratively adding branches is used.<br><br />
Let <math>I_L</math> and <math>I_R</math> be the instance sets of left and right nodes after split and let <math>I=I_L\cup I_R</math>.<br><br />
The loss reduction after split is given by<br><br />
\begin{align}<br />
\tilde{\mathcal{L}}_{\text{split}} &=\frac{1}{2}[\frac{(\sum_{i \in I_L}g_i)^2}{\sum_{i \in I_L}h_i+\lambda}+\frac{(\sum_{i \in I_R}g_i)^2}{\sum_{i \in I_R}h_i+\lambda}-\frac{(\sum_{i \in I}g_i)^2}{\sum_{i \in I}h_i+\lambda}]+\gamma<br />
\end{align}<br />
=== Shrinkage and Column Subsampling ===<br />
The author also mentioned two other methods in order to avoid over-fitting.<br><br />
(1) Shrinkage. Similar to the learning rate in stochastic optimization, a new weight is added to each tree boosting to reduce the influence of a single tree and leave space for future trees.<br><br />
(2) Column (feature) subsampling. In the paper, the author only mentioned that this technique speeds up parallel algorithm used in later sections.<br />
<br />
== Split Finding Algorithms ==<br />
<br />
It is very important to find the best split for tree learning to perform well. Here are a few split finding algorithms mentioned in the paper:<br />
<br />
=== Basic Exact Greedy Algorithm ===<br />
<br />
The basic exact greedy algorithm is a split finding algorithm that is computationally expensive because it enumerates over all the possible splits for continuous features. It is impossible to be done efficiently when the memory is not enough to hold the data needed. A way to carry out this algorithm efficiently is to sort the data according to feature values and visit the data in order to accumulate the gradient statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_1.png|center|alt=Alt text|Basic Exact Greedy Algorithm]]<br />
<br />
=== Approximate Algorithm ===<br />
<br />
The paper introduced a more efficient algorithm compared to Basic Exact Greedy Algorithm which is the Approximate Algorithm. The Approximate Algorithm first proposes candidate splitting points according to percentiles of feature distribution. It then maps the continuous features into buckets split by candidate points, aggregates the statistics and finds the best solution among proposals based on the aggregated statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_2.png|center|alt=Alt text|Approximate Algorithm]]<br />
<br />
There are also two variants to this algorithm, the global variant proposes all the candidate splits during the initial phase of tree construction and uses the same proposals for split finding at all levels. Whereas, the local variant re-proposes after each split. The global variant usually requires less proposal steps but uses more candidate points than local variant because candidates are not refined after each split. For deeper trees, usage of local variant may be more appropriate as compared to global variant. The figure below shows the a comparison in accuracy between Basic Exact Greedy and Approximate split finding algorithms with different variant over the number of iterations. We can see that the quantile strategy is able to achieve similar accuracy as the Basic Exact Greedy algorithm given a reasonable approximation level.<br />
<br />
[[File:iterations.png|center|alt=Alt text|Comparison of accuracy between different algorithms]]<br />
<br />
=== Weighted Quantile Sketch ===<br />
<br />
Proposing candidate split points is the most important step in the Approximate Algorithm, it is done by using the percentile of a feature to make candidates distribute evenly on a dataset.<br />
<br />
Formally, we have a dataset<br />
<br />
<math>D_k={(x_{1k},h_1),(x_{2k},h_2),...,(x_{nk},h_n)}</math><br />
<br />
where <math> x_i </math>'s are the feature values of each data point and <math> h_i </math>'s represents the weight of the corresponding feature <math> x_i </math>.<br />
<br />
=== Sparsity-aware Split Finding ===<br />
<br />
== System Design ==<br />
<br />
=== Column Block for Parallel Learning ===<br />
The most time consuming part of tree learning is to get the data into sorted order. To overcome this problem, XGBoost stores the data in blocks where each block performs the sorting operation in parallel. The results are then merged together.<br />
<br />
# For the exact greedy algorithm, XGBoost stores the entire dataset in a single block<br />
#:* Original spase aware algorithm costs: <math>O(Kd∥x∥_0 log(n))</math><br />
#:* Tree boosting on block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(n))</math><br />
#:* Hence, block structure helps to save an additional <math>log(n)</math> factor<br />
# For approximate algorithms, XGBoost stores the dataset in multiple blocks<br />
#:* Original algorithm with binary search costs: <math>O(Kd∥x∥_0 log(q))</math><br />
#:* With block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(B))</math><br />
#:* Hence, block structure helps to save an additional <math>log(q)</math> factor <br />
<br />
K = total number of trees<br /><br />
d = maximum depth of the tree<br /><br />
<math>∥x∥_0</math> = number of non-missing entries in the training data<br /><br />
n = number of rows in the dataset<br /><br />
q = number of proposal candidates in the dataset, usually between 32 to 100<br /><br />
B = maximum number of rows in each block<br />
<br />
[[File: columnblock.png|800px|thumb|center]]<br />
<br />
=== Cache-aware Access ===<br />
The proposed block structure optimizes the computation complexity but requires indirect fetches of gradient statistics by row index. XGBoost optimizes the process by using the following methods.<br />
<br />
# For the exact greedy algorithm, XGBoost uses a cache-aware prefetching algorithm<br />
#:* It stores Gradient and Hessians in the cache to make calculations fast<br />
#:* It runs twice as fast as the naive method when the dataset is large<br />
# For approximate algorithms, XGBoost chooses a specific block size<br />
#:* Choosing a small block size results in inefficient parallelization<br />
#:* Choosing a large block size results in cache misses<br />
#:* Various choices of block size are compared and the results are shown in Figure 9<br />
#:* XGBoost chose <math>2^{16}</math> as the block size<br />
<br />
[[File: blocksize.png|400px|thumb|center]]<br />
<br />
=== Blocks for Out-of-core Computation ===<br />
When the dataset is too large for the cache and main memory, XGBoost utilizes disk spaces as well. Since reading and writing data to the disks are slow, XGBoost optimizes the process by using the following two methods.<br />
<br />
# Block Compression<br />
#:* Blocks are compressed by columns<br />
#:* Although decompressing takes time, it is still faster than reading from the disks<br />
# Block Sharding<br />
#:* If multiple disks are available, data is split into those disks<br />
#:* When the CPU needs data, all the disks can be read at the same time<br />
<br />
== End To End Evaluations ==<br />
=== System Implementation ===<br />
XGBoost is a portable and reusable open-source package. It supports:<br />
* various weighted classification<br />
* various objective functions (rank & user defined)<br />
* popular languages (python, R, Julia)<br />
* data science pipelines (scikit-learn)<br />
* big data stacks (Flink, Spark)<br />
* cloud platform (Tianchi8)<br />
<br />
=== Dataset and Setup ===<br />
<br />
A summary of the 4 datasets used in the experiments is in table 2.<br />
<br />
[[File: table2data.png|500px|thumb|center]]<br />
<br />
The first and last datasets were used specifically to evaluate the impact of sparsity-aware algorithm and the scaling property of the system in the out-of-core and the distributed settings respectively. In all of the experiments, common settings such as maximum depth equal to 8, shrinkage equal to 0.1 and no column subsampling are applied.<br />
<br />
=== Classification ===<br />
A subset (n = 1M) of Higgs Boson dataset was used for classification. The results are shown in Table 3.<br />
<br />
[[File: classification.png|500px|thumb|center]]<br />
<br />
* R’s GBM creates a tree fast by using greedy approach that only expands one branch of a tree but with the cost of lower accuracy<br />
* XGBoost and scikit-learn have better performance than R’s GBM<br />
* XGBoost runs more than 10x faster than scikit-learn in learning a full tree<br />
* Column subsamples give slightly worse performance possibly due to a few important features in this dataset.<br />
<br />
=== Learning to Rank ===<br />
The results in comparing XGBoost with pGBRT are shown in Table 4.<br />
<br />
[[File: rank.png|500px|thumb|center]]<br />
<br />
* XGBoost runs exact greedy algorithm while pGBRT only supports an approximate algorithm<br />
* XGBoost runs faster<br />
* Subsampling column reduces running time and gives higher performance possibly due to preventing overfitting<br />
<br />
=== Out-of-core Experiment ===<br />
An extremely large Criteo dataset was used to evaluate the out-of-core setting. The results are shown in the figure below.<br />
<br />
[[File: outofcore.png|350px|thumb|center]]<br />
<br />
* Compression speed up the computation by a factor of 3<br />
* Sharding into 2 disks further gives 2x speed<br />
<br />
=== Distributed Experiment ===<br />
YARN cluster on EC2 with m3.2xlarge machines was used to evaluate the distributed setting. XGBoost was compared with Spark MLLib and H20.<br />
<br />
* XGBoost can switch to out-of-core setting when the memory runs out, while the baseline systems need to store the data in RAM<br />
* XGBoost runs faster than the baseline systems<br />
* The baseline systems are only able to handle a subset of the data with the given resources while XGBoost was able to scale smoothly to all 1.7B rows<br />
* XGBoost’s performance scales linearly with more machines<br />
* XGBoost is able to handle all 1.7B data with only 4 machines<br />
<br />
== Conclusion ==<br />
<br />
== References ==<br />
[1] R. Bekkerman. The present and the future of the kdd cup competition: an outsider’s perspective. <br />
<br />
[2] R. Bekkerman, M. Bilenko, and J. Langford. Scaling Up Machine Learning: Parallel and Distributed Approaches. Cambridge University Press, New York, NY, USA, 2011. <br />
<br />
[3] J. Bennett and S. Lanning. The netflix prize. In Proceedings of the KDD Cup Workshop 2007, pages 3–6, New York, Aug. 2007.<br />
<br />
[4] L. Breiman. Random forests. Maching Learning, 45(1):5–32, Oct. 2001.<br />
<br />
[5] C. Burges. From ranknet to lambdarank to lambdamart: An overview. Learning, 11:23–581, 2010.<br />
<br />
[6] O. Chapelle and Y. Chang. Yahoo! Learning to Rank Challenge Overview. Journal of Machine Learning Research - W & CP, 14:1–24, 2011.<br />
<br />
[7] T. Chen, H. Li, Q. Yang, and Y. Yu. General functional matrix factorization using gradient boosting. In Proceeding of 30th International Conference on Machine Learning (ICML’13), volume 1, pages 436–444, 2013.<br />
<br />
[8] T. Chen, S. Singh, B. Taskar, and C. Guestrin. Efficient second-order gradient boosting for conditional random fields. In Proceeding of 18th Artificial Intelligence and Statistics Conference (AISTATS’15), volume 1, 2015.<br />
<br />
[9] R.-E. Fan, K.-W. Chang, C.-J. Hsieh, X.-R. Wang, and C.-J. Lin. LIBLINEAR: A library for large linear classification. Journal of Machine Learning Research, 9:1871–1874, 2008.<br />
<br />
[10] J. Friedman. Greedy function approximation: a gradient boosting machine. Annals of Statistics, 29(5):1189–1232, 2001.<br />
<br />
[11] J. Friedman. Stochastic gradient boosting. Computational Statistics & Data Analysis, 38(4):367–378, 2002.<br />
<br />
[12] J. Friedman, T. Hastie, and R. Tibshirani. Additive logistic regression: a statistical view of boosting. Annals of Statistics, 28(2):337–407, 2000.<br />
<br />
[13] J. H. Friedman and B. E. Popescu. Importance sampled learning ensembles, 2003.<br />
<br />
[14] M. Greenwald and S. Khanna. Space-efficient online computation of quantile summaries. In Proceedings of the 2001 ACM SIGMOD International Conference on Management of Data, pages 58–66, 2001.<br />
<br />
[15] X. He, J. Pan, O. Jin, T. Xu, B. Liu, T. Xu, Y. Shi, A. Atallah, R. Herbrich, S. Bowers, and J. Q. n. Candela. Practical lessons from predicting clicks on ads at facebook. In Proceedings of the Eighth International Workshop on Data Mining for Online Advertising, ADKDD’14, 2014.<br />
<br />
[16] P. Li. Robust Logitboost and adaptive base class (ABC) Logitboost. In Proceedings of the Twenty-Sixth Conference Annual Conference on Uncertainty in Artificial Intelligence (UAI’10), pages 302–311, 2010.<br />
<br />
[17] P. Li, Q. Wu, and C. J. Burges. Mcrank: Learning to rank using multiple classification and gradient boosting. In Advances in Neural Information Processing Systems 20, pages 897–904. 2008.<br />
<br />
[18] X. Meng, J. Bradley, B. Yavuz, E. Sparks, S. Venkataraman, D. Liu, J. Freeman, D. Tsai, M. Amde, S. Owen, D. Xin, R. Xin, M. J. Franklin, R. Zadeh, M. Zaharia, and A. Talwalkar. MLlib: Machine learning in apache spark. Journal of Machine Learning Research, 17(34):1–7, 2016.<br />
<br />
[19] B. Panda, J. S. Herbach, S. Basu, and R. J. Bayardo. Planet: Massively parallel learning of tree ensembles with mapreduce. Proceeding of VLDB Endowment, 2(2):1426–1437, Aug. 2009.<br />
<br />
[20] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.<br />
<br />
[21] G. Ridgeway. Generalized Boosted Models: A guide to the gbm package.<br />
<br />
[22] S. Tyree, K. Weinberger, K. Agrawal, and J. Paykin. Parallel boosted regression trees for web search ranking. In Proceedings of the 20th international conference on World wide web, pages 387–396. ACM, 2011.<br />
<br />
[23] J. Ye, J.-H. Chow, J. Chen, and Z. Zheng. Stochastic gradient boosted distributed decision trees. In Proceedings of the 18th ACM Conference on Information and Knowledge Management, CIKM ’09.<br />
<br />
[24] Q. Zhang and W. Wang. A fast algorithm for approximate quantiles in high speed data streams. In Proceedings of the 19th International Conference on Scientific and Statistical Database Management, 2007.<br />
<br />
[25] T. Zhang and R. Johnson. Learning nonlinear functions using regularized greedy forest. IEEE Transactions on Pattern Analysis and Machine Intelligence, 36(5), 2014.</div>Cwlokehttp://wiki.math.uwaterloo.ca/statwiki/index.php?title=XGBoost&diff=51100XGBoost2021-11-29T04:20:40Z<p>Cwloke: /* Weighted Quantile Sketch */</p>
<hr />
<div>== Presented by == <br />
* Chun Waan Loke<br />
* Peter Chong<br />
* Clarice Osmond<br />
* Zhilong Li<br />
<br />
== Introduction ==<br />
<br />
== Tree Boosting In A Nutshell ==<br />
The author reviews gradient tree boosting in this section.<br />
=== Regularized Learning Objective ===<br />
The author first gives the prediction equation (1) and the regularized objective (2).<br><br />
<br><br />
(1) The additive prediction model is given as<br><br />
<math>\hat{y_i}=\sum_{k=1}^{K}f_k(x_i), f_k \in \mathcal{F} </math> <br><br />
where each <math>f_k</math> corresponds to an independent tree structure with its weights, and <math>\mathcal{F}</math> is the "space of regression trees"<br><br />
<br><br />
(2) The regularized objective to be minimized is given as<br><br />
<math>\mathcal{L}=\sum_{i}l(\hat{y_i},y_i)+\sum_k \Omega(f_k)</math> where <math>\Omega(f)=\gamma T+\frac{1}{2}\lambda ||\omega||^2</math> <br><br />
The first term <math>l</math> is a differentiable convex loss function that calculates the measures between <math>\hat{y}</math> and <math>y</math>.<br><br />
The second term <math>\Omega</math> penalizes on the complexity of model (the <math>f_k</math>'s). For a given tree (<math>f_k</math>), <math>T</math> is the number of leaves, and <math>\omega</math> is the leaf weights.<br><br />
The L1 regularization term <math>\gamma T</math> encourages the tree to be small, and the L2 regularization term <math>\frac{1}{2}\lambda ||\omega||^2</math> encourages the tree to have small weights.<br><br />
<br />
=== Gradient Tree Boosting ===<br />
Let <math>\hat{y_i}^{(t)}</math> be the prediction of <math>y_i</math> at the t-th iteration.<br><br />
Since the prediction equation is simply additive, <math>{\hat y_i}^{(t)}=\hat{y_{i}}^{(t-1)}+f_t(x_i)</math><br><br />
Using this equation and 2nd order Taylor approximation on the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> gives <br><br />
\begin{align}<br />
\mathcal{L}^{(t)}&=\sum_{i}^{n}l(y_i,\hat{y_i}^{(t-1)}+f_t(x_i))+\Omega(f_t)\\<br />
&\simeq \sum_{i}^{n}[l(y_i,\hat{y_i}^{(t-1)})+g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
\end{align}<br />
where <math>g_i</math> and <math>h_i</math> are the first and second derivative of the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> with repspect to the term <math>\hat{y}^{(t-1)}</math><br><br />
We can simplify this objective by removing the constant term <math>l(y_i,\hat{y_i}^{(t-1)})</math>.<br><br />
Define <math>I_j=\{i|q(x_i)=j\}</math>, where <math>q</math> is the tree structure. Since every <math>x_i</math> is mapped by <math>q</math> to some leaf <math>j</math>, going through every <math>x_i</math> is equivalent to going through each leaf j of the structure.<br />
\begin{align}<br />
\tilde{\mathcal{L}}^{(t)}&= \sum_{i}^{n}[g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
&= \sum_{j=1}^{T}[(\sum_{i \in I_j}g_i)\omega_j+\frac{1}{2}(\sum_{i \in I_j}h_i+\lambda)\omega_j^2]+\gamma T<br />
\end{align}<br />
Then for a fixed structure <math>q</math>, the optimal weight of leaf <math>j</math> and the optimal objective value are given as<br><br />
\begin{align}<br />
\omega_j^{*} &= -\frac{\sum_{i \in I_j}g_i}{\sum_{i \in I_j}h_i+\lambda}\\<br />
\tilde{\mathcal{L}}^{(t)}(q) &=-\frac{1}{2}\sum_{j=1}^{T}\frac{(\sum_{i \in I_j}g_i)^2}{\sum_{i \in I_j}h_i+\lambda}+\gamma T<br />
\end{align} <br />
[[File:Structure Score Calculation.png|frame|center|alt=Alt text|Structure Score Calculation]]<br />
Instead of enumerating through all possible tree structures q, a greedy algorithm of iteratively adding branches is used.<br><br />
Let <math>I_L</math> and <math>I_R</math> be the instance sets of left and right nodes after split and let <math>I=I_L\cup I_R</math>.<br><br />
The loss reduction after split is given by<br><br />
\begin{align}<br />
\tilde{\mathcal{L}}_{\text{split}} &=\frac{1}{2}[\frac{(\sum_{i \in I_L}g_i)^2}{\sum_{i \in I_L}h_i+\lambda}+\frac{(\sum_{i \in I_R}g_i)^2}{\sum_{i \in I_R}h_i+\lambda}-\frac{(\sum_{i \in I}g_i)^2}{\sum_{i \in I}h_i+\lambda}]+\gamma<br />
\end{align}<br />
=== Shrinkage and Column Subsampling ===<br />
The author also mentioned two other methods in order to avoid over-fitting.<br><br />
(1) Shrinkage. Similar to the learning rate in stochastic optimization, a new weight is added to each tree boosting to reduce the influence of a single tree and leave space for future trees.<br><br />
(2) Column (feature) subsampling. In the paper, the author only mentioned that this technique speeds up parallel algorithm used in later sections.<br />
<br />
== Split Finding Algorithms ==<br />
<br />
It is very important to find the best split for tree learning to perform well. Here are a few split finding algorithms mentioned in the paper:<br />
<br />
=== Basic Exact Greedy Algorithm ===<br />
<br />
The basic exact greedy algorithm is a split finding algorithm that is computationally expensive because it enumerates over all the possible splits for continuous features. It is impossible to be done efficiently when the memory is not enough to hold the data needed. A way to carry out this algorithm efficiently is to sort the data according to feature values and visit the data in order to accumulate the gradient statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_1.png|center|alt=Alt text|Basic Exact Greedy Algorithm]]<br />
<br />
=== Approximate Algorithm ===<br />
<br />
The paper introduced a more efficient algorithm compared to Basic Exact Greedy Algorithm which is the Approximate Algorithm. The Approximate Algorithm first proposes candidate splitting points according to percentiles of feature distribution. It then maps the continuous features into buckets split by candidate points, aggregates the statistics and finds the best solution among proposals based on the aggregated statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_2.png|center|alt=Alt text|Approximate Algorithm]]<br />
<br />
There are also two variants to this algorithm, the global variant proposes all the candidate splits during the initial phase of tree construction and uses the same proposals for split finding at all levels. Whereas, the local variant re-proposes after each split. The global variant usually requires less proposal steps but uses more candidate points than local variant because candidates are not refined after each split. For deeper trees, usage of local variant may be more appropriate as compared to global variant. The figure below shows the a comparison in accuracy between Basic Exact Greedy and Approximate split finding algorithms with different variant over the number of iterations. We can see that the quantile strategy is able to achieve similar accuracy as the Basic Exact Greedy algorithm given a reasonable approximation level.<br />
<br />
[[File:iterations.png|center|alt=Alt text|Comparison of accuracy between different algorithms]]<br />
<br />
=== Weighted Quantile Sketch ===<br />
<br />
Proposing candidate split points is the most important step in the Approximate Algorithm, it is done by using the percentile of a feature to make candidates distribute evenly on a dataset.<br />
<br />
Formally, we have a dataset<br />
<br />
<math>D_k={(x_{1k},h_1),(x_{2k},h_2),...,(x_{nk},h_n)}</math><br />
<br />
where <math> x_i \textquotesingle </math>'s are the feature values of each data point and <math> h_i </math>'s represents the weight of the corresponding feature <math> x_i </math>.<br />
<br />
=== Sparsity-aware Split Finding ===<br />
<br />
== System Design ==<br />
<br />
=== Column Block for Parallel Learning ===<br />
The most time consuming part of tree learning is to get the data into sorted order. To overcome this problem, XGBoost stores the data in blocks where each block performs the sorting operation in parallel. The results are then merged together.<br />
<br />
# For the exact greedy algorithm, XGBoost stores the entire dataset in a single block<br />
#:* Original spase aware algorithm costs: <math>O(Kd∥x∥_0 log(n))</math><br />
#:* Tree boosting on block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(n))</math><br />
#:* Hence, block structure helps to save an additional <math>log(n)</math> factor<br />
# For approximate algorithms, XGBoost stores the dataset in multiple blocks<br />
#:* Original algorithm with binary search costs: <math>O(Kd∥x∥_0 log(q))</math><br />
#:* With block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(B))</math><br />
#:* Hence, block structure helps to save an additional <math>log(q)</math> factor <br />
<br />
K = total number of trees<br /><br />
d = maximum depth of the tree<br /><br />
<math>∥x∥_0</math> = number of non-missing entries in the training data<br /><br />
n = number of rows in the dataset<br /><br />
q = number of proposal candidates in the dataset, usually between 32 to 100<br /><br />
B = maximum number of rows in each block<br />
<br />
[[File: columnblock.png|800px|thumb|center]]<br />
<br />
=== Cache-aware Access ===<br />
The proposed block structure optimizes the computation complexity but requires indirect fetches of gradient statistics by row index. XGBoost optimizes the process by using the following methods.<br />
<br />
# For the exact greedy algorithm, XGBoost uses a cache-aware prefetching algorithm<br />
#:* It stores Gradient and Hessians in the cache to make calculations fast<br />
#:* It runs twice as fast as the naive method when the dataset is large<br />
# For approximate algorithms, XGBoost chooses a specific block size<br />
#:* Choosing a small block size results in inefficient parallelization<br />
#:* Choosing a large block size results in cache misses<br />
#:* Various choices of block size are compared and the results are shown in Figure 9<br />
#:* XGBoost chose <math>2^{16}</math> as the block size<br />
<br />
[[File: blocksize.png|400px|thumb|center]]<br />
<br />
=== Blocks for Out-of-core Computation ===<br />
When the dataset is too large for the cache and main memory, XGBoost utilizes disk spaces as well. Since reading and writing data to the disks are slow, XGBoost optimizes the process by using the following two methods.<br />
<br />
# Block Compression<br />
#:* Blocks are compressed by columns<br />
#:* Although decompressing takes time, it is still faster than reading from the disks<br />
# Block Sharding<br />
#:* If multiple disks are available, data is split into those disks<br />
#:* When the CPU needs data, all the disks can be read at the same time<br />
<br />
== End To End Evaluations ==<br />
=== System Implementation ===<br />
XGBoost is a portable and reusable open-source package. It supports:<br />
* various weighted classification<br />
* various objective functions (rank & user defined)<br />
* popular languages (python, R, Julia)<br />
* data science pipelines (scikit-learn)<br />
* big data stacks (Flink, Spark)<br />
* cloud platform (Tianchi8)<br />
<br />
=== Dataset and Setup ===<br />
<br />
A summary of the 4 datasets used in the experiments is in table 2.<br />
<br />
[[File: table2data.png|500px|thumb|center]]<br />
<br />
The first and last datasets were used specifically to evaluate the impact of sparsity-aware algorithm and the scaling property of the system in the out-of-core and the distributed settings respectively. In all of the experiments, common settings such as maximum depth equal to 8, shrinkage equal to 0.1 and no column subsampling are applied.<br />
<br />
=== Classification ===<br />
A subset (n = 1M) of Higgs Boson dataset was used for classification. The results are shown in Table 3.<br />
<br />
[[File: classification.png|500px|thumb|center]]<br />
<br />
* R’s GBM creates a tree fast by using greedy approach that only expands one branch of a tree but with the cost of lower accuracy<br />
* XGBoost and scikit-learn have better performance than R’s GBM<br />
* XGBoost runs more than 10x faster than scikit-learn in learning a full tree<br />
* Column subsamples give slightly worse performance possibly due to a few important features in this dataset.<br />
<br />
=== Learning to Rank ===<br />
The results in comparing XGBoost with pGBRT are shown in Table 4.<br />
<br />
[[File: rank.png|500px|thumb|center]]<br />
<br />
* XGBoost runs exact greedy algorithm while pGBRT only supports an approximate algorithm<br />
* XGBoost runs faster<br />
* Subsampling column reduces running time and gives higher performance possibly due to preventing overfitting<br />
<br />
=== Out-of-core Experiment ===<br />
An extremely large Criteo dataset was used to evaluate the out-of-core setting. The results are shown in the figure below.<br />
<br />
[[File: outofcore.png|350px|thumb|center]]<br />
<br />
* Compression speed up the computation by a factor of 3<br />
* Sharding into 2 disks further gives 2x speed<br />
<br />
=== Distributed Experiment ===<br />
YARN cluster on EC2 with m3.2xlarge machines was used to evaluate the distributed setting. XGBoost was compared with Spark MLLib and H20.<br />
<br />
* XGBoost can switch to out-of-core setting when the memory runs out, while the baseline systems need to store the data in RAM<br />
* XGBoost runs faster than the baseline systems<br />
* The baseline systems are only able to handle a subset of the data with the given resources while XGBoost was able to scale smoothly to all 1.7B rows<br />
* XGBoost’s performance scales linearly with more machines<br />
* XGBoost is able to handle all 1.7B data with only 4 machines<br />
<br />
== Conclusion ==<br />
<br />
== References ==<br />
[1] R. Bekkerman. The present and the future of the kdd cup competition: an outsider’s perspective. <br />
<br />
[2] R. Bekkerman, M. Bilenko, and J. Langford. Scaling Up Machine Learning: Parallel and Distributed Approaches. Cambridge University Press, New York, NY, USA, 2011. <br />
<br />
[3] J. Bennett and S. Lanning. The netflix prize. In Proceedings of the KDD Cup Workshop 2007, pages 3–6, New York, Aug. 2007.<br />
<br />
[4] L. Breiman. Random forests. Maching Learning, 45(1):5–32, Oct. 2001.<br />
<br />
[5] C. Burges. From ranknet to lambdarank to lambdamart: An overview. Learning, 11:23–581, 2010.<br />
<br />
[6] O. Chapelle and Y. Chang. Yahoo! Learning to Rank Challenge Overview. Journal of Machine Learning Research - W & CP, 14:1–24, 2011.<br />
<br />
[7] T. Chen, H. Li, Q. Yang, and Y. Yu. General functional matrix factorization using gradient boosting. In Proceeding of 30th International Conference on Machine Learning (ICML’13), volume 1, pages 436–444, 2013.<br />
<br />
[8] T. Chen, S. Singh, B. Taskar, and C. Guestrin. Efficient second-order gradient boosting for conditional random fields. In Proceeding of 18th Artificial Intelligence and Statistics Conference (AISTATS’15), volume 1, 2015.<br />
<br />
[9] R.-E. Fan, K.-W. Chang, C.-J. Hsieh, X.-R. Wang, and C.-J. Lin. LIBLINEAR: A library for large linear classification. Journal of Machine Learning Research, 9:1871–1874, 2008.<br />
<br />
[10] J. Friedman. Greedy function approximation: a gradient boosting machine. Annals of Statistics, 29(5):1189–1232, 2001.<br />
<br />
[11] J. Friedman. Stochastic gradient boosting. Computational Statistics & Data Analysis, 38(4):367–378, 2002.<br />
<br />
[12] J. Friedman, T. Hastie, and R. Tibshirani. Additive logistic regression: a statistical view of boosting. Annals of Statistics, 28(2):337–407, 2000.<br />
<br />
[13] J. H. Friedman and B. E. Popescu. Importance sampled learning ensembles, 2003.<br />
<br />
[14] M. Greenwald and S. Khanna. Space-efficient online computation of quantile summaries. In Proceedings of the 2001 ACM SIGMOD International Conference on Management of Data, pages 58–66, 2001.<br />
<br />
[15] X. He, J. Pan, O. Jin, T. Xu, B. Liu, T. Xu, Y. Shi, A. Atallah, R. Herbrich, S. Bowers, and J. Q. n. Candela. Practical lessons from predicting clicks on ads at facebook. In Proceedings of the Eighth International Workshop on Data Mining for Online Advertising, ADKDD’14, 2014.<br />
<br />
[16] P. Li. Robust Logitboost and adaptive base class (ABC) Logitboost. In Proceedings of the Twenty-Sixth Conference Annual Conference on Uncertainty in Artificial Intelligence (UAI’10), pages 302–311, 2010.<br />
<br />
[17] P. Li, Q. Wu, and C. J. Burges. Mcrank: Learning to rank using multiple classification and gradient boosting. In Advances in Neural Information Processing Systems 20, pages 897–904. 2008.<br />
<br />
[18] X. Meng, J. Bradley, B. Yavuz, E. Sparks, S. Venkataraman, D. Liu, J. Freeman, D. Tsai, M. Amde, S. Owen, D. Xin, R. Xin, M. J. Franklin, R. Zadeh, M. Zaharia, and A. Talwalkar. MLlib: Machine learning in apache spark. Journal of Machine Learning Research, 17(34):1–7, 2016.<br />
<br />
[19] B. Panda, J. S. Herbach, S. Basu, and R. J. Bayardo. Planet: Massively parallel learning of tree ensembles with mapreduce. Proceeding of VLDB Endowment, 2(2):1426–1437, Aug. 2009.<br />
<br />
[20] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.<br />
<br />
[21] G. Ridgeway. Generalized Boosted Models: A guide to the gbm package.<br />
<br />
[22] S. Tyree, K. Weinberger, K. Agrawal, and J. Paykin. Parallel boosted regression trees for web search ranking. In Proceedings of the 20th international conference on World wide web, pages 387–396. ACM, 2011.<br />
<br />
[23] J. Ye, J.-H. Chow, J. Chen, and Z. Zheng. Stochastic gradient boosted distributed decision trees. In Proceedings of the 18th ACM Conference on Information and Knowledge Management, CIKM ’09.<br />
<br />
[24] Q. Zhang and W. Wang. A fast algorithm for approximate quantiles in high speed data streams. In Proceedings of the 19th International Conference on Scientific and Statistical Database Management, 2007.<br />
<br />
[25] T. Zhang and R. Johnson. Learning nonlinear functions using regularized greedy forest. IEEE Transactions on Pattern Analysis and Machine Intelligence, 36(5), 2014.</div>Cwlokehttp://wiki.math.uwaterloo.ca/statwiki/index.php?title=XGBoost&diff=51099XGBoost2021-11-29T04:19:20Z<p>Cwloke: /* Weighted Quantile Sketch */</p>
<hr />
<div>== Presented by == <br />
* Chun Waan Loke<br />
* Peter Chong<br />
* Clarice Osmond<br />
* Zhilong Li<br />
<br />
== Introduction ==<br />
<br />
== Tree Boosting In A Nutshell ==<br />
The author reviews gradient tree boosting in this section.<br />
=== Regularized Learning Objective ===<br />
The author first gives the prediction equation (1) and the regularized objective (2).<br><br />
<br><br />
(1) The additive prediction model is given as<br><br />
<math>\hat{y_i}=\sum_{k=1}^{K}f_k(x_i), f_k \in \mathcal{F} </math> <br><br />
where each <math>f_k</math> corresponds to an independent tree structure with its weights, and <math>\mathcal{F}</math> is the "space of regression trees"<br><br />
<br><br />
(2) The regularized objective to be minimized is given as<br><br />
<math>\mathcal{L}=\sum_{i}l(\hat{y_i},y_i)+\sum_k \Omega(f_k)</math> where <math>\Omega(f)=\gamma T+\frac{1}{2}\lambda ||\omega||^2</math> <br><br />
The first term <math>l</math> is a differentiable convex loss function that calculates the measures between <math>\hat{y}</math> and <math>y</math>.<br><br />
The second term <math>\Omega</math> penalizes on the complexity of model (the <math>f_k</math>'s). For a given tree (<math>f_k</math>), <math>T</math> is the number of leaves, and <math>\omega</math> is the leaf weights.<br><br />
The L1 regularization term <math>\gamma T</math> encourages the tree to be small, and the L2 regularization term <math>\frac{1}{2}\lambda ||\omega||^2</math> encourages the tree to have small weights.<br><br />
<br />
=== Gradient Tree Boosting ===<br />
Let <math>\hat{y_i}^{(t)}</math> be the prediction of <math>y_i</math> at the t-th iteration.<br><br />
Since the prediction equation is simply additive, <math>{\hat y_i}^{(t)}=\hat{y_{i}}^{(t-1)}+f_t(x_i)</math><br><br />
Using this equation and 2nd order Taylor approximation on the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> gives <br><br />
\begin{align}<br />
\mathcal{L}^{(t)}&=\sum_{i}^{n}l(y_i,\hat{y_i}^{(t-1)}+f_t(x_i))+\Omega(f_t)\\<br />
&\simeq \sum_{i}^{n}[l(y_i,\hat{y_i}^{(t-1)})+g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
\end{align}<br />
where <math>g_i</math> and <math>h_i</math> are the first and second derivative of the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> with repspect to the term <math>\hat{y}^{(t-1)}</math><br><br />
We can simplify this objective by removing the constant term <math>l(y_i,\hat{y_i}^{(t-1)})</math>.<br><br />
Define <math>I_j=\{i|q(x_i)=j\}</math>, where <math>q</math> is the tree structure. Since every <math>x_i</math> is mapped by <math>q</math> to some leaf <math>j</math>, going through every <math>x_i</math> is equivalent to going through each leaf j of the structure.<br />
\begin{align}<br />
\tilde{\mathcal{L}}^{(t)}&= \sum_{i}^{n}[g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
&= \sum_{j=1}^{T}[(\sum_{i \in I_j}g_i)\omega_j+\frac{1}{2}(\sum_{i \in I_j}h_i+\lambda)\omega_j^2]+\gamma T<br />
\end{align}<br />
Then for a fixed structure <math>q</math>, the optimal weight of leaf <math>j</math> and the optimal objective value are given as<br><br />
\begin{align}<br />
\omega_j^{*} &= -\frac{\sum_{i \in I_j}g_i}{\sum_{i \in I_j}h_i+\lambda}\\<br />
\tilde{\mathcal{L}}^{(t)}(q) &=-\frac{1}{2}\sum_{j=1}^{T}\frac{(\sum_{i \in I_j}g_i)^2}{\sum_{i \in I_j}h_i+\lambda}+\gamma T<br />
\end{align} <br />
[[File:Structure Score Calculation.png|frame|center|alt=Alt text|Structure Score Calculation]]<br />
Instead of enumerating through all possible tree structures q, a greedy algorithm of iteratively adding branches is used.<br><br />
Let <math>I_L</math> and <math>I_R</math> be the instance sets of left and right nodes after split and let <math>I=I_L\cup I_R</math>.<br><br />
The loss reduction after split is given by<br><br />
\begin{align}<br />
\tilde{\mathcal{L}}_{\text{split}} &=\frac{1}{2}[\frac{(\sum_{i \in I_L}g_i)^2}{\sum_{i \in I_L}h_i+\lambda}+\frac{(\sum_{i \in I_R}g_i)^2}{\sum_{i \in I_R}h_i+\lambda}-\frac{(\sum_{i \in I}g_i)^2}{\sum_{i \in I}h_i+\lambda}]+\gamma<br />
\end{align}<br />
=== Shrinkage and Column Subsampling ===<br />
The author also mentioned two other methods in order to avoid over-fitting.<br><br />
(1) Shrinkage. Similar to the learning rate in stochastic optimization, a new weight is added to each tree boosting to reduce the influence of a single tree and leave space for future trees.<br><br />
(2) Column (feature) subsampling. In the paper, the author only mentioned that this technique speeds up parallel algorithm used in later sections.<br />
<br />
== Split Finding Algorithms ==<br />
<br />
It is very important to find the best split for tree learning to perform well. Here are a few split finding algorithms mentioned in the paper:<br />
<br />
=== Basic Exact Greedy Algorithm ===<br />
<br />
The basic exact greedy algorithm is a split finding algorithm that is computationally expensive because it enumerates over all the possible splits for continuous features. It is impossible to be done efficiently when the memory is not enough to hold the data needed. A way to carry out this algorithm efficiently is to sort the data according to feature values and visit the data in order to accumulate the gradient statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_1.png|center|alt=Alt text|Basic Exact Greedy Algorithm]]<br />
<br />
=== Approximate Algorithm ===<br />
<br />
The paper introduced a more efficient algorithm compared to Basic Exact Greedy Algorithm which is the Approximate Algorithm. The Approximate Algorithm first proposes candidate splitting points according to percentiles of feature distribution. It then maps the continuous features into buckets split by candidate points, aggregates the statistics and finds the best solution among proposals based on the aggregated statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_2.png|center|alt=Alt text|Approximate Algorithm]]<br />
<br />
There are also two variants to this algorithm, the global variant proposes all the candidate splits during the initial phase of tree construction and uses the same proposals for split finding at all levels. Whereas, the local variant re-proposes after each split. The global variant usually requires less proposal steps but uses more candidate points than local variant because candidates are not refined after each split. For deeper trees, usage of local variant may be more appropriate as compared to global variant. The figure below shows the a comparison in accuracy between Basic Exact Greedy and Approximate split finding algorithms with different variant over the number of iterations. We can see that the quantile strategy is able to achieve similar accuracy as the Basic Exact Greedy algorithm given a reasonable approximation level.<br />
<br />
[[File:iterations.png|center|alt=Alt text|Comparison of accuracy between different algorithms]]<br />
<br />
=== Weighted Quantile Sketch ===<br />
<br />
Proposing candidate split points is the most important step in the Approximate Algorithm, it is done by using the percentile of a feature to make candidates distribute evenly on a dataset.<br />
<br />
Formally, we have a dataset<br />
<br />
<math>D_k={(x_{1k},h_1),(x_{2k},h_2),...,(x_{nk},h_n)}</math><br />
<br />
where <math> x_i </math>'s are the feature values of each data point and <math> h_i </math>'s represents the weight of the corresponding feature <math> x_i </math>.<br />
<br />
=== Sparsity-aware Split Finding ===<br />
<br />
== System Design ==<br />
<br />
=== Column Block for Parallel Learning ===<br />
The most time consuming part of tree learning is to get the data into sorted order. To overcome this problem, XGBoost stores the data in blocks where each block performs the sorting operation in parallel. The results are then merged together.<br />
<br />
# For the exact greedy algorithm, XGBoost stores the entire dataset in a single block<br />
#:* Original spase aware algorithm costs: <math>O(Kd∥x∥_0 log(n))</math><br />
#:* Tree boosting on block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(n))</math><br />
#:* Hence, block structure helps to save an additional <math>log(n)</math> factor<br />
# For approximate algorithms, XGBoost stores the dataset in multiple blocks<br />
#:* Original algorithm with binary search costs: <math>O(Kd∥x∥_0 log(q))</math><br />
#:* With block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(B))</math><br />
#:* Hence, block structure helps to save an additional <math>log(q)</math> factor <br />
<br />
K = total number of trees<br /><br />
d = maximum depth of the tree<br /><br />
<math>∥x∥_0</math> = number of non-missing entries in the training data<br /><br />
n = number of rows in the dataset<br /><br />
q = number of proposal candidates in the dataset, usually between 32 to 100<br /><br />
B = maximum number of rows in each block<br />
<br />
[[File: columnblock.png|800px|thumb|center]]<br />
<br />
=== Cache-aware Access ===<br />
The proposed block structure optimizes the computation complexity but requires indirect fetches of gradient statistics by row index. XGBoost optimizes the process by using the following methods.<br />
<br />
# For the exact greedy algorithm, XGBoost uses a cache-aware prefetching algorithm<br />
#:* It stores Gradient and Hessians in the cache to make calculations fast<br />
#:* It runs twice as fast as the naive method when the dataset is large<br />
# For approximate algorithms, XGBoost chooses a specific block size<br />
#:* Choosing a small block size results in inefficient parallelization<br />
#:* Choosing a large block size results in cache misses<br />
#:* Various choices of block size are compared and the results are shown in Figure 9<br />
#:* XGBoost chose <math>2^{16}</math> as the block size<br />
<br />
[[File: blocksize.png|400px|thumb|center]]<br />
<br />
=== Blocks for Out-of-core Computation ===<br />
When the dataset is too large for the cache and main memory, XGBoost utilizes disk spaces as well. Since reading and writing data to the disks are slow, XGBoost optimizes the process by using the following two methods.<br />
<br />
# Block Compression<br />
#:* Blocks are compressed by columns<br />
#:* Although decompressing takes time, it is still faster than reading from the disks<br />
# Block Sharding<br />
#:* If multiple disks are available, data is split into those disks<br />
#:* When the CPU needs data, all the disks can be read at the same time<br />
<br />
== End To End Evaluations ==<br />
=== System Implementation ===<br />
XGBoost is a portable and reusable open-source package. It supports:<br />
* various weighted classification<br />
* various objective functions (rank & user defined)<br />
* popular languages (python, R, Julia)<br />
* data science pipelines (scikit-learn)<br />
* big data stacks (Flink, Spark)<br />
* cloud platform (Tianchi8)<br />
<br />
=== Dataset and Setup ===<br />
<br />
A summary of the 4 datasets used in the experiments is in table 2.<br />
<br />
[[File: table2data.png|500px|thumb|center]]<br />
<br />
The first and last datasets were used specifically to evaluate the impact of sparsity-aware algorithm and the scaling property of the system in the out-of-core and the distributed settings respectively. In all of the experiments, common settings such as maximum depth equal to 8, shrinkage equal to 0.1 and no column subsampling are applied.<br />
<br />
=== Classification ===<br />
A subset (n = 1M) of Higgs Boson dataset was used for classification. The results are shown in Table 3.<br />
<br />
[[File: classification.png|500px|thumb|center]]<br />
<br />
* R’s GBM creates a tree fast by using greedy approach that only expands one branch of a tree but with the cost of lower accuracy<br />
* XGBoost and scikit-learn have better performance than R’s GBM<br />
* XGBoost runs more than 10x faster than scikit-learn in learning a full tree<br />
* Column subsamples give slightly worse performance possibly due to a few important features in this dataset.<br />
<br />
=== Learning to Rank ===<br />
The results in comparing XGBoost with pGBRT are shown in Table 4.<br />
<br />
[[File: rank.png|500px|thumb|center]]<br />
<br />
* XGBoost runs exact greedy algorithm while pGBRT only supports an approximate algorithm<br />
* XGBoost runs faster<br />
* Subsampling column reduces running time and gives higher performance possibly due to preventing overfitting<br />
<br />
=== Out-of-core Experiment ===<br />
An extremely large Criteo dataset was used to evaluate the out-of-core setting. The results are shown in the figure below.<br />
<br />
[[File: outofcore.png|350px|thumb|center]]<br />
<br />
* Compression speed up the computation by a factor of 3<br />
* Sharding into 2 disks further gives 2x speed<br />
<br />
=== Distributed Experiment ===<br />
YARN cluster on EC2 with m3.2xlarge machines was used to evaluate the distributed setting. XGBoost was compared with Spark MLLib and H20.<br />
<br />
* XGBoost can switch to out-of-core setting when the memory runs out, while the baseline systems need to store the data in RAM<br />
* XGBoost runs faster than the baseline systems<br />
* The baseline systems are only able to handle a subset of the data with the given resources while XGBoost was able to scale smoothly to all 1.7B rows<br />
* XGBoost’s performance scales linearly with more machines<br />
* XGBoost is able to handle all 1.7B data with only 4 machines<br />
<br />
== Conclusion ==<br />
<br />
== References ==<br />
[1] R. Bekkerman. The present and the future of the kdd cup competition: an outsider’s perspective. <br />
<br />
[2] R. Bekkerman, M. Bilenko, and J. Langford. Scaling Up Machine Learning: Parallel and Distributed Approaches. Cambridge University Press, New York, NY, USA, 2011. <br />
<br />
[3] J. Bennett and S. Lanning. The netflix prize. In Proceedings of the KDD Cup Workshop 2007, pages 3–6, New York, Aug. 2007.<br />
<br />
[4] L. Breiman. Random forests. Maching Learning, 45(1):5–32, Oct. 2001.<br />
<br />
[5] C. Burges. From ranknet to lambdarank to lambdamart: An overview. Learning, 11:23–581, 2010.<br />
<br />
[6] O. Chapelle and Y. Chang. Yahoo! Learning to Rank Challenge Overview. Journal of Machine Learning Research - W & CP, 14:1–24, 2011.<br />
<br />
[7] T. Chen, H. Li, Q. Yang, and Y. Yu. General functional matrix factorization using gradient boosting. In Proceeding of 30th International Conference on Machine Learning (ICML’13), volume 1, pages 436–444, 2013.<br />
<br />
[8] T. Chen, S. Singh, B. Taskar, and C. Guestrin. Efficient second-order gradient boosting for conditional random fields. In Proceeding of 18th Artificial Intelligence and Statistics Conference (AISTATS’15), volume 1, 2015.<br />
<br />
[9] R.-E. Fan, K.-W. Chang, C.-J. Hsieh, X.-R. Wang, and C.-J. Lin. LIBLINEAR: A library for large linear classification. Journal of Machine Learning Research, 9:1871–1874, 2008.<br />
<br />
[10] J. Friedman. Greedy function approximation: a gradient boosting machine. Annals of Statistics, 29(5):1189–1232, 2001.<br />
<br />
[11] J. Friedman. Stochastic gradient boosting. Computational Statistics & Data Analysis, 38(4):367–378, 2002.<br />
<br />
[12] J. Friedman, T. Hastie, and R. Tibshirani. Additive logistic regression: a statistical view of boosting. Annals of Statistics, 28(2):337–407, 2000.<br />
<br />
[13] J. H. Friedman and B. E. Popescu. Importance sampled learning ensembles, 2003.<br />
<br />
[14] M. Greenwald and S. Khanna. Space-efficient online computation of quantile summaries. In Proceedings of the 2001 ACM SIGMOD International Conference on Management of Data, pages 58–66, 2001.<br />
<br />
[15] X. He, J. Pan, O. Jin, T. Xu, B. Liu, T. Xu, Y. Shi, A. Atallah, R. Herbrich, S. Bowers, and J. Q. n. Candela. Practical lessons from predicting clicks on ads at facebook. In Proceedings of the Eighth International Workshop on Data Mining for Online Advertising, ADKDD’14, 2014.<br />
<br />
[16] P. Li. Robust Logitboost and adaptive base class (ABC) Logitboost. In Proceedings of the Twenty-Sixth Conference Annual Conference on Uncertainty in Artificial Intelligence (UAI’10), pages 302–311, 2010.<br />
<br />
[17] P. Li, Q. Wu, and C. J. Burges. Mcrank: Learning to rank using multiple classification and gradient boosting. In Advances in Neural Information Processing Systems 20, pages 897–904. 2008.<br />
<br />
[18] X. Meng, J. Bradley, B. Yavuz, E. Sparks, S. Venkataraman, D. Liu, J. Freeman, D. Tsai, M. Amde, S. Owen, D. Xin, R. Xin, M. J. Franklin, R. Zadeh, M. Zaharia, and A. Talwalkar. MLlib: Machine learning in apache spark. Journal of Machine Learning Research, 17(34):1–7, 2016.<br />
<br />
[19] B. Panda, J. S. Herbach, S. Basu, and R. J. Bayardo. Planet: Massively parallel learning of tree ensembles with mapreduce. Proceeding of VLDB Endowment, 2(2):1426–1437, Aug. 2009.<br />
<br />
[20] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.<br />
<br />
[21] G. Ridgeway. Generalized Boosted Models: A guide to the gbm package.<br />
<br />
[22] S. Tyree, K. Weinberger, K. Agrawal, and J. Paykin. Parallel boosted regression trees for web search ranking. In Proceedings of the 20th international conference on World wide web, pages 387–396. ACM, 2011.<br />
<br />
[23] J. Ye, J.-H. Chow, J. Chen, and Z. Zheng. Stochastic gradient boosted distributed decision trees. In Proceedings of the 18th ACM Conference on Information and Knowledge Management, CIKM ’09.<br />
<br />
[24] Q. Zhang and W. Wang. A fast algorithm for approximate quantiles in high speed data streams. In Proceedings of the 19th International Conference on Scientific and Statistical Database Management, 2007.<br />
<br />
[25] T. Zhang and R. Johnson. Learning nonlinear functions using regularized greedy forest. IEEE Transactions on Pattern Analysis and Machine Intelligence, 36(5), 2014.</div>Cwlokehttp://wiki.math.uwaterloo.ca/statwiki/index.php?title=XGBoost&diff=51098XGBoost2021-11-29T04:12:30Z<p>Cwloke: /* Weighted Quantile Sketch */</p>
<hr />
<div>== Presented by == <br />
* Chun Waan Loke<br />
* Peter Chong<br />
* Clarice Osmond<br />
* Zhilong Li<br />
<br />
== Introduction ==<br />
<br />
== Tree Boosting In A Nutshell ==<br />
The author reviews gradient tree boosting in this section.<br />
=== Regularized Learning Objective ===<br />
The author first gives the prediction equation (1) and the regularized objective (2).<br><br />
<br><br />
(1) The additive prediction model is given as<br><br />
<math>\hat{y_i}=\sum_{k=1}^{K}f_k(x_i), f_k \in \mathcal{F} </math> <br><br />
where each <math>f_k</math> corresponds to an independent tree structure with its weights, and <math>\mathcal{F}</math> is the "space of regression trees"<br><br />
<br><br />
(2) The regularized objective to be minimized is given as<br><br />
<math>\mathcal{L}=\sum_{i}l(\hat{y_i},y_i)+\sum_k \Omega(f_k)</math> where <math>\Omega(f)=\gamma T+\frac{1}{2}\lambda ||\omega||^2</math> <br><br />
The first term <math>l</math> is a differentiable convex loss function that calculates the measures between <math>\hat{y}</math> and <math>y</math>.<br><br />
The second term <math>\Omega</math> penalizes on the complexity of model (the <math>f_k</math>'s). For a given tree (<math>f_k</math>), <math>T</math> is the number of leaves, and <math>\omega</math> is the leaf weights.<br><br />
The L1 regularization term <math>\gamma T</math> encourages the tree to be small, and the L2 regularization term <math>\frac{1}{2}\lambda ||\omega||^2</math> encourages the tree to have small weights.<br><br />
<br />
=== Gradient Tree Boosting ===<br />
Let <math>\hat{y_i}^{(t)}</math> be the prediction of <math>y_i</math> at the t-th iteration.<br><br />
Since the prediction equation is simply additive, <math>{\hat y_i}^{(t)}=\hat{y_{i}}^{(t-1)}+f_t(x_i)</math><br><br />
Using this equation and 2nd order Taylor approximation on the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> gives <br><br />
\begin{align}<br />
\mathcal{L}^{(t)}&=\sum_{i}^{n}l(y_i,\hat{y_i}^{(t-1)}+f_t(x_i))+\Omega(f_t)\\<br />
&\simeq \sum_{i}^{n}[l(y_i,\hat{y_i}^{(t-1)})+g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
\end{align}<br />
where <math>g_i</math> and <math>h_i</math> are the first and second derivative of the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> with repspect to the term <math>\hat{y}^{(t-1)}</math><br><br />
We can simplify this objective by removing the constant term <math>l(y_i,\hat{y_i}^{(t-1)})</math>.<br><br />
Define <math>I_j=\{i|q(x_i)=j\}</math>, where <math>q</math> is the tree structure. Since every <math>x_i</math> is mapped by <math>q</math> to some leaf <math>j</math>, going through every <math>x_i</math> is equivalent to going through each leaf j of the structure.<br />
\begin{align}<br />
\tilde{\mathcal{L}}^{(t)}&= \sum_{i}^{n}[g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
&= \sum_{j=1}^{T}[(\sum_{i \in I_j}g_i)\omega_j+\frac{1}{2}(\sum_{i \in I_j}h_i+\lambda)\omega_j^2]+\gamma T<br />
\end{align}<br />
Then for a fixed structure <math>q</math>, the optimal weight of leaf <math>j</math> and the optimal objective value are given as<br><br />
\begin{align}<br />
\omega_j^{*} &= -\frac{\sum_{i \in I_j}g_i}{\sum_{i \in I_j}h_i+\lambda}\\<br />
\tilde{\mathcal{L}}^{(t)}(q) &=-\frac{1}{2}\sum_{j=1}^{T}\frac{(\sum_{i \in I_j}g_i)^2}{\sum_{i \in I_j}h_i+\lambda}+\gamma T<br />
\end{align} <br />
[[File:Structure Score Calculation.png|frame|center|alt=Alt text|Structure Score Calculation]]<br />
Instead of enumerating through all possible tree structures q, a greedy algorithm of iteratively adding branches is used.<br><br />
Let <math>I_L</math> and <math>I_R</math> be the instance sets of left and right nodes after split and let <math>I=I_L\cup I_R</math>.<br><br />
The loss reduction after split is given by<br><br />
\begin{align}<br />
\tilde{\mathcal{L}}_{\text{split}} &=\frac{1}{2}[\frac{(\sum_{i \in I_L}g_i)^2}{\sum_{i \in I_L}h_i+\lambda}+\frac{(\sum_{i \in I_R}g_i)^2}{\sum_{i \in I_R}h_i+\lambda}-\frac{(\sum_{i \in I}g_i)^2}{\sum_{i \in I}h_i+\lambda}]+\gamma<br />
\end{align}<br />
=== Shrinkage and Column Subsampling ===<br />
The author also mentioned two other methods in order to avoid over-fitting.<br><br />
(1) Shrinkage. Similar to the learning rate in stochastic optimization, a new weight is added to each tree boosting to reduce the influence of a single tree and leave space for future trees.<br><br />
(2) Column (feature) subsampling. In the paper, the author only mentioned that this technique speeds up parallel algorithm used in later sections.<br />
<br />
== Split Finding Algorithms ==<br />
<br />
It is very important to find the best split for tree learning to perform well. Here are a few split finding algorithms mentioned in the paper:<br />
<br />
=== Basic Exact Greedy Algorithm ===<br />
<br />
The basic exact greedy algorithm is a split finding algorithm that is computationally expensive because it enumerates over all the possible splits for continuous features. It is impossible to be done efficiently when the memory is not enough to hold the data needed. A way to carry out this algorithm efficiently is to sort the data according to feature values and visit the data in order to accumulate the gradient statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_1.png|center|alt=Alt text|Basic Exact Greedy Algorithm]]<br />
<br />
=== Approximate Algorithm ===<br />
<br />
The paper introduced a more efficient algorithm compared to Basic Exact Greedy Algorithm which is the Approximate Algorithm. The Approximate Algorithm first proposes candidate splitting points according to percentiles of feature distribution. It then maps the continuous features into buckets split by candidate points, aggregates the statistics and finds the best solution among proposals based on the aggregated statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_2.png|center|alt=Alt text|Approximate Algorithm]]<br />
<br />
There are also two variants to this algorithm, the global variant proposes all the candidate splits during the initial phase of tree construction and uses the same proposals for split finding at all levels. Whereas, the local variant re-proposes after each split. The global variant usually requires less proposal steps but uses more candidate points than local variant because candidates are not refined after each split. For deeper trees, usage of local variant may be more appropriate as compared to global variant. The figure below shows the a comparison in accuracy between Basic Exact Greedy and Approximate split finding algorithms with different variant over the number of iterations. We can see that the quantile strategy is able to achieve similar accuracy as the Basic Exact Greedy algorithm given a reasonable approximation level.<br />
<br />
[[File:iterations.png|center|alt=Alt text|Comparison of accuracy between different algorithms]]<br />
<br />
=== Weighted Quantile Sketch ===<br />
<br />
Proposing candidate split points is the most important step in the Approximate Algorithm.<br />
<br />
=== Sparsity-aware Split Finding ===<br />
<br />
== System Design ==<br />
<br />
=== Column Block for Parallel Learning ===<br />
The most time consuming part of tree learning is to get the data into sorted order. To overcome this problem, XGBoost stores the data in blocks where each block performs the sorting operation in parallel. The results are then merged together.<br />
<br />
# For the exact greedy algorithm, XGBoost stores the entire dataset in a single block<br />
#:* Original spase aware algorithm costs: <math>O(Kd∥x∥_0 log(n))</math><br />
#:* Tree boosting on block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(n))</math><br />
#:* Hence, block structure helps to save an additional <math>log(n)</math> factor<br />
# For approximate algorithms, XGBoost stores the dataset in multiple blocks<br />
#:* Original algorithm with binary search costs: <math>O(Kd∥x∥_0 log(q))</math><br />
#:* With block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(B))</math><br />
#:* Hence, block structure helps to save an additional <math>log(q)</math> factor <br />
<br />
K = total number of trees<br /><br />
d = maximum depth of the tree<br /><br />
<math>∥x∥_0</math> = number of non-missing entries in the training data<br /><br />
n = number of rows in the dataset<br /><br />
q = number of proposal candidates in the dataset, usually between 32 to 100<br /><br />
B = maximum number of rows in each block<br />
<br />
[[File: columnblock.png|800px|thumb|center]]<br />
<br />
=== Cache-aware Access ===<br />
The proposed block structure optimizes the computation complexity but requires indirect fetches of gradient statistics by row index. XGBoost optimizes the process by using the following methods.<br />
<br />
# For the exact greedy algorithm, XGBoost uses a cache-aware prefetching algorithm<br />
#:* It stores Gradient and Hessians in the cache to make calculations fast<br />
#:* It runs twice as fast as the naive method when the dataset is large<br />
# For approximate algorithms, XGBoost chooses a specific block size<br />
#:* Choosing a small block size results in inefficient parallelization<br />
#:* Choosing a large block size results in cache misses<br />
#:* Various choices of block size are compared and the results are shown in Figure 9<br />
#:* XGBoost chose <math>2^{16}</math> as the block size<br />
<br />
[[File: blocksize.png|400px|thumb|center]]<br />
<br />
=== Blocks for Out-of-core Computation ===<br />
When the dataset is too large for the cache and main memory, XGBoost utilizes disk spaces as well. Since reading and writing data to the disks are slow, XGBoost optimizes the process by using the following two methods.<br />
<br />
# Block Compression<br />
#:* Blocks are compressed by columns<br />
#:* Although decompressing takes time, it is still faster than reading from the disks<br />
# Block Sharding<br />
#:* If multiple disks are available, data is split into those disks<br />
#:* When the CPU needs data, all the disks can be read at the same time<br />
<br />
== End To End Evaluations ==<br />
=== System Implementation ===<br />
XGBoost is a portable and reusable open-source package. It supports:<br />
* various weighted classification<br />
* various objective functions (rank & user defined)<br />
* popular languages (python, R, Julia)<br />
* data science pipelines (scikit-learn)<br />
* big data stacks (Flink, Spark)<br />
* cloud platform (Tianchi8)<br />
<br />
=== Dataset and Setup ===<br />
<br />
A summary of the 4 datasets used in the experiments is in table 2.<br />
<br />
[[File: table2data.png|500px|thumb|center]]<br />
<br />
The first and last datasets were used specifically to evaluate the impact of sparsity-aware algorithm and the scaling property of the system in the out-of-core and the distributed settings respectively. In all of the experiments, common settings such as maximum depth equal to 8, shrinkage equal to 0.1 and no column subsampling are applied.<br />
<br />
=== Classification ===<br />
A subset (n = 1M) of Higgs Boson dataset was used for classification. The results are shown in Table 3.<br />
<br />
[[File: classification.png|500px|thumb|center]]<br />
<br />
* R’s GBM creates a tree fast by using greedy approach that only expands one branch of a tree but with the cost of lower accuracy<br />
* XGBoost and scikit-learn have better performance than R’s GBM<br />
* XGBoost runs more than 10x faster than scikit-learn in learning a full tree<br />
* Column subsamples give slightly worse performance possibly due to a few important features in this dataset.<br />
<br />
=== Learning to Rank ===<br />
The results in comparing XGBoost with pGBRT are shown in Table 4.<br />
<br />
[[File: rank.png|500px|thumb|center]]<br />
<br />
* XGBoost runs exact greedy algorithm while pGBRT only supports an approximate algorithm<br />
* XGBoost runs faster<br />
* Subsampling column reduces running time and gives higher performance possibly due to preventing overfitting<br />
<br />
=== Out-of-core Experiment ===<br />
An extremely large Criteo dataset was used to evaluate the out-of-core setting. The results are shown in the figure below.<br />
<br />
[[File: outofcore.png|350px|thumb|center]]<br />
<br />
* Compression speed up the computation by a factor of 3<br />
* Sharding into 2 disks further gives 2x speed<br />
<br />
=== Distributed Experiment ===<br />
YARN cluster on EC2 with m3.2xlarge machines was used to evaluate the distributed setting. XGBoost was compared with Spark MLLib and H20.<br />
<br />
* XGBoost can switch to out-of-core setting when the memory runs out, while the baseline systems need to store the data in RAM<br />
* XGBoost runs faster than the baseline systems<br />
* The baseline systems are only able to handle a subset of the data with the given resources while XGBoost was able to scale smoothly to all 1.7B rows<br />
* XGBoost’s performance scales linearly with more machines<br />
* XGBoost is able to handle all 1.7B data with only 4 machines<br />
<br />
== Conclusion ==<br />
<br />
== References ==<br />
[1] R. Bekkerman. The present and the future of the kdd cup competition: an outsider’s perspective. <br />
<br />
[2] R. Bekkerman, M. Bilenko, and J. Langford. Scaling Up Machine Learning: Parallel and Distributed Approaches. Cambridge University Press, New York, NY, USA, 2011. <br />
<br />
[3] J. Bennett and S. Lanning. The netflix prize. In Proceedings of the KDD Cup Workshop 2007, pages 3–6, New York, Aug. 2007.<br />
<br />
[4] L. Breiman. Random forests. Maching Learning, 45(1):5–32, Oct. 2001.<br />
<br />
[5] C. Burges. From ranknet to lambdarank to lambdamart: An overview. Learning, 11:23–581, 2010.<br />
<br />
[6] O. Chapelle and Y. Chang. Yahoo! Learning to Rank Challenge Overview. Journal of Machine Learning Research - W & CP, 14:1–24, 2011.<br />
<br />
[7] T. Chen, H. Li, Q. Yang, and Y. Yu. General functional matrix factorization using gradient boosting. In Proceeding of 30th International Conference on Machine Learning (ICML’13), volume 1, pages 436–444, 2013.<br />
<br />
[8] T. Chen, S. Singh, B. Taskar, and C. Guestrin. Efficient second-order gradient boosting for conditional random fields. In Proceeding of 18th Artificial Intelligence and Statistics Conference (AISTATS’15), volume 1, 2015.<br />
<br />
[9] R.-E. Fan, K.-W. Chang, C.-J. Hsieh, X.-R. Wang, and C.-J. Lin. LIBLINEAR: A library for large linear classification. Journal of Machine Learning Research, 9:1871–1874, 2008.<br />
<br />
[10] J. Friedman. Greedy function approximation: a gradient boosting machine. Annals of Statistics, 29(5):1189–1232, 2001.<br />
<br />
[11] J. Friedman. Stochastic gradient boosting. Computational Statistics & Data Analysis, 38(4):367–378, 2002.<br />
<br />
[12] J. Friedman, T. Hastie, and R. Tibshirani. Additive logistic regression: a statistical view of boosting. Annals of Statistics, 28(2):337–407, 2000.<br />
<br />
[13] J. H. Friedman and B. E. Popescu. Importance sampled learning ensembles, 2003.<br />
<br />
[14] M. Greenwald and S. Khanna. Space-efficient online computation of quantile summaries. In Proceedings of the 2001 ACM SIGMOD International Conference on Management of Data, pages 58–66, 2001.<br />
<br />
[15] X. He, J. Pan, O. Jin, T. Xu, B. Liu, T. Xu, Y. Shi, A. Atallah, R. Herbrich, S. Bowers, and J. Q. n. Candela. Practical lessons from predicting clicks on ads at facebook. In Proceedings of the Eighth International Workshop on Data Mining for Online Advertising, ADKDD’14, 2014.<br />
<br />
[16] P. Li. Robust Logitboost and adaptive base class (ABC) Logitboost. In Proceedings of the Twenty-Sixth Conference Annual Conference on Uncertainty in Artificial Intelligence (UAI’10), pages 302–311, 2010.<br />
<br />
[17] P. Li, Q. Wu, and C. J. Burges. Mcrank: Learning to rank using multiple classification and gradient boosting. In Advances in Neural Information Processing Systems 20, pages 897–904. 2008.<br />
<br />
[18] X. Meng, J. Bradley, B. Yavuz, E. Sparks, S. Venkataraman, D. Liu, J. Freeman, D. Tsai, M. Amde, S. Owen, D. Xin, R. Xin, M. J. Franklin, R. Zadeh, M. Zaharia, and A. Talwalkar. MLlib: Machine learning in apache spark. Journal of Machine Learning Research, 17(34):1–7, 2016.<br />
<br />
[19] B. Panda, J. S. Herbach, S. Basu, and R. J. Bayardo. Planet: Massively parallel learning of tree ensembles with mapreduce. Proceeding of VLDB Endowment, 2(2):1426–1437, Aug. 2009.<br />
<br />
[20] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.<br />
<br />
[21] G. Ridgeway. Generalized Boosted Models: A guide to the gbm package.<br />
<br />
[22] S. Tyree, K. Weinberger, K. Agrawal, and J. Paykin. Parallel boosted regression trees for web search ranking. In Proceedings of the 20th international conference on World wide web, pages 387–396. ACM, 2011.<br />
<br />
[23] J. Ye, J.-H. Chow, J. Chen, and Z. Zheng. Stochastic gradient boosted distributed decision trees. In Proceedings of the 18th ACM Conference on Information and Knowledge Management, CIKM ’09.<br />
<br />
[24] Q. Zhang and W. Wang. A fast algorithm for approximate quantiles in high speed data streams. In Proceedings of the 19th International Conference on Scientific and Statistical Database Management, 2007.<br />
<br />
[25] T. Zhang and R. Johnson. Learning nonlinear functions using regularized greedy forest. IEEE Transactions on Pattern Analysis and Machine Intelligence, 36(5), 2014.</div>Cwlokehttp://wiki.math.uwaterloo.ca/statwiki/index.php?title=XGBoost&diff=51097XGBoost2021-11-29T03:49:23Z<p>Cwloke: /* Approximate Algorithm */</p>
<hr />
<div>== Presented by == <br />
* Chun Waan Loke<br />
* Peter Chong<br />
* Clarice Osmond<br />
* Zhilong Li<br />
<br />
== Introduction ==<br />
<br />
== Tree Boosting In A Nutshell ==<br />
The author reviews gradient tree boosting in this section.<br />
=== Regularized Learning Objective ===<br />
The author first gives the prediction equation (1) and the regularized objective (2).<br><br />
<br><br />
(1) The additive prediction model is given as<br><br />
<math>\hat{y_i}=\sum_{k=1}^{K}f_k(x_i), f_k \in \mathcal{F} </math> <br><br />
where each <math>f_k</math> corresponds to an independent tree structure with its weights, and <math>\mathcal{F}</math> is the "space of regression trees"<br><br />
<br><br />
(2) The regularized objective to be minimized is given as<br><br />
<math>\mathcal{L}=\sum_{i}l(\hat{y_i},y_i)+\sum_k \Omega(f_k)</math> where <math>\Omega(f)=\gamma T+\frac{1}{2}\lambda ||\omega||^2</math> <br><br />
The first term <math>l</math> is a differentiable convex loss function that calculates the measures between <math>\hat{y}</math> and <math>y</math>.<br><br />
The second term <math>\Omega</math> penalizes on the complexity of model (the <math>f_k</math>'s). For a given tree (<math>f_k</math>), <math>T</math> is the number of leaves, and <math>\omega</math> is the leaf weights.<br><br />
The L1 regularization term <math>\gamma T</math> encourages the tree to be small, and the L2 regularization term <math>\frac{1}{2}\lambda ||\omega||^2</math> encourages the tree to have small weights.<br><br />
<br />
=== Gradient Tree Boosting ===<br />
Let <math>\hat{y_i}^{(t)}</math> be the prediction of <math>y_i</math> at the t-th iteration.<br><br />
Since the prediction equation is simply additive, <math>{\hat y_i}^{(t)}=\hat{y_{i}}^{(t-1)}+f_t(x_i)</math><br><br />
Using this equation and 2nd order Taylor approximation on the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> gives <br><br />
\begin{align}<br />
\mathcal{L}^{(t)}&=\sum_{i}^{n}l(y_i,\hat{y_i}^{(t-1)}+f_t(x_i))+\Omega(f_t)\\<br />
&\simeq \sum_{i}^{n}[l(y_i,\hat{y_i}^{(t-1)})+g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
\end{align}<br />
where <math>g_i</math> and <math>h_i</math> are the first and second derivative of the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> with repspect to the term <math>\hat{y}^{(t-1)}</math><br><br />
We can simplify this objective by removing the constant term <math>l(y_i,\hat{y_i}^{(t-1)})</math>.<br><br />
Define <math>I_j=\{i|q(x_i)=j\}</math>, where <math>q</math> is the tree structure. Since every <math>x_i</math> is mapped by <math>q</math> to some leaf <math>j</math>, going through every <math>x_i</math> is equivalent to going through each leaf j of the structure.<br />
\begin{align}<br />
\tilde{\mathcal{L}}^{(t)}&= \sum_{i}^{n}[g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
&= \sum_{j=1}^{T}[(\sum_{i \in I_j}g_i)\omega_j+\frac{1}{2}(\sum_{i \in I_j}h_i+\lambda)\omega_j^2]+\gamma T<br />
\end{align}<br />
Then for a fixed structure <math>q</math>, the optimal weight of leaf <math>j</math> and the optimal objective value are given as<br><br />
\begin{align}<br />
\omega_j^{*} &= -\frac{\sum_{i \in I_j}g_i}{\sum_{i \in I_j}h_i+\lambda}\\<br />
\tilde{\mathcal{L}}^{(t)}(q) &=-\frac{1}{2}\sum_{j=1}^{T}\frac{(\sum_{i \in I_j}g_i)^2}{\sum_{i \in I_j}h_i+\lambda}+\gamma T<br />
\end{align} <br />
[[File:Structure Score Calculation.png|frame|center|alt=Alt text|Structure Score Calculation]]<br />
Instead of enumerating through all possible tree structures q, a greedy algorithm of iteratively adding branches is used.<br><br />
Let <math>I_L</math> and <math>I_R</math> be the instance sets of left and right nodes after split and let <math>I=I_L\cup I_R</math>.<br><br />
The loss reduction after split is given by<br><br />
\begin{align}<br />
\tilde{\mathcal{L}}_{\text{split}} &=\frac{1}{2}[\frac{(\sum_{i \in I_L}g_i)^2}{\sum_{i \in I_L}h_i+\lambda}+\frac{(\sum_{i \in I_R}g_i)^2}{\sum_{i \in I_R}h_i+\lambda}-\frac{(\sum_{i \in I}g_i)^2}{\sum_{i \in I}h_i+\lambda}]+\gamma<br />
\end{align}<br />
=== Shrinkage and Column Subsampling ===<br />
The author also mentioned two other methods in order to avoid over-fitting.<br><br />
(1) Shrinkage. Similar to the learning rate in stochastic optimization, a new weight is added to each tree boosting to reduce the influence of a single tree and leave space for future trees.<br><br />
(2) Column (feature) subsampling. In the paper, the author only mentioned that this technique speeds up parallel algorithm used in later sections.<br />
<br />
== Split Finding Algorithms ==<br />
<br />
It is very important to find the best split for tree learning to perform well. Here are a few split finding algorithms mentioned in the paper:<br />
<br />
=== Basic Exact Greedy Algorithm ===<br />
<br />
The basic exact greedy algorithm is a split finding algorithm that is computationally expensive because it enumerates over all the possible splits for continuous features. It is impossible to be done efficiently when the memory is not enough to hold the data needed. A way to carry out this algorithm efficiently is to sort the data according to feature values and visit the data in order to accumulate the gradient statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_1.png|center|alt=Alt text|Basic Exact Greedy Algorithm]]<br />
<br />
=== Approximate Algorithm ===<br />
<br />
The paper introduced a more efficient algorithm compared to Basic Exact Greedy Algorithm which is the Approximate Algorithm. The Approximate Algorithm first proposes candidate splitting points according to percentiles of feature distribution. It then maps the continuous features into buckets split by candidate points, aggregates the statistics and finds the best solution among proposals based on the aggregated statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_2.png|center|alt=Alt text|Approximate Algorithm]]<br />
<br />
There are also two variants to this algorithm, the global variant proposes all the candidate splits during the initial phase of tree construction and uses the same proposals for split finding at all levels. Whereas, the local variant re-proposes after each split. The global variant usually requires less proposal steps but uses more candidate points than local variant because candidates are not refined after each split. For deeper trees, usage of local variant may be more appropriate as compared to global variant. The figure below shows the a comparison in accuracy between Basic Exact Greedy and Approximate split finding algorithms with different variant over the number of iterations. We can see that the quantile strategy is able to achieve similar accuracy as the Basic Exact Greedy algorithm given a reasonable approximation level.<br />
<br />
[[File:iterations.png|center|alt=Alt text|Comparison of accuracy between different algorithms]]<br />
<br />
=== Weighted Quantile Sketch ===<br />
<br />
<br />
<br />
=== Sparsity-aware Split Finding ===<br />
<br />
== System Design ==<br />
<br />
=== Column Block for Parallel Learning ===<br />
The most time consuming part of tree learning is to get the data into sorted order. To overcome this problem, XGBoost stores the data in blocks where each block performs the sorting operation in parallel. The results are then merged together.<br />
<br />
# For the exact greedy algorithm, XGBoost stores the entire dataset in a single block<br />
#:* Original spase aware algorithm costs: <math>O(Kd∥x∥_0 log(n))</math><br />
#:* Tree boosting on block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(n))</math><br />
#:* Hence, block structure helps to save an additional <math>log(n)</math> factor<br />
# For approximate algorithms, XGBoost stores the dataset in multiple blocks<br />
#:* Original algorithm with binary search costs: <math>O(Kd∥x∥_0 log(q))</math><br />
#:* With block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(B))</math><br />
#:* Hence, block structure helps to save an additional <math>log(q)</math> factor <br />
<br />
K = total number of trees<br /><br />
d = maximum depth of the tree<br /><br />
<math>∥x∥_0</math> = number of non-missing entries in the training data<br /><br />
n = number of rows in the dataset<br /><br />
q = number of proposal candidates in the dataset, usually between 32 to 100<br /><br />
B = maximum number of rows in each block<br />
<br />
[[File: columnblock.png|800px|thumb|center]]<br />
<br />
=== Cache-aware Access ===<br />
The proposed block structure optimizes the computation complexity but requires indirect fetches of gradient statistics by row index. XGBoost optimizes the process by using the following methods.<br />
<br />
# For the exact greedy algorithm, XGBoost uses a cache-aware prefetching algorithm<br />
#:* It stores Gradient and Hessians in the cache to make calculations fast<br />
#:* It runs twice as fast as the naive method when the dataset is large<br />
# For approximate algorithms, XGBoost chooses a specific block size<br />
#:* Choosing a small block size results in inefficient parallelization<br />
#:* Choosing a large block size results in cache misses<br />
#:* Various choices of block size are compared and the results are shown in Figure 9<br />
#:* XGBoost chose <math>2^{16}</math> as the block size<br />
<br />
[[File: blocksize.png|400px|thumb|center]]<br />
<br />
=== Blocks for Out-of-core Computation ===<br />
When the dataset is too large for the cache and main memory, XGBoost utilizes disk spaces as well. Since reading and writing data to the disks are slow, XGBoost optimizes the process by using the following two methods.<br />
<br />
# Block Compression<br />
#:* Blocks are compressed by columns<br />
#:* Although decompressing takes time, it is still faster than reading from the disks<br />
# Block Sharding<br />
#:* If multiple disks are available, data is split into those disks<br />
#:* When the CPU needs data, all the disks can be read at the same time<br />
<br />
== End To End Evaluations ==<br />
=== System Implementation ===<br />
XGBoost is a portable and reusable open-source package. It supports:<br />
* various weighted classification<br />
* various objective functions (rank & user defined)<br />
* popular languages (python, R, Julia)<br />
* data science pipelines (scikit-learn)<br />
* big data stacks (Flink, Spark)<br />
* cloud platform (Tianchi8)<br />
<br />
=== Dataset and Setup ===<br />
<br />
A summary of the 4 datasets used in the experiments is in table 2.<br />
<br />
[[File: table2data.png|500px|thumb|center]]<br />
<br />
The first and last datasets were used specifically to evaluate the impact of sparsity-aware algorithm and the scaling property of the system in the out-of-core and the distributed settings respectively. In all of the experiments, common settings such as maximum depth equal to 8, shrinkage equal to 0.1 and no column subsampling are applied.<br />
<br />
=== Classification ===<br />
A subset (n = 1M) of Higgs Boson dataset was used for classification. The results are shown in Table 3.<br />
<br />
[[File: classification.png|500px|thumb|center]]<br />
<br />
* R’s GBM creates a tree fast by using greedy approach that only expands one branch of a tree but with the cost of lower accuracy<br />
* XGBoost and scikit-learn have better performance than R’s GBM<br />
* XGBoost runs more than 10x faster than scikit-learn in learning a full tree<br />
* Column subsamples give slightly worse performance possibly due to a few important features in this dataset.<br />
<br />
=== Learning to Rank ===<br />
The results in comparing XGBoost with pGBRT are shown in Table 4.<br />
<br />
[[File: rank.png|500px|thumb|center]]<br />
<br />
* XGBoost runs exact greedy algorithm while pGBRT only supports an approximate algorithm<br />
* XGBoost runs faster<br />
* Subsampling column reduces running time and gives higher performance possibly due to preventing overfitting<br />
<br />
=== Out-of-core Experiment ===<br />
An extremely large Criteo dataset was used to evaluate the out-of-core setting. The results are shown in the figure below.<br />
<br />
[[File: outofcore.png|350px|thumb|center]]<br />
<br />
* Compression speed up the computation by a factor of 3<br />
* Sharding into 2 disks further gives 2x speed<br />
<br />
=== Distributed Experiment ===<br />
YARN cluster on EC2 with m3.2xlarge machines was used to evaluate the distributed setting. XGBoost was compared with Spark MLLib and H20.<br />
<br />
* XGBoost can switch to out-of-core setting when the memory runs out, while the baseline systems need to store the data in RAM<br />
* XGBoost runs faster than the baseline systems<br />
* The baseline systems are only able to handle a subset of the data with the given resources while XGBoost was able to scale smoothly to all 1.7B rows<br />
* XGBoost’s performance scales linearly with more machines<br />
* XGBoost is able to handle all 1.7B data with only 4 machines<br />
<br />
== Conclusion ==<br />
<br />
== References ==<br />
[1] R. Bekkerman. The present and the future of the kdd cup competition: an outsider’s perspective. <br />
<br />
[2] R. Bekkerman, M. Bilenko, and J. Langford. Scaling Up Machine Learning: Parallel and Distributed Approaches. Cambridge University Press, New York, NY, USA, 2011. <br />
<br />
[3] J. Bennett and S. Lanning. The netflix prize. In Proceedings of the KDD Cup Workshop 2007, pages 3–6, New York, Aug. 2007.<br />
<br />
[4] L. Breiman. Random forests. Maching Learning, 45(1):5–32, Oct. 2001.<br />
<br />
[5] C. Burges. From ranknet to lambdarank to lambdamart: An overview. Learning, 11:23–581, 2010.<br />
<br />
[6] O. Chapelle and Y. Chang. Yahoo! Learning to Rank Challenge Overview. Journal of Machine Learning Research - W & CP, 14:1–24, 2011.<br />
<br />
[7] T. Chen, H. Li, Q. Yang, and Y. Yu. General functional matrix factorization using gradient boosting. In Proceeding of 30th International Conference on Machine Learning (ICML’13), volume 1, pages 436–444, 2013.<br />
<br />
[8] T. Chen, S. Singh, B. Taskar, and C. Guestrin. Efficient second-order gradient boosting for conditional random fields. In Proceeding of 18th Artificial Intelligence and Statistics Conference (AISTATS’15), volume 1, 2015.<br />
<br />
[9] R.-E. Fan, K.-W. Chang, C.-J. Hsieh, X.-R. Wang, and C.-J. Lin. LIBLINEAR: A library for large linear classification. Journal of Machine Learning Research, 9:1871–1874, 2008.<br />
<br />
[10] J. Friedman. Greedy function approximation: a gradient boosting machine. Annals of Statistics, 29(5):1189–1232, 2001.<br />
<br />
[11] J. Friedman. Stochastic gradient boosting. Computational Statistics & Data Analysis, 38(4):367–378, 2002.<br />
<br />
[12] J. Friedman, T. Hastie, and R. Tibshirani. Additive logistic regression: a statistical view of boosting. Annals of Statistics, 28(2):337–407, 2000.<br />
<br />
[13] J. H. Friedman and B. E. Popescu. Importance sampled learning ensembles, 2003.<br />
<br />
[14] M. Greenwald and S. Khanna. Space-efficient online computation of quantile summaries. In Proceedings of the 2001 ACM SIGMOD International Conference on Management of Data, pages 58–66, 2001.<br />
<br />
[15] X. He, J. Pan, O. Jin, T. Xu, B. Liu, T. Xu, Y. Shi, A. Atallah, R. Herbrich, S. Bowers, and J. Q. n. Candela. Practical lessons from predicting clicks on ads at facebook. In Proceedings of the Eighth International Workshop on Data Mining for Online Advertising, ADKDD’14, 2014.<br />
<br />
[16] P. Li. Robust Logitboost and adaptive base class (ABC) Logitboost. In Proceedings of the Twenty-Sixth Conference Annual Conference on Uncertainty in Artificial Intelligence (UAI’10), pages 302–311, 2010.<br />
<br />
[17] P. Li, Q. Wu, and C. J. Burges. Mcrank: Learning to rank using multiple classification and gradient boosting. In Advances in Neural Information Processing Systems 20, pages 897–904. 2008.<br />
<br />
[18] X. Meng, J. Bradley, B. Yavuz, E. Sparks, S. Venkataraman, D. Liu, J. Freeman, D. Tsai, M. Amde, S. Owen, D. Xin, R. Xin, M. J. Franklin, R. Zadeh, M. Zaharia, and A. Talwalkar. MLlib: Machine learning in apache spark. Journal of Machine Learning Research, 17(34):1–7, 2016.<br />
<br />
[19] B. Panda, J. S. Herbach, S. Basu, and R. J. Bayardo. Planet: Massively parallel learning of tree ensembles with mapreduce. Proceeding of VLDB Endowment, 2(2):1426–1437, Aug. 2009.<br />
<br />
[20] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.<br />
<br />
[21] G. Ridgeway. Generalized Boosted Models: A guide to the gbm package.<br />
<br />
[22] S. Tyree, K. Weinberger, K. Agrawal, and J. Paykin. Parallel boosted regression trees for web search ranking. In Proceedings of the 20th international conference on World wide web, pages 387–396. ACM, 2011.<br />
<br />
[23] J. Ye, J.-H. Chow, J. Chen, and Z. Zheng. Stochastic gradient boosted distributed decision trees. In Proceedings of the 18th ACM Conference on Information and Knowledge Management, CIKM ’09.<br />
<br />
[24] Q. Zhang and W. Wang. A fast algorithm for approximate quantiles in high speed data streams. In Proceedings of the 19th International Conference on Scientific and Statistical Database Management, 2007.<br />
<br />
[25] T. Zhang and R. Johnson. Learning nonlinear functions using regularized greedy forest. IEEE Transactions on Pattern Analysis and Machine Intelligence, 36(5), 2014.</div>Cwlokehttp://wiki.math.uwaterloo.ca/statwiki/index.php?title=XGBoost&diff=51096XGBoost2021-11-29T03:48:39Z<p>Cwloke: /* Approximate Algorithm */</p>
<hr />
<div>== Presented by == <br />
* Chun Waan Loke<br />
* Peter Chong<br />
* Clarice Osmond<br />
* Zhilong Li<br />
<br />
== Introduction ==<br />
<br />
== Tree Boosting In A Nutshell ==<br />
The author reviews gradient tree boosting in this section.<br />
=== Regularized Learning Objective ===<br />
The author first gives the prediction equation (1) and the regularized objective (2).<br><br />
<br><br />
(1) The additive prediction model is given as<br><br />
<math>\hat{y_i}=\sum_{k=1}^{K}f_k(x_i), f_k \in \mathcal{F} </math> <br><br />
where each <math>f_k</math> corresponds to an independent tree structure with its weights, and <math>\mathcal{F}</math> is the "space of regression trees"<br><br />
<br><br />
(2) The regularized objective to be minimized is given as<br><br />
<math>\mathcal{L}=\sum_{i}l(\hat{y_i},y_i)+\sum_k \Omega(f_k)</math> where <math>\Omega(f)=\gamma T+\frac{1}{2}\lambda ||\omega||^2</math> <br><br />
The first term <math>l</math> is a differentiable convex loss function that calculates the measures between <math>\hat{y}</math> and <math>y</math>.<br><br />
The second term <math>\Omega</math> penalizes on the complexity of model (the <math>f_k</math>'s). For a given tree (<math>f_k</math>), <math>T</math> is the number of leaves, and <math>\omega</math> is the leaf weights.<br><br />
The L1 regularization term <math>\gamma T</math> encourages the tree to be small, and the L2 regularization term <math>\frac{1}{2}\lambda ||\omega||^2</math> encourages the tree to have small weights.<br><br />
<br />
=== Gradient Tree Boosting ===<br />
Let <math>\hat{y_i}^{(t)}</math> be the prediction of <math>y_i</math> at the t-th iteration.<br><br />
Since the prediction equation is simply additive, <math>{\hat y_i}^{(t)}=\hat{y_{i}}^{(t-1)}+f_t(x_i)</math><br><br />
Using this equation and 2nd order Taylor approximation on the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> gives <br><br />
\begin{align}<br />
\mathcal{L}^{(t)}&=\sum_{i}^{n}l(y_i,\hat{y_i}^{(t-1)}+f_t(x_i))+\Omega(f_t)\\<br />
&\simeq \sum_{i}^{n}[l(y_i,\hat{y_i}^{(t-1)})+g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
\end{align}<br />
where <math>g_i</math> and <math>h_i</math> are the first and second derivative of the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> with repspect to the term <math>\hat{y}^{(t-1)}</math><br><br />
We can simplify this objective by removing the constant term <math>l(y_i,\hat{y_i}^{(t-1)})</math>.<br><br />
Define <math>I_j=\{i|q(x_i)=j\}</math>, where <math>q</math> is the tree structure. Since every <math>x_i</math> is mapped by <math>q</math> to some leaf <math>j</math>, going through every <math>x_i</math> is equivalent to going through each leaf j of the structure.<br />
\begin{align}<br />
\tilde{\mathcal{L}}^{(t)}&= \sum_{i}^{n}[g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
&= \sum_{j=1}^{T}[(\sum_{i \in I_j}g_i)\omega_j+\frac{1}{2}(\sum_{i \in I_j}h_i+\lambda)\omega_j^2]+\gamma T<br />
\end{align}<br />
Then for a fixed structure <math>q</math>, the optimal weight of leaf <math>j</math> and the optimal objective value are given as<br><br />
\begin{align}<br />
\omega_j^{*} &= -\frac{\sum_{i \in I_j}g_i}{\sum_{i \in I_j}h_i+\lambda}\\<br />
\tilde{\mathcal{L}}^{(t)}(q) &=-\frac{1}{2}\sum_{j=1}^{T}\frac{(\sum_{i \in I_j}g_i)^2}{\sum_{i \in I_j}h_i+\lambda}+\gamma T<br />
\end{align} <br />
[[File:Structure Score Calculation.png|frame|center|alt=Alt text|Structure Score Calculation]]<br />
Instead of enumerating through all possible tree structures q, a greedy algorithm of iteratively adding branches is used.<br><br />
Let <math>I_L</math> and <math>I_R</math> be the instance sets of left and right nodes after split and let <math>I=I_L\cup I_R</math>.<br><br />
The loss reduction after split is given by<br><br />
\begin{align}<br />
\tilde{\mathcal{L}}_{\text{split}} &=\frac{1}{2}[\frac{(\sum_{i \in I_L}g_i)^2}{\sum_{i \in I_L}h_i+\lambda}+\frac{(\sum_{i \in I_R}g_i)^2}{\sum_{i \in I_R}h_i+\lambda}-\frac{(\sum_{i \in I}g_i)^2}{\sum_{i \in I}h_i+\lambda}]+\gamma<br />
\end{align}<br />
=== Shrinkage and Column Subsampling ===<br />
The author also mentioned two other methods in order to avoid over-fitting.<br><br />
(1) Shrinkage. Similar to the learning rate in stochastic optimization, a new weight is added to each tree boosting to reduce the influence of a single tree and leave space for future trees.<br><br />
(2) Column (feature) subsampling. In the paper, the author only mentioned that this technique speeds up parallel algorithm used in later sections.<br />
<br />
== Split Finding Algorithms ==<br />
<br />
It is very important to find the best split for tree learning to perform well. Here are a few split finding algorithms mentioned in the paper:<br />
<br />
=== Basic Exact Greedy Algorithm ===<br />
<br />
The basic exact greedy algorithm is a split finding algorithm that is computationally expensive because it enumerates over all the possible splits for continuous features. It is impossible to be done efficiently when the memory is not enough to hold the data needed. A way to carry out this algorithm efficiently is to sort the data according to feature values and visit the data in order to accumulate the gradient statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_1.png|center|alt=Alt text|Basic Exact Greedy Algorithm]]<br />
<br />
=== Approximate Algorithm ===<br />
<br />
The paper introduced a more efficient algorithm compared to Basic Exact Greedy Algorithm which is the Approximate Algorithm. The Approximate Algorithm first proposes candidate splitting points according to percentiles of feature distribution. It then maps the continuous features into buckets split by candidate points, aggregates the statistics and finds the best solution among proposals based on the aggregated statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_2.png|center|alt=Alt text|Approximate Algorithm]]<br />
<br />
There are also two variants to this algorithm, the global variant proposes all the candidate splits during the initial phase of tree construction and uses the same proposals for split finding at all levels. Whereas, the local variant re-proposes after each split. The global variant usually requires less proposal steps but uses more candidate points than local variant. For deeper trees, usage of local variant may be more appropriate as compared to global variant. The figure below shows the a comparison in accuracy between Basic Exact Greedy and Approximate split finding algorithms with different variant over the number of iterations. We can see that the quantile strategy is able to achieve similar accuracy as the Basic Exact Greedy algorithm given a reasonable approximation level.<br />
<br />
[[File:iterations.png|center|alt=Alt text|Comparison of accuracy between different algorithms]]<br />
<br />
=== Weighted Quantile Sketch ===<br />
<br />
<br />
<br />
=== Sparsity-aware Split Finding ===<br />
<br />
== System Design ==<br />
<br />
=== Column Block for Parallel Learning ===<br />
The most time consuming part of tree learning is to get the data into sorted order. To overcome this problem, XGBoost stores the data in blocks where each block performs the sorting operation in parallel. The results are then merged together.<br />
<br />
# For the exact greedy algorithm, XGBoost stores the entire dataset in a single block<br />
#:* Original spase aware algorithm costs: <math>O(Kd∥x∥_0 log(n))</math><br />
#:* Tree boosting on block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(n))</math><br />
#:* Hence, block structure helps to save an additional <math>log(n)</math> factor<br />
# For approximate algorithms, XGBoost stores the dataset in multiple blocks<br />
#:* Original algorithm with binary search costs: <math>O(Kd∥x∥_0 log(q))</math><br />
#:* With block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(B))</math><br />
#:* Hence, block structure helps to save an additional <math>log(q)</math> factor <br />
<br />
K = total number of trees<br /><br />
d = maximum depth of the tree<br /><br />
<math>∥x∥_0</math> = number of non-missing entries in the training data<br /><br />
n = number of rows in the dataset<br /><br />
q = number of proposal candidates in the dataset, usually between 32 to 100<br /><br />
B = maximum number of rows in each block<br />
<br />
[[File: columnblock.png|800px|thumb|center]]<br />
<br />
=== Cache-aware Access ===<br />
The proposed block structure optimizes the computation complexity but requires indirect fetches of gradient statistics by row index. XGBoost optimizes the process by using the following methods.<br />
<br />
# For the exact greedy algorithm, XGBoost uses a cache-aware prefetching algorithm<br />
#:* It stores Gradient and Hessians in the cache to make calculations fast<br />
#:* It runs twice as fast as the naive method when the dataset is large<br />
# For approximate algorithms, XGBoost chooses a specific block size<br />
#:* Choosing a small block size results in inefficient parallelization<br />
#:* Choosing a large block size results in cache misses<br />
#:* Various choices of block size are compared and the results are shown in Figure 9<br />
#:* XGBoost chose <math>2^{16}</math> as the block size<br />
<br />
[[File: blocksize.png|400px|thumb|center]]<br />
<br />
=== Blocks for Out-of-core Computation ===<br />
When the dataset is too large for the cache and main memory, XGBoost utilizes disk spaces as well. Since reading and writing data to the disks are slow, XGBoost optimizes the process by using the following two methods.<br />
<br />
# Block Compression<br />
#:* Blocks are compressed by columns<br />
#:* Although decompressing takes time, it is still faster than reading from the disks<br />
# Block Sharding<br />
#:* If multiple disks are available, data is split into those disks<br />
#:* When the CPU needs data, all the disks can be read at the same time<br />
<br />
== End To End Evaluations ==<br />
=== System Implementation ===<br />
XGBoost is a portable and reusable open-source package. It supports:<br />
* various weighted classification<br />
* various objective functions (rank & user defined)<br />
* popular languages (python, R, Julia)<br />
* data science pipelines (scikit-learn)<br />
* big data stacks (Flink, Spark)<br />
* cloud platform (Tianchi8)<br />
<br />
=== Dataset and Setup ===<br />
<br />
A summary of the 4 datasets used in the experiments is in table 2.<br />
<br />
[[File: table2data.png|500px|thumb|center]]<br />
<br />
The first and last datasets were used specifically to evaluate the impact of sparsity-aware algorithm and the scaling property of the system in the out-of-core and the distributed settings respectively. In all of the experiments, common settings such as maximum depth equal to 8, shrinkage equal to 0.1 and no column subsampling are applied.<br />
<br />
=== Classification ===<br />
A subset (n = 1M) of Higgs Boson dataset was used for classification. The results are shown in Table 3.<br />
<br />
[[File: classification.png|500px|thumb|center]]<br />
<br />
* R’s GBM creates a tree fast by using greedy approach that only expands one branch of a tree but with the cost of lower accuracy<br />
* XGBoost and scikit-learn have better performance than R’s GBM<br />
* XGBoost runs more than 10x faster than scikit-learn in learning a full tree<br />
* Column subsamples give slightly worse performance possibly due to a few important features in this dataset.<br />
<br />
=== Learning to Rank ===<br />
The results in comparing XGBoost with pGBRT are shown in Table 4.<br />
<br />
[[File: rank.png|500px|thumb|center]]<br />
<br />
* XGBoost runs exact greedy algorithm while pGBRT only supports an approximate algorithm<br />
* XGBoost runs faster<br />
* Subsampling column reduces running time and gives higher performance possibly due to preventing overfitting<br />
<br />
=== Out-of-core Experiment ===<br />
An extremely large Criteo dataset was used to evaluate the out-of-core setting. The results are shown in the figure below.<br />
<br />
[[File: outofcore.png|350px|thumb|center]]<br />
<br />
* Compression speed up the computation by a factor of 3<br />
* Sharding into 2 disks further gives 2x speed<br />
<br />
=== Distributed Experiment ===<br />
YARN cluster on EC2 with m3.2xlarge machines was used to evaluate the distributed setting. XGBoost was compared with Spark MLLib and H20.<br />
<br />
* XGBoost can switch to out-of-core setting when the memory runs out, while the baseline systems need to store the data in RAM<br />
* XGBoost runs faster than the baseline systems<br />
* The baseline systems are only able to handle a subset of the data with the given resources while XGBoost was able to scale smoothly to all 1.7B rows<br />
* XGBoost’s performance scales linearly with more machines<br />
* XGBoost is able to handle all 1.7B data with only 4 machines<br />
<br />
== Conclusion ==<br />
<br />
== References ==<br />
[1] R. Bekkerman. The present and the future of the kdd cup competition: an outsider’s perspective. <br />
<br />
[2] R. Bekkerman, M. Bilenko, and J. Langford. Scaling Up Machine Learning: Parallel and Distributed Approaches. Cambridge University Press, New York, NY, USA, 2011. <br />
<br />
[3] J. Bennett and S. Lanning. The netflix prize. In Proceedings of the KDD Cup Workshop 2007, pages 3–6, New York, Aug. 2007.<br />
<br />
[4] L. Breiman. Random forests. Maching Learning, 45(1):5–32, Oct. 2001.<br />
<br />
[5] C. Burges. From ranknet to lambdarank to lambdamart: An overview. Learning, 11:23–581, 2010.<br />
<br />
[6] O. Chapelle and Y. Chang. Yahoo! Learning to Rank Challenge Overview. Journal of Machine Learning Research - W & CP, 14:1–24, 2011.<br />
<br />
[7] T. Chen, H. Li, Q. Yang, and Y. Yu. General functional matrix factorization using gradient boosting. In Proceeding of 30th International Conference on Machine Learning (ICML’13), volume 1, pages 436–444, 2013.<br />
<br />
[8] T. Chen, S. Singh, B. Taskar, and C. Guestrin. Efficient second-order gradient boosting for conditional random fields. In Proceeding of 18th Artificial Intelligence and Statistics Conference (AISTATS’15), volume 1, 2015.<br />
<br />
[9] R.-E. Fan, K.-W. Chang, C.-J. Hsieh, X.-R. Wang, and C.-J. Lin. LIBLINEAR: A library for large linear classification. Journal of Machine Learning Research, 9:1871–1874, 2008.<br />
<br />
[10] J. Friedman. Greedy function approximation: a gradient boosting machine. Annals of Statistics, 29(5):1189–1232, 2001.<br />
<br />
[11] J. Friedman. Stochastic gradient boosting. Computational Statistics & Data Analysis, 38(4):367–378, 2002.<br />
<br />
[12] J. Friedman, T. Hastie, and R. Tibshirani. Additive logistic regression: a statistical view of boosting. Annals of Statistics, 28(2):337–407, 2000.<br />
<br />
[13] J. H. Friedman and B. E. Popescu. Importance sampled learning ensembles, 2003.<br />
<br />
[14] M. Greenwald and S. Khanna. Space-efficient online computation of quantile summaries. In Proceedings of the 2001 ACM SIGMOD International Conference on Management of Data, pages 58–66, 2001.<br />
<br />
[15] X. He, J. Pan, O. Jin, T. Xu, B. Liu, T. Xu, Y. Shi, A. Atallah, R. Herbrich, S. Bowers, and J. Q. n. Candela. Practical lessons from predicting clicks on ads at facebook. In Proceedings of the Eighth International Workshop on Data Mining for Online Advertising, ADKDD’14, 2014.<br />
<br />
[16] P. Li. Robust Logitboost and adaptive base class (ABC) Logitboost. In Proceedings of the Twenty-Sixth Conference Annual Conference on Uncertainty in Artificial Intelligence (UAI’10), pages 302–311, 2010.<br />
<br />
[17] P. Li, Q. Wu, and C. J. Burges. Mcrank: Learning to rank using multiple classification and gradient boosting. In Advances in Neural Information Processing Systems 20, pages 897–904. 2008.<br />
<br />
[18] X. Meng, J. Bradley, B. Yavuz, E. Sparks, S. Venkataraman, D. Liu, J. Freeman, D. Tsai, M. Amde, S. Owen, D. Xin, R. Xin, M. J. Franklin, R. Zadeh, M. Zaharia, and A. Talwalkar. MLlib: Machine learning in apache spark. Journal of Machine Learning Research, 17(34):1–7, 2016.<br />
<br />
[19] B. Panda, J. S. Herbach, S. Basu, and R. J. Bayardo. Planet: Massively parallel learning of tree ensembles with mapreduce. Proceeding of VLDB Endowment, 2(2):1426–1437, Aug. 2009.<br />
<br />
[20] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.<br />
<br />
[21] G. Ridgeway. Generalized Boosted Models: A guide to the gbm package.<br />
<br />
[22] S. Tyree, K. Weinberger, K. Agrawal, and J. Paykin. Parallel boosted regression trees for web search ranking. In Proceedings of the 20th international conference on World wide web, pages 387–396. ACM, 2011.<br />
<br />
[23] J. Ye, J.-H. Chow, J. Chen, and Z. Zheng. Stochastic gradient boosted distributed decision trees. In Proceedings of the 18th ACM Conference on Information and Knowledge Management, CIKM ’09.<br />
<br />
[24] Q. Zhang and W. Wang. A fast algorithm for approximate quantiles in high speed data streams. In Proceedings of the 19th International Conference on Scientific and Statistical Database Management, 2007.<br />
<br />
[25] T. Zhang and R. Johnson. Learning nonlinear functions using regularized greedy forest. IEEE Transactions on Pattern Analysis and Machine Intelligence, 36(5), 2014.</div>Cwlokehttp://wiki.math.uwaterloo.ca/statwiki/index.php?title=XGBoost&diff=51095XGBoost2021-11-29T03:48:06Z<p>Cwloke: /* Approximate Algorithm */</p>
<hr />
<div>== Presented by == <br />
* Chun Waan Loke<br />
* Peter Chong<br />
* Clarice Osmond<br />
* Zhilong Li<br />
<br />
== Introduction ==<br />
<br />
== Tree Boosting In A Nutshell ==<br />
The author reviews gradient tree boosting in this section.<br />
=== Regularized Learning Objective ===<br />
The author first gives the prediction equation (1) and the regularized objective (2).<br><br />
<br><br />
(1) The additive prediction model is given as<br><br />
<math>\hat{y_i}=\sum_{k=1}^{K}f_k(x_i), f_k \in \mathcal{F} </math> <br><br />
where each <math>f_k</math> corresponds to an independent tree structure with its weights, and <math>\mathcal{F}</math> is the "space of regression trees"<br><br />
<br><br />
(2) The regularized objective to be minimized is given as<br><br />
<math>\mathcal{L}=\sum_{i}l(\hat{y_i},y_i)+\sum_k \Omega(f_k)</math> where <math>\Omega(f)=\gamma T+\frac{1}{2}\lambda ||\omega||^2</math> <br><br />
The first term <math>l</math> is a differentiable convex loss function that calculates the measures between <math>\hat{y}</math> and <math>y</math>.<br><br />
The second term <math>\Omega</math> penalizes on the complexity of model (the <math>f_k</math>'s). For a given tree (<math>f_k</math>), <math>T</math> is the number of leaves, and <math>\omega</math> is the leaf weights.<br><br />
The L1 regularization term <math>\gamma T</math> encourages the tree to be small, and the L2 regularization term <math>\frac{1}{2}\lambda ||\omega||^2</math> encourages the tree to have small weights.<br><br />
<br />
=== Gradient Tree Boosting ===<br />
Let <math>\hat{y_i}^{(t)}</math> be the prediction of <math>y_i</math> at the t-th iteration.<br><br />
Since the prediction equation is simply additive, <math>{\hat y_i}^{(t)}=\hat{y_{i}}^{(t-1)}+f_t(x_i)</math><br><br />
Using this equation and 2nd order Taylor approximation on the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> gives <br><br />
\begin{align}<br />
\mathcal{L}^{(t)}&=\sum_{i}^{n}l(y_i,\hat{y_i}^{(t-1)}+f_t(x_i))+\Omega(f_t)\\<br />
&\simeq \sum_{i}^{n}[l(y_i,\hat{y_i}^{(t-1)})+g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
\end{align}<br />
where <math>g_i</math> and <math>h_i</math> are the first and second derivative of the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> with repspect to the term <math>\hat{y}^{(t-1)}</math><br><br />
We can simplify this objective by removing the constant term <math>l(y_i,\hat{y_i}^{(t-1)})</math>.<br><br />
Define <math>I_j=\{i|q(x_i)=j\}</math>, where <math>q</math> is the tree structure. Since every <math>x_i</math> is mapped by <math>q</math> to some leaf <math>j</math>, going through every <math>x_i</math> is equivalent to going through each leaf j of the structure.<br />
\begin{align}<br />
\tilde{\mathcal{L}}^{(t)}&= \sum_{i}^{n}[g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
&= \sum_{j=1}^{T}[(\sum_{i \in I_j}g_i)\omega_j+\frac{1}{2}(\sum_{i \in I_j}h_i+\lambda)\omega_j^2]+\gamma T<br />
\end{align}<br />
Then for a fixed structure <math>q</math>, the optimal weight of leaf <math>j</math> and the optimal objective value are given as<br><br />
\begin{align}<br />
\omega_j^{*} &= -\frac{\sum_{i \in I_j}g_i}{\sum_{i \in I_j}h_i+\lambda}\\<br />
\tilde{\mathcal{L}}^{(t)}(q) &=-\frac{1}{2}\sum_{j=1}^{T}\frac{(\sum_{i \in I_j}g_i)^2}{\sum_{i \in I_j}h_i+\lambda}+\gamma T<br />
\end{align} <br />
[[File:Structure Score Calculation.png|frame|center|alt=Alt text|Structure Score Calculation]]<br />
Instead of enumerating through all possible tree structures q, a greedy algorithm of iteratively adding branches is used.<br><br />
Let <math>I_L</math> and <math>I_R</math> be the instance sets of left and right nodes after split and let <math>I=I_L\cup I_R</math>.<br><br />
The loss reduction after split is given by<br><br />
\begin{align}<br />
\tilde{\mathcal{L}}_{\text{split}} &=\frac{1}{2}[\frac{(\sum_{i \in I_L}g_i)^2}{\sum_{i \in I_L}h_i+\lambda}+\frac{(\sum_{i \in I_R}g_i)^2}{\sum_{i \in I_R}h_i+\lambda}-\frac{(\sum_{i \in I}g_i)^2}{\sum_{i \in I}h_i+\lambda}]+\gamma<br />
\end{align}<br />
=== Shrinkage and Column Subsampling ===<br />
The author also mentioned two other methods in order to avoid over-fitting.<br><br />
(1) Shrinkage. Similar to the learning rate in stochastic optimization, a new weight is added to each tree boosting to reduce the influence of a single tree and leave space for future trees.<br><br />
(2) Column (feature) subsampling. In the paper, the author only mentioned that this technique speeds up parallel algorithm used in later sections.<br />
<br />
== Split Finding Algorithms ==<br />
<br />
It is very important to find the best split for tree learning to perform well. Here are a few split finding algorithms mentioned in the paper:<br />
<br />
=== Basic Exact Greedy Algorithm ===<br />
<br />
The basic exact greedy algorithm is a split finding algorithm that is computationally expensive because it enumerates over all the possible splits for continuous features. It is impossible to be done efficiently when the memory is not enough to hold the data needed. A way to carry out this algorithm efficiently is to sort the data according to feature values and visit the data in order to accumulate the gradient statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_1.png|center|alt=Alt text|Basic Exact Greedy Algorithm]]<br />
<br />
=== Approximate Algorithm ===<br />
<br />
The paper introduced a more efficient algorithm compared to Basic Exact Greedy Algorithm which is the Approximate Algorithm. The Approximate Algorithm first proposes candidate splitting points according to percentiles of feature distribution. It then maps the continuous features into buckets split by candidate points, aggregates the statistics and finds the best solution among proposals based on the aggregated statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_2.png|center|alt=Alt text|Approximate Algorithm]]<br />
<br />
There are also two variants of this algorithm, the global variant proposes all the candidate splits during the initial phase of tree construction and uses the same proposals for split finding at all levels. Whereas, the local variant re-proposes after each split. The global variant usually requires less proposal steps but uses more candidate points than local variant. For deeper trees, usage of local variant may be more appropriate as compared to global variant. The figure below shows the a comparison in accuracy between Basic Exact Greedy and Approximate split finding algorithms with different variant over the number of iterations. We can see that the quantile strategy is able to achieve similar accuracy as the Basic Exact Greedy algorithm given a reasonable approximation level.<br />
<br />
[[File:iterations.png|center|alt=Alt text|Comparison of accuracy between different algorithms]]<br />
<br />
=== Weighted Quantile Sketch ===<br />
<br />
<br />
<br />
=== Sparsity-aware Split Finding ===<br />
<br />
== System Design ==<br />
<br />
=== Column Block for Parallel Learning ===<br />
The most time consuming part of tree learning is to get the data into sorted order. To overcome this problem, XGBoost stores the data in blocks where each block performs the sorting operation in parallel. The results are then merged together.<br />
<br />
# For the exact greedy algorithm, XGBoost stores the entire dataset in a single block<br />
#:* Original spase aware algorithm costs: <math>O(Kd∥x∥_0 log(n))</math><br />
#:* Tree boosting on block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(n))</math><br />
#:* Hence, block structure helps to save an additional <math>log(n)</math> factor<br />
# For approximate algorithms, XGBoost stores the dataset in multiple blocks<br />
#:* Original algorithm with binary search costs: <math>O(Kd∥x∥_0 log(q))</math><br />
#:* With block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(B))</math><br />
#:* Hence, block structure helps to save an additional <math>log(q)</math> factor <br />
<br />
K = total number of trees<br /><br />
d = maximum depth of the tree<br /><br />
<math>∥x∥_0</math> = number of non-missing entries in the training data<br /><br />
n = number of rows in the dataset<br /><br />
q = number of proposal candidates in the dataset, usually between 32 to 100<br /><br />
B = maximum number of rows in each block<br />
<br />
[[File: columnblock.png|800px|thumb|center]]<br />
<br />
=== Cache-aware Access ===<br />
The proposed block structure optimizes the computation complexity but requires indirect fetches of gradient statistics by row index. XGBoost optimizes the process by using the following methods.<br />
<br />
# For the exact greedy algorithm, XGBoost uses a cache-aware prefetching algorithm<br />
#:* It stores Gradient and Hessians in the cache to make calculations fast<br />
#:* It runs twice as fast as the naive method when the dataset is large<br />
# For approximate algorithms, XGBoost chooses a specific block size<br />
#:* Choosing a small block size results in inefficient parallelization<br />
#:* Choosing a large block size results in cache misses<br />
#:* Various choices of block size are compared and the results are shown in Figure 9<br />
#:* XGBoost chose <math>2^{16}</math> as the block size<br />
<br />
[[File: blocksize.png|400px|thumb|center]]<br />
<br />
=== Blocks for Out-of-core Computation ===<br />
When the dataset is too large for the cache and main memory, XGBoost utilizes disk spaces as well. Since reading and writing data to the disks are slow, XGBoost optimizes the process by using the following two methods.<br />
<br />
# Block Compression<br />
#:* Blocks are compressed by columns<br />
#:* Although decompressing takes time, it is still faster than reading from the disks<br />
# Block Sharding<br />
#:* If multiple disks are available, data is split into those disks<br />
#:* When the CPU needs data, all the disks can be read at the same time<br />
<br />
== End To End Evaluations ==<br />
=== System Implementation ===<br />
XGBoost is a portable and reusable open-source package. It supports:<br />
* various weighted classification<br />
* various objective functions (rank & user defined)<br />
* popular languages (python, R, Julia)<br />
* data science pipelines (scikit-learn)<br />
* big data stacks (Flink, Spark)<br />
* cloud platform (Tianchi8)<br />
<br />
=== Dataset and Setup ===<br />
<br />
A summary of the 4 datasets used in the experiments is in table 2.<br />
<br />
[[File: table2data.png|500px|thumb|center]]<br />
<br />
The first and last datasets were used specifically to evaluate the impact of sparsity-aware algorithm and the scaling property of the system in the out-of-core and the distributed settings respectively. In all of the experiments, common settings such as maximum depth equal to 8, shrinkage equal to 0.1 and no column subsampling are applied.<br />
<br />
=== Classification ===<br />
A subset (n = 1M) of Higgs Boson dataset was used for classification. The results are shown in Table 3.<br />
<br />
[[File: classification.png|500px|thumb|center]]<br />
<br />
* R’s GBM creates a tree fast by using greedy approach that only expands one branch of a tree but with the cost of lower accuracy<br />
* XGBoost and scikit-learn have better performance than R’s GBM<br />
* XGBoost runs more than 10x faster than scikit-learn in learning a full tree<br />
* Column subsamples give slightly worse performance possibly due to a few important features in this dataset.<br />
<br />
=== Learning to Rank ===<br />
The results in comparing XGBoost with pGBRT are shown in Table 4.<br />
<br />
[[File: rank.png|500px|thumb|center]]<br />
<br />
* XGBoost runs exact greedy algorithm while pGBRT only supports an approximate algorithm<br />
* XGBoost runs faster<br />
* Subsampling column reduces running time and gives higher performance possibly due to preventing overfitting<br />
<br />
=== Out-of-core Experiment ===<br />
An extremely large Criteo dataset was used to evaluate the out-of-core setting. The results are shown in the figure below.<br />
<br />
[[File: outofcore.png|350px|thumb|center]]<br />
<br />
* Compression speed up the computation by a factor of 3<br />
* Sharding into 2 disks further gives 2x speed<br />
<br />
=== Distributed Experiment ===<br />
YARN cluster on EC2 with m3.2xlarge machines was used to evaluate the distributed setting. XGBoost was compared with Spark MLLib and H20.<br />
<br />
* XGBoost can switch to out-of-core setting when the memory runs out, while the baseline systems need to store the data in RAM<br />
* XGBoost runs faster than the baseline systems<br />
* The baseline systems are only able to handle a subset of the data with the given resources while XGBoost was able to scale smoothly to all 1.7B rows<br />
* XGBoost’s performance scales linearly with more machines<br />
* XGBoost is able to handle all 1.7B data with only 4 machines<br />
<br />
== Conclusion ==<br />
<br />
== References ==<br />
[1] R. Bekkerman. The present and the future of the kdd cup competition: an outsider’s perspective. <br />
<br />
[2] R. Bekkerman, M. Bilenko, and J. Langford. Scaling Up Machine Learning: Parallel and Distributed Approaches. Cambridge University Press, New York, NY, USA, 2011. <br />
<br />
[3] J. Bennett and S. Lanning. The netflix prize. In Proceedings of the KDD Cup Workshop 2007, pages 3–6, New York, Aug. 2007.<br />
<br />
[4] L. Breiman. Random forests. Maching Learning, 45(1):5–32, Oct. 2001.<br />
<br />
[5] C. Burges. From ranknet to lambdarank to lambdamart: An overview. Learning, 11:23–581, 2010.<br />
<br />
[6] O. Chapelle and Y. Chang. Yahoo! Learning to Rank Challenge Overview. Journal of Machine Learning Research - W & CP, 14:1–24, 2011.<br />
<br />
[7] T. Chen, H. Li, Q. Yang, and Y. Yu. General functional matrix factorization using gradient boosting. In Proceeding of 30th International Conference on Machine Learning (ICML’13), volume 1, pages 436–444, 2013.<br />
<br />
[8] T. Chen, S. Singh, B. Taskar, and C. Guestrin. Efficient second-order gradient boosting for conditional random fields. In Proceeding of 18th Artificial Intelligence and Statistics Conference (AISTATS’15), volume 1, 2015.<br />
<br />
[9] R.-E. Fan, K.-W. Chang, C.-J. Hsieh, X.-R. Wang, and C.-J. Lin. LIBLINEAR: A library for large linear classification. Journal of Machine Learning Research, 9:1871–1874, 2008.<br />
<br />
[10] J. Friedman. Greedy function approximation: a gradient boosting machine. Annals of Statistics, 29(5):1189–1232, 2001.<br />
<br />
[11] J. Friedman. Stochastic gradient boosting. Computational Statistics & Data Analysis, 38(4):367–378, 2002.<br />
<br />
[12] J. Friedman, T. Hastie, and R. Tibshirani. Additive logistic regression: a statistical view of boosting. Annals of Statistics, 28(2):337–407, 2000.<br />
<br />
[13] J. H. Friedman and B. E. Popescu. Importance sampled learning ensembles, 2003.<br />
<br />
[14] M. Greenwald and S. Khanna. Space-efficient online computation of quantile summaries. In Proceedings of the 2001 ACM SIGMOD International Conference on Management of Data, pages 58–66, 2001.<br />
<br />
[15] X. He, J. Pan, O. Jin, T. Xu, B. Liu, T. Xu, Y. Shi, A. Atallah, R. Herbrich, S. Bowers, and J. Q. n. Candela. Practical lessons from predicting clicks on ads at facebook. In Proceedings of the Eighth International Workshop on Data Mining for Online Advertising, ADKDD’14, 2014.<br />
<br />
[16] P. Li. Robust Logitboost and adaptive base class (ABC) Logitboost. In Proceedings of the Twenty-Sixth Conference Annual Conference on Uncertainty in Artificial Intelligence (UAI’10), pages 302–311, 2010.<br />
<br />
[17] P. Li, Q. Wu, and C. J. Burges. Mcrank: Learning to rank using multiple classification and gradient boosting. In Advances in Neural Information Processing Systems 20, pages 897–904. 2008.<br />
<br />
[18] X. Meng, J. Bradley, B. Yavuz, E. Sparks, S. Venkataraman, D. Liu, J. Freeman, D. Tsai, M. Amde, S. Owen, D. Xin, R. Xin, M. J. Franklin, R. Zadeh, M. Zaharia, and A. Talwalkar. MLlib: Machine learning in apache spark. Journal of Machine Learning Research, 17(34):1–7, 2016.<br />
<br />
[19] B. Panda, J. S. Herbach, S. Basu, and R. J. Bayardo. Planet: Massively parallel learning of tree ensembles with mapreduce. Proceeding of VLDB Endowment, 2(2):1426–1437, Aug. 2009.<br />
<br />
[20] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.<br />
<br />
[21] G. Ridgeway. Generalized Boosted Models: A guide to the gbm package.<br />
<br />
[22] S. Tyree, K. Weinberger, K. Agrawal, and J. Paykin. Parallel boosted regression trees for web search ranking. In Proceedings of the 20th international conference on World wide web, pages 387–396. ACM, 2011.<br />
<br />
[23] J. Ye, J.-H. Chow, J. Chen, and Z. Zheng. Stochastic gradient boosted distributed decision trees. In Proceedings of the 18th ACM Conference on Information and Knowledge Management, CIKM ’09.<br />
<br />
[24] Q. Zhang and W. Wang. A fast algorithm for approximate quantiles in high speed data streams. In Proceedings of the 19th International Conference on Scientific and Statistical Database Management, 2007.<br />
<br />
[25] T. Zhang and R. Johnson. Learning nonlinear functions using regularized greedy forest. IEEE Transactions on Pattern Analysis and Machine Intelligence, 36(5), 2014.</div>Cwlokehttp://wiki.math.uwaterloo.ca/statwiki/index.php?title=XGBoost&diff=51094XGBoost2021-11-29T03:45:18Z<p>Cwloke: /* Split Finding Algorithms */</p>
<hr />
<div>== Presented by == <br />
* Chun Waan Loke<br />
* Peter Chong<br />
* Clarice Osmond<br />
* Zhilong Li<br />
<br />
== Introduction ==<br />
<br />
== Tree Boosting In A Nutshell ==<br />
The author reviews gradient tree boosting in this section.<br />
=== Regularized Learning Objective ===<br />
The author first gives the prediction equation (1) and the regularized objective (2).<br><br />
<br><br />
(1) The additive prediction model is given as<br><br />
<math>\hat{y_i}=\sum_{k=1}^{K}f_k(x_i), f_k \in \mathcal{F} </math> <br><br />
where each <math>f_k</math> corresponds to an independent tree structure with its weights, and <math>\mathcal{F}</math> is the "space of regression trees"<br><br />
<br><br />
(2) The regularized objective to be minimized is given as<br><br />
<math>\mathcal{L}=\sum_{i}l(\hat{y_i},y_i)+\sum_k \Omega(f_k)</math> where <math>\Omega(f)=\gamma T+\frac{1}{2}\lambda ||\omega||^2</math> <br><br />
The first term <math>l</math> is a differentiable convex loss function that calculates the measures between <math>\hat{y}</math> and <math>y</math>.<br><br />
The second term <math>\Omega</math> penalizes on the complexity of model (the <math>f_k</math>'s). For a given tree (<math>f_k</math>), <math>T</math> is the number of leaves, and <math>\omega</math> is the leaf weights.<br><br />
The L1 regularization term <math>\gamma T</math> encourages the tree to be small, and the L2 regularization term <math>\frac{1}{2}\lambda ||\omega||^2</math> encourages the tree to have small weights.<br><br />
<br />
=== Gradient Tree Boosting ===<br />
Let <math>\hat{y_i}^{(t)}</math> be the prediction of <math>y_i</math> at the t-th iteration.<br><br />
Since the prediction equation is simply additive, <math>{\hat y_i}^{(t)}=\hat{y_{i}}^{(t-1)}+f_t(x_i)</math><br><br />
Using this equation and 2nd order Taylor approximation on the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> gives <br><br />
\begin{align}<br />
\mathcal{L}^{(t)}&=\sum_{i}^{n}l(y_i,\hat{y_i}^{(t-1)}+f_t(x_i))+\Omega(f_t)\\<br />
&\simeq \sum_{i}^{n}[l(y_i,\hat{y_i}^{(t-1)})+g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
\end{align}<br />
where <math>g_i</math> and <math>h_i</math> are the first and second derivative of the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> with repspect to the term <math>\hat{y}^{(t-1)}</math><br><br />
We can simplify this objective by removing the constant term <math>l(y_i,\hat{y_i}^{(t-1)})</math>.<br><br />
Define <math>I_j=\{i|q(x_i)=j\}</math>, where <math>q</math> is the tree structure. Since every <math>x_i</math> is mapped by <math>q</math> to some leaf <math>j</math>, going through every <math>x_i</math> is equivalent to going through each leaf j of the structure.<br />
\begin{align}<br />
\tilde{\mathcal{L}}^{(t)}&= \sum_{i}^{n}[g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
&= \sum_{j=1}^{T}[(\sum_{i \in I_j}g_i)\omega_j+\frac{1}{2}(\sum_{i \in I_j}h_i+\lambda)\omega_j^2]+\gamma T<br />
\end{align}<br />
Then for a fixed structure <math>q</math>, the optimal weight of leaf <math>j</math> and the optimal objective value are given as<br><br />
\begin{align}<br />
\omega_j^{*} &= -\frac{\sum_{i \in I_j}g_i}{\sum_{i \in I_j}h_i+\lambda}\\<br />
\tilde{\mathcal{L}}^{(t)}(q) &=-\frac{1}{2}\sum_{j=1}^{T}\frac{(\sum_{i \in I_j}g_i)^2}{\sum_{i \in I_j}h_i+\lambda}+\gamma T<br />
\end{align} <br />
[[File:Structure Score Calculation.png|frame|center|alt=Alt text|Structure Score Calculation]]<br />
Instead of enumerating through all possible tree structures q, a greedy algorithm of iteratively adding branches is used.<br><br />
Let <math>I_L</math> and <math>I_R</math> be the instance sets of left and right nodes after split and let <math>I=I_L\cup I_R</math>.<br><br />
The loss reduction after split is given by<br><br />
\begin{align}<br />
\tilde{\mathcal{L}}_{\text{split}} &=\frac{1}{2}[\frac{(\sum_{i \in I_L}g_i)^2}{\sum_{i \in I_L}h_i+\lambda}+\frac{(\sum_{i \in I_R}g_i)^2}{\sum_{i \in I_R}h_i+\lambda}-\frac{(\sum_{i \in I}g_i)^2}{\sum_{i \in I}h_i+\lambda}]+\gamma<br />
\end{align}<br />
=== Shrinkage and Column Subsampling ===<br />
The author also mentioned two other methods in order to avoid over-fitting.<br><br />
(1) Shrinkage. Similar to the learning rate in stochastic optimization, a new weight is added to each tree boosting to reduce the influence of a single tree and leave space for future trees.<br><br />
(2) Column (feature) subsampling. In the paper, the author only mentioned that this technique speeds up parallel algorithm used in later sections.<br />
<br />
== Split Finding Algorithms ==<br />
<br />
It is very important to find the best split for tree learning to perform well. Here are a few split finding algorithms mentioned in the paper:<br />
<br />
=== Basic Exact Greedy Algorithm ===<br />
<br />
The basic exact greedy algorithm is a split finding algorithm that is computationally expensive because it enumerates over all the possible splits for continuous features. It is impossible to be done efficiently when the memory is not enough to hold the data needed. A way to carry out this algorithm efficiently is to sort the data according to feature values and visit the data in order to accumulate the gradient statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_1.png|center|alt=Alt text|Basic Exact Greedy Algorithm]]<br />
<br />
=== Approximate Algorithm ===<br />
<br />
The paper introduced a more efficient algorithm compared to Basic Exact Greedy Algorithm which is the Approximate Algorithm. The Approximate Algorithm first proposes candidate splitting points according to percentiles of feature distribution. It then maps the continuous features into buckets split by candidate points, aggregates the statistics and finds the best solution among proposals based on the aggregated statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_2.png|center|alt=Alt text|Approximate Algorithm]]<br />
<br />
There are also two variants of this algorithm, the global variant proposes all the candidate splits during the initial phase of tree construction and uses the same proposals for split finding at all levels. Whereas, the local variant re-proposes after each split. The global variant usually requires less proposal steps but uses more candidate points than local variant. For deeper trees, usage of local variant may be more appropriate as compared to global variant. The figure below shows the a comparison in accuracy between Basic Exact Greedy and Approximate split finding algorithms with different variant over the number of iterations. We can see that the quantile strategy is able to achieve similar accuracy as the Basic Exact Greedy algorithm given a reasonable approximation level.<br />
<br />
[[File:iterations.png|center|alt=Alt text|Comparison of Accuracy between different algorithms]]<br />
<br />
=== Weighted Quantile Sketch ===<br />
<br />
<br />
<br />
=== Sparsity-aware Split Finding ===<br />
<br />
== System Design ==<br />
<br />
=== Column Block for Parallel Learning ===<br />
The most time consuming part of tree learning is to get the data into sorted order. To overcome this problem, XGBoost stores the data in blocks where each block performs the sorting operation in parallel. The results are then merged together.<br />
<br />
# For the exact greedy algorithm, XGBoost stores the entire dataset in a single block<br />
#:* Original spase aware algorithm costs: <math>O(Kd∥x∥_0 log(n))</math><br />
#:* Tree boosting on block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(n))</math><br />
#:* Hence, block structure helps to save an additional <math>log(n)</math> factor<br />
# For approximate algorithms, XGBoost stores the dataset in multiple blocks<br />
#:* Original algorithm with binary search costs: <math>O(Kd∥x∥_0 log(q))</math><br />
#:* With block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(B))</math><br />
#:* Hence, block structure helps to save an additional <math>log(q)</math> factor <br />
<br />
K = total number of trees<br /><br />
d = maximum depth of the tree<br /><br />
<math>∥x∥_0</math> = number of non-missing entries in the training data<br /><br />
n = number of rows in the dataset<br /><br />
q = number of proposal candidates in the dataset, usually between 32 to 100<br /><br />
B = maximum number of rows in each block<br />
<br />
[[File: columnblock.png|800px|thumb|center]]<br />
<br />
=== Cache-aware Access ===<br />
The proposed block structure optimizes the computation complexity but requires indirect fetches of gradient statistics by row index. XGBoost optimizes the process by using the following methods.<br />
<br />
# For the exact greedy algorithm, XGBoost uses a cache-aware prefetching algorithm<br />
#:* It stores Gradient and Hessians in the cache to make calculations fast<br />
#:* It runs twice as fast as the naive method when the dataset is large<br />
# For approximate algorithms, XGBoost chooses a specific block size<br />
#:* Choosing a small block size results in inefficient parallelization<br />
#:* Choosing a large block size results in cache misses<br />
#:* Various choices of block size are compared and the results are shown in Figure 9<br />
#:* XGBoost chose <math>2^{16}</math> as the block size<br />
<br />
[[File: blocksize.png|400px|thumb|center]]<br />
<br />
=== Blocks for Out-of-core Computation ===<br />
When the dataset is too large for the cache and main memory, XGBoost utilizes disk spaces as well. Since reading and writing data to the disks are slow, XGBoost optimizes the process by using the following two methods.<br />
<br />
# Block Compression<br />
#:* Blocks are compressed by columns<br />
#:* Although decompressing takes time, it is still faster than reading from the disks<br />
# Block Sharding<br />
#:* If multiple disks are available, data is split into those disks<br />
#:* When the CPU needs data, all the disks can be read at the same time<br />
<br />
== End To End Evaluations ==<br />
=== System Implementation ===<br />
XGBoost is a portable and reusable open-source package. It supports:<br />
* various weighted classification<br />
* various objective functions (rank & user defined)<br />
* popular languages (python, R, Julia)<br />
* data science pipelines (scikit-learn)<br />
* big data stacks (Flink, Spark)<br />
* cloud platform (Tianchi8)<br />
<br />
=== Dataset and Setup ===<br />
<br />
A summary of the 4 datasets used in the experiments is in table 2.<br />
<br />
[[File: table2data.png|500px|thumb|center]]<br />
<br />
The first and last datasets were used specifically to evaluate the impact of sparsity-aware algorithm and the scaling property of the system in the out-of-core and the distributed settings respectively. In all of the experiments, common settings such as maximum depth equal to 8, shrinkage equal to 0.1 and no column subsampling are applied.<br />
<br />
=== Classification ===<br />
A subset (n = 1M) of Higgs Boson dataset was used for classification. The results are shown in Table 3.<br />
<br />
[[File: classification.png|500px|thumb|center]]<br />
<br />
* R’s GBM creates a tree fast by using greedy approach that only expands one branch of a tree but with the cost of lower accuracy<br />
* XGBoost and scikit-learn have better performance than R’s GBM<br />
* XGBoost runs more than 10x faster than scikit-learn in learning a full tree<br />
* Column subsamples give slightly worse performance possibly due to a few important features in this dataset.<br />
<br />
=== Learning to Rank ===<br />
The results in comparing XGBoost with pGBRT are shown in Table 4.<br />
<br />
[[File: rank.png|500px|thumb|center]]<br />
<br />
* XGBoost runs exact greedy algorithm while pGBRT only supports an approximate algorithm<br />
* XGBoost runs faster<br />
* Subsampling column reduces running time and gives higher performance possibly due to preventing overfitting<br />
<br />
=== Out-of-core Experiment ===<br />
An extremely large Criteo dataset was used to evaluate the out-of-core setting. The results are shown in the figure below.<br />
<br />
[[File: outofcore.png|350px|thumb|center]]<br />
<br />
* Compression speed up the computation by a factor of 3<br />
* Sharding into 2 disks further gives 2x speed<br />
<br />
=== Distributed Experiment ===<br />
YARN cluster on EC2 with m3.2xlarge machines was used to evaluate the distributed setting. XGBoost was compared with Spark MLLib and H20.<br />
<br />
* XGBoost can switch to out-of-core setting when the memory runs out, while the baseline systems need to store the data in RAM<br />
* XGBoost runs faster than the baseline systems<br />
* The baseline systems are only able to handle a subset of the data with the given resources while XGBoost was able to scale smoothly to all 1.7B rows<br />
* XGBoost’s performance scales linearly with more machines<br />
* XGBoost is able to handle all 1.7B data with only 4 machines<br />
<br />
== Conclusion ==<br />
<br />
== References ==<br />
[1] R. Bekkerman. The present and the future of the kdd cup competition: an outsider’s perspective. <br />
<br />
[2] R. Bekkerman, M. Bilenko, and J. Langford. Scaling Up Machine Learning: Parallel and Distributed Approaches. Cambridge University Press, New York, NY, USA, 2011. <br />
<br />
[3] J. Bennett and S. Lanning. The netflix prize. In Proceedings of the KDD Cup Workshop 2007, pages 3–6, New York, Aug. 2007.<br />
<br />
[4] L. Breiman. Random forests. Maching Learning, 45(1):5–32, Oct. 2001.<br />
<br />
[5] C. Burges. From ranknet to lambdarank to lambdamart: An overview. Learning, 11:23–581, 2010.<br />
<br />
[6] O. Chapelle and Y. Chang. Yahoo! Learning to Rank Challenge Overview. Journal of Machine Learning Research - W & CP, 14:1–24, 2011.<br />
<br />
[7] T. Chen, H. Li, Q. Yang, and Y. Yu. General functional matrix factorization using gradient boosting. In Proceeding of 30th International Conference on Machine Learning (ICML’13), volume 1, pages 436–444, 2013.<br />
<br />
[8] T. Chen, S. Singh, B. Taskar, and C. Guestrin. Efficient second-order gradient boosting for conditional random fields. In Proceeding of 18th Artificial Intelligence and Statistics Conference (AISTATS’15), volume 1, 2015.<br />
<br />
[9] R.-E. Fan, K.-W. Chang, C.-J. Hsieh, X.-R. Wang, and C.-J. Lin. LIBLINEAR: A library for large linear classification. Journal of Machine Learning Research, 9:1871–1874, 2008.<br />
<br />
[10] J. Friedman. Greedy function approximation: a gradient boosting machine. Annals of Statistics, 29(5):1189–1232, 2001.<br />
<br />
[11] J. Friedman. Stochastic gradient boosting. Computational Statistics & Data Analysis, 38(4):367–378, 2002.<br />
<br />
[12] J. Friedman, T. Hastie, and R. Tibshirani. Additive logistic regression: a statistical view of boosting. Annals of Statistics, 28(2):337–407, 2000.<br />
<br />
[13] J. H. Friedman and B. E. Popescu. Importance sampled learning ensembles, 2003.<br />
<br />
[14] M. Greenwald and S. Khanna. Space-efficient online computation of quantile summaries. In Proceedings of the 2001 ACM SIGMOD International Conference on Management of Data, pages 58–66, 2001.<br />
<br />
[15] X. He, J. Pan, O. Jin, T. Xu, B. Liu, T. Xu, Y. Shi, A. Atallah, R. Herbrich, S. Bowers, and J. Q. n. Candela. Practical lessons from predicting clicks on ads at facebook. In Proceedings of the Eighth International Workshop on Data Mining for Online Advertising, ADKDD’14, 2014.<br />
<br />
[16] P. Li. Robust Logitboost and adaptive base class (ABC) Logitboost. In Proceedings of the Twenty-Sixth Conference Annual Conference on Uncertainty in Artificial Intelligence (UAI’10), pages 302–311, 2010.<br />
<br />
[17] P. Li, Q. Wu, and C. J. Burges. Mcrank: Learning to rank using multiple classification and gradient boosting. In Advances in Neural Information Processing Systems 20, pages 897–904. 2008.<br />
<br />
[18] X. Meng, J. Bradley, B. Yavuz, E. Sparks, S. Venkataraman, D. Liu, J. Freeman, D. Tsai, M. Amde, S. Owen, D. Xin, R. Xin, M. J. Franklin, R. Zadeh, M. Zaharia, and A. Talwalkar. MLlib: Machine learning in apache spark. Journal of Machine Learning Research, 17(34):1–7, 2016.<br />
<br />
[19] B. Panda, J. S. Herbach, S. Basu, and R. J. Bayardo. Planet: Massively parallel learning of tree ensembles with mapreduce. Proceeding of VLDB Endowment, 2(2):1426–1437, Aug. 2009.<br />
<br />
[20] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.<br />
<br />
[21] G. Ridgeway. Generalized Boosted Models: A guide to the gbm package.<br />
<br />
[22] S. Tyree, K. Weinberger, K. Agrawal, and J. Paykin. Parallel boosted regression trees for web search ranking. In Proceedings of the 20th international conference on World wide web, pages 387–396. ACM, 2011.<br />
<br />
[23] J. Ye, J.-H. Chow, J. Chen, and Z. Zheng. Stochastic gradient boosted distributed decision trees. In Proceedings of the 18th ACM Conference on Information and Knowledge Management, CIKM ’09.<br />
<br />
[24] Q. Zhang and W. Wang. A fast algorithm for approximate quantiles in high speed data streams. In Proceedings of the 19th International Conference on Scientific and Statistical Database Management, 2007.<br />
<br />
[25] T. Zhang and R. Johnson. Learning nonlinear functions using regularized greedy forest. IEEE Transactions on Pattern Analysis and Machine Intelligence, 36(5), 2014.</div>Cwlokehttp://wiki.math.uwaterloo.ca/statwiki/index.php?title=XGBoost&diff=51093XGBoost2021-11-29T03:35:15Z<p>Cwloke: /* Approximate Algorithm */</p>
<hr />
<div>== Presented by == <br />
* Chun Waan Loke<br />
* Peter Chong<br />
* Clarice Osmond<br />
* Zhilong Li<br />
<br />
== Introduction ==<br />
<br />
== Tree Boosting In A Nutshell ==<br />
The author reviews gradient tree boosting in this section.<br />
=== Regularized Learning Objective ===<br />
The author first gives the prediction equation (1) and the regularized objective (2).<br><br />
<br><br />
(1) The additive prediction model is given as<br><br />
<math>\hat{y_i}=\sum_{k=1}^{K}f_k(x_i), f_k \in \mathcal{F} </math> <br><br />
where each <math>f_k</math> corresponds to an independent tree structure with its weights, and <math>\mathcal{F}</math> is the "space of regression trees"<br><br />
<br><br />
(2) The regularized objective to be minimized is given as<br><br />
<math>\mathcal{L}=\sum_{i}l(\hat{y_i},y_i)+\sum_k \Omega(f_k)</math> where <math>\Omega(f)=\gamma T+\frac{1}{2}\lambda ||\omega||^2</math> <br><br />
The first term <math>l</math> is a differentiable convex loss function that calculates the measures between <math>\hat{y}</math> and <math>y</math>.<br><br />
The second term <math>\Omega</math> penalizes on the complexity of model (the <math>f_k</math>'s). For a given tree (<math>f_k</math>), <math>T</math> is the number of leaves, and <math>\omega</math> is the leaf weights.<br><br />
The L1 regularization term <math>\gamma T</math> encourages the tree to be small, and the L2 regularization term <math>\frac{1}{2}\lambda ||\omega||^2</math> encourages the tree to have small weights.<br><br />
<br />
=== Gradient Tree Boosting ===<br />
Let <math>\hat{y_i}^{(t)}</math> be the prediction of <math>y_i</math> at the t-th iteration.<br><br />
Since the prediction equation is simply additive, <math>{\hat y_i}^{(t)}=\hat{y_{i}}^{(t-1)}+f_t(x_i)</math><br><br />
Using this equation and 2nd order Taylor approximation on the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> gives <br><br />
\begin{align}<br />
\mathcal{L}^{(t)}&=\sum_{i}^{n}l(y_i,\hat{y_i}^{(t-1)}+f_t(x_i))+\Omega(f_t)\\<br />
&\simeq \sum_{i}^{n}[l(y_i,\hat{y_i}^{(t-1)})+g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
\end{align}<br />
where <math>g_i</math> and <math>h_i</math> are the first and second derivative of the loss function <math>l(y_i,\hat{y_i}^{(t-1)})</math> with repspect to the term <math>\hat{y}^{(t-1)}</math><br><br />
We can simplify this objective by removing the constant term <math>l(y_i,\hat{y_i}^{(t-1)})</math>.<br><br />
Define <math>I_j=\{i|q(x_i)=j\}</math>, where <math>q</math> is the tree structure. Since every <math>x_i</math> is mapped by <math>q</math> to some leaf <math>j</math>, going through every <math>x_i</math> is equivalent to going through each leaf j of the structure.<br />
\begin{align}<br />
\tilde{\mathcal{L}}^{(t)}&= \sum_{i}^{n}[g_if_t(x_i)+\frac{1}{2}h_if_t^2(x_i)]+\gamma T+\frac{1}{2}\lambda \sum_{j=1}^{T}\omega^2\\<br />
&= \sum_{j=1}^{T}[(\sum_{i \in I_j}g_i)\omega_j+\frac{1}{2}(\sum_{i \in I_j}h_i+\lambda)\omega_j^2]+\gamma T<br />
\end{align}<br />
Then for a fixed structure <math>q</math>, the optimal weight of leaf <math>j</math> and the optimal objective value are given as<br><br />
\begin{align}<br />
\omega_j^{*} &= -\frac{\sum_{i \in I_j}g_i}{\sum_{i \in I_j}h_i+\lambda}\\<br />
\tilde{\mathcal{L}}^{(t)}(q) &=-\frac{1}{2}\sum_{j=1}^{T}\frac{(\sum_{i \in I_j}g_i)^2}{\sum_{i \in I_j}h_i+\lambda}+\gamma T<br />
\end{align} <br />
[[File:Structure Score Calculation.png|frame|center|alt=Alt text|Structure Score Calculation]]<br />
Instead of enumerating through all possible tree structures q, a greedy algorithm of iteratively adding branches is used.<br><br />
Let <math>I_L</math> and <math>I_R</math> be the instance sets of left and right nodes after split and let <math>I=I_L\cup I_R</math>.<br><br />
The loss reduction after split is given by<br><br />
\begin{align}<br />
\tilde{\mathcal{L}}_{\text{split}} &=\frac{1}{2}[\frac{(\sum_{i \in I_L}g_i)^2}{\sum_{i \in I_L}h_i+\lambda}+\frac{(\sum_{i \in I_R}g_i)^2}{\sum_{i \in I_R}h_i+\lambda}-\frac{(\sum_{i \in I}g_i)^2}{\sum_{i \in I}h_i+\lambda}]+\gamma<br />
\end{align}<br />
=== Shrinkage and Column Subsampling ===<br />
The author also mentioned two other methods in order to avoid over-fitting.<br><br />
(1) Shrinkage. Similar to the learning rate in stochastic optimization, a new weight is added to each tree boosting to reduce the influence of a single tree and leave space for future trees.<br><br />
(2) Column (feature) subsampling. In the paper, the author only mentioned that this technique speeds up parallel algorithm used in later sections.<br />
<br />
== Split Finding Algorithms ==<br />
<br />
It is very important to find the best split for tree learning to perform well. Here are a few split finding algorithms mentioned in the paper:<br />
<br />
=== Basic Exact Greedy Algorithm ===<br />
<br />
The basic exact greedy algorithm is a split finding algorithm that is computationally expensive because it enumerates over all the possible splits for continuous features. It is impossible to be done efficiently when the memory is not enough to hold the data needed. A way to carry out this algorithm efficiently is to sort the data according to feature values and visit the data in order to accumulate the gradient statistics. The algorithm is shown below:<br />
<br />
[[File:Algorithm_1.png|center|alt=Alt text|Basic Exact Greedy Algorithm]]<br />
<br />
=== Approximate Algorithm ===<br />
<br />
The paper introduced a more efficient algorithm compared to Basic Exact Greedy Algorithm which is the Approximate Algorithm. The Approximate Algorithm first proposes candidate splitting points according to percentiles of feature distribution. It then maps the continuous features into buckets split by candidate points, aggregates the statistics and finds the best solution among proposals based on the aggregated statistics. The algorithm is shown below:<br />
<br />
=== Weighted Quantile Sketch ===<br />
<br />
<br />
<br />
=== Sparsity-aware Split Finding ===<br />
<br />
== System Design ==<br />
<br />
=== Column Block for Parallel Learning ===<br />
The most time consuming part of tree learning is to get the data into sorted order. To overcome this problem, XGBoost stores the data in blocks where each block performs the sorting operation in parallel. The results are then merged together.<br />
<br />
# For the exact greedy algorithm, XGBoost stores the entire dataset in a single block<br />
#:* Original spase aware algorithm costs: <math>O(Kd∥x∥_0 log(n))</math><br />
#:* Tree boosting on block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(n))</math><br />
#:* Hence, block structure helps to save an additional <math>log(n)</math> factor<br />
# For approximate algorithms, XGBoost stores the dataset in multiple blocks<br />
#:* Original algorithm with binary search costs: <math>O(Kd∥x∥_0 log(q))</math><br />
#:* With block structure costs: <math>O(Kd∥x∥_0 + ∥x∥_0 log(B))</math><br />
#:* Hence, block structure helps to save an additional <math>log(q)</math> factor <br />
<br />
K = total number of trees<br /><br />
d = maximum depth of the tree<br /><br />
<math>∥x∥_0</math> = number of non-missing entries in the training data<br /><br />
n = number of rows in the dataset<br /><br />
q = number of proposal candidates in the dataset, usually between 32 to 100<br /><br />
B = maximum number of rows in each block<br />
<br />
[[File: columnblock.png|800px|thumb|center]]<br />
<br />
=== Cache-aware Access ===<br />
The proposed block structure optimizes the computation complexity but requires indirect fetches of gradient statistics by row index. XGBoost optimizes the process by using the following methods.<br />
<br />
# For the exact greedy algorithm, XGBoost uses a cache-aware prefetching algorithm<br />
#:* It stores Gradient and Hessians in the cache to make calculations fast<br />
#:* It runs twice as fast as the naive method when the dataset is large<br />
# For approximate algorithms, XGBoost chooses a specific block size<br />
#:* Choosing a small block size results in inefficient parallelization<br />
#:* Choosing a large block size results in cache misses<br />
#:* Various choices of block size are compared and the results are shown in Figure 9<br />
#:* XGBoost chose <math>2^{16}</math> as the block size<br />
<br />
[[File: blocksize.png|400px|thumb|center]]<br />
<br />
=== Blocks for Out-of-core Computation ===<br />
When the dataset is too large for the cache and main memory, XGBoost utilizes disk spaces as well. Since reading and writing data to the disks are slow, XGBoost optimizes the process by using the following two methods.<br />
<br />
# Block Compression<br />
#:* Blocks are compressed by columns<br />
#:* Although decompressing takes time, it is still faster than reading from the disks<br />
# Block Sharding<br />
#:* If multiple disks are available, data is split into those disks<br />
#:* When the CPU needs data, all the disks can be read at the same time<br />
<br />
== End To End Evaluations ==<br />
=== System Implementation ===<br />
XGBoost is a portable and reusable open-source package. It supports:<br />
* various weighted classification<br />
* various objective functions (rank & user defined)<br />
* popular languages (python, R, Julia)<br />
* data science pipelines (scikit-learn)<br />
* big data stacks (Flink, Spark)<br />
* cloud platform (Tianchi8)<br />
<br />
=== Dataset and Setup ===<br />
<br />
A summary of the 4 datasets used in the experiments is in table 2.<br />
<br />
[[File: table2data.png|500px|thumb|center]]<br />
<br />
The first and last datasets were used specifically to evaluate the impact of sparsity-aware algorithm and the scaling property of the system in the out-of-core and the distributed settings respectively. In all of the experiments, common settings such as maximum depth equal to 8, shrinkage equal to 0.1 and no column subsampling are applied.<br />
<br />
=== Classification ===<br />
A subset (n = 1M) of Higgs Boson dataset was used for classification. The results are shown in Table 3.<br />
<br />
[[File: classification.png|500px|thumb|center]]<br />
<br />
* R’s GBM creates a tree fast by using greedy approach that only expands one branch of a tree but with the cost of lower accuracy<br />
* XGBoost and scikit-learn have better performance than R’s GBM<br />
* XGBoost runs more than 10x faster than scikit-learn in learning a full tree<br />
* Column subsamples give slightly worse performance possibly due to a few important features in this dataset.<br />
<br />
=== Learning to Rank ===<br />
The results in comparing XGBoost with pGBRT are shown in Table 4.<br />
<br />
[[File: rank.png|500px|thumb|center]]<br />
<br />
* XGBoost runs exact greedy algorithm while pGBRT only supports an approximate algorithm<br />
* XGBoost runs faster<br />
* Subsampling column reduces running time and gives higher performance possibly due to preventing overfitting<br />
<br />
=== Out-of-core Experiment ===<br />
An extremely large Criteo dataset was used to evaluate the out-of-core setting. The results are shown in the figure below.<br />
<br />
[[File: outofcore.png|350px|thumb|center]]<br />
<br />
* Compression speed up the computation by a factor of 3<br />
* Sharding into 2 disks further gives 2x speed<br />
<br />
=== Distributed Experiment ===<br />
YARN cluster on EC2 with m3.2xlarge machines was used to evaluate the distributed setting. XGBoost was compared with Spark MLLib and H20.<br />
<br />
* XGBoost can switch to out-of-core setting when the memory runs out, while the baseline systems need to store the data in RAM<br />
* XGBoost runs faster than the baseline systems<br />
* The baseline systems are only able to handle a subset of the data with the given resources while XGBoost was able to scale smoothly to all 1.7B rows<br />
* XGBoost’s performance scales linearly with more machines<br />
* XGBoost is able to handle all 1.7B data with only 4 machines<br />
<br />
== Conclusion ==<br />
<br />
== References ==<br />
[1] R. Bekkerman. The present and the future of the kdd cup competition: an outsider’s perspective. <br />
<br />
[2] R. Bekkerman, M. Bilenko, and J. Langford. Scaling Up Machine Learning: Parallel and Distributed Approaches. Cambridge University Press, New York, NY, USA, 2011. <br />
<br />
[3] J. Bennett and S. Lanning. The netflix prize. In Proceedings of the KDD Cup Workshop 2007, pages 3–6, New York, Aug. 2007.<br />
<br />
[4] L. Breiman. Random forests. Maching Learning, 45(1):5–32, Oct. 2001.<br />
<br />
[5] C. Burges. From ranknet to lambdarank to lambdamart: An overview. Learning, 11:23–581, 2010.<br />
<br />
[6] O. Chapelle and Y. Chang. Yahoo! Learning to Rank Challenge Overview. Journal of Machine Learning Research - W & CP, 14:1–24, 2011.<br />
<br />
[7] T. Chen, H. Li, Q. Yang, and Y. Yu. General functional matrix factorization using gradient boosting. In Proceeding of 30th International Conference on Machine Learning (ICML’13), volume 1, pages 436–444, 2013.<br />
<br />
[8] T. Chen, S. Singh, B. Taskar, and C. Guestrin. Efficient second-order gradient boosting for conditional random fields. In Proceeding of 18th Artificial Intelligence and Statistics Conference (AISTATS’15), volume 1, 2015.<br />
<br />
[9] R.-E. Fan, K.-W. Chang, C.-J. Hsieh, X.-R. Wang, and C.-J. Lin. LIBLINEAR: A library for large linear classification. Journal of Machine Learning Research, 9:1871–1874, 2008.<br />
<br />
[10] J. Friedman. Greedy function approximation: a gradient boosting machine. Annals of Statistics, 29(5):1189–1232, 2001.<br />
<br />
[11] J. Friedman. Stochastic gradient boosting. Computational Statistics & Data Analysis, 38(4):367–378, 2002.<br />
<br />
[12] J. Friedman, T. Hastie, and R. Tibshirani. Additive logistic regression: a statistical view of boosting. Annals of Statistics, 28(2):337–407, 2000.<br />
<br />
[13] J. H. Friedman and B. E. Popescu. Importance sampled learning ensembles, 2003.<br />
<br />
[14] M. Greenwald and S. Khanna. Space-efficient online computation of quantile summaries. In Proceedings of the 2001 ACM SIGMOD International Conference on Management of Data, pages 58–66, 2001.<br />
<br />
[15] X. He, J. Pan, O. Jin, T. Xu, B. Liu, T. Xu, Y. Shi, A. Atallah, R. Herbrich, S. Bowers, and J. Q. n. Candela. Practical lessons from predicting clicks on ads at facebook. In Proceedings of the Eighth International Workshop on Data Mining for Online Advertising, ADKDD’14, 2014.<br />
<br />
[16] P. Li. Robust Logitboost and adaptive base class (ABC) Logitboost. In Proceedings of the Twenty-Sixth Conference Annual Conference on Uncertainty in Artificial Intelligence (UAI’10), pages 302–311, 2010.<br />
<br />
[17] P. Li, Q. Wu, and C. J. Burges. Mcrank: Learning to rank using multiple classification and gradient boosting. In Advances in Neural Information Processing Systems 20, pages 897–904. 2008.<br />
<br />
[18] X. Meng, J. Bradley, B. Yavuz, E. Sparks, S. Venkataraman, D. Liu, J. Freeman, D. Tsai, M. Amde, S. Owen, D. Xin, R. Xin, M. J. Franklin, R. Zadeh, M. Zaharia, and A. Talwalkar. MLlib: Machine learning in apache spark. Journal of Machine Learning Research, 17(34):1–7, 2016.<br />
<br />
[19] B. Panda, J. S. Herbach, S. Basu, and R. J. Bayardo. Planet: Massively parallel learning of tree ensembles with mapreduce. Proceeding of VLDB Endowment, 2(2):1426–1437, Aug. 2009.<br />
<br />
[20] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.<br />
<br />
[21] G. Ridgeway. Generalized Boosted Models: A guide to the gbm package.<br />
<br />
[22] S. Tyree, K. Weinberger, K. Agrawal, and J. Paykin. Parallel boosted regression trees for web search ranking. In Proceedings of the 20th international conference on World wide web, pages 387–396. ACM, 2011.<br />
<br />
[23] J. Ye, J.-H. Chow, J. Chen, and Z. Zheng. Stochastic gradient boosted distributed decision trees. In Proceedings of the 18th ACM Conference on Information and Knowledge Management, CIKM ’09.<br />
<br />
[24] Q. Zhang and W. Wang. A fast algorithm for approximate quantiles in high speed data streams. In Proceedings of the 19th International Conference on Scientific and Statistical Database Management, 2007.<br />
<br />
[25] T. Zhang and R. Johnson. Learning nonlinear functions using regularized greedy forest. IEEE Transactions on Pattern Analysis and Machine Intelligence, 36(5), 2014.</div>Cwloke