Q1
Why can a fraud detection model score 99.2% accuracy while catching ZERO actual fraud cases?
On a 99.2% legitimate / 0.8% fraud imbalanced dataset, predicting 'Not Fraud' every time hits 99.2% accuracy! Evaluate Precision-Recall AUC (PR-AUC), F1, and cost-weighted recall thresholds rather than raw accuracy.
Q2
What causes subtle data leakage if you apply StandardScaler().fit_transform(X) BEFORE train_test_split?
Fitting normalization on the full dataset leaks test-set mean and variance into training scaling parameters—artificially inflating validation scores. Always call .fit() strictly on X_train, then .transform() on validation/test sets.
Q3
Why does L1 (Lasso) regularization zero out feature weights cleanly while L2 (Ridge) shrinks them toward zero without sparsity?
L1's diamond-shaped constraint corners intersect error contours along coordinate axes, driving irrelevant weights to exact zero; L2's circular constraint smoothly shrinks correlated coefficients proportionally.
Q4
Why do tree-based models (Random Forest, XGBoost) NOT require feature scaling, while SVM, KNN, and Logistic Regression degrade heavily without it?
Decision trees split features along monotonic thresholds independently per variable, unaffected by scale. Distance and gradient-step models (KNN, SVM, neural nets) get dominated by large-magnitude numeric columns unless scaled.
Q5
What happens in Random Forest if max_features is set equal to all features (n_features)?
Every tree splits on the exact same strongest predictors at the root, making trees highly correlated (essentially Bagged Trees) and losing the variance-reduction power of feature subsampling.
Q6
Why can Random KFold cross-validation leak future information on stock, energy, or sales forecasting data?
Random shuffling lets models train on Tuesday/Thursday data to 'predict' Wednesday, exploiting temporal autocorrelation. Always evaluate time series via walk-forward / expanding-window TimeSeriesSplit.
Q7
In deep neural networks, why do Batch Normalization and Dropout behave completely differently during .eval() inference vs .train()?
During training, BatchNorm normalizes using current mini-batch stats and Dropout randomly zeroes activations. During .eval(), Dropout turns off and BatchNorm uses frozen running mean/variance estimates—forgetting model.eval() ruins deterministic inference.
Q8
Why does gradient descent stall when feeding unscaled features or poorly initialized weights into sigmoid / tanh networks?
Large pre-activations saturate sigmoid/tanh tails where derivatives approach 0 (vanishing gradients). ReLU/GELU activations paired with He/Xavier initialization and residual connections preserve healthy gradient flow.
Q9
What is the bias-variance trade-off when boosting depth (max_depth) too high in XGBoost without tuning learning_rate or subsample?
Overly deep boosted trees memorize training noise sequentially, dropping training loss near zero while spiking validation error. Lower tree depth (3–6), shrink learning_rate, add subsample/colsample_bytree, and use early stopping.
Q10
Why does high R-squared (R^2) alone fail to prove a linear regression model is valid or causal?
Adding irrelevant predictors monotonically increases R^2 (even random noise!), and non-linear curves can score high R^2 while failing residual homoscedasticity/normality checks. Inspect Adjusted R^2, residual plots, and RMSE on holdout sets.