Decision Tree vs Linear Regression

The data follows a curved relationship: y = x/2 + sin(x) + noise. Watch how a straight line and a decision tree try to learn the same nonlinear pattern.

Linear Regression

Creates one straight line. It captures the overall direction, but it cannot follow every curve.

Decision Tree Regression

Divides the input into regions. Each region receives its own prediction, creating a staircase-shaped curve.