36 practice questions with answers for Machine Learning interviews in Kochi.
Machine Learning jobs in Kochi
Kochi's Infopark and SmartCity host IT-services firms, product companies and start-ups, making it Kerala's largest tech job market along with Thiruvananthapuram. Testing and data roles are common in its service and product teams.
Below are 36 questions that match the mix of service, product and domain employers hiring machine learning engineers in Kochi.
Solved for KochiStart 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
Why do we split data into training, validation and test sets?
The training set fits model parameters, the validation set is used to choose hyperparameters and compare models, and the test set gives a final unbiased estimate of performance. If you tune on the test set, its score becomes optimistic because information has leaked into model choices. A common split is 70/15/15, or train/test plus cross-validation on the training part.
02
Build RFM features for customer segmentation in pandas.
Association rule mining finds items that occur together, such as in market basket analysis. Support is how often an itemset appears in all transactions. Confidence of A to B is the share of transactions with A that also contain B. Lift is confidence divided by B's support; lift above 1 means A and B occur together more than by chance. Apriori and FP-Growth are common algorithms.
04
How do you tune the alpha of Ridge regression using cross-validation?
RidgeCV tests many alphas efficiently; scale features first.
from sklearn.linear_model import RidgeCV
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import StandardScaler
import numpy as np
m = make_pipeline(StandardScaler(), RidgeCV(alphas=np.logspace(-3, 3, 30)))
m.fit(X_train, y_train)
print(m[-1].alpha_)
LassoCV and ElasticNetCV work the same way.
05
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.
06
How do you select the top k features using mutual information in scikit-learn?
SelectKBest with mutual_info_classif captures non-linear relationships, unlike plain correlation.
from sklearn.feature_selection import SelectKBest, mutual_info_classif
sel = SelectKBest(score_func=mutual_info_classif, k=20)
X_new = sel.fit_transform(X_train, y_train)
print(X_train.columns[sel.get_support()])
Put the selector inside a pipeline so selection is redone in each CV fold.
07
Compare filter, wrapper and embedded feature selection methods.
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.
08
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.
09
The segments you built six months ago no longer match customer behaviour. What do you do?
I would measure drift by comparing feature distributions and segment sizes over time. Then refit clustering on recent data and map new clusters to old ones by centroid similarity so business names stay consistent. I would set up a quarterly refresh with stability checks and alert when segment sizes shift sharply, and explain any renamed or merged segments to stakeholders.
10
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.
Situation: a product-return prediction model had 0.68 AUC with logistic regression. Task: improve it for a warehouse pilot. Action: I engineered features like past return rate per customer and category, moved to LightGBM with early stopping, and tuned it with Optuna on time-based folds. Result: AUC rose to 0.81, and the pilot reduced avoidable returns in two categories. I documented each step's gain.
14
How does ordinary least squares find the regression coefficients?
OLS chooses coefficients that minimise the sum of squared residuals between actual and predicted values. It has a closed-form solution, beta = (X^T X)^-1 X^T y, when X^T X is invertible. For very large or ill-conditioned data, gradient descent or a pseudo-inverse is used instead. Squaring errors penalises large mistakes heavily, which makes OLS sensitive to outliers.
15
How do you decide when a model is good enough to stop tuning?
I agree on a target metric and business threshold before starting, such as recall of 70 percent at 90 percent precision. I stop tuning when gains fall below the noise between CV folds or when further work costs more than the expected value. In one project I stopped at a 0.3 percent gain and spent the time on monitoring instead, which proved more useful.
16
What makes XGBoost, LightGBM and CatBoost different?
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.
17
How do you implement simple gradient descent for linear regression in NumPy?
Compute predictions, the gradient of MSE, and update weights in a loop.
import numpy as np
w = np.zeros(X.shape[1]); b = 0.0; lr = 0.01
for _ in range(1000):
err = X @ w + b - y
w -= lr * (2 / len(y)) * (X.T @ err)
b -= lr * (2 / len(y)) * err.sum()
Scale features first or the loop converges slowly.
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.
19
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.
The kernel trick computes dot products of data in a high-dimensional feature space without explicitly transforming the data, using a kernel function such as RBF, exp(-gamma times squared distance). This lets linear algorithms like SVM learn non-linear boundaries efficiently. In RBF SVMs, larger gamma makes each point's influence more local, which can lead to overfitting.
Log loss, or cross-entropy, is the negative average log of the probability assigned to the true class. It heavily penalises confident wrong predictions, such as predicting 0.99 for an event that does not happen. It evaluates probability quality, not just ranking, so it suits problems where probabilities drive decisions. Lower is better, and a constant base-rate prediction is the baseline to beat.
22
What is target encoding and how do you avoid leakage with it?
Target encoding replaces each category with the mean target value for that category, which works well for high-cardinality features. It leaks if computed on the full data because each row sees its own label. Avoid this by computing encodings out-of-fold within cross-validation and adding smoothing toward the global mean for rare categories. scikit-learn 1.3+ has TargetEncoder with built-in cross-fitting.
23
Random forest and LightGBM give the same AUC. Which would you deploy?
I would compare beyond AUC: model size, inference latency, training time, calibration and stability across time periods. LightGBM is usually smaller and faster to score, while random forest needs less tuning and is less prone to overfitting. If both are equal, I would choose the one that is cheaper to run and easier for the team to maintain and retrain.
24
Business users do not trust a gradient boosting model because it is a black box. How do you help?
I would use SHAP to show global drivers with a summary plot and explain individual decisions with waterfall plots, such as why one applicant got a high risk score. I would also check that the top drivers make business sense, add monotonic constraints where logic requires it, and share a few real case examples. If trust is still an issue, a scorecard model can serve as a transparent benchmark.
25
What is the ROC curve and AUC? When is PR-AUC better?
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.
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.
27
Use statsmodels to get p-values for regression coefficients.
import statsmodels.api as sm
Xc = sm.add_constant(X_train)
ols = sm.OLS(y_train, Xc).fit()
print(ols.summary())
The summary shows coefficients, standard errors, p-values, confidence intervals, R-squared and diagnostics. scikit-learn focuses on prediction and does not report p-values, so statsmodels is preferred for inference.
28
A product team wants 'similar products' recommendations with no purchase labels. How would you start?
I would build product embeddings from content: TF-IDF or sentence embeddings of titles and descriptions, plus category and price features. Then use cosine similarity with nearest-neighbour search, such as scikit-learn NearestNeighbors or an approximate index like FAISS for large catalogues. I would review samples with the product team and later add co-view or co-purchase signals once collected.
29
Marketing wants customer segments for campaigns. How do you approach it?
I would agree on the purpose first, such as retention or upsell. Then build RFM features (recency, frequency, monetary) plus category preferences, log-transform skewed values and scale them. I would try k-means for k between 3 and 8, use silhouette and business review to pick k, profile each segment and give them clear names. Finally, test segment-based campaigns against a control group.
30
40 percent of values in an important income column are missing. What do you do?
I would study the missingness pattern first, for example whether self-employed applicants skip it. I would add a binary was_missing feature, impute with the median within relevant groups or use IterativeImputer, and compare against models that handle missing values natively, like HistGradientBoosting or XGBoost. I would also raise the issue with the data owner so collection can improve.
31
What is k-fold cross-validation and why is it better than a single split?
k-fold cross-validation splits training data into k folds, trains on k-1 folds and validates on the remaining one, repeating k times so every row is validated once. Averaging the k scores gives a more stable estimate than one random split and shows variance across folds. Five or ten folds are common. Use StratifiedKFold for classification and GroupKFold when rows from one user must stay together.
A model registry is a central store of model versions with metadata: training data version, parameters, metrics, owner and stage such as staging or production. It makes promotions and rollbacks controlled and auditable, and lets serving systems load a model by name and version. MLflow Model Registry, SageMaker Model Registry and Vertex AI Model Registry are common examples.
33
What should you monitor for a model in production?
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.
34
How do you keep learning new ML techniques while working full time?
I set a small weekly routine: one paper summary or library release note, and one hands-on experiment on a public dataset. I follow scikit-learn and LightGBM release notes, and I rebuild ideas on a small problem before suggesting them at work. Recently I tried TunedThresholdClassifierCV and later used it to replace a manual threshold script in our project.
35
What are shadow deployment and canary release for models?
In shadow deployment the new model receives a copy of live traffic and its predictions are logged but not used, so you can compare it with the current model safely. In a canary release a small share of real traffic, such as 5 percent, is served by the new model, and the share grows if metrics stay healthy. Both reduce the risk of a bad model affecting all users.
36
How do you build a scikit-learn pipeline for mixed numeric and categorical data?
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))])
Few big employers listed in Kochi?
Many Kochi candidates also apply to teams in Bangalore and to remote or hybrid roles. Practise the Bangalore set as well.
Which companies hire Machine Learning professionals in Kochi?
Companies with large offices in Kochi include many IT services and product firms. Use their company pages below to practise employer-specific sets.
Are Machine Learning interviews in Kochi different from other cities?
The questions depend more on the company than the city. Kochi's mix of employers decides the style: Testing and data roles are common in its service and product teams
How do I find Machine Learning jobs in Kochi?
Shortlist companies with Kochi offices, keep your CV focused on Machine Learning projects, apply on company career pages and job portals with the Kochi filter, and practise the questions on this page before each interview.