The intuition: Imagine measuring someone's height. What's the probability their height is EXACTLY 170.000... cm (infinite precision)? Zero. But the probability their height is between 169.5 and 170.5 cm? Non-zero.
Mathematical reason:
P(X=c)=∫ccfX(x)dx=0
An integral from c to c has zero width.
Consequence: For continuous variables, P(a≤X≤b)=P(a<X<b)—boundary points don't matter.
| Property | PMF (Discrete) | PDF (Continuous) |
|----------|------------------|
| Values | pX(x)=P(X=x) | fX(x) is NOT a probability |
| Range | 0≤pX(x)≤1 | fX(x)≥0, can exceed 1! |
| Total | ∑xpX(x)=1 | ∫−∞∞fX(x)dx=1 |
| Point prob | pX(x) is the answer | P(X=x)=0 |
| Interval prob | ∑x∈[a,b]pX(x) | ∫abfX(x)dx |
Recall Feynman Explanation (Explain to a 12-year-old)
Imagine you have a big jar of marbles, each with a number written on it. If you can COUNT the marbles (1, 2, 3, ..), that's discrete. I can tell you exactly: "The probability of picking marble #7 is 1 out of 20." That's a PMF—it gives the exact chance for each marble.
Now imagine instead the jar is full of sand, and you're measuring how much gold dust is mixed in. You can't pick out a single grain and ask its probability—there are infinite grains! But I can tell you: "In this REGION of the jar, there's a lot of gold; in that region, very little." That's what a PDF does—it tells you where the "gold" (probability) is concentrated.
If I scoop a tiny spoonful from the high-density region, I'll probably get some gold. If I scoop from the low-density region, probably not. But a single grain? Zero gold (zero probability). The density tells you: look in THIS neighborhood if you want to find gold.
In machine learning, every time your model says "I think the answer is around here," it's giving you a density function!
2.1.05-Softmax-activation — Softmax converts logits to a PMF over classes
3.2.04-Gaussian-processes — Model functions as draws from a distribution with PDF over function space
#flashcards/ai-ml
What is the key difference between a PMF and a PDF? :: PMF gives exact probabilities for discrete outcomes: pX(x)=P(X=x). PDF gives probability density for continuous variables—probability is the integral (area), not the value itself: P(a≤X≤b)=∫abfX(x)dx.
What are the two properties that any PMF must satisfy?
(1) 0≤pX(x)≤1 for all x, and (2) ∑all xpX(x)=1.
What are the two properties that any PDF must satisfy?
(1) fX(x)≥0 for all x, and (2) ∫−∞∞fX(x)dx=1.
Why is P(X=c)=0 for any specific value c of a continuous random variable?
Because the probability is the area under the PDF curve, and a single point has zero width, hence zero area: P(X=c)=∫ccfX(x)dx=0.
What is the relationship between PDF and CDF?
The PDF is the derivative of the CDF: fX(x)=dxdFX(x). The CDF is the integral of the PDF: FX(x)=∫−∞xfX(t)dt.
Can a PDF value fX(x) be greater than 1?
Yes! PDF is a density (probability per unit), not a probability. Example: uniform on [0,0.5] has fX(x)=2.
What is the PMF of a Bernoulli random variable with success probability p?
pX(1)=p and pX(0)=1−p, or compactly: pX(x)=px(1−p)1−x for x∈{0,1}.
What is the PDF of a uniform distribution on [a,b]?
fX(x)=b−a1 for x∈[a,b], and 0 otherwise. The constant density ensures total probability is 1.
What is the PDF of an exponential distribution with rate λ?
fX(x)=λe−λx for x≥0, and 0 otherwise. It models waiting times in memoryless processes.
What is the PDF of a Gaussian distribution with mean μ and variance σ2?
fX(x)=σ2π1exp(−2σ2(x−μ)2) for all x∈R.
How do you compute P(a≤X≤b) for a discrete random variable?
P(a≤X≤b)=∑x=abpX(x) (sum the PMF over the interval).
How do you compute P(a≤X≤b) for a continuous random variable?
P(a≤X≤b)=∫abfX(x)dx (integrate the PDF over the interval).
Why do we use PMF for classification and PDF for regression in ML?
Classification outputs discrete class labels (finite outcomes) → PMF over classes. Regression outputs continuous values (infinite possibilities) → PDF over the real line.
If two dice are rolled and X is their sum, what is pX(7)?
There are 6 outcomes giving sum 7: (1,6),(2,5),(3,4),(4,3),(5,2),(6,1) out of 36 total equally likely outcomes. So pX(7)=6/36=1/6.
What does "memoryless property" of the exponential distribution mean?
P(X>s+t∣X>s)=P(X>t): the probability of waiting an additional t time doesn't depend on how long you've already waited. The past doesn't matter.
Socho tum ek AI model bana rahe ho jo predict karta hai kikal barish hogi ya nahi. Yeh ek discrete problem hai—do outcomes hain: haan ya na. Har outcome ko ek exact probability milti hai, jaise 0.7 (barish) aur 0.3 (no barish). Yeh PMF (Probability Mass Function) ka kaam hai. Yeh tumhe bolta hai ki kisi specific outcome ki exact probability kya hai. Jaise dice roll karo, toh sum = 7 ane ki probability PMF se milti hai.
Ab socho tum predict kar rahe ho ki kal temperature kya hoga—23.5°C, 23.51°C, 23.512°C... infinite possibilities hain! Yahanek single value ki probability zero hai (kyunki infinite values mein se koiek exact match ho—bahut rare!). Toh hum PDF (Probability Density Function) use karte hain. PDF tumhe bata hai ki probability ka "concentration" kahan zyada hai. Agar tum ek chhota interval lo, jaise 23°C se 24°C, toh PDF ko integrate karke (area nikalke) probability milti hai. PDF is like density of gold dust in sand—jahan density zyada, wahan probability zyada.
ML mein kyun zaroori hai? Jab bhi tumara model kuch predict karta hai—classification mein class probabilities (PMF), regression mein continuous values