6.1 Linear & Logistic Regression
Linear regression: assumptions (linearity, no multicollinearity, homoscedasticity), coefficients interpretation, R² score. Regularisation: Ridge (L2), Lasso (L1), Elastic Net. Logistic regression: sigmoid function, log-odds, probability output, decision boundary. Multiclass: One-vs-Rest. These are the BASELINE models — always start here before trying complex algorithms. "Explain the difference between linear and logistic regression" — interview staple.
6.2 KNN, SVM & Naive Bayes
K-Nearest Neighbours: distance-based, no training phase, sensitive to scale, choosing K (odd to avoid ties). SVM: maximum margin classifier, kernel trick (linear, RBF, polynomial), support vectors. Naive Bayes: probability-based, assumes feature independence, works surprisingly well for text. When to use each: KNN (small datasets, interpretable), SVM (binary classification, high dimensions), Naive Bayes (text classification, spam filtering).
6.3 Decision Trees & Random Forest
Decision tree: recursive splitting (Gini impurity, entropy), pruning, max_depth. Random Forest: ensemble of decorrelated trees (bagging + feature randomisation). Why RF beats individual trees: lower variance, more stable. Feature importance from RF. Hyperparameters: n_estimators, max_depth, min_samples_split. Random Forest is the "first algorithm to try" for most tabular data problems.
6.4 XGBoost & LightGBM
Gradient boosting: sequential ensemble where each tree corrects the previous. XGBoost: the Kaggle competition king — regularisation, handling missing values, GPU support. LightGBM: faster training (leaf-wise growth), handles large datasets. CatBoost: native categorical feature support. Hyperparameters: learning_rate, n_estimators, max_depth, min_child_weight, subsample. XGBoost/LightGBM wins 80%+ of tabular data Kaggle competitions — the most important algorithms to master.
6.5 Model Evaluation & Selection
Classification: accuracy, precision, recall, F1-score, AUC-ROC curve, confusion matrix, precision-recall curve. Regression: MAE, MSE, RMSE, R², adjusted R². Cross-validation: KFold, StratifiedKFold — never evaluate on training data. Train/validation/test split strategy. Bias-variance trade-off: underfitting vs overfitting. Learning curves for diagnosis. "Your model has 95% training accuracy and 70% test accuracy — what's wrong?" — overfitting, the answer every interviewer expects.
6.6 Hyperparameter Tuning
GridSearchCV: exhaustive search (slow but thorough). RandomizedSearchCV: random sampling (faster, often sufficient). Optuna: Bayesian optimisation (most efficient — finds best params with fewer trials). Halving search: progressive elimination. Cross-validation inside tuning (nested CV). Early stopping for boosting models. "How do you tune hyperparameters?" — the professional answer is Optuna or RandomizedSearchCV, not manual trial-and-error.
Placement relevance: "Explain Random Forest vs XGBoost" "When would you use logistic regression vs SVM?" "How do you handle overfitting?" — the core ML interview questions at every data science company. XGBoost is the most important algorithm for tabular data. Model evaluation (precision/recall/AUC) is tested in every interview. Hyperparameter tuning with cross-validation demonstrates production-level ML practice.