Skip to content
BIASED

Decision trees

Block 1 of 8~2 min

Questions instead of weights

The topic Multiclass and multilabel classification closed the linear part of the course. One-vs-rest, one-vs-one and softmax regression handle KK classes, and independent sigmoids handle several labels at once. Every one of those models scores an object by a weighted sum of its features, ⟨wk,x⟩+bk\langle w_k, x \rangle + b_k.

A weighted sum has two habits that tabular data dislike. First, it needs numbers on comparable scales, so categories have to be encoded and features scaled, as in the topic Data, features and leakage. Second, it treats each feature on its own. In the credit task, the rule "a higher income lowers the risk of default, unless the debt is also high" says that the effect of income depends on the debt. Such a rule is an interaction. A linear model gets it only through a hand-made feature like income × debt, or through a kernel from the topic Kernels, which has to be chosen and whose Gram matrix grows as n2n^2.

A decision tree starts from the other end. Its building block is a yes-or-no question about one feature, xj≤tx_j \le t. An object starts at the root, answers the question, goes left or right, and repeats until it reaches a leaf, which returns a stored answer.

Interactions come for free: the next question is asked on one side of the previous answer only. "Is the income at most 40? If not, is the debt at most 25?" asks about debt for high earners alone, so debt matters for them and not for the others.

Classes are {0,1}\{0, 1\} when there are two of them and 1,…,K1, \dots, K in general. A leaf can store any number of classes, so a tree needs no one-vs-rest wrapper.

Answers are saved on the server and tied to this browser until you sign in.