Lesson 35
LightGBM
Grow boosted trees leaf by leaf, expanding the leaf with the largest error first, which trains faster on wide tables. One example is on this page.
Intermediate12 min
What You Will Learn
- Idea
- Example
- When to use it
Idea
LightGBM is gradient boosting that grows a tree by the leaf, not by a full level. The leaf whose split would cut the loss the most is expanded next. That spends depth where the data is still wrong, and it skips work on leaves that are already pure.
Example
leaves = {"left": 4.2, "right": 1.1}
chosen = max(leaves, key=leaves.get)
print(f"grow next: {chosen}")
print(f"error: {leaves[chosen]:.1f}")Output:
grow next: left
error: 4.2When to use it
- Use it on large tabular data when training time matters.
- Leaf-wise growth can overfit small tables. Limit leaves and depth.
- Histogram binning is why it stays fast as the row count grows.
Loading playground…