1.3.7 · AI-ML › Probability & Statistics
Intuition Running Total ka Nazariya
Socho tum ek shooting range par ho aur measure kar rahe ho ki bullets kahaan land kar rahi hain. Probability density tumhe batati hai ki har distance par hits ki density kitni hai. Lekin agar tum jaanna chahte ho: "Kitne fraction shots 50 meters tak ya usse pehle land kiye?"
Yahi cheez Cumulative Distribution Function (CDF) tumhe deta hai: woh probability ki ek random variable kisi value se ≤ ho . Yeh probability ka running total hai jab tum left se right sweep karte ho saare possible outcomes ke across.
ML mein yeh kyun matter karta hai? CDFs distributions ko samajhne, percentiles compute karne (e.g., "95% predictions is threshold se neeche hain"), random samples generate karne, aur probabilistic models banane ki backbone hain.
Definition CDF — Formal Definition
Ek random variable X ke liye, cumulative distribution function F X ( x ) is tarah define hota hai:
F X ( x ) = P ( X ≤ x )
Yeh woh probability hai ki random variable X koi value less than or equal to x le.
Domain: x ∈ R (saare real numbers)
Range: F X ( x ) ∈ [ 0 , 1 ] (probabilities)
Key properties jo har CDF mein honi chahiye:
Monotonically non-decreasing: Agar x 1 < x 2 hai, toh F X ( x 1 ) ≤ F X ( x 2 )
Limits: lim x → − ∞ F X ( x ) = 0 aur lim x → ∞ F X ( x ) = 1
Right-continuous: lim h → 0 + F X ( x + h ) = F X ( x )
PMF se shuru karo: Maano humara ek discrete random variable X hai jiska probability mass function p X ( x ) = P ( X = x ) hai.
Step 1 — P ( X ≤ x ) ka matlab kya hai?
Hum x tak aur x shamil karke saare outcomes ki total probability chahte hain. Kyunki disjoint events ki probabilities add hoti hain:
F X ( x ) = P ( X ≤ x ) = ∑ x i ≤ x p X ( x i )
Yeh step kyun? Hum individual point probabilities accumulate kar rahe hain. Har woh value x i jo ≤ x hai, apni probability mass contribute karti hai.
Worked example Discrete CDF — Fair Die Roll
Maano X ek fair six-sided die roll ka outcome hai. PMF hai p X ( k ) = 6 1 for k ∈ { 1 , 2 , 3 , 4 , 5 , 6 } .
Nikalo: F X ( 3.7 ) — 3.7 ya usse kam roll karne ki probability.
Solution:
F X ( 3.7 ) = P ( X ≤ 3.7 ) = P ( X = 1 ) + P ( X = 2 ) + P ( X = 3 )
= 6 1 + 6 1 + 6 1 = 6 3 = 0.5
Yeh step kyun? Sirf discrete values 1, 2, 3 hi ≤ 3.7 hain. Die 3.7 par land nahi kar sakti.
Poora CDF ek staircase jaisa dikhta hai:
F X ( x ) = ⎩ ⎨ ⎧ 0 6 k 1 x < 1 k ≤ x < k + 1 , k ∈ { 1 , … , 5 } x ≥ 6
PDF se shuru karo: Continuous X ke liye jiska probability density function f X ( x ) hai, probabilities curve ke neeche areas hoti hain.
Step 1 — Probability as an integral:
Kyunki P ( a < X ≤ b ) = ∫ a b f X ( x ) d x hai, − ∞ se x tak ki cumulative probability hai:
F X ( x ) = P ( X ≤ x ) = ∫ − ∞ x f X ( t ) d t
Yeh step kyun? Hum point x tak, bilkul left se, saare infinitesimal probability "slices" f X ( t ) d t integrate (accumulate) kar rahe hain.
Step 2 — CDF se PDF recover karna:
Fundamental Theorem of Calculus se:
f X ( x ) = d x d F X ( x )
Yeh relationship kyun? PDF cumulative probability ki rate of change hai. CDF antiderivative hai.
Worked example Continuous CDF — Uniform Distribution
Maano X ∼ Uniform ( 0 , 1 ) , matlab X [ 0 , 1 ] mein kaheen bhi equally likely hai.
PDF hai:
f X ( x ) = { 1 0 0 ≤ x ≤ 1 otherwise
CDF derive karo:
x < 0 ke liye: Abhi koi probability accumulate nahi hui.
F X ( x ) = ∫ − ∞ x 0 d t = 0
0 ≤ x ≤ 1 ke liye: Constant density ko integrate karo.
F X ( x ) = ∫ − ∞ 0 0 d t + ∫ 0 x 1 d t = 0 + [ t ] 0 x = x
Yeh step kyun? Height 1 aur 0 se x tak ke rectangle ka area bas x hota hai.
x > 1 ke liye: Saari probability accumulate ho gayi.
F X ( x ) = ∫ − ∞ 1 f X ( t ) d t = 1
Final CDF:
F X ( x ) = ⎩ ⎨ ⎧ 0 x 1 x < 0 0 ≤ x ≤ 1 x > 1
Yeh ek ramp function hai — 0 se 1 tak linearly increase karta hai.
Worked example Interval Probability — Exponential Distribution
Maano X ∼ Exp ( λ ) jiska CDF hai:
F X ( x ) = { 1 − e − λ x 0 x ≥ 0 x < 0
Nikalo: P ( 1 < X ≤ 3 ) jab λ = 0.5 ho.
Solution:
P ( 1 < X ≤ 3 ) = F X ( 3 ) − F X ( 1 )
= ( 1 − e − 0.5 ⋅ 3 ) − ( 1 − e − 0.5 ⋅ 1 )
= ( 1 − e − 1.5 ) − ( 1 − e − 0.5 )
= e − 0.5 − e − 1.5
= 0.6065 − 0.231 = 0.3834
Yeh step kyun? CDF ka difference automatically hume interval mein "probability mass" deta hai.
ML mein hum kyun care karte hain?
Confidence intervals: "95% predictions is threshold se neeche hain"
Random sampling: X = F − 1 ( U ) ke through samples generate karo jahan U ∼ Uniform ( 0 , 1 )
Outlier detection: 99th percentile se aage ke data points flag karo
Worked example Median Nikalna — Exponential Distribution
X ∼ Exp ( λ ) ke liye jahan F X ( x ) = 1 − e − λ x hai, median nikalo.
Setup: Hum woh x chahte hain jaise ki F X ( x ) = 0.5 ho.
1 − e − λ x = 0.5
e − λ x = 0.5
− λ x = ln ( 0.5 ) = − ln ( 2 )
x = λ l n ( 2 )
Yeh step kyun? Humne CDF ko algebraically invert kiya. λ = 1 ke liye, median ln ( 2 ) ≈ 0.693 hai, matlab exponentially-distributed events ka aadha time 0.693 se pehle hota hai.
Common mistake Common Mistake — PDF aur CDF mein Confusion
Galat idea: "CDF x par mujhe batata hai ki x kitna likely hai."
Yeh sahi kyun lagta hai: Dono x ke functions hain jo distribution describe karte hain.
Fix:
PDF f X ( x ) : x par probability density (curve ki height). 1 se zyada ho sakta hai!
CDF F X ( x ) : x tak cumulative probability (left ki taraf area). Hamesha [ 0 , 1 ] mein.
Continuous variables ke liye, P ( X = x ) = 0 hamesha. PDF relative likelihood deta hai, absolute probability nahi.
Common mistake Common Mistake — CDF ka Non-Decreasing hona bhool jaana
Galat calculation: F X ( 5 ) − F X ( 8 ) = − 0.2 compute karna aur yeh sochna ki yeh ek probability hai.
Yeh galat kyun lagta hai: Tumhe probability ke liye negative number milta hai.
Fix: Probabilities hamesha non-negative hoti hain. CDF monotonically non-decreasing hai, isliye:
F X ( a ) ≤ F X ( b ) whenever a < b
P ( 5 < X ≤ 8 ) nikalene ke liye, tumhe F X ( 8 ) − F X ( 5 ) karna hoga, ulta nahi.
Model Evaluation:
Prediction intervals compute karna: P ( y pred ∈ [ a , b ])
Calibration curves predicted CDF ko empirical CDF se compare karti hain
Data Preprocessing:
Quantile normalization : CDF ke through data ko uniform distribution par map karo
Outlier detection: woh points flag karo jahan F X ( x ) > 0.99 ya < 0.01 ho
Generative Models:
Inverse transform sampling: Uniform random numbers use karke kisi bhi distribution se samples generate karo
Copulas: Marginal CDFs combine karke joint distributions model karo
Statistical Tests:
Kolmogorov-Smirnov test empirical CDF ko theoretical CDF se compare karta hai
p-values tail probabilities hain: p = 1 − F null ( t obs )
Recall Ek 12-Saal ke Bachche ko Explain karo
Socho tum Pokémon cards collect kar rahe ho, aur track kar rahe ho ki har card kitna rare hai.
Probability density ek bar chart ki tarah hai jo dikhata hai ki har card level kitna common hai. CDF alag hai — yeh answer karta hai: "Agar main ek random card uthata hoon, toh kya chance hai ki woh itna rare ya kam rare ho?"
Imagine karo ki tum cards mein se least rare se most rare ki taraf chal rahe ho, aur running count rakh rahe ho "Abhi tak kitne dekh liye?" Woh running percentage hi CDF hai.
Jab tum end tak pahunchte ho (sabse rare card), tumhara CDF 100% hit karta hai kyunki tumne saare cards count kar liye.
Yeh useful kyun hai? Agar koi puche "Kya chance hai ki main woh card pull karun jo bottom 75% mein hai?", tum bas CDF ko 75% mark par dekho. Koi complicated addition nahi chahiye!
Mnemonic CDF = "Cumulative = Collect Everything Below"
C umulative → C ollect
D istribution → D istance traveled from − ∞
F unction → F raction accumulated
Socho: "CDF woh C ollected F raction hai jo point x tak D one ho gayi."
Visual mnemonic: CDF curve hamesha upar chadhti hai (ya flat rehti hai) bilkul stairs chadhne ki tarah — tum kabhi neeche nahi jaate kyunki tum hamesha zyada probability add kar rahe ho.
Probability Distributions — CDF, PDF ka integral hai
Random Variables — CDF kisi bhi random variable ke liye define hota hai
Expected Value and Variance — CDF use karke E [ X ] compute kar sakte hain
Inverse Transform Sampling — Random samples generate karne ke liye F − 1 use karta hai
Quantile Functions — CDF ka inverse
Empirical Distribution — CDF ka sample-based estimate
Kolmogorov-Smirnov Test — Goodness-of-fit ke liye CDFs compare karta hai
Copulas — Dependence model karne ke liye marginal CDFs join karta hai
Survival Analysis — Survival function S ( x ) = 1 − F X ( x ) use karta hai
#flashcards/ai-ml
CDF F X ( x ) kya represent karta hai? :: Woh probability ki random variable X x se less than or equal to ho: F X ( x ) = P ( X ≤ x )
CDF ki range aur domain kya hain? Domain: saare real numbers R . Range: [ 0 , 1 ] (probabilities).
Sahi ya Galat: Ek CDF x badhne ke saath decrease ho sakti hai. Galat. CDFs monotonically non-decreasing hote hain.
CDF use karke P ( a < X ≤ b ) kaise compute karte hain? P ( a < X ≤ b ) = F X ( b ) − F X ( a )
Ek continuous random variable ke liye, PDF aur CDF mein kya relationship hai? F X ( x ) = ∫ − ∞ x f X ( t ) d t aur f X ( x ) = d x d F X ( x )
Ek discrete random variable ke liye, PMF se CDF kaise compute hoti hai? F X ( x ) = ∑ x i ≤ x p X ( x i ) (x se ≤ saare outcomes ki probabilities ka sum)
Quantile function kya hai? Inverse CDF F X − 1 ( p ) , jo woh value x deta hai jaise ki F X ( x ) = p ho.
F X − 1 ( 0.5 ) kya kehlaata hai?Distribution ka median.
Ek continuous random variable ke liye P ( X = x ) kya hai? Zero. Continuous variables ke liye, P ( X = x ) = 0 .
CDF use karke P ( X > x ) kaise compute karte hain? P ( X > x ) = 1 − F X ( x )
Ek CDF ki limit properties kya hain? lim x → − ∞ F X ( x ) = 0 aur lim x → ∞ F X ( x ) = 1
X ∼ Uniform ( 0 , 1 ) ke liye, F X ( 0.3 ) kya hai?F X ( 0.3 ) = 0.3 (CDF hai F X ( x ) = x for x ∈ [ 0 , 1 ] )
Ek discrete CDF ki kya shape hoti hai? Ek staircase (step function) jo har possible value par jump karti hai.
Inverse transform sampling kaise ki jaati hai? U ∼ Uniform ( 0 , 1 ) generate karo, phir X = F X − 1 ( U ) compute karo.
95th percentile ka kya matlab hai? Woh value x jiske neeche distribution ka 95% hai, matlab F X ( x ) = 0.95 .
Percentiles and thresholds