The Language of Uncertainty 🎲अनिश्चितता की भाषा 🎲不确定性的语言 🎲
Every day you decide under uncertainty. Will it rain? Will the bus be on time? Is this email a scam? Your brain guesses the chances — but its guesses are shaped by mood, memory and bias.
हर दिन आप अनिश्चितता में फ़ैसले लेते हैं। बारिश होगी? बस समय पर आएगी? यह email धोखा है? आपका दिमाग़ chances का अंदाज़ा लगाता है — पर ये अंदाज़े मूड, याददाश्त और पूर्वाग्रह से बनते हैं।
每天你都在不确定中做决定。会下雨吗?公交车会准时吗?这封邮件是诈骗吗?大脑会估计可能性 —— 但这些估计受情绪、记忆和偏见影响。
Probability makes this exact. It gives every outcome a number between 0 and 1. A probability of 0 means "impossible". A probability of 1 means "certain". Everything interesting lives in between.
Probability इसे सटीक बनाती है। यह हर नतीजे को 0 और 1 के बीच एक संख्या देती है। Probability 0 का मतलब "असंभव"। Probability 1 का मतलब "निश्चित"। सारी दिलचस्प चीज़ें इनके बीच हैं।
概率让这件事变得精确。它给每个结果一个 0 到 1 之间的数。概率 0 表示“不可能”,概率 1 表示“必然”。所有有趣的事情都在两者之间。
Every value here is exact, worked out by counting equally likely outcomes.
यहाँ हर मान सटीक है, बराबर संभावना वाले नतीजों को गिनकर निकाला गया।
这里每个值都是精确的,通过数等可能结果得出。
Conditional probability is the core of Naive Bayes classifiers. The multiplication rule powers Bayesian networks. The addition and multiplication rules together give the law of total probability. Sample spaces are the starting point of every Monte Carlo simulation. None of these make sense without the basics below.
Conditional probability, Naive Bayes classifiers का मूल है। Multiplication rule, Bayesian networks चलाता है। Addition और multiplication rules मिलकर law of total probability देते हैं। हर Monte Carlo simulation sample space से शुरू होता है। नीचे की बुनियादी बातों के बिना इनमें से कुछ समझ नहीं आता।
条件概率是朴素贝叶斯分类器的核心。乘法法则驱动贝叶斯网络。加法和乘法法则合起来得到全概率公式。每个蒙特卡洛模拟都从样本空间出发。没有下面这些基础,这些都无从理解。
Sample Space & Events 🎯Sample Space और Events 🎯样本空间与事件 🎯
The Story: Rolling a Die at Game Nightकहानी: Game Night पर Die फेंकना故事:游戏之夜掷骰子
It is game night. You roll a normal six-sided die. Before it lands, you can list every possible result: 1, 2, 3, 4, 5 or 6. It cannot land on 7. This full list of outcomes is the sample space.
Game night है। आप एक सामान्य छह-मुखी die फेंकते हैं। गिरने से पहले ही आप हर संभव नतीजा लिख सकते हैं: 1, 2, 3, 4, 5 या 6। यह 7 पर नहीं गिर सकता। नतीजों की यह पूरी सूची sample space है।
游戏之夜,你掷一颗普通的六面骰子。落地前,你就能列出所有可能结果:1、2、3、4、5、6。它不可能出现 7。这份完整的结果清单就是样本空间。
Your friend says: "I win if I roll an even number." The outcomes {2, 4, 6} form an event. An event is any group of outcomes you care about — one outcome ("a 6") or many ("a prime number above 3", which is just {5}).
आपका दोस्त कहता है: "सम संख्या आई तो मैं जीता।" नतीजे {2, 4, 6} एक event बनाते हैं। Event नतीजों का कोई भी समूह है जिसकी आपको परवाह है — एक नतीजा ("छक्का") या कई ("3 से बड़ी prime संख्या", जो सिर्फ़ {5} है)।
朋友说:“掷出偶数我就赢。”结果 {2, 4, 6} 构成一个事件。事件就是你关心的任意一组结果 —— 可以是一个结果(“掷出 6”),也可以是多个(“大于 3 的质数”,其实只有 {5})。
Common Sample Spacesआम Sample Spaces常见样本空间
| Experimentप्रयोग试验 | Sample space (Ω)Sample space (Ω)样本空间(Ω) | Example eventउदाहरण event示例事件 | P(event)P(event)P(事件) |
|---|---|---|---|
| Flip one coinएक सिक्का उछालें抛一枚硬币 | {H, T} | Heads: {H}Heads: {H}正面:{H} | 1/2 = 0.50 |
| Roll one dieएक die फेंकें掷一颗骰子 | {1, 2, 3, 4, 5, 6} | Even: {2, 4, 6}सम: {2, 4, 6}偶数:{2, 4, 6} | 3/6 = 0.50 |
| Flip two coinsदो सिक्के उछालें抛两枚硬币 | {HH, HT, TH, TT} | At least one head: {HH, HT, TH}कम से कम एक head: {HH, HT, TH}至少一次正面:{HH, HT, TH} | 3/4 = 0.75 |
| Roll two diceदो dice फेंकें掷两颗骰子 | 36 ordered pairs (1,1) … (6,6)36 क्रमबद्ध जोड़े (1,1) … (6,6)36 个有序对 (1,1) … (6,6) | Sum is 7: 6 pairsयोग 7: 6 जोड़े和为 7:6 对 | 6/36 = 1/6 |
| Draw 1 card (52-card deck)1 पत्ता खींचें (52 पत्ते)抽 1 张牌(52 张) | {A♠, 2♠, …, K♣} | A King: {K♠, K♥, K♦, K♣}बादशाह: {K♠, K♥, K♦, K♣}抽到 K:{K♠, K♥, K♦, K♣} | 4/52 = 1/13 |
| Baby's sex (simplified)बच्चे का लिंग (सरल)新生儿性别(简化) | {Boy, Girl} | A girl: {Girl}लड़की: {Girl}女孩:{Girl} | ≈ 0.49 (from birth records, not 0.5)≈ 0.49 (जन्म रिकॉर्ड से, 0.5 नहीं)≈ 0.49(来自出生记录,不是 0.5) |
| Daily stock moveशेयर की रोज़ की चाल股票每日涨跌 | {Up, Down, Unchanged} | Stock rises: {Up}शेयर बढ़ा: {Up}上涨:{Up} | Estimated from historyइतिहास से अनुमान由历史数据估计 |
The sums 2 to 12 are 11 values, but they are not equally likely. A sum of 7 can happen 6 ways; a sum of 2 only 1 way. To use counting, list the 36 equally likely ordered pairs. A wrong sample space gives wrong answers every time.
योग 2 से 12 कुल 11 मान हैं, पर ये बराबर संभावना वाले नहीं हैं। योग 7 छह तरीकों से आ सकता है; योग 2 सिर्फ़ एक तरीके से। गिनती से हल करने के लिए 36 बराबर संभावना वाले क्रमबद्ध जोड़े लिखें। ग़लत sample space हमेशा ग़लत जवाब देता है।
点数和 2 到 12 共 11 个值,但它们并不等可能。和为 7 有 6 种方式,和为 2 只有 1 种。要用计数法,必须列出 36 个等可能的有序对。样本空间错了,答案就一定错。
Special Types of EventsEvents के ख़ास प्रकार特殊类型的事件
| Event typeEvent का प्रकार事件类型 | Meaningमतलब含义 | Example (one die)उदाहरण (एक die)示例(一颗骰子) |
|---|---|---|
| Simple eventSimple event基本事件 | Exactly one outcomeठीक एक नतीजा恰好一个结果 | {3} — rolling a 3{3} — 3 आना{3} — 掷出 3 |
| Compound eventCompound event复合事件 | Two or more outcomesदो या ज़्यादा नतीजे两个或更多结果 | {2, 4, 6} — rolling even{2, 4, 6} — सम आना{2, 4, 6} — 掷出偶数 |
| Impossible event (∅)असंभव event (∅)不可能事件(∅) | No outcomes; P = 0कोई नतीजा नहीं; P = 0不含结果;P = 0 | Rolling a 77 आना掷出 7 |
| Certain event (Ω)निश्चित event (Ω)必然事件(Ω) | All outcomes; P = 1सारे नतीजे; P = 1包含全部结果;P = 1 | {1, …, 6} — rolling anything{1, …, 6} — कुछ भी आना{1, …, 6} — 掷出任意点 |
| Mutually exclusiveMutually exclusive互斥 | Cannot happen together (no shared outcome)साथ नहीं हो सकते (कोई साझा नतीजा नहीं)不能同时发生(没有共同结果) | {1, 3, 5} and {2, 4, 6}{1, 3, 5} और {2, 4, 6}{1, 3, 5} 与 {2, 4, 6} |
| ExhaustiveExhaustive完备 | Together they cover all of Ωमिलकर पूरा Ω ढकते हैं合起来覆盖整个 Ω | {1, 2, 3} and {4, 5, 6}{1, 2, 3} और {4, 5, 6}{1, 2, 3} 与 {4, 5, 6} |
| IndependentIndependent独立 | Knowing one does not change the chance of the otherएक का पता होने से दूसरे का chance नहीं बदलता知道一个不会改变另一个的概率 | Two separate rolls: 1st roll is 6, 2nd roll is 6दो अलग फेंक: पहली में 6, दूसरी में 6两次独立投掷:第一次 6,第二次 6 |
A ∪ B — union: A OR B (or both) happens. A ∩ B — intersection: A AND B both happen. Aᶜ — complement: A does NOT happen. A ⊆ B — subset: every outcome in A is also in B. B | A — "B given A": the chance of B once we know A happened.
A ∪ B — union: A या B (या दोनों) होता है। A ∩ B — intersection: A और B दोनों होते हैं। Aᶜ — complement: A नहीं होता। A ⊆ B — subset: A का हर नतीजा B में भी है। B | A — "A दिया हो तो B": A हो चुका है यह पता हो तब B का chance।
A ∪ B — 并集:A 或 B(或两者)发生。A ∩ B — 交集:A 与 B 同时发生。Aᶜ — 对立事件:A 不发生。A ⊆ B — 子集:A 中每个结果也在 B 中。B | A —“已知 A 时的 B”:在知道 A 已发生后 B 的概率。
Events in Pictures — Understand Before the Maths 📊तस्वीरों में Events — गणित से पहले समझें 📊图解事件 — 先理解,再算数 📊
Take one die. Let A = "even" = {2, 4, 6} and B = "greater than 3" = {4, 5, 6}. Each number below sits in its real region. The rectangle is the whole sample space Ω. Shading shows which outcomes count.
एक die लें। मान लें A = "सम" = {2, 4, 6} और B = "3 से बड़ा" = {4, 5, 6}। नीचे हर संख्या अपने असली हिस्से में है। आयत पूरा sample space Ω है। रंग दिखाता है कौन-से नतीजे गिने जाते हैं।
取一颗骰子。设 A =“偶数”= {2, 4, 6},B =“大于 3”= {4, 5, 6}。下图每个数字都放在它真实所属的区域。矩形是整个样本空间 Ω,阴影表示哪些结果被计入。
Count the shaded numbers and divide by the numbers in your "world" (6, or 3 once A is known).
रंगीन संख्याएँ गिनें और अपनी "दुनिया" की संख्याओं से भाग दें (6, या A पता होने पर 3)।
数阴影中的数字,再除以“世界”中的数字个数(6 个;已知 A 时为 3 个)。
Each cell is one of the 36 equally likely outcomes (first die, second die). Pick events A and B, then switch between OR, AND and "B given A". The panel checks the addition rule and independence by counting cells.
हर खाना 36 बराबर संभावना वाले नतीजों में से एक है (पहला die, दूसरा die)। Events A और B चुनें, फिर OR, AND और "A दिया हो तो B" के बीच बदलें। Panel खाने गिनकर addition rule और independence जाँचता है।
每个格子是 36 个等可能结果之一(第一颗,第二颗)。选择事件 A 和 B,再在“或”“且”“已知 A 时的 B”之间切换。右侧面板通过数格子验证加法法则和独立性。
sum = 7 with first die = 1: independent — a surprise for most people. sum = 7 with sum even: mutually exclusive. first die even with second die ≤ 2: independent, because the two dice do not affect each other. sum ≥ 9 with at least one 6: strongly dependent.
योग = 7 के साथ पहला die = 1: independent — ज़्यादातर लोगों के लिए हैरानी की बात। योग = 7 के साथ योग सम: mutually exclusive। पहला die सम के साथ दूसरा die ≤ 2: independent, क्योंकि दोनों dice एक-दूसरे पर असर नहीं डालते। योग ≥ 9 के साथ कम से कम एक 6: बहुत dependent।
和 = 7 配 第一颗 = 1:独立 —— 多数人会感到意外。和 = 7 配 和为偶数:互斥。第一颗为偶数 配 第二颗 ≤ 2:独立,因为两颗骰子互不影响。和 ≥ 9 配 至少一个 6:强烈相关。
Three Meanings of Probability 🔭Probability के तीन अर्थ 🔭概率的三种含义 🔭
Over three centuries, people developed three ways to say what a probability is. Each fits different problems, and a data scientist uses all three.
तीन सदियों में लोगों ने यह बताने के तीन तरीके बनाए कि probability क्या है। हर तरीका अलग समस्याओं में काम आता है, और data scientist तीनों का इस्तेमाल करता है।
三个世纪以来,人们发展出三种方式来解释概率是什么。每种适合不同的问题,数据科学家三种都会用。
- Also: a priori / theoreticalदूसरा नाम: a priori / सैद्धांतिक又称:先验 / 理论概率
- Needs equally likely outcomesबराबर संभावना वाले नतीजे चाहिए要求结果等可能
- Worked out before any experimentकिसी प्रयोग से पहले निकाली जाती है实验之前就能算出
- Works for: dice, cards, coinsकाम आती है: dice, पत्ते, सिक्के适用:骰子、扑克、硬币
- Fails when outcomes are not equalनतीजे बराबर न हों तो विफल结果不等可能时失效
- Also: empirical / long-run frequencyदूसरा नाम: empirical / लंबी अवधि की आवृत्ति又称:经验 / 长期频率
- Based on repeated trialsदोहराए गए trials पर आधारित基于重复试验
- Estimated from real dataअसली data से अनुमान由真实数据估计
- Works for: insurance, medicine, QCकाम आती है: बीमा, चिकित्सा, QC适用:保险、医学、质检
- Struggles with one-time eventsएक बार की घटनाओं में मुश्किल难以处理一次性事件
- Also: subjective / degree of beliefदूसरा नाम: subjective / विश्वास की मात्रा又称:主观 / 信念程度
- Updated when evidence arrivesसबूत आने पर update有新证据就更新
- Prior × likelihood → posteriorPrior × likelihood → posterior先验 × 似然 → 后验
- Works for: one-time events, ML, AIकाम आती है: एक बार की घटनाएँ, ML, AI适用:一次性事件、ML、AI
- Needs a prior (can be debated)Prior चाहिए (जिस पर बहस हो सकती है)需要先验(可能有争议)
Type 1 — Classical Probability 🎴प्रकार 1 — Classical Probability 🎴类型 1 — 古典概率 🎴
The Story: Laplace and the Equally Likely Worldकहानी: Laplace और बराबर संभावना की दुनिया故事:拉普拉斯与等可能的世界
In 1814 the French mathematician Pierre-Simon Laplace published his Philosophical Essay on Probabilities. He wrote down the classical rule clearly: when all outcomes are equally likely — a fair coin, a fair die, a well-shuffled deck — you can find a probability just by counting, before any data is collected. (Cardano, Pascal and Fermat had used the idea earlier.)
1814 में फ़्रांसीसी गणितज्ञ Pierre-Simon Laplace ने Philosophical Essay on Probabilities प्रकाशित किया। उन्होंने classical नियम साफ़ लिखा: जब सारे नतीजे बराबर संभावना वाले हों — सही सिक्का, सही die, अच्छी तरह फेंटी गई गड्डी — तो probability सिर्फ़ गिनकर निकाली जा सकती है, कोई data जुटाने से पहले। (Cardano, Pascal और Fermat यह विचार पहले इस्तेमाल कर चुके थे।)
1814 年,法国数学家拉普拉斯出版了《概率的哲学随笔》。他清楚地写出古典法则:当所有结果等可能时 —— 均匀的硬币、均匀的骰子、洗好的牌 —— 不用收集数据,只靠计数就能算出概率。(卡尔达诺、帕斯卡和费马更早就用过这个想法。)
It fails when outcomes are NOT equally likely. A thumbtack can land point-up or point-down, but these are not 50/50. A loaded die, a real stock market, a football match — none fit Laplace's assumption. For these you need frequentist or Bayesian probability.
यह तब विफल होती है जब नतीजे बराबर संभावना वाले नहीं होते। Thumbtack नोक ऊपर या नीचे गिर सकती है, पर यह 50/50 नहीं। Loaded die, असली शेयर बाज़ार, फ़ुटबॉल मैच — कोई Laplace की मान्यता पर खरा नहीं उतरता। इनके लिए frequentist या Bayesian probability चाहिए।
当结果不等可能时它就失效。图钉可以针尖朝上或朝下落地,但并非 50/50。灌铅骰子、真实股市、足球比赛 —— 都不符合拉普拉斯的假设。这时需要频率或贝叶斯概率。
Type 2 — Frequentist Probability 📊प्रकार 2 — Frequentist Probability 📊类型 2 — 频率概率 📊
The Story: Halley and the First Life Insurance Mathsकहानी: Halley और जीवन बीमा का पहला गणित故事:哈雷与最早的寿险数学
In 1693 Edmond Halley (of Halley's Comet) published one of the first reliable life tables. It used birth and death records from the city of Breslau (today Wrocław, Poland). Halley could not say when any one person would die. But his table showed that of 445 people alive at age 40, about 436 were still alive at 41. So roughly 9 in 445 — about 2 in 100 — died in that year. Fair prices for life insurance could now be calculated.
1693 में Edmond Halley (Halley's Comet वाले) ने पहली भरोसेमंद life tables में से एक प्रकाशित की। इसमें Breslau शहर (आज Wrocław, Poland) के जन्म और मृत्यु रिकॉर्ड इस्तेमाल हुए। Halley यह नहीं बता सकते थे कि कोई एक व्यक्ति कब मरेगा। पर उनकी table ने दिखाया कि 40 की उम्र में जीवित 445 लोगों में से लगभग 436, 41 पर भी जीवित थे। यानी लगभग 445 में 9 — लगभग 100 में 2 — उस साल मरे। अब जीवन बीमा की सही कीमत निकाली जा सकती थी।
1693 年,埃德蒙·哈雷(哈雷彗星的发现者)发表了最早的可靠生命表之一。它使用了布雷斯劳(今波兰弗罗茨瓦夫)的出生与死亡记录。哈雷无法预测某个人何时去世,但他的表显示:40 岁时在世的 445 人中,约 436 人活到 41 岁。也就是 445 人中约 9 人 —— 约每 100 人中 2 人 —— 在那一年去世。从此可以计算出合理的寿险价格。
This is frequentist probability: the long-run share of times an event happens over many repeated trials. It needs no "equally likely" assumption — only plenty of data.
यही frequentist probability है: बहुत सारे दोहराए trials में किसी event के होने का लंबी अवधि का हिस्सा। इसे "बराबर संभावना" की मान्यता नहीं चाहिए — बस काफ़ी data।
这就是频率概率:在大量重复试验中事件发生的长期比例。它不需要“等可能”假设 —— 只需要足够多的数据。
The Law of Large Numbers — Real RunsLaw of Large Numbers — असली Runs大数定律 — 真实模拟
Below are three real computer runs of 10,000 fair coin flips (not a hand-drawn sketch). Early on they wander far from 0.5. Later they settle down and stay inside the shrinking band.
नीचे 10,000 सही सिक्का उछालों के तीन असली computer runs हैं (हाथ से बना sketch नहीं)। शुरुआत में ये 0.5 से दूर भटकते हैं। बाद में शांत होकर सिकुड़ते band के अंदर रहते हैं।
下面是 10,000 次公平抛硬币的三次真实电脑模拟(不是手绘示意图)。开始时它们远离 0.5,之后逐渐稳定并保持在不断收窄的带内。
Choose an experiment and add trials. The blue line is the running share f/n. The amber band shows how much wobble is normal for each n. For the thumbtack, no formula gives the answer — the trials find it.
एक प्रयोग चुनें और trials जोड़ें। नीली रेखा चलता हिस्सा f/n है। नारंगी band दिखाता है कि हर n पर कितना उतार-चढ़ाव सामान्य है। Thumbtack के लिए कोई formula जवाब नहीं देता — trials उसे ढूँढते हैं।
选择一个试验并增加次数。蓝线是累计比例 f/n。琥珀色带表示每个 n 下正常的波动范围。图钉没有公式能给出答案 —— 要靠试验找出来。
It needs repeatable trials. What is the chance of rain in Delhi on 15 August 2027? There will be only one such day. Or: "What is the chance that this defendant committed this crime?" One-time events need another way of thinking — Bayesian probability. (Weather forecasters do check their forecasts against long-run records of similar days, which mixes both ideas.)
इसे दोहराए जा सकने वाले trials चाहिए। 15 अगस्त 2027 को दिल्ली में बारिश का chance क्या है? ऐसा दिन सिर्फ़ एक बार आएगा। या: "इस आरोपी ने यह अपराध किया, इसका chance क्या है?" एक बार की घटनाओं को सोचने का दूसरा तरीका चाहिए — Bayesian probability। (मौसम विभाग अपने forecasts को मिलते-जुलते दिनों के लंबे रिकॉर्ड से जाँचते हैं, जो दोनों विचारों को मिलाता है।)
它需要可重复的试验。2027 年 8 月 15 日德里下雨的概率是多少?这样的日子只有一个。又如:“这名被告犯下这桩罪行的概率是多少?”一次性事件需要另一种思路 —— 贝叶斯概率。(天气预报员会用相似日子的长期记录来检验预报,这其实结合了两种思想。)
Type 3 — Bayesian Probability 🔄प्रकार 3 — Bayesian Probability 🔄类型 3 — 贝叶斯概率 🔄
The Story: The Lost Submarineकहानी: खोई हुई पनडुब्बी故事:失踪的潜艇
In May 1968 the US nuclear submarine Scorpion vanished in the Atlantic. Searching the whole ocean floor was hopeless. Navy scientist John Craven used Bayesian reasoning. He asked experienced submariners and other experts how likely each loss scenario was. Each scenario pointed to different grid squares of sea floor. Combined, they gave a probability for every square, and the search went to the most likely squares first.
मई 1968 में अमेरिकी परमाणु पनडुब्बी Scorpion Atlantic में ग़ायब हो गई। पूरे समुद्र तल को खोजना नामुमकिन था। Navy वैज्ञानिक John Craven ने Bayesian सोच अपनाई। उन्होंने अनुभवी पनडुब्बी अफ़सरों और दूसरे विशेषज्ञों से पूछा कि हर हादसे की कहानी (scenario) कितनी संभव है। हर scenario समुद्र तल के अलग खानों की ओर इशारा करता था। मिलाकर इन्होंने हर खाने की probability दी, और खोज पहले सबसे संभावित खानों में हुई।
1968 年 5 月,美国核潜艇天蝎号在大西洋失踪。搜索整个海底毫无希望。海军科学家约翰·克雷文采用了贝叶斯推理。他请经验丰富的潜艇军官和其他专家评估每种失事情景的可能性。每种情景指向海底网格中的不同方块。综合起来就得到每个方块的概率,搜索先从最可能的方块开始。
In October 1968 the wreck was found in about 3,000 m of water southwest of the Azores — reported to be within about 220 yards (≈ 200 m) of Craven's best estimate. Bayesian search has since helped find lost aircraft and other submarines.
अक्टूबर 1968 में मलबा Azores के दक्षिण-पश्चिम में लगभग 3,000 m गहराई में मिला — बताया जाता है कि Craven के सबसे अच्छे अनुमान से लगभग 220 yards (≈ 200 m) के अंदर। तब से Bayesian search ने खोए विमान और दूसरी पनडुब्बियाँ ढूँढने में मदद की है।
1968 年 10 月,残骸在亚速尔群岛西南约 3,000 米深的海底被找到 —— 据报道距克雷文的最佳估计点约 220 码(≈ 200 米)以内。此后,贝叶斯搜索还帮助找到了失事飞机和其他潜艇。
Counting people is easier than multiplying fractions. Set the disease rate and test quality, then test 10,000 people. Then re-test only the positives and watch the posterior jump.
लोगों को गिनना fractions गुणा करने से आसान है। बीमारी की दर और test की गुणवत्ता चुनें, फिर 10,000 लोगों की जाँच करें। फिर सिर्फ़ positives की दोबारा जाँच करें और posterior की छलांग देखें।
数人头比乘分数更容易。设置患病率和检测质量,然后检测 10,000 人。再只对阳性者复检,看后验概率如何跃升。
After the first positive test, 16.1% becomes the new prior. A second positive test (with independent errors) lifts it to about 78.5%, and a third to about 98.6%. Each piece of evidence sharpens the belief. This is the idea behind spam filters, robot navigation and many recommendation systems.
पहले positive test के बाद 16.1% नया prior बन जाता है। दूसरा positive test (independent ग़लतियों के साथ) इसे लगभग 78.5% और तीसरा लगभग 98.6% तक ले जाता है। हर सबूत विश्वास को और पक्का करता है। Spam filters, robot navigation और कई recommendation systems के पीछे यही विचार है।
第一次阳性后,16.1% 成为新的先验。第二次阳性(假设各次检测的错误相互独立)把它提高到约 78.5%,第三次提高到约 98.6%。每条证据都让信念更清晰。垃圾邮件过滤、机器人导航和许多推荐系统都基于这个思想。
| FeatureFeature特征 | ClassicalClassical古典 | FrequentistFrequentist频率 | BayesianBayesian贝叶斯 |
|---|---|---|---|
| Based onआधार依据 | Counting equally likely outcomesबराबर संभावना वाले नतीजे गिनना数等可能结果 | Long-run observed frequencyलंबी अवधि की देखी गई आवृत्ति长期观测频率 | Degree of belief + evidenceविश्वास की मात्रा + सबूत信念程度 + 证据 |
| Needs data?Data चाहिए?需要数据吗? | No — theoryनहीं — सिद्धांत不需要 — 理论 | Yes — many trialsहाँ — कई trials需要 — 大量试验 | Prior + evidencePrior + सबूत先验 + 证据 |
| One-time events?एक बार की घटनाएँ?一次性事件? | Only if outcomes are symmetricसिर्फ़ अगर नतीजे सममित हों仅当结果对称时 | Hardमुश्किल困难 | Yesहाँ可以 |
| Key assumptionमुख्य मान्यता关键假设 | Equal likelihoodबराबर संभावना等可能 | Repeatable experimentsदोहराए जा सकने वाले प्रयोग可重复的实验 | A sensible priorएक उचित prior合理的先验 |
| Best forसबसे अच्छा最适合 | Games, combinatoricsखेल, combinatorics游戏、组合数学 | Insurance, QC, epidemiologyबीमा, QC, epidemiology保险、质检、流行病学 | ML, medicine, forecastingML, चिकित्सा, forecasting机器学习、医学、预测 |
| Exampleउदाहरण例子 | Card-game oddsपत्तों के खेल के odds纸牌游戏胜率 | Defect rates, life tablesDefect दरें, life tables次品率、生命表 | Spam filters, diagnosisSpam filters, निदान垃圾邮件过滤、诊断 |
The Rules of the Game — Kolmogorov's Axioms 📏खेल के नियम — Kolmogorov के Axioms 📏游戏规则 — 柯尔莫哥洛夫公理 📏
All three meanings of probability follow the same maths. In 1933 Andrey Kolmogorov wrote it down as three simple axioms — starting rules that are accepted, not proved. Every other rule in this tutorial is derived from them.
Probability के तीनों अर्थ एक ही गणित मानते हैं। 1933 में Andrey Kolmogorov ने इसे तीन सरल axioms के रूप में लिखा — शुरुआती नियम जो माने जाते हैं, साबित नहीं किए जाते। इस tutorial का हर दूसरा नियम इन्हीं से निकाला गया है।
三种概率含义遵循同一套数学。1933 年,柯尔莫哥洛夫把它写成三条简单的公理 —— 公理是被接受的出发点,而不是被证明的结论。本教程中其他所有法则都由它们推导出来。
Rule 1 — The Addition Rule (OR) ➕नियम 1 — Addition Rule (OR) ➕法则 1 — 加法法则(或)➕
The Story: Raffle Tickets and Playing Cardsकहानी: Raffle Tickets और ताश के पत्ते故事:抽奖券与扑克牌
A school raffle has 100 tickets. You hold tickets #7 and #23. Only one ticket is drawn, so both cannot win. Your chance is 1/100 + 1/100 = 2%. Adding works because the events are mutually exclusive.
एक school raffle में 100 tickets हैं। आपके पास #7 और #23 हैं। सिर्फ़ एक ticket निकलता है, इसलिए दोनों नहीं जीत सकते। आपका chance 1/100 + 1/100 = 2%। जोड़ना इसलिए काम करता है क्योंकि events mutually exclusive हैं।
学校抽奖共 100 张券,你持有 7 号和 23 号。只抽一张,所以两张不可能同时中奖。你的概率是 1/100 + 1/100 = 2%。能直接相加是因为两个事件互斥。
Now: "What is the chance of drawing a King OR a Heart?" The King of Hearts is both. Adding P(King) + P(Heart) would count it twice. So we subtract the overlap once.
अब: "बादशाह या पान (Heart) निकलने का chance क्या है?" पान का बादशाह दोनों है। P(King) + P(Heart) जोड़ने पर वह दो बार गिना जाएगा। इसलिए overlap को एक बार घटाते हैं।
再看:“抽到 K 或红心的概率是多少?”红心 K 两者都是。直接相加 P(K) + P(红心) 会把它数两次,所以要减去一次重叠部分。
Kings appear first, then Hearts, then the one card counted twice.
पहले Kings दिखते हैं, फिर Hearts, फिर वह एक पत्ता जो दो बार गिना गया।
先显示 K,再显示红心,最后显示被数了两次的那张牌。
Rule 2 — The Multiplication Rule (AND) ✖️नियम 2 — Multiplication Rule (AND) ✖️法则 2 — 乘法法则(且)✖️
The Story: Guessing a PINकहानी: PIN का अंदाज़ा故事:猜 PIN 码
A security analyst asks: what is the chance of guessing a random 4-digit PIN on the first try? Each digit has 10 choices, chosen independently. So there are 10 × 10 × 10 × 10 = 10,000 PINs, and P(right first time) = 1/10,000 = 0.01%. (Real people often pick easy PINs like 1234, so real attackers do better than this — the "independent and equally likely" assumption matters.)
एक security analyst पूछता है: random 4-अंकों वाला PIN पहली कोशिश में सही अंदाज़ा लगाने का chance क्या है? हर अंक के 10 विकल्प हैं, independent तरीके से चुने गए। तो 10 × 10 × 10 × 10 = 10,000 PINs हैं, और P(पहली बार सही) = 1/10,000 = 0.01%। (असली लोग अक्सर 1234 जैसे आसान PIN चुनते हैं, इसलिए असली हमलावर इससे बेहतर करते हैं — "independent और बराबर संभावना" वाली मान्यता मायने रखती है।)
安全分析师问:第一次就猜中一个随机 4 位 PIN 的概率是多少?每位数字有 10 种选择,且相互独立。共有 10 × 10 × 10 × 10 = 10,000 种 PIN,P(一次猜中) = 1/10,000 = 0.01%。(现实中人们常选 1234 这类简单 PIN,所以真实攻击者成功率更高 ——“独立且等可能”的假设很关键。)
Multiply along a path to get its probability. Add paths for "or".
किसी रास्ते की probability के लिए उस पर गुणा करें। "या" के लिए रास्ते जोड़ें।
沿路径相乘得到该路径概率;“或”就把路径相加。
Set the red and blue balls, then draw two. Switch between with and without replacement and watch the second-level branches change. Run 1,000 draws to compare the tree with real frequencies.
लाल और नीली गेंदें चुनें, फिर दो निकालें। वापस डालकर और बिना वापस डाले के बीच बदलें और दूसरे स्तर की शाखाएँ बदलती देखें। Tree की असली frequencies से तुलना के लिए 1,000 बार निकालें।
设置红球和蓝球数量,然后摸两个。在有放回与无放回之间切换,观察第二层分支如何变化。摸 1,000 次,把树上的概率与真实频率比较。
Testing Independence 🔍Independence की जाँच 🔍检验独立性 🔍
How do you know if two events are independent? Work out P(A), P(B) and P(A ∩ B) from your data, and check whether the multiplication rule holds.
कैसे पता करें कि दो events independent हैं? अपने data से P(A), P(B) और P(A ∩ B) निकालें, और देखें कि multiplication rule लागू होता है या नहीं।
怎么知道两个事件是否独立?从数据算出 P(A)、P(B) 和 P(A ∩ B),检查乘法法则是否成立。
This is a very common mix-up. If A and B are mutually exclusive (and both possible), then knowing A happened tells you B did not happen. That is the strongest possible dependence. Example: on one die, "odd" and "even" are mutually exclusive, and P(even | odd) = 0, not 0.5.
यह बहुत आम ग़लतफ़हमी है। अगर A और B mutually exclusive हैं (और दोनों संभव हैं), तो A हुआ यह जानते ही पता चल जाता है कि B नहीं हुआ। यह सबसे मज़बूत dependence है। उदाहरण: एक die पर "विषम" और "सम" mutually exclusive हैं, और P(सम | विषम) = 0, 0.5 नहीं।
这是非常常见的混淆。若 A 与 B 互斥(且都可能发生),知道 A 发生就等于知道 B 没有发生 —— 这是最强的相依。例如一颗骰子上“奇数”与“偶数”互斥,P(偶数 | 奇数) = 0,而不是 0.5。
The Complement Shortcut — The Birthday Problem 🎂Complement का Shortcut — Birthday Problem 🎂对立事件捷径 — 生日问题 🎂
How many people must be in a room for a 50% chance that two share a birthday? Most people guess around 180. The answer is just 23. The trick is the complement rule: it is hard to count all the ways of "at least one match", but easy to find P(all different) and subtract it from 1.
कमरे में कितने लोग हों कि दो का जन्मदिन एक होने का 50% chance हो? ज़्यादातर लोग लगभग 180 कहते हैं। जवाब सिर्फ़ 23 है। तरकीब complement rule है: "कम से कम एक मेल" के सारे तरीके गिनना मुश्किल है, पर P(सब अलग) निकालकर 1 से घटाना आसान है।
房间里要有多少人,才能有 50% 的概率出现两人同一天生日?多数人会猜 180 左右。答案只是 23。窍门是对立事件法则:直接数“至少一对相同”的所有情况很难,但算出 P(全部不同) 再用 1 减去它很容易。
Each row is a month and each square a day. People arrive one by one; a red square means two share that birthday. Run 1,000 rooms to check the exact curve.
हर पंक्ति एक महीना और हर खाना एक दिन है। लोग एक-एक कर आते हैं; लाल खाना मतलब दो का जन्मदिन एक। सटीक curve जाँचने के लिए 1,000 कमरे चलाएँ।
每行是一个月,每个方块是一天。人一个个进来,红色方块表示有两人同一天生日。模拟 1,000 个房间来验证精确曲线。
Python ImplementationPython ImplementationPython 实现
Classical probability by listing the sample spaceSample space लिखकर classical probability列出样本空间计算古典概率
# 1) Classical probability: list the sample space and count
from fractions import Fraction
from itertools import product
omega = list(product(range(1, 7), repeat=2)) # two dice: 36 outcomes
print("Size of sample space:", len(omega))
def P(event):
favourable = [w for w in omega if event(w)]
return Fraction(len(favourable), len(omega))
A = lambda w: w[0] + w[1] == 7 # sum is 7
B = lambda w: w[0] == 6 or w[1] == 6 # at least one six
print("P(sum = 7) =", P(A))
print("P(at least one 6) =", P(B))
print("P(A and B) =", P(lambda w: A(w) and B(w)))
print("P(A or B) =", P(lambda w: A(w) or B(w)))
print("Check addition rule:", P(A) + P(B) - P(lambda w: A(w) and B(w)))
Frequentist probability: the law of large numbersFrequentist probability: law of large numbers频率概率:大数定律
# 2) Frequentist probability: relative frequency settles down (Law of Large Numbers)
import numpy as np
rng = np.random.default_rng(7)
flips = rng.integers(0, 2, size=100_000) # 1 = heads
running = np.cumsum(flips) / np.arange(1, flips.size + 1)
for n in [10, 100, 1_000, 10_000, 100_000]:
print(f"after {n:>7,} flips: share of heads = {running[n-1]:.4f} (error {abs(running[n-1]-0.5):.4f})")
Checking the card rules by brute forceताश के नियम brute force से जाँचना用穷举验证纸牌法则
# 3) Card rules checked by brute force over a real deck
from fractions import Fraction
from itertools import permutations
ranks = "A 2 3 4 5 6 7 8 9 10 J Q K".split()
suits = "♠♥♦♣"
deck = [(r, s) for r in ranks for s in suits]
king = sum(r == "K" for r, s in deck)
heart = sum(s == "♥" for r, s in deck)
both = sum(r == "K" and s == "♥" for r, s in deck)
print("P(King or Heart) =", Fraction(king + heart - both, 52))
pairs = list(permutations(deck, 2)) # ordered draws, no replacement
aces = sum(a[0] == "A" and b[0] == "A" for a, b in pairs)
print("P(two Aces, no replacement) =", Fraction(aces, len(pairs)))
print("P(two Aces, with replacement) =", Fraction(4, 52) ** 2)
reds = Fraction(26, 52) * Fraction(25, 51) * Fraction(24, 50)
print("P(three reds in a row) =", reds, "=", round(float(reds), 4))
Bayes' theorem, one test at a timeBayes' theorem, एक-एक test贝叶斯定理:逐次检测
# 4) Bayes: update after each positive test
prior, sens, spec = 0.01, 0.95, 0.95
p = prior
for test in range(1, 4):
p_pos = sens * p + (1 - spec) * (1 - p) # total probability
p = sens * p / p_pos # Bayes' theorem
print(f"after positive test {test}: P(disease) = {p:.3f}")
Independence check and the birthday problemIndependence जाँच और birthday problem独立性检验与生日问题
# 5) Independence check and the complement rule (birthday problem)
pA, pB, pAB = 100/200, 140/200, 90/200
print("P(A)P(B) =", pA * pB, " P(A and B) =", pAB, " P(B|A) =", pAB / pA)
print("independent?", abs(pA * pB - pAB) < 1e-9)
def p_shared(n):
p_none = 1.0
for k in range(n):
p_none *= (365 - k) / 365
return 1 - p_none # complement rule
for n in [10, 23, 30, 50, 70]:
print(f"{n} people: P(at least two share a birthday) = {p_shared(n):.3f}")
All the Rules Together — Quick Referenceसारे नियम एक साथ — झटपट सारांश全部法则 — 速查表
| Ruleनियम法则 | FormulaFormula公式 | When to useकब इस्तेमाल करें何时使用 | Key wordमुख्य शब्द关键词 |
|---|---|---|---|
| ComplementComplement对立 | P(Aᶜ) = 1 − P(A) | "At least one", "not", "none""कम से कम एक", "नहीं", "कोई नहीं"“至少一个”“不”“没有” | NOTNOT非 |
| Addition (ME)Addition (ME)加法(互斥) | P(A ∪ B) = P(A) + P(B) | Events that cannot overlapजो events overlap नहीं कर सकते不会重叠的事件 | OR, no overlapOR, overlap नहीं或,无重叠 |
| Addition (general)Addition (general)加法(一般) | P(A ∪ B) = P(A) + P(B) − P(A ∩ B) | Any two events (always safe)कोई भी दो events (हमेशा सुरक्षित)任意两个事件(总是安全) | OR, with overlapOR, overlap के साथ或,有重叠 |
| Multiplication (indep.)Multiplication (indep.)乘法(独立) | P(A ∩ B) = P(A) × P(B) | Independent events onlyसिर्फ़ independent events仅限独立事件 | AND, independentAND, independent且,独立 |
| Multiplication (general)Multiplication (general)乘法(一般) | P(A ∩ B) = P(A) × P(B | A) | Any two events (always safe)कोई भी दो events (हमेशा सुरक्षित)任意两个事件(总是安全) | AND, dependentAND, dependent且,相依 |
| ConditionalConditional条件概率 | P(B | A) = P(A ∩ B) / P(A) | Given that A happenedजब A हो चुका हो已知 A 发生 | GIVENGIVEN已知 |
| Total probabilityTotal probability全概率 | P(E) = P(E|H)P(H) + P(E|Hᶜ)P(Hᶜ) | The denominator of BayesBayes का हर (denominator)贝叶斯公式的分母 | SPLITSPLIT拆分 |
| Bayes' theoremBayes' theorem贝叶斯定理 | P(H | E) = P(E | H) × P(H) / P(E) | Update a belief with evidenceसबूत से विश्वास update करना用证据更新信念 | UPDATEUPDATE更新 |
The Golden Rules of ProbabilityProbability के सुनहरे नियम概率的黄金法则
Sample spaces define what can happen. Events pick out the outcomes you care about. The classical, frequentist and Bayesian views give probability its meaning. Three axioms lead to the addition, complement and multiplication rules, and from them come conditional probability, independence and Bayes' theorem. With these you are ready for random variables, distributions and statistical inference.
Sample spaces बताते हैं कि क्या हो सकता है। Events उन नतीजों को चुनते हैं जिनकी आपको परवाह है। Classical, frequentist और Bayesian नज़रिए probability को अर्थ देते हैं। तीन axioms से addition, complement और multiplication rules निकलते हैं, और उनसे conditional probability, independence और Bayes' theorem। इनके साथ आप random variables, distributions और statistical inference के लिए तैयार हैं।
样本空间规定了可能发生什么,事件挑出你关心的结果。古典、频率和贝叶斯观点赋予概率含义。三条公理推出加法、对立和乘法法则,进而得到条件概率、独立性和贝叶斯定理。掌握这些,你就可以学习随机变量、概率分布和统计推断了。