Fresher machine learning interviews focus on concepts and judgement: do you understand what a model is doing, how to tell if it is any good, and how to avoid fooling yourself? Here are the questions to prepare.
Fundamentals
Supervised vs unsupervised learning
Supervised learning uses labelled examples (inputs with known answers) to predict the answer for new inputs: regression and classification. Unsupervised learning finds structure without labels: clustering and dimensionality reduction.
Regression vs classification
Regression predicts a number (price, time). Classification predicts a category (default or not, spam or not).
What is a feature? What is a label?
Features are the input columns used to make a prediction; the label (target) is what you are predicting.
Model quality
What is overfitting?
The model learns the training data too closely, including noise, and performs poorly on new data. Sign: high training score, much lower test score. Fixes: simpler model, more data, regularization, limiting tree depth, cross-validation, fewer features.
What is underfitting?
The model is too simple to capture the pattern; it performs poorly on both training and test data. Fixes: a more flexible model, better features.
Explain the bias-variance trade-off
Bias is error from overly simple assumptions (underfitting). Variance is error from sensitivity to the particular training data (overfitting). Making a model more complex usually lowers bias and raises variance; the goal is the balance that minimises error on new data.
Why split data into train and test sets?
To measure performance on data the model has not seen, which is the only honest estimate of how it will behave in practice.
What is cross-validation?
Splitting the data into k folds, training on k − 1 and testing on the remaining one, rotating k times and averaging. It gives a more reliable estimate than a single split. See train-test split and cross-validation.
What is data leakage?
When information that would not be available at prediction time sneaks into training, for example scaling using the whole dataset before splitting, or a feature recorded after the outcome. It produces unrealistically good scores.
Regularization
What is regularization?
Adding a penalty for large coefficients to discourage overly complex models. L2 (Ridge) shrinks coefficients smoothly; L1 (Lasso) can shrink some to exactly zero, effectively selecting features. Try it in the regularization playground.
Metrics
Why is accuracy not always enough?
With imbalanced classes, a model can score high accuracy by always predicting the majority class. Use precision, recall, F1 and ROC-AUC. See confusion matrix, precision and recall.
Precision vs recall
Precision: of predicted positives, how many were right. Recall: of actual positives, how many were found. Choose based on which mistake costs more.
Regression metrics
MAE (average absolute error), RMSE (penalises large errors more), R² (share of variance explained).
Algorithms
- Linear vs logistic regression: number vs probability of a class. Read more.
- How does a decision tree split? It picks the feature and threshold that best separate the classes, using a measure such as Gini impurity or entropy.
- Random forest vs decision tree: many trees on random samples and features, voting together, which reduces overfitting. Read more.
- Why scale features for KNN and SVM? Both depend on distances, so large-range features would dominate.
- How do you choose K in K-Means? Elbow method, silhouette score and business usefulness.
- What does PCA do? Combines correlated features into fewer components that keep most of the variance.
Practical judgement
- "Your model has 99% accuracy. What do you check?" Class balance, leakage, test set used properly, the confusion matrix.
- "How would you handle missing values?" Understand why they are missing, then drop, impute or flag, fitting any imputation on training data only.
- "How would you explain your model to a manager?" Focus on what it predicts, how good it is in business terms and what drives its predictions.
Prepare with hands-on work
Every algorithm in our ML section has a worked example, a visual playground and practice questions. Being able to say "I built this and here is what I learned" is the strongest answer to almost any ML interview question.
Practise what you just read
Reading helps; writing the code yourself is what sticks. Start here: