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 - What is bootstrap sampling and the out-of-bag score in a random forest?
Each tree trains on a bootstrap sample: n rows drawn with replacement, containing about 63% of the unique rows. The remaining roughly 37% are out-of-bag for that tree and give a free validation estimate.
IntermediateQuick answer1 min read - Which hyperparameters matter most in a random forest?
n_estimators (more trees gives stable results with diminishing returns), max_features (how many features each split considers), max_depth, min_samples_leaf and min_samples_split. max_features and min_samples_leaf usually matter most.
IntermediateQuick answer1 min read