Polynomial features, source convention. A row [2, 3] keeps its originals, adds the squares, then the cross term:
[2, 3] → [2, 3, 2², 3², 2·3] = [2, 3, 4, 9, 6]
column count = n originals + n squares + n(n−1)/2 pairs
= n(n+3)/2
n = 2 → 5 n = 3 → 9
n = 10 → 65 n = 100 → 5,150 (51× the raw columns)
the lab's interaction check:
best single-feature cut on x: 9/14 = 0.643
best single-feature cut on y: 9/14 = 0.643
best cut on x·y: 14/14 = 1.000
Log transform. Incomes 10, 20 and 1,000 ($k) become log(1 + x) = 2.40, 3.04, 6.91. The gap between 20 and 1,000 is 50× in raw units but only 2.3× on the log scale — the transform trades raw distance for a fair comparison of orders of magnitude. (Log is undefined at 0, which is why every library ships log1p, log(1 + x).)
Binning. Ages 0.5, 12, 27, 44 and 49.9 into 5 bins over the observed [0, 50] range: width = (50 − 0)/5 = 10, so the bin index is floor(age / 10) capped at 4 → 0, 1, 2, 4, 4. The bin edges are a fitted statistic: compute them on training rows and reuse them, or test values fall into different bins than the model was trained on.
TF-IDF. Three documents: “cat sat mat”, “dog sat mat”, “cat dog run run”. The word sat appears in 2 of 3 documents, so IDF = ln(3/2) = 0.4055; its TF in document 1 is 1/3, giving 0.1352. The word run appears in 1 document, so IDF = ln(3/1) = 1.0986; its TF in document 3 is 2/4 = 0.5, giving 0.5493 — about 4× the weight of sat, from one extra occurrence, because it is the rarer word.