Interview Q&A / Machine Learning
Machine Learning interview questions
Supervised vs unsupervised learning, overfitting, metrics and the classic models, explained simply.
Prefer rapid revision? Practise Machine Learning short interview answers →
- How does a decision tree work, and why does a random forest usually perform better?
A decision tree splits data with a series of yes/no questions, choosing each split to make the groups as pure as possible. A single deep tree overfits easily. A random forest trains many trees on random samples of rows and features and averages their votes, which reduces variance and usually improves accuracy.
IntermediateIn-depth4 min read - How does a decision tree predict a number in regression?
It splits the data to reduce squared error and each leaf predicts the average target of the rows in it. The output is therefore piecewise constant, a staircase, not a smooth line.
IntermediateQuick answer1 min read - What are entropy and information gain in a decision tree?
Entropy measures how mixed a group is: 0 when pure, 1 for a 50-50 split of two classes. Information gain is the entropy before a split minus the weighted entropy after. The tree picks the split with the highest gain.
IntermediateQuick answer1 min read