Skip to content

Machine Learning Interview Questions in Chennai

36 practice questions with answers for Machine Learning interviews in Chennai.

Machine Learning jobs in Chennai

Chennai is a long-standing IT-services and SaaS hub along OMR, with strong demand for testing, data and support-engineering roles. Many companies here hire freshers in large batches and train them on the job.

Below are 36 questions that match the mix of service, product and domain employers hiring machine learning engineers in Chennai.

Solved for ChennaiStart 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.
3 questions free Unlock the rest in seconds
01

How do you choose the number of clusters k?

Save to ▾
Show answer
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.
02

How do you build a scikit-learn pipeline for mixed numeric and categorical data?

Save to ▾
Show answer
Use ColumnTransformer inside a Pipeline so preprocessing is fit only on training folds. from sklearn.compose import ColumnTransformer from sklearn.pipeline import Pipeline from sklearn.impute import SimpleImputer from sklearn.preprocessing import StandardScaler, OneHotEncoder num = Pipeline([('imp', SimpleImputer(strategy='median')), ('sc', StandardScaler())]) pre = ColumnTransformer([ ('num', num, num_cols), ('cat', OneHotEncoder(handle_unknown='ignore'), cat_cols) ]) model = Pipeline([('pre', pre), ('clf', LogisticRegression(max_iter=1000))])
03

What does it mean to deploy a machine learning model?

Save to ▾
Show answer
Deployment makes a trained model available to produce predictions for real users or systems. It can be batch, scoring data on a schedule and writing results to a table, or real-time, serving predictions through a REST API, or streaming, scoring events as they arrive. It includes packaging the model with its preprocessing, setting up infrastructure, logging, monitoring and a retraining plan.
04

Your dataset has a city column with 2,000 unique values. How will you encode it?

Save to ▾
Show answer
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.
05

What is data leakage? Give two examples.

Save to ▾
Show answer
Data leakage is when information not available at prediction time gets into training, giving falsely high validation scores. Example one: fitting a scaler or imputer on the full dataset before splitting. Example two: using a feature created after the event, such as 'refund issued' when predicting fraud. Prevent it with pipelines, time-aware splits and checking each feature's timestamp.
06

What are the assumptions of linear regression?

Save to ▾
Show answer
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.
07

What is the curse of dimensionality?

Save to ▾
Show answer
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.
08

Tell me about a time a production model failed and how you communicated it.

Save to ▾
Show answer
Situation: our daily scoring job silently produced all-zero scores for two days after an upstream column was renamed. Task: fix it and inform affected teams. Action: I rolled back to cached scores, patched the feature mapping, and sent a short note explaining impact, cause and fix. I then added schema validation and a check on score distribution. Result: the issue never repeated, and teams trusted our alerts more.
09

What should you monitor for a model in production?

Save to ▾
Show answer
Monitor service health such as latency, error rate and throughput; input data quality such as missing values, schema changes and out-of-range values; feature and prediction distribution drift; and real performance once labels arrive. Also track business KPIs the model influences. Set alerts with thresholds and owners, and keep a dashboard so issues are found before users report them.
10

What makes XGBoost, LightGBM and CatBoost different?

Save to ▾
Show answer
XGBoost adds regularisation to the objective, uses second-order gradients and handles missing values natively. LightGBM grows trees leaf-wise and uses histogram binning, making it very fast on large data, though it can overfit small data. CatBoost handles categorical features with ordered target statistics and uses symmetric trees, giving strong defaults with less tuning. All three support GPU training.
11

Write a unit test for a model prediction function.

Save to ▾
Show answer
import joblib, pandas as pd def test_predict_shape_and_range(): model = joblib.load('model_v1.joblib') df = pd.DataFrame([{'age': 30, 'income': 50000.0, 'city': 'Pune'}, {'age': 45, 'income': 0.0, 'city': 'UnknownCity'}]) p = model.predict_proba(df)[:, 1] assert p.shape == (2,) assert ((p >= 0) & (p <= 1)).all() Run with pytest in CI so broken artifacts never reach production.
12

How does k-means clustering work?

