[ { "id": "trees-pre-1", "stage": "pre", "question": "What does Gini impurity measure at a decision tree node?", "options": [ "The total number of samples at the node", "The probability of misclassifying a randomly chosen sample given the class distribution at that node", "The correlation between features", "The depth of the node in the tree" ], "correct": 1, "explanation": "Gini impurity = 1 - sum(p_k^2). It measures how often a randomly chosen sample would be misclassified if labeled according to the class distribution at that node. Pure node = 0." }, { "id": "trees-pre-2", "stage": "pre", "question": "What is the main advantage of tree-based models over neural networks for tabular data?", "options": [ "Trees train faster on GPU hardware", "Trees handle mixed feature types, require less preprocessing, and are more interpretable", "Trees can process images and text natively", "Trees always have lower bias than neural networks" ], "correct": 1, "explanation": "Trees natively handle numeric and categorical features without encoding, require minimal preprocessing, and produce interpretable rules. Neural networks excel at spatial/sequential data, not flat tables." }, { "id": "trees-post-1", "stage": "post", "question": "Why does a random forest use both bootstrap sampling AND random feature subsets at each split?", "options": [ "To reduce the depth of individual trees", "To ensure each tree sees every data point at least once", "To speed up training by reducing the dataset size", "To create diverse, decorrelated trees so that averaging reduces variance without increasing bias" ], "correct": 3, "explanation": "Both sources of randomness make the trees diverse. Without feature randomization, all trees would split on the same dominant feature. Diversity is what makes averaging effective at reducing variance." }, { "id": "trees-post-2", "stage": "post", "question": "A node contains 8 dogs and 2 cats. What is its Gini impurity?", "options": [ "0.20", "0.50", "0.32", "0.0" ], "correct": 2, "explanation": "Gini = 1 - (0.8^2 + 0.2^2) = 1 - (0.64 + 0.04) = 0.32. The node is mostly dogs but not pure, so Gini is between 0 (pure) and 0.5 (max for binary)." }, { "id": "trees-post-3", "stage": "post", "question": "MDI (Mean Decrease in Impurity) feature importance is biased toward which type of feature?", "options": [ "Binary features with only two values", "Features with low variance", "High-cardinality features with many possible split points", "Features that are highly correlated with the target" ], "correct": 2, "explanation": "MDI is biased toward high-cardinality features because they offer more possible split points, giving them more chances to reduce impurity by luck. Permutation importance is more reliable." } ]