Gradient Boosted Trees
Gradient boosting (Friedman, 2001) builds a model as a sum of shallow regression trees, fit one after another. Each new tree corrects the errors of the trees before it. The model after rounds is
where is the tree from round and is the learning rate, also called shrinkage. is the constant with the lowest training loss. It is the mean of for squared error and the log-odds of the positive rate for log loss. Round first computes the pseudo-residuals, the negative gradients of the loss at the current predictions:
It grows a small tree on the pairs with squared error. It sets each leaf’s value to the constant with the lowest loss on that leaf’s points, and it updates . For squared error , the pseudo-residual is the ordinary residual . For log loss with , it is .XGBoost (Chen and Guestrin, 2016) fits each tree to a second-order expansion of the loss. It uses and at . A tree has leaves (CART writes ), and is the output value of leaf . This is a leaf weight, unlike the linear weights elsewhere in this folder. XGBoost penalizes each tree by
where charges for each leaf and shrinks the leaf values. Let be the set of training points in leaf , with and . The best leaf value and the gain from splitting a leaf into children and are
XGBoost ranks candidate splits by this gain and prunes splits whose gain is negative. Four further controls limit overfitting:
- Shrinkage: a learning rate between and scales every tree.
- Tree size: a maximum depth of about to limits how many features can interact.
- Subsampling: each tree sees a random fraction of the rows (Friedman, 2002) and of the columns.
- Early stopping: training stops when the validation loss has not improved for a set number of rounds.
Two other libraries follow the same design:
- LightGBM: Ke et al. (2017) bin each feature into a histogram and grow each tree leaf by leaf, which is fast on large data.
- CatBoost: Prokhorenkova et al. (2018) encode each categorical value by the mean target of earlier rows in a random order. A row’s own label therefore never enters its own feature.
Gradient boosted trees are usually the most accurate model on tabular data. They need more tuning than a random forest, and they are harder to read than a single decision tree.
Intuition
Gradient boosting starts from a constant prediction, such as the average target. Each new tree is trained on what the current model still gets wrong. With squared error that is the residual of each point, so each tree is a regression on the residuals. With other losses, each tree fits the negative gradient of the loss instead. It gives the direction and size of the change that would lower each point’s loss. The learning rate scales each tree down before the model adds it. Many small corrections fit the data more carefully than a few large ones, and they need more trees. The name joins two ideas. Boosting combines many weak models in sequence, where a weak model is only slightly better than a constant. “Gradient” means each model follows the negative gradient of the loss. A random forest averages independent deep trees, each a full model on its own. Boosted trees are shallow and depend on each other, and only their sum predicts well.
Properties
(Bias Falls Step by Step) Boosting starts from a high-bias model and lowers the bias with every tree.
The constant underfits completely. Each shallow tree adds a small, coarse correction, so the training loss falls round by round. The tree depth sets which patterns the sum can express. Stumps, trees with one split, give an additive model with no interactions between features. A tree of depth can model interactions among up to features. ESL (ch. 10) recommends trees with to leaves. It reports that results change little within that range.
(Gradient Descent in Function Space) Each round approximates one step of gradient descent on the training loss, with the predictions as the parameters.
Treat the training predictions as the unknowns. The gradient of the training loss with respect to has entries . Its negative is the vector of pseudo-residuals. A step of gradient descent would move each training prediction by . That step defines nothing for new inputs. A tree fit to the turns the step into a function defined everywhere. Gradient boosting therefore accepts any differentiable loss, such as 2.1.3. Huber Loss for robust regression.
(Each Leaf Takes a Newton Step) XGBoost’s leaf value is a damped Newton step on the loss of the points in that leaf.
For one point, Newton’s method moves the prediction by . A leaf must give all its points one shared value, so XGBoost pools the derivatives into . The in the denominator damps the step, most strongly in leaves with a small . For squared error with , every . The leaf value is then , a shrunken mean of the residuals. For log loss, , which is small when is near or . A leaf of confidently misclassified points could then take a huge step. The min_child_weight setting prevents this by requiring above a threshold.
(Smaller Steps Need More Trees) Lowering raises the number of trees needed, and it usually lowers the test error.
With , each tree removes as much of the residual as it can. Later trees then fit the noise that remains. With a small , many trees each contribute a little, so no single tree’s errors dominate. Friedman (2001) found that gave much lower test error than . The cost is training time. For small the training loss depends mostly on the product . Halving therefore roughly doubles the number of rounds needed. A common recipe fixes at or and lets early stopping choose .
(More Trees Can Overfit) Every new tree fits the training residuals further, so the validation loss eventually rises.
The training loss keeps falling as grows, toward zero if trees can isolate single points. The validation loss falls, flattens, and then climbs once the trees fit noise. is therefore a real hyperparameter, chosen by early stopping or cross-validation. A random forest has no such turning point, because its trees are independent and their average converges. Early stopping in boosting resembles early stopping of gradient descent on a linear model, which acts like a ridge penalty.
Each round fits a stump to the current residuals and adds times it to the model. Validation error is lowest after 30 rounds, so early stopping keeps .
\usepackage{tikz}
\usetikzlibrary{animations, arrows.meta}
\begin{document}
\definecolor{hot}{HTML}{D9483B}
\definecolor{cold}{HTML}{2F80ED}
\definecolor{mid}{HTML}{8A8A8A}
\newcommand{\pf}[1]{\filldraw[draw=black, fill=cold] (#1) circle (2.1pt);}
\newcommand{\rb}[2]{\draw[mid, line width=2.4pt] (#1,0.0) -- (#1,#2);}
\begin{tikzpicture}[font=\small, >={Stealth[length=2.2mm]}]
\draw (0.0,2.80) rectangle (8.0,6.00);
\draw[mid] (0.0,3.90) -- (8.0,3.90);
\draw (0.0,2.90) -- (-0.08,2.90) node[left] {\footnotesize $-1$};
\draw (0.0,3.90) -- (-0.08,3.90) node[left] {\footnotesize $0$};
\draw (0.0,4.90) -- (-0.08,4.90) node[left] {\footnotesize $1$};
\draw (0.0,5.90) -- (-0.08,5.90) node[left] {\footnotesize $2$};
\node[anchor=west] at (-0.1,6.32) {data $y_i$ (blue) and the fit $F_m(x)$ (red)};
\draw (0.0,-1.23) rectangle (8.0,1.23);
\draw[mid] (0.0,0.00) -- (8.0,0.00);
\draw (0.0,-0.85) -- (-0.08,-0.85) node[left] {\footnotesize $-1$};
\draw (0.0,0.00) -- (-0.08,0.00) node[left] {\footnotesize $0$};
\draw (0.0,0.85) -- (-0.08,0.85) node[left] {\footnotesize $1$};
\node[anchor=west] at (-0.1,1.55) {residuals $r_i$ (gray) and the stump $f_m(x)$ (blue)};
\draw (0.00,-1.23) -- (0.00,-1.31) node[below] {\footnotesize $0$};
\draw (4.00,-1.23) -- (4.00,-1.31) node[below] {\footnotesize $0.5$};
\draw (8.00,-1.23) -- (8.00,-1.31) node[below] {\footnotesize $1$};
\node at (4.00,-1.85) {$x$};
\draw[->] (9.7,-1.23) -- (15.60,-1.23) node[right] {$m$};
\draw[->] (9.7,-1.23) -- (9.7,5.97);
\draw (9.70,-1.23) -- (9.70,-1.31) node[below] {\footnotesize $0$};
\draw (11.57,-1.23) -- (11.57,-1.31) node[below] {\footnotesize $50$};
\draw (13.43,-1.23) -- (13.43,-1.31) node[below] {\footnotesize $100$};
\draw (15.30,-1.23) -- (15.30,-1.31) node[below] {\footnotesize $150$};
\draw (9.7,-0.08) -- (9.62,-0.08) node[left] {\footnotesize $0.1$};
\draw (9.7,1.07) -- (9.62,1.07) node[left] {\footnotesize $0.2$};
\draw (9.7,2.22) -- (9.62,2.22) node[left] {\footnotesize $0.3$};
\draw (9.7,3.37) -- (9.62,3.37) node[left] {\footnotesize $0.4$};
\draw (9.7,4.52) -- (9.62,4.52) node[left] {\footnotesize $0.5$};
\node[rotate=90] at (8.85,2.22) {mean squared error};
\draw[thick] (12.10,5.10) -- (12.60,5.10) node[right] {\footnotesize training};
\draw[thick, dashed] (11.90,4.63) -- (12.60,4.63) node[right] {\footnotesize validation ($200$ points)};
\begin{scope}[animate = {myself: = {:visible = {0s = "true", 2.4s = "false", 37.7s = "false", repeats}}}]
\draw[hot, line width=1.8pt] (0.00,4.32) -- (8.00,4.32);
\draw[thick] (9.70,4.76);
\draw[thick, dashed] (9.70,4.58);
\fill (9.70,4.76) circle (2pt); \fill (9.70,4.58) circle (2pt);
\node[anchor=west] at (8.80,6.32) {MSE at $m = 0$: \ training $0.521$, \ validation $0.505$};
\node[anchor=west] at (-0.6,-2.5) {Start from the mean: $F_0(x) = \bar y = 0.42$ for every $x$.};
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 2.4s = "true", 4.8s = "false", 37.7s = "false", repeats}}}]
\draw[hot, line width=1.8pt] (0.00,4.32) -- (8.00,4.32);
\draw[thick] (9.70,4.76);
\draw[thick, dashed] (9.70,4.58);
\fill (9.70,4.76) circle (2pt); \fill (9.70,4.58) circle (2pt);
\node[anchor=west] at (8.80,6.32) {MSE at $m = 0$: \ training $0.521$, \ validation $0.505$};
\rb{0.37}{-0.65}\rb{1.19}{0.35}\rb{1.26}{0.31}\rb{1.72}{0.65}\rb{2.18}{0.69}\rb{2.31}{1.25}\rb{2.49}{0.26}\rb{2.55}{0.46}\rb{2.70}{1.15}\rb{3.26}{0.51}\rb{3.30}{0.49}\rb{3.41}{0.09}\rb{3.64}{-0.38}\rb{3.89}{0.02}\rb{4.09}{-0.12}\rb{4.30}{-0.64}\rb{4.38}{-0.53}\rb{5.92}{-0.85}\rb{5.94}{-1.11}\rb{6.22}{-0.83}\rb{6.52}{-0.69}\rb{7.45}{-0.23}\rb{7.46}{-0.38}\rb{7.54}{0.00}\rb{7.70}{0.20}
\node[anchor=west] at (-0.6,-2.5) {Round $1$: the residuals $r_i = y_i - F_0(x_i)$, drawn as gray bars below.};
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 4.8s = "true", 7.2s = "false", 37.7s = "false", repeats}}}]
\draw[hot, line width=1.8pt] (0.00,4.32) -- (8.00,4.32);
\draw[thick] (9.70,4.76);
\draw[thick, dashed] (9.70,4.58);
\fill (9.70,4.76) circle (2pt); \fill (9.70,4.58) circle (2pt);
\node[anchor=west] at (8.80,6.32) {MSE at $m = 0$: \ training $0.521$, \ validation $0.505$};
\rb{0.37}{-0.65}\rb{1.19}{0.35}\rb{1.26}{0.31}\rb{1.72}{0.65}\rb{2.18}{0.69}\rb{2.31}{1.25}\rb{2.49}{0.26}\rb{2.55}{0.46}\rb{2.70}{1.15}\rb{3.26}{0.51}\rb{3.30}{0.49}\rb{3.41}{0.09}\rb{3.64}{-0.38}\rb{3.89}{0.02}\rb{4.09}{-0.12}\rb{4.30}{-0.64}\rb{4.38}{-0.53}\rb{5.92}{-0.85}\rb{5.94}{-1.11}\rb{6.22}{-0.83}\rb{6.52}{-0.69}\rb{7.45}{-0.23}\rb{7.46}{-0.38}\rb{7.54}{0.00}\rb{7.70}{0.20}
\draw[cold, line width=1.8pt] (0.00,0.46) -- (3.52,0.46) -- (3.52,-0.43) -- (8.00,-0.43);
\node[anchor=west] at (-0.6,-2.5) {Round $1$: a stump fits the residuals. It splits at $x < 0.44$, with leaf means $0.54$ and $-0.50$.};
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 7.2s = "true", 9.6s = "false", 37.7s = "false", repeats}}}]
\draw[mid, thick] (0.00,4.32) -- (8.00,4.32);
\draw[hot, line width=1.8pt] (0.00,4.48) -- (3.52,4.48) -- (3.52,4.17) -- (8.00,4.17);
\draw[thick] (9.70,4.76) -- (9.74,3.16);
\draw[thick, dashed] (9.70,4.58) -- (9.74,2.98);
\fill (9.74,3.16) circle (2pt); \fill (9.74,2.98) circle (2pt);
\node[anchor=west] at (8.80,6.32) {MSE at $m = 1$: \ training $0.382$, \ validation $0.366$};
\rb{0.37}{-0.65}\rb{1.19}{0.35}\rb{1.26}{0.31}\rb{1.72}{0.65}\rb{2.18}{0.69}\rb{2.31}{1.25}\rb{2.49}{0.26}\rb{2.55}{0.46}\rb{2.70}{1.15}\rb{3.26}{0.51}\rb{3.30}{0.49}\rb{3.41}{0.09}\rb{3.64}{-0.38}\rb{3.89}{0.02}\rb{4.09}{-0.12}\rb{4.30}{-0.64}\rb{4.38}{-0.53}\rb{5.92}{-0.85}\rb{5.94}{-1.11}\rb{6.22}{-0.83}\rb{6.52}{-0.69}\rb{7.45}{-0.23}\rb{7.46}{-0.38}\rb{7.54}{0.00}\rb{7.70}{0.20}
\draw[cold, line width=1.8pt] (0.00,0.46) -- (3.52,0.46) -- (3.52,-0.43) -- (8.00,-0.43);
\node[anchor=west] at (-0.6,-2.5) {$F_{1} = F_{0} + 0.3\, f_{1}$: the red fit adds $30\%$ of the stump. Gray: the previous fit.};
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 9.6s = "true", 10.9s = "false", 37.7s = "false", repeats}}}]
\draw[hot, line width=1.8pt] (0.00,4.48) -- (3.52,4.48) -- (3.52,4.17) -- (8.00,4.17);
\draw[thick] (9.70,4.76) -- (9.74,3.16);
\draw[thick, dashed] (9.70,4.58) -- (9.74,2.98);
\fill (9.74,3.16) circle (2pt); \fill (9.74,2.98) circle (2pt);
\node[anchor=west] at (8.80,6.32) {MSE at $m = 1$: \ training $0.382$, \ validation $0.366$};
\rb{0.37}{-0.79}\rb{1.19}{0.21}\rb{1.26}{0.17}\rb{1.72}{0.51}\rb{2.18}{0.55}\rb{2.31}{1.11}\rb{2.49}{0.12}\rb{2.55}{0.33}\rb{2.70}{1.01}\rb{3.26}{0.37}\rb{3.30}{0.35}\rb{3.41}{-0.05}\rb{3.64}{-0.25}\rb{3.89}{0.14}\rb{4.09}{0.01}\rb{4.30}{-0.52}\rb{4.38}{-0.41}\rb{5.92}{-0.72}\rb{5.94}{-0.98}\rb{6.22}{-0.70}\rb{6.52}{-0.56}\rb{7.45}{-0.10}\rb{7.46}{-0.26}\rb{7.54}{0.13}\rb{7.70}{0.33}
\draw[cold, line width=1.8pt] (0.00,0.36) -- (3.36,0.36) -- (3.36,-0.28) -- (8.00,-0.28);
\node[anchor=west] at (-0.6,-2.5) {Round $2$: a stump fits the residuals. It splits at $x < 0.42$, with leaf means $0.42$ and $-0.33$.};
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 10.9s = "true", 12.2s = "false", 37.7s = "false", repeats}}}]
\draw[mid, thick] (0.00,4.48) -- (3.52,4.48) -- (3.52,4.17) -- (8.00,4.17);
\draw[hot, line width=1.8pt] (0.00,4.61) -- (3.36,4.61) -- (3.36,4.38) -- (3.52,4.38) -- (3.52,4.07) -- (8.00,4.07);
\draw[thick] (9.70,4.76) -- (9.74,3.16) -- (9.77,2.34);
\draw[thick, dashed] (9.70,4.58) -- (9.74,2.98) -- (9.77,2.21);
\fill (9.77,2.34) circle (2pt); \fill (9.77,2.21) circle (2pt);
\node[anchor=west] at (8.80,6.32) {MSE at $m = 2$: \ training $0.311$, \ validation $0.299$};
\rb{0.37}{-0.79}\rb{1.19}{0.21}\rb{1.26}{0.17}\rb{1.72}{0.51}\rb{2.18}{0.55}\rb{2.31}{1.11}\rb{2.49}{0.12}\rb{2.55}{0.33}\rb{2.70}{1.01}\rb{3.26}{0.37}\rb{3.30}{0.35}\rb{3.41}{-0.05}\rb{3.64}{-0.25}\rb{3.89}{0.14}\rb{4.09}{0.01}\rb{4.30}{-0.52}\rb{4.38}{-0.41}\rb{5.92}{-0.72}\rb{5.94}{-0.98}\rb{6.22}{-0.70}\rb{6.52}{-0.56}\rb{7.45}{-0.10}\rb{7.46}{-0.26}\rb{7.54}{0.13}\rb{7.70}{0.33}
\draw[cold, line width=1.8pt] (0.00,0.36) -- (3.36,0.36) -- (3.36,-0.28) -- (8.00,-0.28);
\node[anchor=west] at (-0.6,-2.5) {$F_{2} = F_{1} + 0.3\, f_{2}$: the red fit adds $30\%$ of the stump. Gray: the previous fit.};
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 12.2s = "true", 13.5s = "false", 37.7s = "false", repeats}}}]
\draw[hot, line width=1.8pt] (0.00,4.61) -- (3.36,4.61) -- (3.36,4.38) -- (3.52,4.38) -- (3.52,4.07) -- (8.00,4.07);
\draw[thick] (9.70,4.76) -- (9.74,3.16) -- (9.77,2.34);
\draw[thick, dashed] (9.70,4.58) -- (9.74,2.98) -- (9.77,2.21);
\fill (9.77,2.34) circle (2pt); \fill (9.77,2.21) circle (2pt);
\node[anchor=west] at (8.80,6.32) {MSE at $m = 2$: \ training $0.311$, \ validation $0.299$};
\rb{0.37}{-0.90}\rb{1.19}{0.11}\rb{1.26}{0.06}\rb{1.72}{0.40}\rb{2.18}{0.44}\rb{2.31}{1.00}\rb{2.49}{0.01}\rb{2.55}{0.22}\rb{2.70}{0.90}\rb{3.26}{0.27}\rb{3.30}{0.25}\rb{3.41}{0.03}\rb{3.64}{-0.17}\rb{3.89}{0.23}\rb{4.09}{0.09}\rb{4.30}{-0.43}\rb{4.38}{-0.32}\rb{5.92}{-0.64}\rb{5.94}{-0.90}\rb{6.22}{-0.62}\rb{6.52}{-0.48}\rb{7.45}{-0.02}\rb{7.46}{-0.17}\rb{7.54}{0.22}\rb{7.70}{0.41}
\draw[cold, line width=1.8pt] (0.00,0.20) -- (4.19,0.20) -- (4.19,-0.29) -- (8.00,-0.29);
\node[anchor=west] at (-0.6,-2.5) {Round $3$: a stump fits the residuals. It splits at $x < 0.52$, with leaf means $0.23$ and $-0.35$.};
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 13.5s = "true", 14.8s = "false", 37.7s = "false", repeats}}}]
\draw[mid, thick] (0.00,4.61) -- (3.36,4.61) -- (3.36,4.38) -- (3.52,4.38) -- (3.52,4.07) -- (8.00,4.07);
\draw[hot, line width=1.8pt] (0.00,4.68) -- (3.36,4.68) -- (3.36,4.45) -- (3.52,4.45) -- (3.52,4.14) -- (4.19,4.14) -- (4.19,3.97) -- (8.00,3.97);
\draw[thick] (9.70,4.76) -- (9.74,3.16) -- (9.77,2.34) -- (9.81,1.87);
\draw[thick, dashed] (9.70,4.58) -- (9.74,2.98) -- (9.77,2.21) -- (9.81,1.65);
\fill (9.81,1.87) circle (2pt); \fill (9.81,1.65) circle (2pt);
\node[anchor=west] at (8.80,6.32) {MSE at $m = 3$: \ training $0.270$, \ validation $0.251$};
\rb{0.37}{-0.90}\rb{1.19}{0.11}\rb{1.26}{0.06}\rb{1.72}{0.40}\rb{2.18}{0.44}\rb{2.31}{1.00}\rb{2.49}{0.01}\rb{2.55}{0.22}\rb{2.70}{0.90}\rb{3.26}{0.27}\rb{3.30}{0.25}\rb{3.41}{0.03}\rb{3.64}{-0.17}\rb{3.89}{0.23}\rb{4.09}{0.09}\rb{4.30}{-0.43}\rb{4.38}{-0.32}\rb{5.92}{-0.64}\rb{5.94}{-0.90}\rb{6.22}{-0.62}\rb{6.52}{-0.48}\rb{7.45}{-0.02}\rb{7.46}{-0.17}\rb{7.54}{0.22}\rb{7.70}{0.41}
\draw[cold, line width=1.8pt] (0.00,0.20) -- (4.19,0.20) -- (4.19,-0.29) -- (8.00,-0.29);
\node[anchor=west] at (-0.6,-2.5) {$F_{3} = F_{2} + 0.3\, f_{3}$: the red fit adds $30\%$ of the stump. Gray: the previous fit.};
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 14.8s = "true", 16.1s = "false", 37.7s = "false", repeats}}}]
\draw[hot, line width=1.8pt] (0.00,4.68) -- (3.36,4.68) -- (3.36,4.45) -- (3.52,4.45) -- (3.52,4.14) -- (4.19,4.14) -- (4.19,3.97) -- (8.00,3.97);
\draw[thick] (9.70,4.76) -- (9.74,3.16) -- (9.77,2.34) -- (9.81,1.87);
\draw[thick, dashed] (9.70,4.58) -- (9.74,2.98) -- (9.77,2.21) -- (9.81,1.65);
\fill (9.81,1.87) circle (2pt); \fill (9.81,1.65) circle (2pt);
\node[anchor=west] at (8.80,6.32) {MSE at $m = 3$: \ training $0.270$, \ validation $0.251$};
\rb{0.37}{-0.96}\rb{1.19}{0.05}\rb{1.26}{0.00}\rb{1.72}{0.34}\rb{2.18}{0.38}\rb{2.31}{0.94}\rb{2.49}{-0.05}\rb{2.55}{0.16}\rb{2.70}{0.84}\rb{3.26}{0.21}\rb{3.30}{0.19}\rb{3.41}{-0.02}\rb{3.64}{-0.22}\rb{3.89}{0.17}\rb{4.09}{0.03}\rb{4.30}{-0.34}\rb{4.38}{-0.23}\rb{5.92}{-0.55}\rb{5.94}{-0.81}\rb{6.22}{-0.53}\rb{6.52}{-0.39}\rb{7.45}{0.07}\rb{7.46}{-0.08}\rb{7.54}{0.30}\rb{7.70}{0.50}
\draw[cold, line width=1.8pt] (0.00,-0.96) -- (0.78,-0.96) -- (0.78,0.04) -- (8.00,0.04);
\node[anchor=west] at (-0.6,-2.5) {Round $4$: a stump fits the residuals. It splits at $x < 0.10$, with leaf means $-1.13$ and $0.05$.};
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 16.1s = "true", 17.4s = "false", 37.7s = "false", repeats}}}]
\draw[mid, thick] (0.00,4.68) -- (3.36,4.68) -- (3.36,4.45) -- (3.52,4.45) -- (3.52,4.14) -- (4.19,4.14) -- (4.19,3.97) -- (8.00,3.97);
\draw[hot, line width=1.8pt] (0.00,4.34) -- (0.78,4.34) -- (0.78,4.69) -- (3.36,4.69) -- (3.36,4.47) -- (3.52,4.47) -- (3.52,4.15) -- (4.19,4.15) -- (4.19,3.98) -- (8.00,3.98);
\draw[thick] (9.70,4.76) -- (9.74,3.16) -- (9.77,2.34) -- (9.81,1.87) -- (9.85,1.56);
\draw[thick, dashed] (9.70,4.58) -- (9.74,2.98) -- (9.77,2.21) -- (9.81,1.65) -- (9.85,1.47);
\fill (9.85,1.56) circle (2pt); \fill (9.85,1.47) circle (2pt);
\node[anchor=west] at (8.80,6.32) {MSE at $m = 4$: \ training $0.243$, \ validation $0.235$};
\rb{0.37}{-0.96}\rb{1.19}{0.05}\rb{1.26}{0.00}\rb{1.72}{0.34}\rb{2.18}{0.38}\rb{2.31}{0.94}\rb{2.49}{-0.05}\rb{2.55}{0.16}\rb{2.70}{0.84}\rb{3.26}{0.21}\rb{3.30}{0.19}\rb{3.41}{-0.02}\rb{3.64}{-0.22}\rb{3.89}{0.17}\rb{4.09}{0.03}\rb{4.30}{-0.34}\rb{4.38}{-0.23}\rb{5.92}{-0.55}\rb{5.94}{-0.81}\rb{6.22}{-0.53}\rb{6.52}{-0.39}\rb{7.45}{0.07}\rb{7.46}{-0.08}\rb{7.54}{0.30}\rb{7.70}{0.50}
\draw[cold, line width=1.8pt] (0.00,-0.96) -- (0.78,-0.96) -- (0.78,0.04) -- (8.00,0.04);
\node[anchor=west] at (-0.6,-2.5) {$F_{4} = F_{3} + 0.3\, f_{4}$: the red fit adds $30\%$ of the stump. Gray: the previous fit.};
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 17.4s = "true", 18.7s = "false", 37.7s = "false", repeats}}}]
\draw[hot, line width=1.8pt] (0.00,4.34) -- (0.78,4.34) -- (0.78,4.69) -- (3.36,4.69) -- (3.36,4.47) -- (3.52,4.47) -- (3.52,4.15) -- (4.19,4.15) -- (4.19,3.98) -- (8.00,3.98);
\draw[thick] (9.70,4.76) -- (9.74,3.16) -- (9.77,2.34) -- (9.81,1.87) -- (9.85,1.56);
\draw[thick, dashed] (9.70,4.58) -- (9.74,2.98) -- (9.77,2.21) -- (9.81,1.65) -- (9.85,1.47);
\fill (9.85,1.56) circle (2pt); \fill (9.85,1.47) circle (2pt);
\node[anchor=west] at (8.80,6.32) {MSE at $m = 4$: \ training $0.243$, \ validation $0.235$};
\rb{0.37}{-0.67}\rb{1.19}{0.03}\rb{1.26}{-0.01}\rb{1.72}{0.33}\rb{2.18}{0.37}\rb{2.31}{0.93}\rb{2.49}{-0.06}\rb{2.55}{0.15}\rb{2.70}{0.83}\rb{3.26}{0.19}\rb{3.30}{0.18}\rb{3.41}{-0.04}\rb{3.64}{-0.24}\rb{3.89}{0.16}\rb{4.09}{0.02}\rb{4.30}{-0.36}\rb{4.38}{-0.24}\rb{5.92}{-0.56}\rb{5.94}{-0.82}\rb{6.22}{-0.54}\rb{6.52}{-0.40}\rb{7.45}{0.06}\rb{7.46}{-0.10}\rb{7.54}{0.29}\rb{7.70}{0.49}
\draw[cold, line width=1.8pt] (0.00,0.21) -- (3.36,0.21) -- (3.36,-0.16) -- (8.00,-0.16);
\node[anchor=west] at (-0.6,-2.5) {Round $5$: a stump fits the residuals. It splits at $x < 0.42$, with leaf means $0.24$ and $-0.19$.};
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 18.7s = "true", 20s = "false", 37.7s = "false", repeats}}}]
\draw[mid, thick] (0.00,4.34) -- (0.78,4.34) -- (0.78,4.69) -- (3.36,4.69) -- (3.36,4.47) -- (3.52,4.47) -- (3.52,4.15) -- (4.19,4.15) -- (4.19,3.98) -- (8.00,3.98);
\draw[hot, line width=1.8pt] (0.00,4.41) -- (0.78,4.41) -- (0.78,4.77) -- (3.36,4.77) -- (3.36,4.41) -- (3.52,4.41) -- (3.52,4.10) -- (4.19,4.10) -- (4.19,3.92) -- (8.00,3.92);
\draw[thick] (9.70,4.76) -- (9.74,3.16) -- (9.77,2.34) -- (9.81,1.87) -- (9.85,1.56) -- (9.89,1.29);
\draw[thick, dashed] (9.70,4.58) -- (9.74,2.98) -- (9.77,2.21) -- (9.81,1.65) -- (9.85,1.47) -- (9.89,1.22);
\fill (9.89,1.29) circle (2pt); \fill (9.89,1.22) circle (2pt);
\node[anchor=west] at (8.80,6.32) {MSE at $m = 5$: \ training $0.219$, \ validation $0.213$};
\rb{0.37}{-0.67}\rb{1.19}{0.03}\rb{1.26}{-0.01}\rb{1.72}{0.33}\rb{2.18}{0.37}\rb{2.31}{0.93}\rb{2.49}{-0.06}\rb{2.55}{0.15}\rb{2.70}{0.83}\rb{3.26}{0.19}\rb{3.30}{0.18}\rb{3.41}{-0.04}\rb{3.64}{-0.24}\rb{3.89}{0.16}\rb{4.09}{0.02}\rb{4.30}{-0.36}\rb{4.38}{-0.24}\rb{5.92}{-0.56}\rb{5.94}{-0.82}\rb{6.22}{-0.54}\rb{6.52}{-0.40}\rb{7.45}{0.06}\rb{7.46}{-0.10}\rb{7.54}{0.29}\rb{7.70}{0.49}
\draw[cold, line width=1.8pt] (0.00,0.21) -- (3.36,0.21) -- (3.36,-0.16) -- (8.00,-0.16);
\node[anchor=west] at (-0.6,-2.5) {$F_{5} = F_{4} + 0.3\, f_{5}$: the red fit adds $30\%$ of the stump. Gray: the previous fit.};
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 20s = "true", 21.3s = "false", 37.7s = "false", repeats}}}]
\draw[hot, line width=1.8pt] (0.00,4.41) -- (0.78,4.41) -- (0.78,4.77) -- (3.36,4.77) -- (3.36,4.41) -- (3.52,4.41) -- (3.52,4.10) -- (4.19,4.10) -- (4.19,3.92) -- (8.00,3.92);
\draw[thick] (9.70,4.76) -- (9.74,3.16) -- (9.77,2.34) -- (9.81,1.87) -- (9.85,1.56) -- (9.89,1.29);
\draw[thick, dashed] (9.70,4.58) -- (9.74,2.98) -- (9.77,2.21) -- (9.81,1.65) -- (9.85,1.47) -- (9.89,1.22);
\fill (9.89,1.29) circle (2pt); \fill (9.89,1.22) circle (2pt);
\node[anchor=west] at (8.80,6.32) {MSE at $m = 5$: \ training $0.219$, \ validation $0.213$};
\rb{0.37}{-0.73}\rb{1.19}{-0.03}\rb{1.26}{-0.07}\rb{1.72}{0.27}\rb{2.18}{0.31}\rb{2.31}{0.87}\rb{2.49}{-0.12}\rb{2.55}{0.09}\rb{2.70}{0.77}\rb{3.26}{0.13}\rb{3.30}{0.11}\rb{3.41}{0.01}\rb{3.64}{-0.19}\rb{3.89}{0.21}\rb{4.09}{0.07}\rb{4.30}{-0.31}\rb{4.38}{-0.20}\rb{5.92}{-0.51}\rb{5.94}{-0.77}\rb{6.22}{-0.49}\rb{6.52}{-0.36}\rb{7.45}{0.11}\rb{7.46}{-0.05}\rb{7.54}{0.34}\rb{7.70}{0.54}
\draw[cold, line width=1.8pt] (0.00,-0.73) -- (0.78,-0.73) -- (0.78,0.03) -- (8.00,0.03);
\node[anchor=west] at (-0.6,-2.5) {Round $6$: a stump fits the residuals. It splits at $x < 0.10$, with leaf means $-0.86$ and $0.04$.};
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 21.3s = "true", 22.6s = "false", 37.7s = "false", repeats}}}]
\draw[mid, thick] (0.00,4.41) -- (0.78,4.41) -- (0.78,4.77) -- (3.36,4.77) -- (3.36,4.41) -- (3.52,4.41) -- (3.52,4.10) -- (4.19,4.10) -- (4.19,3.92) -- (8.00,3.92);
\draw[hot, line width=1.8pt] (0.00,4.16) -- (0.78,4.16) -- (0.78,4.78) -- (3.36,4.78) -- (3.36,4.42) -- (3.52,4.42) -- (3.52,4.11) -- (4.19,4.11) -- (4.19,3.93) -- (8.00,3.93);
\draw[thick] (9.70,4.76) -- (9.74,3.16) -- (9.77,2.34) -- (9.81,1.87) -- (9.85,1.56) -- (9.89,1.29) -- (9.92,1.11);
\draw[thick, dashed] (9.70,4.58) -- (9.74,2.98) -- (9.77,2.21) -- (9.81,1.65) -- (9.85,1.47) -- (9.89,1.22) -- (9.92,1.19);
\fill (9.92,1.11) circle (2pt); \fill (9.92,1.19) circle (2pt);
\node[anchor=west] at (8.80,6.32) {MSE at $m = 6$: \ training $0.203$, \ validation $0.210$};
\rb{0.37}{-0.73}\rb{1.19}{-0.03}\rb{1.26}{-0.07}\rb{1.72}{0.27}\rb{2.18}{0.31}\rb{2.31}{0.87}\rb{2.49}{-0.12}\rb{2.55}{0.09}\rb{2.70}{0.77}\rb{3.26}{0.13}\rb{3.30}{0.11}\rb{3.41}{0.01}\rb{3.64}{-0.19}\rb{3.89}{0.21}\rb{4.09}{0.07}\rb{4.30}{-0.31}\rb{4.38}{-0.20}\rb{5.92}{-0.51}\rb{5.94}{-0.77}\rb{6.22}{-0.49}\rb{6.52}{-0.36}\rb{7.45}{0.11}\rb{7.46}{-0.05}\rb{7.54}{0.34}\rb{7.70}{0.54}
\draw[cold, line width=1.8pt] (0.00,-0.73) -- (0.78,-0.73) -- (0.78,0.03) -- (8.00,0.03);
\node[anchor=west] at (-0.6,-2.5) {$F_{6} = F_{5} + 0.3\, f_{6}$: the red fit adds $30\%$ of the stump. Gray: the previous fit.};
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 22.6s = "true", 23.9s = "false", 37.7s = "false", repeats}}}]
\draw[hot, line width=1.8pt] (0.00,4.16) -- (0.78,4.16) -- (0.78,4.78) -- (3.36,4.78) -- (3.36,4.42) -- (3.52,4.42) -- (3.52,4.11) -- (4.19,4.11) -- (4.19,3.93) -- (8.00,3.93);
\draw[thick] (9.70,4.76) -- (9.74,3.16) -- (9.77,2.34) -- (9.81,1.87) -- (9.85,1.56) -- (9.89,1.29) -- (9.92,1.11);
\draw[thick, dashed] (9.70,4.58) -- (9.74,2.98) -- (9.77,2.21) -- (9.81,1.65) -- (9.85,1.47) -- (9.89,1.22) -- (9.92,1.19);
\fill (9.92,1.11) circle (2pt); \fill (9.92,1.19) circle (2pt);
\node[anchor=west] at (8.80,6.32) {MSE at $m = 6$: \ training $0.203$, \ validation $0.210$};
\rb{0.37}{-0.51}\rb{1.19}{-0.04}\rb{1.26}{-0.08}\rb{1.72}{0.26}\rb{2.18}{0.30}\rb{2.31}{0.86}\rb{2.49}{-0.13}\rb{2.55}{0.08}\rb{2.70}{0.76}\rb{3.26}{0.12}\rb{3.30}{0.10}\rb{3.41}{0.00}\rb{3.64}{-0.20}\rb{3.89}{0.20}\rb{4.09}{0.06}\rb{4.30}{-0.32}\rb{4.38}{-0.20}\rb{5.92}{-0.52}\rb{5.94}{-0.78}\rb{6.22}{-0.50}\rb{6.52}{-0.36}\rb{7.45}{0.10}\rb{7.46}{-0.06}\rb{7.54}{0.33}\rb{7.70}{0.53}
\draw[cold, line width=1.8pt] (0.00,0.12) -- (4.19,0.12) -- (4.19,-0.18) -- (8.00,-0.18);
\node[anchor=west] at (-0.6,-2.5) {Round $7$: a stump fits the residuals. It splits at $x < 0.52$, with leaf means $0.14$ and $-0.21$.};
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 23.9s = "true", 25.2s = "false", 37.7s = "false", repeats}}}]
\draw[mid, thick] (0.00,4.16) -- (0.78,4.16) -- (0.78,4.78) -- (3.36,4.78) -- (3.36,4.42) -- (3.52,4.42) -- (3.52,4.11) -- (4.19,4.11) -- (4.19,3.93) -- (8.00,3.93);
\draw[hot, line width=1.8pt] (0.00,4.20) -- (0.78,4.20) -- (0.78,4.82) -- (3.36,4.82) -- (3.36,4.46) -- (3.52,4.46) -- (3.52,4.15) -- (4.19,4.15) -- (4.19,3.87) -- (8.00,3.87);
\draw[thick] (9.70,4.76) -- (9.74,3.16) -- (9.77,2.34) -- (9.81,1.87) -- (9.85,1.56) -- (9.89,1.29) -- (9.92,1.11) -- (9.96,0.94);
\draw[thick, dashed] (9.70,4.58) -- (9.74,2.98) -- (9.77,2.21) -- (9.81,1.65) -- (9.85,1.47) -- (9.89,1.22) -- (9.92,1.19) -- (9.96,0.95);
\fill (9.96,0.94) circle (2pt); \fill (9.96,0.95) circle (2pt);
\node[anchor=west] at (8.80,6.32) {MSE at $m = 7$: \ training $0.188$, \ validation $0.189$};
\rb{0.37}{-0.51}\rb{1.19}{-0.04}\rb{1.26}{-0.08}\rb{1.72}{0.26}\rb{2.18}{0.30}\rb{2.31}{0.86}\rb{2.49}{-0.13}\rb{2.55}{0.08}\rb{2.70}{0.76}\rb{3.26}{0.12}\rb{3.30}{0.10}\rb{3.41}{0.00}\rb{3.64}{-0.20}\rb{3.89}{0.20}\rb{4.09}{0.06}\rb{4.30}{-0.32}\rb{4.38}{-0.20}\rb{5.92}{-0.52}\rb{5.94}{-0.78}\rb{6.22}{-0.50}\rb{6.52}{-0.36}\rb{7.45}{0.10}\rb{7.46}{-0.06}\rb{7.54}{0.33}\rb{7.70}{0.53}
\draw[cold, line width=1.8pt] (0.00,0.12) -- (4.19,0.12) -- (4.19,-0.18) -- (8.00,-0.18);
\node[anchor=west] at (-0.6,-2.5) {$F_{7} = F_{6} + 0.3\, f_{7}$: the red fit adds $30\%$ of the stump. Gray: the previous fit.};
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 25.2s = "true", 26.5s = "false", 37.7s = "false", repeats}}}]
\draw[hot, line width=1.8pt] (0.00,4.20) -- (0.78,4.20) -- (0.78,4.82) -- (3.36,4.82) -- (3.36,4.46) -- (3.52,4.46) -- (3.52,4.15) -- (4.19,4.15) -- (4.19,3.87) -- (8.00,3.87);
\draw[thick] (9.70,4.76) -- (9.74,3.16) -- (9.77,2.34) -- (9.81,1.87) -- (9.85,1.56) -- (9.89,1.29) -- (9.92,1.11) -- (9.96,0.94);
\draw[thick, dashed] (9.70,4.58) -- (9.74,2.98) -- (9.77,2.21) -- (9.81,1.65) -- (9.85,1.47) -- (9.89,1.22) -- (9.92,1.19) -- (9.96,0.95);
\fill (9.96,0.94) circle (2pt); \fill (9.96,0.95) circle (2pt);
\node[anchor=west] at (8.80,6.32) {MSE at $m = 7$: \ training $0.188$, \ validation $0.189$};
\rb{0.37}{-0.55}\rb{1.19}{-0.07}\rb{1.26}{-0.11}\rb{1.72}{0.22}\rb{2.18}{0.26}\rb{2.31}{0.82}\rb{2.49}{-0.16}\rb{2.55}{0.04}\rb{2.70}{0.72}\rb{3.26}{0.09}\rb{3.30}{0.07}\rb{3.41}{-0.03}\rb{3.64}{-0.23}\rb{3.89}{0.16}\rb{4.09}{0.02}\rb{4.30}{-0.26}\rb{4.38}{-0.15}\rb{5.92}{-0.47}\rb{5.94}{-0.73}\rb{6.22}{-0.45}\rb{6.52}{-0.31}\rb{7.45}{0.15}\rb{7.46}{-0.00}\rb{7.54}{0.38}\rb{7.70}{0.58}
\draw[cold, line width=1.8pt] (0.00,-0.04) -- (7.50,-0.04) -- (7.50,0.48) -- (8.00,0.48);
\node[anchor=west] at (-0.6,-2.5) {Round $8$: a stump fits the residuals. It splits at $x < 0.94$, with leaf means $-0.05$ and $0.57$.};
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 26.5s = "true", 27.8s = "false", 37.7s = "false", repeats}}}]
\draw[mid, thick] (0.00,4.20) -- (0.78,4.20) -- (0.78,4.82) -- (3.36,4.82) -- (3.36,4.46) -- (3.52,4.46) -- (3.52,4.15) -- (4.19,4.15) -- (4.19,3.87) -- (8.00,3.87);
\draw[hot, line width=1.8pt] (0.00,4.18) -- (0.78,4.18) -- (0.78,4.80) -- (3.36,4.80) -- (3.36,4.45) -- (3.52,4.45) -- (3.52,4.13) -- (4.19,4.13) -- (4.19,3.86) -- (7.50,3.86) -- (7.50,4.04) -- (8.00,4.04);
\draw[thick] (9.70,4.76) -- (9.74,3.16) -- (9.77,2.34) -- (9.81,1.87) -- (9.85,1.56) -- (9.89,1.29) -- (9.92,1.11) -- (9.96,0.94) -- (10.00,0.77);
\draw[thick, dashed] (9.70,4.58) -- (9.74,2.98) -- (9.77,2.21) -- (9.81,1.65) -- (9.85,1.47) -- (9.89,1.22) -- (9.92,1.19) -- (9.96,0.95) -- (10.00,0.84);
\fill (10.00,0.77) circle (2pt); \fill (10.00,0.84) circle (2pt);
\node[anchor=west] at (8.80,6.32) {MSE at $m = 8$: \ training $0.174$, \ validation $0.180$};
\rb{0.37}{-0.55}\rb{1.19}{-0.07}\rb{1.26}{-0.11}\rb{1.72}{0.22}\rb{2.18}{0.26}\rb{2.31}{0.82}\rb{2.49}{-0.16}\rb{2.55}{0.04}\rb{2.70}{0.72}\rb{3.26}{0.09}\rb{3.30}{0.07}\rb{3.41}{-0.03}\rb{3.64}{-0.23}\rb{3.89}{0.16}\rb{4.09}{0.02}\rb{4.30}{-0.26}\rb{4.38}{-0.15}\rb{5.92}{-0.47}\rb{5.94}{-0.73}\rb{6.22}{-0.45}\rb{6.52}{-0.31}\rb{7.45}{0.15}\rb{7.46}{-0.00}\rb{7.54}{0.38}\rb{7.70}{0.58}
\draw[cold, line width=1.8pt] (0.00,-0.04) -- (7.50,-0.04) -- (7.50,0.48) -- (8.00,0.48);
\node[anchor=west] at (-0.6,-2.5) {$F_{8} = F_{7} + 0.3\, f_{8}$: the red fit adds $30\%$ of the stump. Gray: the previous fit.};
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 27.8s = "true", 28.5s = "false", 37.7s = "false", repeats}}}]
\draw[hot, line width=1.8pt] (0.00,3.97) -- (0.78,3.97) -- (0.78,4.80) -- (1.49,4.80) -- (1.49,4.90) -- (3.36,4.90) -- (3.36,4.46) -- (3.52,4.46) -- (3.52,4.15) -- (4.19,4.15) -- (4.19,3.73) -- (6.98,3.73) -- (6.98,3.82) -- (7.50,3.82) -- (7.50,4.15) -- (8.00,4.15);
\draw[thick] (9.70,4.76) -- (9.74,3.16) -- (9.77,2.34) -- (9.81,1.87) -- (9.85,1.56) -- (9.89,1.29) -- (9.92,1.11) -- (9.96,0.94) -- (10.00,0.77) -- (10.04,0.66) -- (10.07,0.55) -- (10.11,0.45) -- (10.15,0.36) -- (10.19,0.28) -- (10.22,0.21) -- (10.26,0.14);
\draw[thick, dashed] (9.70,4.58) -- (9.74,2.98) -- (9.77,2.21) -- (9.81,1.65) -- (9.85,1.47) -- (9.89,1.22) -- (9.92,1.19) -- (9.96,0.95) -- (10.00,0.84) -- (10.04,0.74) -- (10.07,0.77) -- (10.11,0.72) -- (10.15,0.58) -- (10.19,0.53) -- (10.22,0.43) -- (10.26,0.47);
\fill (10.26,0.14) circle (2pt); \fill (10.26,0.47) circle (2pt);
\node[anchor=west] at (8.80,6.32) {MSE at $m = 15$: \ training $0.119$, \ validation $0.148$};
\rb{0.37}{-0.36}\rb{1.19}{-0.06}\rb{1.26}{-0.10}\rb{1.72}{0.15}\rb{2.18}{0.19}\rb{2.31}{0.75}\rb{2.49}{-0.24}\rb{2.55}{-0.03}\rb{2.70}{0.65}\rb{3.26}{0.02}\rb{3.30}{-0.00}\rb{3.41}{-0.03}\rb{3.64}{-0.23}\rb{3.89}{0.16}\rb{4.09}{0.02}\rb{4.30}{-0.14}\rb{4.38}{-0.03}\rb{5.92}{-0.34}\rb{5.94}{-0.60}\rb{6.22}{-0.32}\rb{6.52}{-0.19}\rb{7.45}{0.20}\rb{7.46}{0.04}\rb{7.54}{0.15}\rb{7.70}{0.35}
\node[anchor=west] at (-0.6,-2.5) {After $15$ rounds the residuals are small. Both errors still fall.};
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 28.5s = "true", 30.7s = "false", 37.7s = "false", repeats}}}]
\draw[hot, line width=1.8pt] (0.00,3.82) -- (0.78,3.82) -- (0.78,4.79) -- (1.49,4.79) -- (1.49,5.03) -- (2.98,5.03) -- (2.98,4.93) -- (3.36,4.93) -- (3.36,4.44) -- (3.52,4.44) -- (3.52,4.13) -- (4.19,4.13) -- (4.19,3.65) -- (5.15,3.65) -- (5.15,3.53) -- (6.98,3.53) -- (6.98,3.89) -- (7.50,3.89) -- (7.50,4.21) -- (7.62,4.21) -- (7.62,4.32) -- (8.00,4.32);
\draw[thick] (9.70,4.76) -- (9.74,3.16) -- (9.77,2.34) -- (9.81,1.87) -- (9.85,1.56) -- (9.89,1.29) -- (9.92,1.11) -- (9.96,0.94) -- (10.00,0.77) -- (10.04,0.66) -- (10.07,0.55) -- (10.11,0.45) -- (10.15,0.36) -- (10.19,0.28) -- (10.22,0.21) -- (10.26,0.14) -- (10.30,0.09) -- (10.33,0.03) -- (10.37,-0.02) -- (10.41,-0.07) -- (10.45,-0.11) -- (10.48,-0.15) -- (10.52,-0.19) -- (10.56,-0.21) -- (10.60,-0.25) -- (10.63,-0.27) -- (10.67,-0.30) -- (10.71,-0.33) -- (10.75,-0.35) -- (10.78,-0.37) -- (10.82,-0.39);
\draw[thick, dashed] (9.70,4.58) -- (9.74,2.98) -- (9.77,2.21) -- (9.81,1.65) -- (9.85,1.47) -- (9.89,1.22) -- (9.92,1.19) -- (9.96,0.95) -- (10.00,0.84) -- (10.04,0.74) -- (10.07,0.77) -- (10.11,0.72) -- (10.15,0.58) -- (10.19,0.53) -- (10.22,0.43) -- (10.26,0.47) -- (10.30,0.42) -- (10.33,0.39) -- (10.37,0.45) -- (10.41,0.38) -- (10.45,0.36) -- (10.48,0.34) -- (10.52,0.39) -- (10.56,0.38) -- (10.60,0.32) -- (10.63,0.32) -- (10.67,0.30) -- (10.71,0.34) -- (10.75,0.30) -- (10.78,0.30) -- (10.82,0.27);
\fill (10.82,-0.39) circle (2pt); \fill (10.82,0.27) circle (2pt);
\node[anchor=west] at (8.80,6.32) {MSE at $m = 30$: \ training $0.073$, \ validation $0.130$};
\rb{0.37}{-0.23}\rb{1.19}{-0.05}\rb{1.26}{-0.09}\rb{1.72}{0.04}\rb{2.18}{0.08}\rb{2.31}{0.64}\rb{2.49}{-0.34}\rb{2.55}{-0.14}\rb{2.70}{0.55}\rb{3.26}{-0.01}\rb{3.30}{-0.03}\rb{3.41}{-0.02}\rb{3.64}{-0.22}\rb{3.89}{0.18}\rb{4.09}{0.04}\rb{4.30}{-0.08}\rb{4.38}{0.04}\rb{5.92}{-0.18}\rb{5.94}{-0.44}\rb{6.22}{-0.16}\rb{6.52}{-0.02}\rb{7.45}{0.14}\rb{7.46}{-0.02}\rb{7.54}{0.10}\rb{7.70}{0.20}
\node[anchor=west] at (-0.6,-2.5) {After $30$ rounds the validation MSE reaches its minimum, $0.130$.};
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 30.7s = "true", 31.4s = "false", 37.7s = "false", repeats}}}]
\draw[hot, line width=1.8pt] (0.00,3.68) -- (0.78,3.68) -- (0.78,4.73) -- (1.49,4.73) -- (1.49,5.10) -- (1.95,5.10) -- (1.95,5.15) -- (2.24,5.15) -- (2.24,5.23) -- (2.40,5.23) -- (2.40,5.04) -- (2.62,5.04) -- (2.62,5.06) -- (2.98,5.06) -- (2.98,4.93) -- (3.36,4.93) -- (3.36,4.44) -- (3.52,4.44) -- (3.52,4.12) -- (4.19,4.12) -- (4.19,3.65) -- (5.15,3.65) -- (5.15,3.41) -- (6.37,3.41) -- (6.37,3.48) -- (6.98,3.48) -- (6.98,3.92) -- (7.50,3.92) -- (7.50,4.29) -- (7.62,4.29) -- (7.62,4.45) -- (8.00,4.45);
\draw[thick] (9.70,4.76) -- (9.74,3.16) -- (9.77,2.34) -- (9.81,1.87) -- (9.85,1.56) -- (9.89,1.29) -- (9.92,1.11) -- (9.96,0.94) -- (10.00,0.77) -- (10.04,0.66) -- (10.07,0.55) -- (10.11,0.45) -- (10.15,0.36) -- (10.19,0.28) -- (10.22,0.21) -- (10.26,0.14) -- (10.30,0.09) -- (10.33,0.03) -- (10.37,-0.02) -- (10.41,-0.07) -- (10.45,-0.11) -- (10.48,-0.15) -- (10.52,-0.19) -- (10.56,-0.21) -- (10.60,-0.25) -- (10.63,-0.27) -- (10.67,-0.30) -- (10.71,-0.33) -- (10.75,-0.35) -- (10.78,-0.37) -- (10.82,-0.39) -- (10.86,-0.41) -- (10.89,-0.42) -- (10.93,-0.44) -- (10.97,-0.45) -- (11.01,-0.47) -- (11.04,-0.48) -- (11.08,-0.49) -- (11.12,-0.50) -- (11.16,-0.52) -- (11.19,-0.53) -- (11.23,-0.54) -- (11.27,-0.55) -- (11.31,-0.55) -- (11.34,-0.56) -- (11.38,-0.57) -- (11.42,-0.58) -- (11.45,-0.59) -- (11.49,-0.59) -- (11.53,-0.60) -- (11.57,-0.61) -- (11.60,-0.62) -- (11.64,-0.62) -- (11.68,-0.63) -- (11.72,-0.63) -- (11.75,-0.64) -- (11.79,-0.65) -- (11.83,-0.65) -- (11.87,-0.66) -- (11.90,-0.66) -- (11.94,-0.67);
\draw[thick, dashed] (9.70,4.58) -- (9.74,2.98) -- (9.77,2.21) -- (9.81,1.65) -- (9.85,1.47) -- (9.89,1.22) -- (9.92,1.19) -- (9.96,0.95) -- (10.00,0.84) -- (10.04,0.74) -- (10.07,0.77) -- (10.11,0.72) -- (10.15,0.58) -- (10.19,0.53) -- (10.22,0.43) -- (10.26,0.47) -- (10.30,0.42) -- (10.33,0.39) -- (10.37,0.45) -- (10.41,0.38) -- (10.45,0.36) -- (10.48,0.34) -- (10.52,0.39) -- (10.56,0.38) -- (10.60,0.32) -- (10.63,0.32) -- (10.67,0.30) -- (10.71,0.34) -- (10.75,0.30) -- (10.78,0.30) -- (10.82,0.27) -- (10.86,0.33) -- (10.89,0.33) -- (10.93,0.31) -- (10.97,0.35) -- (11.01,0.34) -- (11.04,0.37) -- (11.08,0.36) -- (11.12,0.37) -- (11.16,0.35) -- (11.19,0.35) -- (11.23,0.39) -- (11.27,0.37) -- (11.31,0.37) -- (11.34,0.36) -- (11.38,0.38) -- (11.42,0.36) -- (11.45,0.37) -- (11.49,0.36) -- (11.53,0.37) -- (11.57,0.36) -- (11.60,0.37) -- (11.64,0.37) -- (11.68,0.38) -- (11.72,0.37) -- (11.75,0.38) -- (11.79,0.38) -- (11.83,0.37) -- (11.87,0.38) -- (11.90,0.37) -- (11.94,0.38);
\fill (11.94,-0.67) circle (2pt); \fill (11.94,0.38) circle (2pt);
\node[anchor=west] at (8.80,6.32) {MSE at $m = 60$: \ training $0.049$, \ validation $0.140$};
\rb{0.37}{-0.11}\rb{1.19}{0.00}\rb{1.26}{-0.04}\rb{1.72}{-0.01}\rb{2.18}{-0.02}\rb{2.31}{0.47}\rb{2.49}{-0.35}\rb{2.55}{-0.15}\rb{2.70}{0.52}\rb{3.26}{-0.00}\rb{3.30}{-0.02}\rb{3.41}{-0.01}\rb{3.64}{-0.21}\rb{3.89}{0.18}\rb{4.09}{0.04}\rb{4.30}{-0.07}\rb{4.38}{0.04}\rb{5.92}{-0.07}\rb{5.94}{-0.33}\rb{6.22}{-0.05}\rb{6.52}{0.02}\rb{7.45}{0.11}\rb{7.46}{-0.04}\rb{7.54}{0.03}\rb{7.70}{0.09}
\node[anchor=west] at (-0.6,-2.5) {After $60$ rounds the training MSE still falls. The validation MSE has started to rise.};
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 31.4s = "true", 32.1s = "false", 37.7s = "false", repeats}}}]
\draw[hot, line width=1.8pt] (0.00,3.65) -- (0.78,3.65) -- (0.78,4.74) -- (1.49,4.74) -- (1.49,5.11) -- (1.95,5.11) -- (1.95,5.17) -- (2.24,5.17) -- (2.24,5.37) -- (2.40,5.37) -- (2.40,4.98) -- (2.62,4.98) -- (2.62,5.19) -- (2.98,5.19) -- (2.98,4.92) -- (3.36,4.92) -- (3.36,4.44) -- (3.52,4.44) -- (3.52,4.12) -- (4.19,4.12) -- (4.19,3.63) -- (5.15,3.63) -- (5.15,3.37) -- (6.37,3.37) -- (6.37,3.48) -- (6.98,3.48) -- (6.98,3.92) -- (7.50,3.92) -- (7.50,4.29) -- (7.62,4.29) -- (7.62,4.45) -- (8.00,4.45);
\draw[thick] (9.70,4.76) -- (9.74,3.16) -- (9.77,2.34) -- (9.81,1.87) -- (9.85,1.56) -- (9.89,1.29) -- (9.92,1.11) -- (9.96,0.94) -- (10.00,0.77) -- (10.04,0.66) -- (10.07,0.55) -- (10.11,0.45) -- (10.15,0.36) -- (10.19,0.28) -- (10.22,0.21) -- (10.26,0.14) -- (10.30,0.09) -- (10.33,0.03) -- (10.37,-0.02) -- (10.41,-0.07) -- (10.45,-0.11) -- (10.48,-0.15) -- (10.52,-0.19) -- (10.56,-0.21) -- (10.60,-0.25) -- (10.63,-0.27) -- (10.67,-0.30) -- (10.71,-0.33) -- (10.75,-0.35) -- (10.78,-0.37) -- (10.82,-0.39) -- (10.86,-0.41) -- (10.89,-0.42) -- (10.93,-0.44) -- (10.97,-0.45) -- (11.01,-0.47) -- (11.04,-0.48) -- (11.08,-0.49) -- (11.12,-0.50) -- (11.16,-0.52) -- (11.19,-0.53) -- (11.23,-0.54) -- (11.27,-0.55) -- (11.31,-0.55) -- (11.34,-0.56) -- (11.38,-0.57) -- (11.42,-0.58) -- (11.45,-0.59) -- (11.49,-0.59) -- (11.53,-0.60) -- (11.57,-0.61) -- (11.60,-0.62) -- (11.64,-0.62) -- (11.68,-0.63) -- (11.72,-0.63) -- (11.75,-0.64) -- (11.79,-0.65) -- (11.83,-0.65) -- (11.87,-0.66) -- (11.90,-0.66) -- (11.94,-0.67) -- (12.01,-0.68) -- (12.09,-0.69) -- (12.16,-0.70) -- (12.24,-0.71) -- (12.31,-0.72) -- (12.39,-0.73) -- (12.46,-0.74) -- (12.54,-0.75) -- (12.61,-0.76) -- (12.69,-0.77) -- (12.76,-0.77) -- (12.84,-0.78) -- (12.91,-0.79) -- (12.99,-0.80) -- (13.06,-0.81) -- (13.13,-0.81) -- (13.21,-0.82) -- (13.28,-0.83) -- (13.36,-0.84) -- (13.43,-0.84);
\draw[thick, dashed] (9.70,4.58) -- (9.74,2.98) -- (9.77,2.21) -- (9.81,1.65) -- (9.85,1.47) -- (9.89,1.22) -- (9.92,1.19) -- (9.96,0.95) -- (10.00,0.84) -- (10.04,0.74) -- (10.07,0.77) -- (10.11,0.72) -- (10.15,0.58) -- (10.19,0.53) -- (10.22,0.43) -- (10.26,0.47) -- (10.30,0.42) -- (10.33,0.39) -- (10.37,0.45) -- (10.41,0.38) -- (10.45,0.36) -- (10.48,0.34) -- (10.52,0.39) -- (10.56,0.38) -- (10.60,0.32) -- (10.63,0.32) -- (10.67,0.30) -- (10.71,0.34) -- (10.75,0.30) -- (10.78,0.30) -- (10.82,0.27) -- (10.86,0.33) -- (10.89,0.33) -- (10.93,0.31) -- (10.97,0.35) -- (11.01,0.34) -- (11.04,0.37) -- (11.08,0.36) -- (11.12,0.37) -- (11.16,0.35) -- (11.19,0.35) -- (11.23,0.39) -- (11.27,0.37) -- (11.31,0.37) -- (11.34,0.36) -- (11.38,0.38) -- (11.42,0.36) -- (11.45,0.37) -- (11.49,0.36) -- (11.53,0.37) -- (11.57,0.36) -- (11.60,0.37) -- (11.64,0.37) -- (11.68,0.38) -- (11.72,0.37) -- (11.75,0.38) -- (11.79,0.38) -- (11.83,0.37) -- (11.87,0.38) -- (11.90,0.37) -- (11.94,0.38) -- (12.01,0.38) -- (12.09,0.38) -- (12.16,0.39) -- (12.24,0.39) -- (12.31,0.39) -- (12.39,0.43) -- (12.46,0.42) -- (12.54,0.43) -- (12.61,0.43) -- (12.69,0.43) -- (12.76,0.44) -- (12.84,0.44) -- (12.91,0.44) -- (12.99,0.45) -- (13.06,0.45) -- (13.13,0.45) -- (13.21,0.45) -- (13.28,0.45) -- (13.36,0.46) -- (13.43,0.46);
\fill (13.43,-0.84) circle (2pt); \fill (13.43,0.46) circle (2pt);
\node[anchor=west] at (8.80,6.32) {MSE at $m = 100$: \ training $0.034$, \ validation $0.147$};
\rb{0.37}{-0.08}\rb{1.19}{-0.01}\rb{1.26}{-0.05}\rb{1.72}{-0.02}\rb{2.18}{-0.03}\rb{2.31}{0.36}\rb{2.49}{-0.30}\rb{2.55}{-0.10}\rb{2.70}{0.41}\rb{3.26}{0.00}\rb{3.30}{-0.02}\rb{3.41}{-0.01}\rb{3.64}{-0.21}\rb{3.89}{0.18}\rb{4.09}{0.05}\rb{4.30}{-0.05}\rb{4.38}{0.06}\rb{5.92}{-0.04}\rb{5.94}{-0.30}\rb{6.22}{-0.02}\rb{6.52}{0.02}\rb{7.45}{0.11}\rb{7.46}{-0.04}\rb{7.54}{0.03}\rb{7.70}{0.09}
\node[anchor=west] at (-0.6,-2.5) {After $100$ rounds the fit has steps for single noisy points.};
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 32.1s = "true", 34.3s = "false", 37.7s = "false", repeats}}}]
\draw[hot, line width=1.8pt] (0.00,3.62) -- (0.78,3.62) -- (0.78,4.72) -- (1.49,4.72) -- (1.49,5.09) -- (1.95,5.09) -- (1.95,5.15) -- (2.24,5.15) -- (2.24,5.47) -- (2.40,5.47) -- (2.40,4.91) -- (2.62,4.91) -- (2.62,5.32) -- (2.98,5.32) -- (2.98,4.92) -- (3.36,4.92) -- (3.36,4.43) -- (3.52,4.43) -- (3.52,4.12) -- (4.19,4.12) -- (4.19,3.63) -- (5.15,3.63) -- (5.15,3.34) -- (6.37,3.34) -- (6.37,3.49) -- (6.98,3.49) -- (6.98,3.94) -- (7.50,3.94) -- (7.50,4.31) -- (7.62,4.31) -- (7.62,4.47) -- (8.00,4.47);
\draw[thick] (9.70,4.76) -- (9.74,3.16) -- (9.77,2.34) -- (9.81,1.87) -- (9.85,1.56) -- (9.89,1.29) -- (9.92,1.11) -- (9.96,0.94) -- (10.00,0.77) -- (10.04,0.66) -- (10.07,0.55) -- (10.11,0.45) -- (10.15,0.36) -- (10.19,0.28) -- (10.22,0.21) -- (10.26,0.14) -- (10.30,0.09) -- (10.33,0.03) -- (10.37,-0.02) -- (10.41,-0.07) -- (10.45,-0.11) -- (10.48,-0.15) -- (10.52,-0.19) -- (10.56,-0.21) -- (10.60,-0.25) -- (10.63,-0.27) -- (10.67,-0.30) -- (10.71,-0.33) -- (10.75,-0.35) -- (10.78,-0.37) -- (10.82,-0.39) -- (10.86,-0.41) -- (10.89,-0.42) -- (10.93,-0.44) -- (10.97,-0.45) -- (11.01,-0.47) -- (11.04,-0.48) -- (11.08,-0.49) -- (11.12,-0.50) -- (11.16,-0.52) -- (11.19,-0.53) -- (11.23,-0.54) -- (11.27,-0.55) -- (11.31,-0.55) -- (11.34,-0.56) -- (11.38,-0.57) -- (11.42,-0.58) -- (11.45,-0.59) -- (11.49,-0.59) -- (11.53,-0.60) -- (11.57,-0.61) -- (11.60,-0.62) -- (11.64,-0.62) -- (11.68,-0.63) -- (11.72,-0.63) -- (11.75,-0.64) -- (11.79,-0.65) -- (11.83,-0.65) -- (11.87,-0.66) -- (11.90,-0.66) -- (11.94,-0.67) -- (12.01,-0.68) -- (12.09,-0.69) -- (12.16,-0.70) -- (12.24,-0.71) -- (12.31,-0.72) -- (12.39,-0.73) -- (12.46,-0.74) -- (12.54,-0.75) -- (12.61,-0.76) -- (12.69,-0.77) -- (12.76,-0.77) -- (12.84,-0.78) -- (12.91,-0.79) -- (12.99,-0.80) -- (13.06,-0.81) -- (13.13,-0.81) -- (13.21,-0.82) -- (13.28,-0.83) -- (13.36,-0.84) -- (13.43,-0.84) -- (13.51,-0.85) -- (13.58,-0.86) -- (13.66,-0.86) -- (13.73,-0.87) -- (13.81,-0.87) -- (13.88,-0.88) -- (13.96,-0.89) -- (14.03,-0.89) -- (14.11,-0.90) -- (14.18,-0.90) -- (14.25,-0.91) -- (14.33,-0.91) -- (14.40,-0.92) -- (14.48,-0.92) -- (14.55,-0.93) -- (14.63,-0.93) -- (14.70,-0.94) -- (14.78,-0.94) -- (14.85,-0.95) -- (14.93,-0.95) -- (15.00,-0.95) -- (15.08,-0.96) -- (15.15,-0.96) -- (15.23,-0.97) -- (15.30,-0.97);
\draw[thick, dashed] (9.70,4.58) -- (9.74,2.98) -- (9.77,2.21) -- (9.81,1.65) -- (9.85,1.47) -- (9.89,1.22) -- (9.92,1.19) -- (9.96,0.95) -- (10.00,0.84) -- (10.04,0.74) -- (10.07,0.77) -- (10.11,0.72) -- (10.15,0.58) -- (10.19,0.53) -- (10.22,0.43) -- (10.26,0.47) -- (10.30,0.42) -- (10.33,0.39) -- (10.37,0.45) -- (10.41,0.38) -- (10.45,0.36) -- (10.48,0.34) -- (10.52,0.39) -- (10.56,0.38) -- (10.60,0.32) -- (10.63,0.32) -- (10.67,0.30) -- (10.71,0.34) -- (10.75,0.30) -- (10.78,0.30) -- (10.82,0.27) -- (10.86,0.33) -- (10.89,0.33) -- (10.93,0.31) -- (10.97,0.35) -- (11.01,0.34) -- (11.04,0.37) -- (11.08,0.36) -- (11.12,0.37) -- (11.16,0.35) -- (11.19,0.35) -- (11.23,0.39) -- (11.27,0.37) -- (11.31,0.37) -- (11.34,0.36) -- (11.38,0.38) -- (11.42,0.36) -- (11.45,0.37) -- (11.49,0.36) -- (11.53,0.37) -- (11.57,0.36) -- (11.60,0.37) -- (11.64,0.37) -- (11.68,0.38) -- (11.72,0.37) -- (11.75,0.38) -- (11.79,0.38) -- (11.83,0.37) -- (11.87,0.38) -- (11.90,0.37) -- (11.94,0.38) -- (12.01,0.38) -- (12.09,0.38) -- (12.16,0.39) -- (12.24,0.39) -- (12.31,0.39) -- (12.39,0.43) -- (12.46,0.42) -- (12.54,0.43) -- (12.61,0.43) -- (12.69,0.43) -- (12.76,0.44) -- (12.84,0.44) -- (12.91,0.44) -- (12.99,0.45) -- (13.06,0.45) -- (13.13,0.45) -- (13.21,0.45) -- (13.28,0.45) -- (13.36,0.46) -- (13.43,0.46) -- (13.51,0.46) -- (13.58,0.47) -- (13.66,0.47) -- (13.73,0.47) -- (13.81,0.48) -- (13.88,0.48) -- (13.96,0.48) -- (14.03,0.49) -- (14.11,0.49) -- (14.18,0.50) -- (14.25,0.50) -- (14.33,0.51) -- (14.40,0.51) -- (14.48,0.51) -- (14.55,0.52) -- (14.63,0.52) -- (14.70,0.52) -- (14.78,0.53) -- (14.85,0.53) -- (14.93,0.54) -- (15.00,0.54) -- (15.08,0.54) -- (15.15,0.54) -- (15.23,0.55) -- (15.30,0.55);
\fill (15.30,-0.97) circle (2pt); \fill (15.30,0.55) circle (2pt);
\node[anchor=west] at (8.80,6.32) {MSE at $m = 150$: \ training $0.023$, \ validation $0.155$};
\rb{0.37}{-0.06}\rb{1.19}{0.01}\rb{1.26}{-0.03}\rb{1.72}{-0.01}\rb{2.18}{-0.01}\rb{2.31}{0.27}\rb{2.49}{-0.24}\rb{2.55}{-0.04}\rb{2.70}{0.30}\rb{3.26}{0.00}\rb{3.30}{-0.02}\rb{3.41}{-0.01}\rb{3.64}{-0.21}\rb{3.89}{0.18}\rb{4.09}{0.05}\rb{4.30}{-0.05}\rb{4.38}{0.06}\rb{5.92}{-0.02}\rb{5.94}{-0.28}\rb{6.22}{0.00}\rb{6.52}{0.01}\rb{7.45}{0.09}\rb{7.46}{-0.06}\rb{7.54}{0.01}\rb{7.70}{0.07}
\node[anchor=west] at (-0.6,-2.5) {After $150$ rounds the training MSE is $0.023$. The validation MSE has risen to $0.155$.};
\end{scope}
\begin{scope}[animate = {myself: = {:visible = {0s = "false", 34.3s = "true", 37.7s = "true", repeats}}}]
\draw[hot, line width=1.8pt] (0.00,3.82) -- (0.78,3.82) -- (0.78,4.79) -- (1.49,4.79) -- (1.49,5.03) -- (2.98,5.03) -- (2.98,4.93) -- (3.36,4.93) -- (3.36,4.44) -- (3.52,4.44) -- (3.52,4.13) -- (4.19,4.13) -- (4.19,3.65) -- (5.15,3.65) -- (5.15,3.53) -- (6.98,3.53) -- (6.98,3.89) -- (7.50,3.89) -- (7.50,4.21) -- (7.62,4.21) -- (7.62,4.32) -- (8.00,4.32);
\draw[thick] (9.70,4.76) -- (9.74,3.16) -- (9.77,2.34) -- (9.81,1.87) -- (9.85,1.56) -- (9.89,1.29) -- (9.92,1.11) -- (9.96,0.94) -- (10.00,0.77) -- (10.04,0.66) -- (10.07,0.55) -- (10.11,0.45) -- (10.15,0.36) -- (10.19,0.28) -- (10.22,0.21) -- (10.26,0.14) -- (10.30,0.09) -- (10.33,0.03) -- (10.37,-0.02) -- (10.41,-0.07) -- (10.45,-0.11) -- (10.48,-0.15) -- (10.52,-0.19) -- (10.56,-0.21) -- (10.60,-0.25) -- (10.63,-0.27) -- (10.67,-0.30) -- (10.71,-0.33) -- (10.75,-0.35) -- (10.78,-0.37) -- (10.82,-0.39) -- (10.86,-0.41) -- (10.89,-0.42) -- (10.93,-0.44) -- (10.97,-0.45) -- (11.01,-0.47) -- (11.04,-0.48) -- (11.08,-0.49) -- (11.12,-0.50) -- (11.16,-0.52) -- (11.19,-0.53) -- (11.23,-0.54) -- (11.27,-0.55) -- (11.31,-0.55) -- (11.34,-0.56) -- (11.38,-0.57) -- (11.42,-0.58) -- (11.45,-0.59) -- (11.49,-0.59) -- (11.53,-0.60) -- (11.57,-0.61) -- (11.60,-0.62) -- (11.64,-0.62) -- (11.68,-0.63) -- (11.72,-0.63) -- (11.75,-0.64) -- (11.79,-0.65) -- (11.83,-0.65) -- (11.87,-0.66) -- (11.90,-0.66) -- (11.94,-0.67) -- (12.01,-0.68) -- (12.09,-0.69) -- (12.16,-0.70) -- (12.24,-0.71) -- (12.31,-0.72) -- (12.39,-0.73) -- (12.46,-0.74) -- (12.54,-0.75) -- (12.61,-0.76) -- (12.69,-0.77) -- (12.76,-0.77) -- (12.84,-0.78) -- (12.91,-0.79) -- (12.99,-0.80) -- (13.06,-0.81) -- (13.13,-0.81) -- (13.21,-0.82) -- (13.28,-0.83) -- (13.36,-0.84) -- (13.43,-0.84) -- (13.51,-0.85) -- (13.58,-0.86) -- (13.66,-0.86) -- (13.73,-0.87) -- (13.81,-0.87) -- (13.88,-0.88) -- (13.96,-0.89) -- (14.03,-0.89) -- (14.11,-0.90) -- (14.18,-0.90) -- (14.25,-0.91) -- (14.33,-0.91) -- (14.40,-0.92) -- (14.48,-0.92) -- (14.55,-0.93) -- (14.63,-0.93) -- (14.70,-0.94) -- (14.78,-0.94) -- (14.85,-0.95) -- (14.93,-0.95) -- (15.00,-0.95) -- (15.08,-0.96) -- (15.15,-0.96) -- (15.23,-0.97) -- (15.30,-0.97);
\draw[thick, dashed] (9.70,4.58) -- (9.74,2.98) -- (9.77,2.21) -- (9.81,1.65) -- (9.85,1.47) -- (9.89,1.22) -- (9.92,1.19) -- (9.96,0.95) -- (10.00,0.84) -- (10.04,0.74) -- (10.07,0.77) -- (10.11,0.72) -- (10.15,0.58) -- (10.19,0.53) -- (10.22,0.43) -- (10.26,0.47) -- (10.30,0.42) -- (10.33,0.39) -- (10.37,0.45) -- (10.41,0.38) -- (10.45,0.36) -- (10.48,0.34) -- (10.52,0.39) -- (10.56,0.38) -- (10.60,0.32) -- (10.63,0.32) -- (10.67,0.30) -- (10.71,0.34) -- (10.75,0.30) -- (10.78,0.30) -- (10.82,0.27) -- (10.86,0.33) -- (10.89,0.33) -- (10.93,0.31) -- (10.97,0.35) -- (11.01,0.34) -- (11.04,0.37) -- (11.08,0.36) -- (11.12,0.37) -- (11.16,0.35) -- (11.19,0.35) -- (11.23,0.39) -- (11.27,0.37) -- (11.31,0.37) -- (11.34,0.36) -- (11.38,0.38) -- (11.42,0.36) -- (11.45,0.37) -- (11.49,0.36) -- (11.53,0.37) -- (11.57,0.36) -- (11.60,0.37) -- (11.64,0.37) -- (11.68,0.38) -- (11.72,0.37) -- (11.75,0.38) -- (11.79,0.38) -- (11.83,0.37) -- (11.87,0.38) -- (11.90,0.37) -- (11.94,0.38) -- (12.01,0.38) -- (12.09,0.38) -- (12.16,0.39) -- (12.24,0.39) -- (12.31,0.39) -- (12.39,0.43) -- (12.46,0.42) -- (12.54,0.43) -- (12.61,0.43) -- (12.69,0.43) -- (12.76,0.44) -- (12.84,0.44) -- (12.91,0.44) -- (12.99,0.45) -- (13.06,0.45) -- (13.13,0.45) -- (13.21,0.45) -- (13.28,0.45) -- (13.36,0.46) -- (13.43,0.46) -- (13.51,0.46) -- (13.58,0.47) -- (13.66,0.47) -- (13.73,0.47) -- (13.81,0.48) -- (13.88,0.48) -- (13.96,0.48) -- (14.03,0.49) -- (14.11,0.49) -- (14.18,0.50) -- (14.25,0.50) -- (14.33,0.51) -- (14.40,0.51) -- (14.48,0.51) -- (14.55,0.52) -- (14.63,0.52) -- (14.70,0.52) -- (14.78,0.53) -- (14.85,0.53) -- (14.93,0.54) -- (15.00,0.54) -- (15.08,0.54) -- (15.15,0.54) -- (15.23,0.55) -- (15.30,0.55);
\fill (15.30,-0.97) circle (2pt); \fill (15.30,0.55) circle (2pt);
\draw[hot, thick] (10.82,-1.23) -- (10.82,2.91);
\filldraw[draw=black, fill=hot] (10.82,0.27) circle (2.6pt);
\node[anchor=south west, inner sep=1pt] at (10.87,2.66) {\footnotesize stop at $m = 30$};
\node[anchor=west] at (8.80,6.32) {MSE at $m = 30$: \ training $0.073$, \ validation $0.130$};
\rb{0.37}{-0.23}\rb{1.19}{-0.05}\rb{1.26}{-0.09}\rb{1.72}{0.04}\rb{2.18}{0.08}\rb{2.31}{0.64}\rb{2.49}{-0.34}\rb{2.55}{-0.14}\rb{2.70}{0.55}\rb{3.26}{-0.01}\rb{3.30}{-0.03}\rb{3.41}{-0.02}\rb{3.64}{-0.22}\rb{3.89}{0.18}\rb{4.09}{0.04}\rb{4.30}{-0.08}\rb{4.38}{0.04}\rb{5.92}{-0.18}\rb{5.94}{-0.44}\rb{6.22}{-0.16}\rb{6.52}{-0.02}\rb{7.45}{0.14}\rb{7.46}{-0.02}\rb{7.54}{0.10}\rb{7.70}{0.20}
\node[anchor=west] at (-0.6,-2.5) {Early stopping keeps $F_{30}$, the round with the lowest validation MSE.};
\end{scope}
\pf{0.37,3.55}\pf{1.19,4.73}\pf{1.26,4.68}\pf{1.72,5.08}\pf{2.18,5.13}\pf{2.31,5.78}\pf{2.49,4.62}\pf{2.55,4.87}\pf{2.70,5.67}\pf{3.26,4.92}\pf{3.30,4.90}\pf{3.41,4.42}\pf{3.64,3.88}\pf{3.89,4.34}\pf{4.09,4.18}\pf{4.30,3.56}\pf{4.38,3.69}\pf{5.92,3.32}\pf{5.94,3.02}\pf{6.22,3.35}\pf{6.52,3.50}\pf{7.45,4.05}\pf{7.46,3.87}\pf{7.54,4.32}\pf{7.70,4.55}
\end{tikzpicture}
\end{document}Derivation
At round , XGBoost looks for the tree that minimizes the penalized training loss
A second-order Taylor expansion of each loss term around gives
The first term in the brackets does not depend on . Every point in leaf gets , so grouping the points by leaf leaves
Each bracket is a parabola in with its minimum at and minimum value . Splitting one leaf into and replaces its term by two terms and adds one leaf, which costs . The resulting drop in the objective is the gain formula. A convex loss has , so each parabola opens upward whenever .
Examples
(Medium) Two Rounds of Boosting by Hand
A drone company predicts delivery time from distance. Four past deliveries covered km and took minutes. The model uses squared error, stumps and .
Run two rounds. What are the predictions and the training MSE after each round? , the mean time, with residuals and MSE . Round 1 tries the thresholds , and km on the residuals. Their summed squared errors are , and , so the stump splits at km. Its leaves hold the mean residuals and . Adding half of each gives with MSE . The new residuals are . Round 2 scores the same thresholds at , and , so this stump splits at km. Its leaves hold and , which gives and MSE . The first stump had removed half of the long trip's error. The remaining residuals separate short trips from long ones, so the second stump chose a new split.
The start is
(Hard) One XGBoost Split for Fraud Detection
Six card transactions are labeled fraud () or legitimate (), and three are fraud. The model starts at , so every . A candidate split asks whether the merchant is foreign. The domestic transactions include fraud, and the foreign ones are both fraud. The loss is log loss, with and .
Find the leaf weights, the gain, and the new fraud probabilities with . Would the split survive ? For log loss, and , as in 4.3. Logistic Regression. So for a legitimate transaction, for fraud, and for all six. The domestic leaf has and . The foreign leaf has and . The weights are and . The parent has , so its term in the gain vanishes: With , the domestic score becomes and the foreign score . The probabilities become and . The mean log loss falls from to . With , the gain is , so XGBoost would not split. Without , the Newton steps would be and . The penalty shrank the two-point foreign leaf by a factor of . It shrank the domestic leaf by a factor of .
See Also
- 5.2. Random Forests, which averages independent deep trees instead of adding dependent shallow ones.
- 5.1. Decision Trees, the base learner and its split search.
- 5. Tree-Based Methods, which compares boosting with forests and single trees.
- 2.2.4. Log Loss, the usual loss for boosted classifiers.