Save to ▾
Show answer
k-means picks k initial centroids, assigns each point to its nearest centroid, recomputes each centroid as the mean of its points, and repeats until assignments stop changing. It minimises within-cluster sum of squares (inertia). It needs k in advance, scaled features, and assumes roughly spherical, similar-sized clusters. k-means++ initialisation and multiple runs with n_init reduce bad starting points.
13

What is the no free lunch theorem and what does it mean in practice?

Save to ▾
Show answer
It states that no single algorithm is best for every problem when averaged over all possible problems. In practice it means you should try several model families, start with a simple baseline, and choose based on validation results for your data. For tabular data gradient boosting often wins, but a logistic regression may be preferred if interpretability matters more.
14

Compare batch scoring and real-time inference.

Save to ▾
Show answer
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.
15

Train LightGBM with early stopping.

Save to ▾
Show answer
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.
16

Log a training run to MLflow.

Save to ▾
Show answer
import mlflow, mlflow.sklearn mlflow.set_experiment('churn') with mlflow.start_run(): pipe.fit(X_train, y_train) auc = roc_auc_score(y_val, pipe.predict_proba(X_val)[:, 1]) mlflow.log_params({'C': 1.0, 'model': 'logreg'}) mlflow.log_metric('val_auc', auc) mlflow.sklearn.log_model(pipe, 'model', registered_model_name='churn-model')
17

What is one-hot encoding and when can it cause problems?

Save to ▾
Show answer
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.
18

What is the ROC curve and AUC? When is PR-AUC better?

Save to ▾
Show answer
The ROC curve plots true positive rate against false positive rate at every threshold, and AUC is the probability that a random positive is ranked above a random negative. It is threshold-independent. On heavily imbalanced data, like 0.5 percent fraud, ROC-AUC can look high even when precision is poor, so the precision-recall curve and PR-AUC give a more honest picture.
19

A model's accuracy dropped 10 percent over three months in production. How do you investigate?

Save to ▾
Show answer
I would first check data pipelines for broken features, nulls or schema changes, then compare current feature distributions with training data using PSI to find drift. I would check whether the label definition or business process changed, and analyse errors by segment. If drift is real, retrain on recent data, possibly with time-weighted samples, and set up automatic drift alerts and scheduled retraining.
20

Write a simple Dockerfile for an ML API.

Save to ▾
Show answer
FROM python:3.12-slim WORKDIR /app COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt COPY app.py model_v1.joblib ./ EXPOSE 8000 CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"] The exec-form CMD avoids a shell wrapper. Pin versions in requirements.txt so training and serving match.
21

You are asked to predict customer churn. How would you frame the ML problem from scratch?

Save to ▾
Show answer
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.
22

Check calibration with a reliability curve and Brier score.

Save to ▾
Show answer
from sklearn.calibration import CalibrationDisplay from sklearn.metrics import brier_score_loss proba = clf.predict_proba(X_test)[:, 1] print('Brier', brier_score_loss(y_test, proba)) CalibrationDisplay.from_predictions(y_test, proba, n_bins=10) plt.show() Points on the diagonal mean predicted probabilities match observed frequencies.
23

What is polynomial regression and what risk does it carry?

Save to ▾
Show answer
Polynomial regression adds powers and interaction terms of features, such as x squared and x1 times x2, so a linear model can fit curves. It is still linear in its coefficients. The main risk is overfitting at high degrees, plus wild behaviour outside the training range. Use cross-validation to choose the degree, scale features, and combine it with Ridge regularisation.
24

How do you build a text classifier with TF-IDF and logistic regression?

Save to ▾
Show answer
from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.linear_model import LogisticRegression from sklearn.pipeline import make_pipeline clf = make_pipeline( TfidfVectorizer(ngram_range=(1, 2), min_df=2, sublinear_tf=True), LogisticRegression(max_iter=1000, class_weight='balanced') ) clf.fit(train_texts, train_labels) print(clf.score(test_texts, test_labels))
25

What are overfitting and underfitting, and how do you detect them?

