# The accumulative tree structure in a tree based gradient boosting

I'm playing with gradient boosting methods and with its python packages out there. I tried lightgbm, started with a high-dimensional input to predict a task. A left the training settings to default (which means n_estimator=100 and n_leaves=31) and fitting was done without anything going wrong. I assumed that at each step, it makes a 31-leaves tree to fit inputs to the (pseudo-)residuals, find the proper $$\gamma_{jm}$$ for each partition of the $$m$$th tree and then up the results with some shrinkage rate $$\nu$$ in which I have used the wikipedia's notation.

So to me, after fitting, I should have 100 trees, each partitioning the input into 31 sections and estimation a score for that. Yet the splitting point over each tree can be different. Therefore, I expected the resultant estimator to have partitioned my input into n_estimator * n_leaves + 1 regions and have attributed score over each single one of them.

I tried to visualize the tree and found out that the resultant tree only has 31 leaves. How can it be? What am I missing?

Your description sounds like the algorithm is working correctly. Each tree can have up to 31 leaves, depending on other parameters like max_depth and min_data_in_leaf. Visualizing the last tree, or any tree, will show up to 31 leaves.