36 practice questions with answers for Machine Learning interviews in Mumbai.
Machine Learning jobs in Mumbai
Mumbai is India's financial capital, so banks, fintechs, insurers, media and consulting firms drive much of the hiring. Data and QA interviews often include domain questions on payments, risk, trading or customer analytics.
Below are 36 questions that match the mix of service, product and domain employers hiring machine learning engineers in Mumbai.
Solved for MumbaiStart practicing
3 QUESTIONS FREESign up to unlock the full question bank and track your progress.Unlock every question and answer, then continue practising company-wise and package-wise.
Gradient boosting starts with a simple prediction, like the mean, then repeatedly fits a small tree to the negative gradient of the loss, which for MSE is just the residuals. Each tree's output is scaled by a learning rate and added to the ensemble. A lower learning rate with more trees usually generalises better. Any differentiable loss can be used, which makes it flexible.
from sklearn.model_selection import LearningCurveDisplay
import numpy as np
LearningCurveDisplay.from_estimator(model, X, y, cv=5,
train_sizes=np.linspace(0.1, 1.0, 6), scoring='roc_auc', n_jobs=-1)
plt.show()
A persistent gap between curves suggests more data or regularisation; two low curves suggest a richer model or better features.
Linear regression assumes a linear relationship between features and target, independent errors, constant error variance (homoscedasticity), normally distributed errors for valid inference, and little multicollinearity among features. Violations mainly hurt confidence intervals and coefficient interpretation more than raw predictions. Check them with residual plots, Q-Q plots, the Durbin-Watson test and VIF.
04
You must build a spam classifier quickly with limited compute. What do you choose?
I would use TF-IDF features with a Multinomial Naive Bayes or linear model like logistic regression or LinearSVC. They train in seconds, handle high-dimensional sparse text well and give strong baselines. I would evaluate precision carefully because blocking genuine mail is costly. Only if this is not good enough would I try fine-tuning a small transformer model.
05
How do you create polynomial features with regularisation in a pipeline?
from sklearn.preprocessing import PolynomialFeatures, StandardScaler
from sklearn.linear_model import Ridge
from sklearn.pipeline import make_pipeline
model = make_pipeline(
PolynomialFeatures(degree=2, include_bias=False),
StandardScaler(),
Ridge(alpha=1.0)
)
model.fit(X_train, y_train)
Tune degree and alpha together with GridSearchCV to avoid overfitting.
06
How do you prioritise when several teams ask you for models at the same time?
I estimate each request's business value, effort and urgency, then share a ranked list with my manager so priorities are agreed rather than assumed. For quick wins I offer a simple baseline first. In one quarter this helped us deliver a high-value churn model first while giving another team a dashboard-based interim answer, and both teams knew the timeline.
07
What is one-hot encoding and when can it cause problems?
One-hot encoding turns a categorical column into binary columns, one per category, so models do not assume order. It causes problems with high-cardinality features like city or product ID, creating thousands of sparse columns and higher memory and overfitting risk. Alternatives are target encoding, frequency encoding, hashing, or grouping rare categories into 'Other'. Use handle_unknown='ignore' for unseen categories.
08
Compute permutation importance on validation data.
from sklearn.inspection import permutation_importance
import pandas as pd
r = permutation_importance(model, X_val, y_val, n_repeats=10,
scoring='roc_auc', random_state=42, n_jobs=-1)
imp = pd.Series(r.importances_mean, index=X_val.columns)
print(imp.sort_values(ascending=False))
Near-zero or negative values mean the feature adds little on unseen data.
09
Leadership wants a model in one week, but data quality is poor. How do you handle it?
I would agree on a narrow first version: a simple, explainable baseline built on the cleanest available fields, with clear notes on data gaps and expected accuracy. In parallel I would log specific data issues and their impact. Delivering a working baseline with an honest limitations section builds trust and gives a reference point for improvement in later iterations.
10
Run stratified 5-fold cross-validation with multiple metrics.
from sklearn.model_selection import StratifiedKFold, cross_validate
cv = StratifiedKFold(n_splits=5, shuffle=True, random_state=42)
res = cross_validate(pipe, X, y, cv=cv,
scoring=['roc_auc', 'average_precision', 'f1'], n_jobs=-1)
for k in ['test_roc_auc', 'test_average_precision', 'test_f1']:
print(k, res[k].mean().round(3), res[k].std().round(3))
Fix random seeds in NumPy, Python and the model, pin library versions in requirements.txt, version the data or record its hash, and save the exact code commit and hyperparameters. Tools like MLflow log parameters, metrics and artifacts per run. Use pipelines so preprocessing is identical each time, and keep the train-test split stored rather than recreated randomly.
Switch to random search or Optuna with pruning, which find good settings with far fewer trials. Narrow ranges using a quick coarse search, tune the most important parameters first, use early stopping for boosting, run trials in parallel with n_jobs, and tune on a stratified sample of the data before a final refit on the full set. HalvingRandomSearchCV is another quick option.
14
You need prediction intervals, not just point estimates, for delivery time. How?
Options are quantile regression, training separate models for the 10th and 90th percentiles with GradientBoostingRegressor(loss='quantile') or LightGBM; conformal prediction, which wraps any model and gives intervals with guaranteed coverage; or bootstrapping. I would check calibration: about 80 percent of actual values should fall within an 80 percent interval on a holdout set.
It depends on error cost. The first model makes fewer big errors, while the second is better on typical cases but has some large misses. If large errors are expensive, such as stock-outs of costly items, choose the first. If typical accuracy matters more, choose the second. I would also check error distributions by segment and discuss with stakeholders before deciding.
17
How do you explain the precision-recall trade-off to a business manager?
I use their own example. For fraud: 'If we flag more transactions, we catch more fraud, which is recall, but more genuine customers get blocked, which hurts precision. Here is a table of what each threshold means per day: frauds caught, customers disturbed, reviews needed.' Then we choose the threshold together based on cost. Managers relate much better to counts than to percentages.
import lightgbm as lgb
m = lgb.LGBMClassifier(n_estimators=5000, learning_rate=0.05,
num_leaves=31, subsample=0.8, subsample_freq=1, colsample_bytree=0.8)
m.fit(X_train, y_train, eval_set=[(X_val, y_val)],
eval_metric='auc', callbacks=[lgb.early_stopping(100)])
print(m.best_iteration_)
The large n_estimators is only an upper limit; early stopping picks the real number.
As the number of features grows, data becomes sparse in the feature space, distances between points become similar, and the amount of data needed to generalise grows rapidly. Distance-based methods like k-NN and k-means suffer most. Remedies include feature selection, dimensionality reduction such as PCA, regularisation and collecting more data. Text and genomics data often face this problem.
20
You are asked to predict customer churn. How would you frame the ML problem from scratch?
First define churn precisely, for example no purchase in 60 days, and the prediction window. It becomes binary classification. Build features from data available before the cut-off date only, choose a time-based split, and pick metrics like recall at a fixed precision or lift in the top decile. Start with logistic regression as a baseline, then try boosting, and agree on how retention teams will use the scores.
21
Your random forest model file is 2 GB and too slow for real-time scoring. What can you do?
Reduce size by limiting max_depth and min_samples_leaf, using fewer trees since gains flatten after a few hundred, and dropping weak features. Alternatively switch to a gradient boosting model like LightGBM, which usually gives similar accuracy with far smaller, faster models. Converting to ONNX or using a compiled predictor can also speed up inference. Measure accuracy and latency after each change.
22
What is the difference between parameters and hyperparameters?
Parameters are learned from data during training, such as the weights of a linear regression or split thresholds of a tree. Hyperparameters are set before training and control the learning process, such as learning rate, max_depth, number of trees or regularisation strength C. Hyperparameters are tuned with validation data using grid search, random search or Bayesian optimisation.
Principal Component Analysis finds new orthogonal axes, the principal components, that capture maximum variance in the data. It works by computing eigenvectors of the covariance matrix, or via SVD, after centring and usually standardising the data. Keeping the top components that explain, say, 95 percent of variance reduces dimensions, removes correlation and speeds up models, but the components are harder to interpret.
Batch scoring runs on a schedule, for example nightly churn scores for all customers written to a table; it is simple, cheap and tolerant of slow models. Real-time inference returns predictions on request, such as fraud checks during payment, and needs low latency, high availability, scaling and fresh features. Choose real-time only when the decision must happen at the moment of the event.
Data drift, or covariate shift, means the distribution of input features changes, such as average order value rising after a pricing change. Concept drift means the relationship between features and target changes, such as fraud patterns evolving. Data drift can be detected without labels using PSI or KS tests; concept drift usually needs labels and shows up as falling performance. Both trigger investigation and retraining.
26
How do you handle disagreement with a senior colleague about model choice?
I keep it about evidence. In one project a senior preferred a complex model while I proposed regularised regression. I suggested we compare both on the same cross-validation folds and also measure inference time and explainability. The complex model was only 1 percent better, so we chose the simpler one. I made sure to credit his idea of the extra features, which we kept.
Softmax turns a vector of raw scores into probabilities that sum to one: p_i = exp(z_i) / sum of exp(z_j). It is used in multinomial logistic regression and the output layer of neural networks for multiclass problems. Larger scores get exponentially larger shares. In practice the maximum score is subtracted before exponentiation to avoid numerical overflow.
28
How do you approach a time series forecasting problem differently from normal regression?
Time series data is ordered and autocorrelated, so random splits leak future information. I use time-based splits or TimeSeriesSplit, create lag and rolling-window features from past values only, and handle trend and seasonality. Baselines like last value or seasonal naive come first. Models range from ARIMA and Prophet to gradient boosting on lag features.
29
How would you encode cyclical features like hour of day or month?
Map the value onto a circle with sine and cosine so the end connects to the start.
import numpy as np
df['hour_sin'] = np.sin(2 * np.pi * df['hour'] / 24)
df['hour_cos'] = np.cos(2 * np.pi * df['hour'] / 24)
Now 23:00 and 00:00 are close, which linear and distance-based models cannot see with raw integers. Tree models often manage with the raw value.
30
Your model shows 99 percent training accuracy but 72 percent validation accuracy. What will you do?
This is overfitting. I would first check for leakage or a split mismatch, then simplify the model: add regularisation, reduce depth or features, use early stopping, or prune trees. I would gather more data or use augmentation if possible and use cross-validation to confirm the fix. Plotting learning curves shows whether more data would actually help.
from sklearn.ensemble import IsolationForest
iso = IsolationForest(n_estimators=300, contamination=0.01, random_state=42)
iso.fit(X_train)
scores = -iso.score_samples(X_new)
flags = iso.predict(X_new) == -1
Higher scores mean more anomalous. Tune contamination to match how many alerts reviewers can handle.
Common methods are the elbow method, plotting inertia against k and looking for the bend; the silhouette score, which measures how close points are to their own cluster versus the next one; and the gap statistic. Business usability matters too: four clear segments a marketing team can act on are better than nine statistically optimal but confusing ones.
33
Find the most similar items using cosine similarity.
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.neighbors import NearestNeighbors
X = TfidfVectorizer(min_df=2).fit_transform(df['title'])
nn = NearestNeighbors(n_neighbors=6, metric='cosine').fit(X)
dist, idx = nn.kneighbors(X[0])
print(df['title'].iloc[idx[0][1:]].tolist())
The first neighbour is the item itself, so skip it.
34
Labels for your loan model arrive only after 6 months. How do you monitor it meanwhile?
I would rely on proxy signals: input data drift with PSI, prediction score distribution, approval rates by segment, and early indicators like first missed payment at 30 or 60 days. Once enough early outcomes arrive, I would check performance on these. I would also set up a delayed evaluation job that computes full metrics as labels mature and compares them with the validation baseline.
35
Your dataset has a city column with 2,000 unique values. How will you encode it?
One-hot would create 2,000 sparse columns, so I would first group rare cities below a frequency threshold into 'Other'. Then options are frequency encoding, out-of-fold target encoding, or mapping cities to useful attributes such as tier, state or population. For boosting models like CatBoost or LightGBM, native categorical handling also works well. I would compare options with cross-validation.
36
Tell me about a time you discovered your own mistake after sharing results.
Situation: after presenting a 12 percent uplift from a pricing model, I found my evaluation used a random split on time-series data. Task: correct it quickly. Action: I re-ran with a time-based split, which showed 7 percent, and informed my manager the same day with the corrected analysis. Result: the team appreciated the honesty, the rollout plan used the right number, and I added split checks to our review template.
Which companies hire Machine Learning professionals in Mumbai?
Companies with large offices in Mumbai include Google, Paytm, Razorpay, JP Morgan Chase, Fractal Analytics, TCS, Accenture, Quantiphi. Use their company pages below to practise employer-specific sets.
Are Machine Learning interviews in Mumbai different from other cities?
The questions depend more on the company than the city. Mumbai's mix of employers decides the style: Data and QA interviews often include domain questions on payments, risk, trading or customer analytics
How do I find Machine Learning jobs in Mumbai?
Shortlist companies with Mumbai offices, keep your CV focused on Machine Learning projects, apply on company career pages and job portals with the Mumbai filter, and practise the questions on this page before each interview.