InterviewStack.io LogoInterviewStack.io

Machine Learning Algorithms and Theory Questions

Core supervised and unsupervised machine learning algorithms and the theoretical principles that guide their selection and use. Covers linear regression, logistic regression, decision trees, random forests, gradient boosting, support vector machines, k means clustering, hierarchical clustering, principal component analysis, and anomaly detection. Topics include model selection, bias variance trade off, regularization, overfitting and underfitting, ensemble methods and why they reduce variance, computational complexity and scaling considerations, interpretability versus predictive power, common hyperparameters and tuning strategies, and practical guidance on when each algorithm is appropriate given data size, feature types, noise, and explainability requirements.

MediumTechnical
25 practiced
Implement functions in Python to compute ROC and Precision–Recall (PR) curves from `y_true` and `y_scores` without using sklearn. Return arrays of thresholds and corresponding (TPR, FPR) for ROC and (precision, recall) for PR, and compute AUCs. Discuss how ties in scores affect both curves and numerical stability considerations.
HardTechnical
29 practiced
Case study: False positive manual-review cost is $50, false negative lost revenue is $200. Design a cost-sensitive ML approach to minimize expected operational cost: define expected cost, propose ways to incorporate costs at training time (reweighting or custom loss), choose operating threshold, and describe an A/B testing plan to validate business impact.
EasyTechnical
27 practiced
Implement k-means clustering from scratch in Python. Your function should accept X (numpy array), k, max_iters, init='random' or 'kmeans++', random_seed and return centroids, labels, and inertia (sum of squared distances). Handle empty clusters robustly and explain complexity and typical failure modes.
MediumTechnical
26 practiced
You have limited compute budget and need to tune XGBoost on 10M rows. Propose a practical hyperparameter tuning strategy that balances search quality and cost, including choices like smaller proxy datasets, early stopping, multi-fidelity optimization (successive halving), and warm-starting.
HardTechnical
21 practiced
Implement PCA using SVD in Python without calling sklearn.decomposition.PCA. Write `pca_svd(X, n_components=None)` that centers X, computes SVD, returns principal components, transformed data (scores), and explained variance ratio. Handle both cases when n_features > n_samples and vice versa efficiently.

Unlock Full Question Bank

Get access to hundreds of Machine Learning Algorithms and Theory interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.