Skip to content
Preptima

Machine Learning interview questions

The modelling half of an ML loop: supervised and unsupervised methods, features and leakage, metric choice, imbalance, deep learning foundations, forecasting and ranking.

24 published across 8 topics.

Machine learning fundamentals58 short answers on one page, for revising rather than studying.

Linear and logistic models, trees and gradient boosting, regularisation, and choosing a family from the data and the constraints rather than by habit.

mediumConcept

What does regularisation do to a model, and how do L1 and L2 differ in their effect?

Regularisation adds a penalty on coefficient size to the objective, so each coefficient must buy its own weight with error. L2 shrinks smoothly and spreads weight across correlated features; L1 has a constant gradient towards zero, so it drives coefficients exactly to zero and selects features as a side effect.

4 minentry, mid, senior
All 3 in Supervised Learning

Encoding, scaling and interaction terms, target and temporal leakage, train-serve skew, and the features that quietly encode the label.

hardDesignScenario

Where does train-serve skew come from, and how do you stop it?

Skew is any difference between the feature values a model trained on and the ones it receives at request time. It comes from two implementations of one transformation, joins that ignore the as-of timestamp, and features unavailable in a request. Prevent it with shared code, as-of joins and served-vector logging.

5 minmid, senior, staff
mediumConceptScenario

What is target leakage, and how would you catch it before the model ships?

Target leakage is a feature carrying information that would not exist at prediction time, so the model is partly reading the answer. The two forms are a column written after the label event and an aggregate over a window including it. You catch it by auditing when each column is written.

5 minmid, senior, staff
All 3 in Feature Engineering & Leakage

Cross-validation that respects structure, ROC versus precision-recall, calibration, threshold selection, and tying a metric to a business decision.

All 3 in Model Evaluation & Metrics

Fraud and failure-scale imbalance, resampling and class weights, why accuracy is meaningless here, and evaluating at the operating point you will run.

hardConceptScenario

How do you choose the decision threshold for a classifier, and what makes it move?

Derive it from the two error costs. Acting is worthwhile when its expected cost falls below the cost of inaction, which gives a threshold of the false-positive cost over the sum of both. With calibrated probabilities that threshold is fixed as prevalence moves; under a fixed alert budget it must move.

6 minmid, senior, staff
hardConcept

Class weights, oversampling, undersampling, SMOTE. What does each one cost you?

None of them adds information. Weights change the loss without touching the data, oversampling duplicates rows and inflates any score computed after it, undersampling discards real observations, and SMOTE interpolates implausible points. All shift the implied prior, so the scores need recalibrating.

5 minmid, senior, staff
All 3 in Imbalanced & Rare Events

Clustering and its evaluation, dimensionality reduction, density and isolation methods, and detecting anomalies with no labels to learn from.

mediumConceptDesignScenario

You need to flag anomalies and nobody has labelled a single one. How do you build it?

Model what normal looks like and score deviation from it, using distance or density methods, an isolation forest, or reconstruction error from an autoencoder. Then set the threshold from how many alerts the team can investigate per day, because an unlabelled score distribution cannot tell you where to cut.

4 minmid, senior, staff
mediumConcept

When does dimensionality reduction help, and when does it hide the problem?

It helps when features are genuinely redundant, when a downstream method needs dense low-dimensional input, or when you must compress for cost. It hides the problem when PCA's linearity assumption discards the signal, and when a t-SNE or UMAP picture is used as evidence for a modelling decision it cannot support.

4 minmid, senior, staff
All 3 in Unsupervised & Anomaly Detection

Backpropagation, optimisers and learning-rate behaviour, normalisation and regularisation, attention and transformers, and when a neural net is not the answer.

mediumConceptScenario

How do you choose an optimiser and a learning-rate schedule?

Start with AdamW because it needs less tuning, and consider SGD with momentum where you have the budget to tune it and want its generalisation behaviour. The schedule matters more than the choice: a short warmup, then decay, and read the loss curve to tell a rate that is too high from a model that has stopped learning.

5 minmid, senior, staff
mediumConceptDesign

When is a neural network the wrong choice?

On small and medium tabular data, where gradient-boosted trees usually match it for a fraction of the effort; where a decision must be explained exactly rather than approximately; and where a tight CPU latency or memory budget makes it unservable. The simpler model then wins on every axis that matters.

5 minmid, senior, staff, lead
All 3 in Deep Learning Foundations

Stationarity and seasonality, backtesting without lookahead, horizon and hierarchy, and why a random split ruins a forecasting model.

mediumConceptScenario

Why does a random train-test split ruin a forecasting model?

Because it puts future observations in the training set, so the model is scored on interpolating between points it has already seen rather than on predicting forward. The correct evaluation is a rolling-origin backtest, and every feature must be computable from data available strictly before the timestamp it describes.

4 minentry, mid, senior, staff
All 3 in Time Series & Forecasting

Collaborative and content signals, candidate generation then ranking, cold start, position bias and feedback loops, and offline-online metric divergence.

hardDesignScenario

How do you handle cold start for a brand new user and a brand new item?

Fall back to content features and segment popularity while behavioural signal is absent, then blend towards collaborative scores as interactions accumulate. New items also need guaranteed exploration impressions, or the already-popular items take all the traffic and nothing can dislodge them.

5 minmid, senior, staff, lead
All 3 in Recommenders & Ranking