Save to ▾
Show answer
Overfitting is when a model memorises training noise and performs much worse on unseen data. Underfitting is when the model is too simple to capture the pattern, so both training and validation scores are poor. Detect them by comparing training and validation metrics or plotting learning curves. A large gap means overfitting; two low, close scores mean underfitting.
26

Tell me about a time you balanced model accuracy against a business constraint.

Save to ▾
Show answer
Situation: our lead-scoring model had the best AUC with a large ensemble, but the CRM needed scores within 50 ms. Task: meet latency without losing much quality. Action: I compared a smaller LightGBM model with fewer features and measured both AUC and latency. Result: we lost 0.01 AUC but met the 50 ms limit, and sales teams adopted it because scores appeared instantly.
27

Detect anomalies with Isolation Forest.

Save to ▾
Show answer
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.
28

How do you plot an ROC curve and get AUC in scikit-learn?

Save to ▾
Show answer
from sklearn.metrics import roc_auc_score, RocCurveDisplay import matplotlib.pyplot as plt proba = clf.predict_proba(X_test)[:, 1] print('AUC', roc_auc_score(y_test, proba)) RocCurveDisplay.from_predictions(y_test, proba) plt.show() Pass probabilities or decision scores, not hard labels, otherwise the curve has only one point.
29

Find the most similar items using cosine similarity.

Save to ▾
Show answer
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.
30

Build RFM features for customer segmentation in pandas.

Save to ▾
Show answer
snap = df['order_date'].max() + pd.Timedelta(days=1) rfm = df.groupby('customer_id').agg( recency=('order_date', lambda d: (snap - d.max()).days), frequency=('order_id', 'nunique'), monetary=('amount', 'sum')) rfm[['frequency', 'monetary']] = np.log1p(rfm[['frequency', 'monetary']]) Scale these columns before clustering.
31

Compare filter, wrapper and embedded feature selection methods.

Save to ▾
Show answer
Filter methods score features independently of a model using statistics such as correlation, chi-square or mutual information; they are fast but ignore interactions. Wrapper methods like Recursive Feature Elimination train models on feature subsets; they are accurate but slow. Embedded methods select during training, such as L1 regularisation or tree feature importances. Embedded methods are a common practical middle ground.
32

The fraud team can only review 500 alerts a day. How do you set the threshold?

Save to ▾
Show answer
Instead of 0.5, rank transactions by predicted probability and pick the threshold that yields about 500 alerts per day on recent data. Then report precision and recall at that cut-off, or precision at k. I would monitor daily alert volume because drift can change it, and recompute the threshold periodically. If cost data exists, I would choose the threshold that maximises expected savings.
33

Two models have RMSE 120 and 125, but the second has much lower MAE. Which do you choose?

Save to ▾
Show answer
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.
34

Your dataset has 800 correlated features and the model trains slowly. What would you do?

Save to ▾
Show answer
I would remove constant and near-duplicate features, drop one from each highly correlated pair, then apply PCA inside the pipeline and keep components explaining about 95 percent of variance. Alternatively, use L1-regularised models or tree importances for supervised selection. I would compare speed and cross-validated scores; often 50 to 100 features give nearly the same accuracy.
35

What is data drift and concept drift?

Save to ▾
Show answer
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.
36

What is a holdout set and why should it be touched only once?

Save to ▾
Show answer
A holdout or test set is kept aside for the final evaluation after all model and hyperparameter choices are done. If you check it repeatedly and adjust the model, you are indirectly tuning on it, so its score becomes optimistic. Use cross-validation or a separate validation set for decisions, and report the holdout score once as the realistic estimate.

Companies with offices in Chennai (4)

Frequently asked questions

Which companies hire Machine Learning professionals in Chennai?

Companies with large offices in Chennai include Amazon, Walmart, Tiger Analytics, TCS. Use their company pages below to practise employer-specific sets.

Are Machine Learning interviews in Chennai different from other cities?

The questions depend more on the company than the city. Chennai's mix of employers decides the style: Many companies here hire freshers in large batches and train them on the job

How do I find Machine Learning jobs in Chennai?

Shortlist companies with Chennai offices, keep your CV focused on Machine Learning projects, apply on company career pages and job portals with the Chennai filter, and practise the questions on this page before each interview.