Skip to content

Module 03

Anurag Prasad edited this page Nov 7, 2026 · 10 revisions

Module 03: Probability, Statistics and Information Theory

Curriculum part: Mathematical and Theoretical Foundations
Study level: Foundational
Content status: Substantive introductory chapter; supporting exercises and implementations are maintained separately.

1. Why this module matters

Probability represents uncertainty, statistics studies estimation from samples, and information theory connects likelihood to cross-entropy and KL divergence.

2. Learning objectives

After studying this module, you should be able to:

  • Explain the central problem and assumptions of the methods covered.
  • Interpret the principal mathematical objects, equations and tensor dimensions.
  • Work through a small numerical example without relying on a framework.
  • Implement or verify the central operation using NumPy or PyTorch.
  • Identify failure modes and select appropriate follow-up material.

3. Prerequisites and connections

Prerequisites: Basic algebra and functions; Module 01 for vector notation.

The module follows the principle write once, reference everywhere. Foundational derivations are maintained in their primary module; later modules focus on how those ideas are used rather than repeating the full derivation.

4. Core concepts and theory

Discrete random variables use probability mass functions; continuous variables use densities whose integrals give probabilities. Expectation is a weighted average, variance measures spread and covariance measures joint linear variation. Conditional probability and Bayes' rule update beliefs after evidence. Maximum likelihood chooses parameters that make observed data probable; minimizing negative log-likelihood is equivalent. Entropy measures uncertainty, cross-entropy measures expected coding cost under a model distribution, and KL divergence measures directed discrepancy. Mutual information measures dependence. Softmax and sigmoid outputs parameterize categorical and Bernoulli distributions respectively.

5. Mathematical formulation

A compact form of the central operation is:

$$ D_{\mathrm{KL}}(P|Q)=\sum_i p_i\log\frac{p_i}{q_i} $$

P(A|B)=P(A∩B)/P(B); P(θ|D)∝P(D|θ)P(θ). H(P)=−Σp log p; H(P,Q)=−Σp log q; D_KL(P||Q)=Σp log(p/q). For one-hot class k, cross-entropy is −log q_k.

The equations above define the main computational objects. When implementing them, specify tensor shapes, reduction axes, normalization conventions and whether a loss is summed or averaged. Those details determine the actual computation.

6. Worked numerical reasoning

If the true class is class 2 and prediction is (0.1,0.7,0.2), cross-entropy is −ln(0.7)≈0.357 nats. Assigning only 0.1 to the true class raises it to 2.303 nats. Confident errors are penalized strongly.

Use the example as a check on notation and implementation. Change one input at a time and verify how the output changes; this is often more informative than immediately moving to a large dataset.

7. Computational workflow

flowchart TD
    A[Define the problem and data] --> B[Identify mathematical objects]
    B --> C[Write equations and tensor shapes]
    C --> D[Work through a small numerical case]
    D --> E[Implement the operation]
    E --> F[Verify outputs and gradients]
    F --> G[Evaluate limitations and connect to later modules]
Loading

8. Implementation and verification

Compute expectation, variance and covariance on small datasets. Derive a Bayes posterior for a test example. Use stable logits-based loss functions rather than manually applying softmax and log. Check calibration on held-out data.

A good implementation sequence is:

  1. Write the operation in plain mathematical notation.
  2. Calculate a tiny example by hand.
  3. Implement the operation with NumPy.
  4. Compare against a trusted PyTorch operation.
  5. Add shape and numerical assertions.
  6. Only then run a larger experiment.

See the implementation roadmap for a module-specific progression.

9. Common misconceptions and failure modes

KL divergence is asymmetric and not a metric. A density can exceed one. Zero covariance does not generally imply independence. State whether logarithms are natural (nats) or base 2 (bits).

10. Advanced directions

Study exponential families, Bayesian neural networks, variational inference, information bottleneck, proper scoring rules, calibration and distribution shift.

These are extensions beyond the minimum conceptual foundation. Treat them as directions for further reading or experiments, not as claims that an implementation or benchmark is already complete.

11. Focused pages and practice

This module is best studied as one integrated chapter; the lesson map divides the reading sequence without duplicating the theory.

12. Where this concept is used

13. Scope and content provenance

The original course material is the primary basis for the course topics in this curriculum. Mathematical prerequisites are included to make the course topics understandable from first principles. Additional modern methods are identified as extensions where appropriate. The chapter does not imply that every proposed coding exercise or research experiment has already been executed.

15. Selected references

These sources provide canonical starting points for the concepts in this chapter. They are not a claim that every extension listed above is covered by the original course material.

  • Cover, T. M., & Thomas, J. A. (2006). Elements of Information Theory (2nd ed.). Wiley.
  • Murphy, K. P. (2022). Probabilistic Machine Learning: An Introduction. MIT Press.

16. Completion criteria

  • Explain the main ideas in your own words.
  • Re-derive the central equations and check dimensions.
  • Solve the worked example independently.
  • Complete at least one numerical exercise.
  • Implement and verify the central operation.
  • Explain at least two limitations or failure modes.
  • Follow the cross-module links relevant to your learning path.

Next: Continue to the lesson map or return to the curriculum map.

🎓 Deep Learning Hub

🏠 Home · 🗺️ Curriculum · 🧭 Learning paths

❓ Question bank · 📖 Glossary · 📚 References

Jump to module:

01 02 03 04 05 06 07 08 09 10 11 12

13 14 15 16 17 18 19 20 21 22 23 24

Part 1 · Mathematical foundations
Part 2 · Neural network fundamentals
Part 3 · Training deep networks
Part 4 · Core architectures
Part 5 · Representation and generative learning
Part 6 · Specialised, modern and responsible deep learning
Reference and meta

Clone this wiki locally