Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Machine Learning Overview

Overview

Machine Learning (ML) is a subset of artificial intelligence where systems learn patterns from data to make predictions or decisions without being explicitly programmed. This overview provides a roadmap of the ML landscape covered in this book, connecting foundational concepts to advanced topics.

ML Taxonomy

graph TD
    A[Machine Learning] --> B[Supervised Learning]
    A --> C[Unsupervised Learning]
    A --> D[Reinforcement Learning]
    A --> E[Self-Supervised Learning]
    B --> B1[Classification]
    B --> B2[Regression]
    C --> C1[Clustering]
    C --> C2[Dimensionality Reduction]
    C --> C3[Anomaly Detection]
    D --> D1[Policy Gradient]
    D --> D2[Value-Based]
    E --> E1[Pre-training LLMs]
    E --> E2[Contrastive Learning]

Learning Paradigms

ParadigmDataGoalExample
SupervisedLabeled (X, y)Learn mapping X → ySpam detection
UnsupervisedUnlabeled (X)Find structureCustomer segmentation
Semi-supervisedFew labeled + many unlabeledLeverage unlabeled dataMedical imaging
Self-supervisedUnlabeled (pretext task)Learn representationsBERT, GPT pre-training
ReinforcementEnvironment interactionMaximize rewardGame playing, robotics

The ML Pipeline

graph LR
    A[Data Collection] --> B[EDA & Cleaning]
    B --> C[Feature Engineering]
    C --> D[Model Selection]
    D --> E[Training]
    E --> F[Evaluation]
    F --> G[Deployment]
    G --> H[Monitoring]
    H -->|Drift| A

Topics in This Book

graph TD
    A[ML] --> B[Foundations]
    A --> C[Classical ML]
    A --> D[Deep Learning]
    A --> E[Transformers & LLMs]
    A --> F[Computer Vision]
    A --> G[Generative Models]
    A --> H[Advanced Topics]
    A --> I[System Design]
    A --> J[MLOps]
    B --> B1[Linear Algebra, Probability, Optimization]
    C --> C1[Linear/Logistic Regression, Trees, SVM]
    D --> D1[NN, CNN, RNN, Optimizers]
    E --> E1[Attention, BERT, GPT, Fine-tuning]
    F --> F1[Classification, Detection, Segmentation]
    G --> G1[GANs, VAEs, Diffusion]
    H --> H1[Distillation, NAS, Federated, Compression]
    I --> I1[Recommendation, Search, Fraud Detection]
    J --> J1[Pipelines, Monitoring, Deployment]

Key Metrics by Task

TaskPrimary Metrics
ClassificationAccuracy, Precision, Recall, F1, AUC-ROC
RegressionMAE, RMSE, R²
RankingNDCG, MAP, MRR
GenerationBLEU, ROUGE, Perplexity, FID
ClusteringSilhouette Score, Adjusted Rand Index

Interview Preparation Roadmap

  1. Foundations: Linear algebra, probability, optimization, loss functions
  2. Classical ML: Regression, trees, ensembles, SVM, clustering
  3. Deep Learning: NN basics, CNNs, RNNs, optimizers, regularization
  4. Transformers: Self-attention, BERT, GPT, fine-tuning, RLHF
  5. Specialized: GANs, GNNs, time series, recommendation
  6. System Design: End-to-end ML systems, feature stores, serving
  7. MLOps: Pipelines, monitoring, deployment, drift detection
  8. Advanced: Distillation, quantization, pruning, NAS

Interview Questions

  1. What is the bias-variance tradeoff? — High bias = underfitting (model too simple). High variance = overfitting (model too complex). The goal is to find the sweet spot that minimizes total error.

  2. How do you handle overfitting? — Regularization (L1/L2), dropout, early stopping, more data, data augmentation, simpler model, cross-validation.

  3. What is cross-validation and why use it? — K-fold CV splits data into K parts, trains on K-1, tests on 1, repeats K times. Provides more reliable performance estimate than a single train/test split.

  4. How do you choose a model? — Start simple (logistic regression), increase complexity as needed. Consider: data size, interpretability requirements, latency constraints, and available compute.

  5. What is transfer learning? — Using a model pre-trained on one task as a starting point for a different task. Especially powerful in NLP (BERT, GPT) and vision (ImageNet pre-trained CNNs).

Common Mistakes

  • Not exploring data before modeling (EDA is critical)
  • Using accuracy for imbalanced datasets (use F1/AUC)
  • Data leakage (using future data in training)
  • Not validating on held-out test set
  • Over-engineering features before trying simple models
  • Ignoring business context (optimize the right metric)

Summary

Machine learning encompasses supervised, unsupervised, and reinforcement learning paradigms. The ML pipeline from data collection to deployment requires expertise in statistics, algorithms, and engineering. This book covers the full spectrum from foundations to production systems, preparing you for ML interviews at top tech companies.

Cross-References