Quiz: forests on feature tables, and feature importance
Before this unit: Bagging and random forests (previous unit); Day 2: Edges, blobs and ridges.
See also: Day 12: Thresholding; Day 16: Measurements.
Short questions to test your understanding. Try each on paper first, then open the answer.
Q1. Your table has area in µm², intensity in camera counts (0–4095) and solidity (0–1). Do you need to standardise the columns before training a forest?
What does a split compare?
No. Each split compares one feature with its own threshold; the units and ranges of the other features play no role. (Distance-based classifiers such as nearest neighbour or the SVM do need it.)
Q2. How is the impurity importance of a feature computed, in one sentence?
Every split purifies its node a little.
Add up the impurity decreases of all splits that use the feature, each weighted by the fraction of the training objects reaching that node, and average over the trees.
Q3. Why is permutation importance usually computed on out-of-bag or held-out objects rather than on the training objects?
What is the training error of a forest of deep trees?
On the training objects the forest is almost perfect and partly memorised; shuffling a column measures how much the memorisation depends on it, not how much prediction on new objects does. On OOB or held-out objects the error rise is about generalisation.
Q4. Area has permutation importance 0.1 points, perimeter 0.3, equivalent diameter −0.2. Can you drop all three?
What happens when you shuffle one of three features that carry the same information?
Not without checking: the three are strongly correlated, so each can be shuffled without loss because the other two still carry the size. Shuffle them together (or drop all three and compare the OOB error). If that hurts, size matters, and one of them (any) should be kept.
Q5. A random noise column gets 8 % of the impurity importance. How can that be?
Where in the tree do these splits happen?
Deep trees split small nodes until they are pure. In a small node, a continuous noise feature with many distinct values offers many thresholds and often purifies the node best by chance. These decreases are counted on the training data, so noise collects a share. Its permutation importance on OOB data stays near zero.
Q6. Shuffling the area column creates cells with a large area and a small perimeter. Why is that a problem for permutation importance?
Did the forest ever see such cells?
Such objects do not exist in the data; the forest’s predictions for them are extrapolations that were never trained. The error rise then partly measures the behaviour on impossible objects, not the value of the feature. Permuting correlated features as a group avoids this.
Q7. (math) In a tree, a node with 40 objects and Gini 0.48 is split into children of 30 objects (Gini 0.2) and 10 objects (Gini 0). The training set has 200 objects. What does this split add to its feature’s impurity importance?
\tfrac{n_t}{n}\Delta G.
\Delta G = 0.48 - \tfrac{30}{40}0.2 - 0 = 0.33; weighted by 40/200 = 0.2: 0.066.