Beginner 100 Questions • ~20 hrs study

ML Fundamentals (Q1-100)

Core machine learning concepts — supervised vs unsupervised, bias-variance tradeoff, regularization, cross-validation, ensemble methods, and evaluation metrics.

1

What is the bias-variance tradeoff?

Short Answer

Bias = error from oversimplified assumptions (underfitting). Variance = error from sensitivity to training data fluctuations (overfitting). Total error = Bias² + Variance + Irreducible noise. The goal is to find the sweet spot.

Key Points

  • High bias: Linear model on non-linear data → underfitting
  • High variance: Complex model with little data → overfitting
  • Fix high bias: More features, complex model, less regularization
  • Fix high variance: More data, regularization, simpler model, dropout

💡 Memory Trick: "Bias = too simple (dart always left) | Variance = too scattered (darts everywhere)"

2

Explain the difference between L1 and L2 regularization.

Short Answer

L1 (Lasso) adds |w| penalty → produces sparse weights (feature selection). L2 (Ridge) adds w² penalty → shrinks weights but keeps all features. ElasticNet combines both.

Property L1 (Lasso) L2 (Ridge)
PenaltyΣ|wᵢ|Σwᵢ²
SparsityYes (zeros out features)No (shrinks, never zero)
Feature SelectionBuilt-inNo
Use WhenMany irrelevant featuresAll features matter

💡 Memory Trick: "L1 = Laser (cuts features) | L2 = Leveler (smooths weights)"

3

What is cross-validation and why is it important?

Short Answer

Cross-validation splits data into k folds, trains on k-1 folds and validates on the remaining one, rotating k times. Gives a more reliable performance estimate than a single train/test split.

Key Points

  • K-Fold: Standard approach, k=5 or k=10 common
  • Stratified K-Fold: Preserves class distribution in each fold
  • Leave-One-Out (LOO): k = n, expensive but low bias
  • Time Series: Use TimeSeriesSplit (no future leakage)

💡 Memory Trick: "Cross-validation = Every data point gets to be in the test set once"

4

Random Forest vs Gradient Boosting — when to use which?

Short Answer

Random Forest: Bagging, parallel trees, robust to overfitting, less tuning needed. Gradient Boosting (XGBoost, LightGBM): Sequential trees, each correcting previous errors, usually higher accuracy but more prone to overfitting.

Aspect Random Forest Gradient Boosting
StrategyBagging (parallel)Boosting (sequential)
OverfittingLess proneMore prone
AccuracyGoodUsually better
SpeedFaster (parallel)Slower (sequential)

💡 Memory Trick: "RF = Team of independent experts voting | GB = Each expert learns from previous mistakes"

Questions 5-100 continue with the same detailed format.

Topics covered: SVM, KNN, Naive Bayes, Decision Trees, PCA, Clustering (K-Means, DBSCAN, Hierarchical), Feature Engineering, Handling Imbalanced Data, Gradient Descent variants, Hyperparameter Tuning, Evaluation Metrics (Precision, Recall, F1, AUC-ROC), and more.

View Full Documentation →