tree() — Decision trees (CART)

Splits the data into regions with simple yes/no questions.

tree(depth, X, y)

Key idea

Definition

a region (leaf) carved by the splits
the prediction in that region (its mean)
how many questions deep the tree goes

In plain words

Play twenty questions with the data: each yes/no answer narrows things down until you can make a guess.

Where you'd use it

Frequently asked questions

Why do single trees overfit?
They keep splitting until the leaves are pure. Prune, limit depth, or use a forest.