Foundations of Data Science 📂 Probability · 4 of 5 115 min read

Joint & Marginal Probability

A richly illustrated, story-driven tutorial covering joint probability P(A,B), marginal probability through summation/integration, and the precise mathematical triangle connecting joint, marginal, and conditional probability — with three complete real-world stories (Meera's commute, e-commerce email campaigns, medical smoking study), six custom inline SVGs (Venn, joint-to-marginal collapse, Golden Triangle, bivariate normal contours, probability tree, full tables), independence testing, continuo

🌐
Section 01

When Two Things Happen Together 🔗जब दो चीज़ें एक साथ होती हैं 🔗当两件事同时发生 🔗

Most events do not happen alone. A customer buys a laptop and a mouse. A patient has high blood pressure and high cholesterol. A student studies and passes the exam. Real data is full of pairs.

ज़्यादातर घटनाएँ अकेले नहीं होतीं। एक ग्राहक लैपटॉप और माउस दोनों खरीदता है। एक मरीज़ को high blood pressure और high cholesterol दोनों होते हैं। एक छात्र पढ़ाई करता है और परीक्षा पास करता है। असली data जोड़ों (pairs) से भरा है।

大多数事件不会单独发生。顾客买了笔记本电脑和鼠标。病人有高血压和高胆固醇。学生认真学习并且通过了考试。真实数据中到处都是"成对"的事件。

So far we asked about one event: "What is P(A)?" But data science looks at two or more variables together. How likely are A and B together? Does knowing one tell us about the other? For this we need three ideas: Joint Probability, Marginal Probability and Conditional Probability.

अब तक हमने एक ही event के बारे में पूछा: "P(A) क्या है?" लेकिन data science में हम दो या ज़्यादा variables को साथ में देखते हैं। A और B के साथ होने की probability कितनी है? क्या एक को जानकर दूसरे के बारे में कुछ पता चलता है? इसके लिए तीन concepts चाहिए: Joint Probability, Marginal Probability और Conditional Probability।

之前我们只问一个事件:"P(A) 是多少?"但数据科学经常同时研究两个或更多变量。A 和 B 同时发生的可能性有多大?知道其中一个,能否告诉我们另一个的信息?为此我们需要三个概念:Joint Probability、Marginal Probability 和 Conditional Probability。

Learn these three well. They are the base of Naive Bayes, Bayesian Networks and even Large Language Models. This page has 7 interactive simulations — play with each one.

इन तीनों को अच्छे से समझ लें। यही Naive Bayes, Bayesian Networks और Large Language Models की नींव हैं। इस page पर 7 interactive simulations हैं — हर एक को चलाकर देखें।

掌握这三个概念,你就理解了 Naive Bayes、Bayesian Networks 甚至 Large Language Models 的数学基础。本页包含 7 个交互式模拟——每一个都动手试试。

💡
The Three Probabilities at a Glanceतीनों Probabilities एक नज़र में三种概率一览

Joint P(A, B): A and B both happen.  |  Marginal P(A): A alone, ignoring B (sum out B).  |  Conditional P(A|B): A, given that B happened.  |  The link: P(A,B) = P(A|B) × P(B) = P(B|A) × P(A)

Joint P(A, B): A और B दोनों होते हैं।  |  Marginal P(A): सिर्फ़ A, B को ignore करके (B को sum out)।  |  Conditional P(A|B): A, जब पता हो कि B हुआ।  |  संबंध: P(A,B) = P(A|B) × P(B) = P(B|A) × P(A)

Joint P(A, B):A 和 B 同时发生。 |  Marginal P(A):只看 A,忽略 B(把 B sum out)。 |  Conditional P(A|B):已知 B 发生时 A 的概率。 |  关系:P(A,B) = P(A|B) × P(B) = P(B|A) × P(A)


Section 02

Joint Probability — P(A, B) 🎯

The Story: The Morning Commuterकहानी: सुबह का सफ़र故事:早晨的通勤者

Meera goes to work every morning. Two uncertain things happen each day. It might rain (R). Her bus might be late (L). They may be linked — rain can cause traffic. Meera wants to know all the combinations together, not each one alone. That is joint probability.

मीरा हर सुबह काम पर जाती है। हर दिन दो अनिश्चित बातें होती हैं। बारिश हो सकती है (R)। उसकी बस लेट हो सकती है (L)। ये जुड़ी हो सकती हैं — बारिश से traffic बढ़ता है। मीरा अलग-अलग नहीं, बल्कि सारे combinations एक साथ जानना चाहती है। यही joint probability है।

Meera 每天早上通勤上班。每天有两件不确定的事:可能下雨(R),公交可能晚点(L)。两者可能有关——下雨会导致堵车。Meera 想同时了解所有组合,而不是单独看每一件。这就是 joint probability。

Joint Probability (Discrete)
P(A, B) = P(A ∩ B)
The chance that A and B both happen in the same trial. The comma and ∩ mean the same thing.एक ही trial में A और B दोनों के होने की probability। Comma और ∩ का मतलब एक ही है।A 和 B 在同一次试验中同时发生的概率。逗号和 ∩ 含义相同。
Joint PDF (Continuous)
f(x, y)
For continuous X and Y, f(x,y) gives the density for each pair. P(a≤X≤b, c≤Y≤d) = ∬ f(x,y) dx dy.Continuous X और Y के लिए f(x,y) हर जोड़ी की density बताता है। P(a≤X≤b, c≤Y≤d) = ∬ f(x,y) dx dy।对于连续变量 X 和 Y,f(x,y) 给出每一对的密度。P(a≤X≤b, c≤Y≤d) = ∬ f(x,y) dx dy。
Joint PMF (Discrete)
p(x, y) = P(X=x, Y=y)
Gives a probability to every pair (x, y). All values add up to 1: Σₓ Σᵧ p(x,y) = 1.हर जोड़ी (x, y) को एक probability देता है। सभी values का जोड़ 1 होता है: Σₓ Σᵧ p(x,y) = 1।为每一对 (x, y) 分配一个概率。所有值之和为 1:Σₓ Σᵧ p(x,y) = 1。
Independence Test
P(A,B) = P(A)·P(B)
A and B are independent only if the joint equals the product. Any gap means they affect each other.A और B तभी independent हैं जब joint, दोनों probabilities के गुणनफल के बराबर हो। कोई भी अंतर बताता है कि वे एक-दूसरे पर असर डालते हैं।只有当 joint 等于乘积时,A 和 B 才是 independent。任何差异都说明它们相互影响。
Sim 1🎮 Venn ExplorerVenn ExplorerVenn 图探索

Move the sliders. Circle areas show P(A) and P(B). The orange overlap is the joint probability P(A,B). Watch the conditional probabilities and the independence check change live.

Sliders को खिसकाएँ। Circles का area P(A) और P(B) दिखाता है। नारंगी overlap ही joint probability P(A,B) है। देखें कि conditional probabilities और independence check कैसे तुरंत बदलते हैं।

拖动滑块。圆的面积表示 P(A) 和 P(B)。橙色重叠部分就是 joint probability P(A,B)。观察 conditional probability 和 independence 检验如何实时变化。

Ω A B A∩B area ∝ probability
P(A,B)
P(A)·P(B)
P(A|B)
P(B|A)
P(A∪B)
Lift

Section 03

The Joint Distribution Table 📋Joint Distribution Table 📋Joint Distribution 表 📋

The Story: Meera's Commute — The Full Pictureकहानी: मीरा का सफ़र — पूरी तस्वीर故事:Meera 的通勤——完整图景

Meera tracked her commute for 200 days. Each day she noted two things: did it rain (R)? Was the bus late (L)? From these counts we can build the full joint distribution. Then we can read every marginal and work out every conditional probability.

मीरा ने 200 दिनों तक अपने सफ़र का रिकॉर्ड रखा। हर दिन उसने दो बातें लिखीं: क्या बारिश हुई (R)? क्या बस लेट थी (L)? इन counts से हम पूरा joint distribution बना सकते हैं। फिर हर marginal पढ़ सकते हैं और हर conditional probability निकाल सकते हैं।

Meera 记录了 200 天的通勤情况。每天她记下两件事:是否下雨(R)?公交是否晚点(L)?根据这些计数,我们可以建立完整的 joint distribution,读出每个 marginal,并算出每个 conditional probability。

Count (200 days)गिनती (200 दिन)计数(200 天) Bus Late (L)बस लेट (L)公交晚点 (L) Bus On Time (Lᶜ)बस समय पर (Lᶜ)公交准时 (Lᶜ) Row TotalRow का जोड़行合计
Rained (R)बारिश हुई (R)下雨 (R)451560
No Rain (Rᶜ)बारिश नहीं (Rᶜ)没下雨 (Rᶜ)25115140
Column TotalColumn का जोड़列合计70130200

Now divide every cell by the grand total (200) to turn counts into probabilities:

अब हर cell को कुल जोड़ (200) से भाग दें, ताकि counts probabilities बन जाएँ:

现在把每个格子除以总数(200),把计数变成概率:

Joint P(·,·) L Lᶜ Marginal P(R·)
RP(R,L) = 45/200 = 0.225P(R,Lᶜ) = 15/200 = 0.075P(R) = 60/200 = 0.300
RᶜP(Rᶜ,L) = 25/200 = 0.125P(Rᶜ,Lᶜ) = 115/200 = 0.575P(Rᶜ) = 140/200 = 0.700
Marginal P(·L)P(L) = 70/200 = 0.350P(Lᶜ) = 130/200 = 0.6501.000 ✓
📐
How to Read the Joint TableJoint Table कैसे पढ़ें如何阅读 Joint Table

Each inner cell is a joint probability — one exact combination of both variables. Each row total is a marginal of the row variable. Each column total is a marginal of the column variable. The four inner cells add up to 1.00, because they cover every possible combination.

हर अंदर वाला cell एक joint probability है — दोनों variables का एक खास combination। हर row total, row variable की marginal है। हर column total, column variable की marginal है। चारों अंदर वाले cells का जोड़ 1.00 होता है, क्योंकि वे हर संभव combination को cover करते हैं।

每个内部格子都是一个 joint probability——两个变量的一种具体组合。每个行合计是行变量的 marginal。每个列合计是列变量的 marginal。四个内部格子之和为 1.00,因为它们覆盖了所有可能的组合。

Sim 2🚌 Meera's Commute Simulatorमीरा का Commute SimulatorMeera 通勤模拟器

Each simulated day has two steps. First, it rains with probability P(R). Then the bus is late with P(L|R) on rainy days, or P(L|Rᶜ) on dry days. Each day drops a dot into one of four cells. Run many days. The simulated joint probabilities settle near the true values. This is the Law of Large Numbers.

हर simulated दिन दो steps में चलता है। पहले, P(R) probability से बारिश होती है। फिर बारिश वाले दिन P(L|R) से और सूखे दिन P(L|Rᶜ) से बस लेट होती है। हर दिन चार cells में से एक में एक dot गिरता है। बहुत सारे दिन चलाएँ। Simulated joint probabilities असली values के पास आ जाती हैं। इसे Law of Large Numbers कहते हैं।

每个模拟日分两步:首先以概率 P(R) 下雨;然后雨天公交以 P(L|R) 晚点,晴天以 P(L|Rᶜ) 晚点。每一天会在四个格子之一落下一个点。运行很多天后,模拟的 joint probability 会接近真实值。这就是 Law of Large Numbers。

Simulated P(R,L) vs days (dashed = true value)Simulated P(R,L) बनाम दिन (dashed = असली value)模拟 P(R,L) 随天数变化(虚线 = 真实值)

Section 04

Marginal Probability — Summing Out a Variable 📊Marginal Probability — एक Variable को Sum Out करना 📊Marginal Probability — 把一个变量求和消去 📊

The Story: Zooming Outकहानी: बड़ी तस्वीर देखना故事:放眼全局

Meera's boss asks: "How often does it rain overall?" He does not care about the bus. So Meera adds the joint probabilities across every bus outcome. She is marginalising out the bus — summing over all its values.

मीरा का बॉस पूछता है: "कुल मिलाकर कितनी बार बारिश होती है?" उसे बस से कोई मतलब नहीं। इसलिए मीरा हर bus outcome की joint probabilities जोड़ देती है। वह bus variable को marginalise out कर रही है — उसकी सभी values पर जोड़ ले रही है।

Meera 的老板问:"总体来说,多久下一次雨?"他不关心公交。于是 Meera 把所有公交结果下的 joint probability 加起来。她正在把公交变量 marginalise out——对它的所有取值求和。

The name "marginal" comes from where these numbers sit: in the margins (edges) of the table. The idea matters more than the name. Marginalisation lets you focus on one variable and ignore the rest.

नाम "marginal" इसलिए है क्योंकि ये numbers table के margins (किनारों) पर होते हैं। नाम से ज़्यादा idea ज़रूरी है। Marginalisation से हम एक variable पर ध्यान देते हैं और बाकी को ignore करते हैं।

"Marginal"这个名字来自这些数字的位置:表格的边缘(margin)。概念比名字更重要。Marginalisation 让你只关注一个变量,忽略其他变量。

Marginal — Discrete (Sum)
P(A) = Σ_B P(A, B)
Add P(A,B) over all values of B. "Summing out" B leaves only A's distribution.B की सभी values पर P(A,B) जोड़ें। B को "sum out" करने पर सिर्फ़ A का distribution बचता है।对 B 的所有取值求 P(A,B) 之和。把 B "sum out" 后,只剩下 A 的分布。
Marginal — Continuous (Integrate)
f_X(x) = ∫ f(x,y) dy
Integrate the joint density over all values of Y. The result is X's density on its own.Y की सभी values पर joint density का integral लें। नतीजा सिर्फ़ X की density है।对 Y 的所有取值积分 joint density,结果就是 X 自己的密度。
Marginal P(B) from Joint
P(B) = Σ_A P(A, B)
Add P(A,B) over all values of A. This gives B's distribution and ignores A.A की सभी values पर P(A,B) जोड़ें। इससे B का distribution मिलता है और A ignore हो जाता है।对 A 的所有取值求 P(A,B) 之和,得到 B 的分布,忽略 A。
Normalisation Check
Σ_A P(A) = 1,  Σ_B P(B) = 1
Each marginal must add up to 1. All joint cells together must also add up to 1.हर marginal का जोड़ 1 होना चाहिए। सारे joint cells का जोड़ भी 1 होना चाहिए।每个 marginal 之和必须为 1。所有 joint 格子之和也必须为 1。
🧮 Computing Marginals — Meera's CommuteMarginals निकालना — मीरा का सफ़र计算 Marginal — Meera 的通勤
P(R) — Marginal
Sum across all bus outcomes (L and Lᶜ):सभी bus outcomes (L और Lᶜ) पर जोड़ें:对所有公交结果(L 和 Lᶜ)求和:
P(R) = P(R,L) + P(R,Lᶜ) = 0.225 + 0.075 = 0.300 (30%)
It rains on 30% of days — whatever the bus does.30% दिनों में बारिश होती है — बस चाहे जो करे।30% 的日子下雨——不管公交怎样。
P(Rᶜ) — Marginal
P(Rᶜ) = P(Rᶜ,L) + P(Rᶜ,Lᶜ) = 0.125 + 0.575 = 0.700 (70%)
Check: P(R) + P(Rᶜ) = 0.30 + 0.70 = 1.00 ✓
P(L) — Marginal
Sum across all rain outcomes (R and Rᶜ):सभी बारिश outcomes (R और Rᶜ) पर जोड़ें:对所有下雨结果(R 和 Rᶜ)求和:
P(L) = P(R,L) + P(Rᶜ,L) = 0.225 + 0.125 = 0.350 (35%)
The bus is late on 35% of days — ignoring rain.35% दिनों में बस लेट होती है — बारिश को ignore करके।35% 的日子公交晚点——不考虑是否下雨。
P(Lᶜ) — Marginal
P(Lᶜ) = P(R,Lᶜ) + P(Rᶜ,Lᶜ) = 0.075 + 0.575 = 0.650 (65%)
Check: P(L) + P(Lᶜ) = 0.35 + 0.65 = 1.00 ✓
All Cells Sum
0.225 + 0.075 + 0.125 + 0.575 = 1.000 ✓
The four joint cells cover every outcome, so they sum to 1.चारों joint cells हर outcome को cover करते हैं, इसलिए जोड़ 1 है।四个 joint 格子覆盖所有结果,因此总和为 1。
Sim 3🎬 Animation — Watch the Sum-OutAnimation — Sum-Out होते देखें动画 — 观看 Sum-Out 过程

Click a button. The joint values slide into the margin and add up. Row sums give P(R). Column sums give P(L).

Button दबाएँ। Joint values खिसककर margin में जाती हैं और जुड़ जाती हैं। Row का जोड़ P(R) देता है। Column का जोड़ P(L) देता है।

点击按钮。Joint 值会滑入边缘并相加。行之和得到 P(R),列之和得到 P(L)。

⏰ L✅ LᶜΣ → P(R·)
🌧️ R0.2250.075?
☀️ Rᶜ0.1250.575?
Σ → P(·L)???

Section 05

The Golden Triangle — Joint, Marginal & Conditional 🔺Golden Triangle — Joint, Marginal और Conditional 🔺Golden Triangle — Joint、Marginal 与 Conditional 🔺

Joint, marginal and conditional are not three separate topics. They are three views of the same information. Exact formulas link them. If you know any two, you can find the third.

Joint, marginal और conditional तीन अलग topics नहीं हैं। ये एक ही जानकारी के तीन रूप हैं। Exact formulas इन्हें जोड़ते हैं। किन्हीं दो को जानें, तो तीसरा निकाल सकते हैं।

Joint、marginal 和 conditional 不是三个独立的主题,而是同一信息的三种视角。精确的公式把它们联系在一起。知道其中任意两个,就能求出第三个。

Joint from Conditional × Marginal
P(A,B) = P(A|B) · P(B)
The multiplication rule. Joint = conditional × the marginal you condition on. Bayesian networks use this to break big joints into small pieces.Multiplication rule। Joint = conditional × जिस पर condition लगाई उसकी marginal। Bayesian networks इसी से बड़े joint को छोटे टुकड़ों में तोड़ते हैं।Multiplication rule。Joint = conditional × 被条件变量的 marginal。Bayesian networks 用它把大的 joint 分解成小块。
Conditional from Joint ÷ Marginal
P(A|B) = P(A,B) / P(B)
The definition of conditional probability. Divide by B's marginal. This shrinks the world to "only the cases where B happened".Conditional probability की definition। B की marginal से भाग दें। इससे दुनिया सिमटकर "सिर्फ़ वे cases जहाँ B हुआ" रह जाती है।Conditional probability 的定义。除以 B 的 marginal。这把样本空间缩小到"只看 B 发生的情况"。
Marginal from Joint (Sum Out)
P(A) = Σ_B P(A,B)
Sum (or integrate) the joint over every value of B. B disappears from the picture.Joint को B की हर value पर जोड़ें (या integrate करें)। B तस्वीर से गायब हो जाता है।对 B 的每个取值求和(或积分)joint。B 就从图中消失了。
Bayes' Theorem
P(A|B) = P(B|A)·P(A) / P(B)
Write P(A,B) two ways: P(A|B)·P(B) = P(B|A)·P(A). Divide by P(B). That is Bayes — the triangle used twice.P(A,B) को दो तरह से लिखें: P(A|B)·P(B) = P(B|A)·P(A)। P(B) से भाग दें। यही Bayes है — triangle का दो बार इस्तेमाल।把 P(A,B) 写成两种形式:P(A|B)·P(B) = P(B|A)·P(A),再除以 P(B)。这就是 Bayes——三角关系用了两次。
Sim 4🔺 Interactive Golden TriangleInteractive Golden Triangle交互式 Golden Triangle

Pick a route. The arrows light up and show the exact step with Meera's numbers.

एक route चुनें। तीर चमकेंगे और मीरा के numbers के साथ exact step दिखेगा।

选择一条路线。箭头会亮起,并用 Meera 的数据展示具体步骤。

Σ ÷ / × Bayes P(A, B)Joint P(A), P(B)Marginal P(A|B), P(B|A)Conditional
Sum out the other variable.दूसरे variable को sum out करें।把另一个变量 sum out。
P(R) = P(R,L) + P(R,Lᶜ) = 0.225 + 0.075 = 0.300
Divide the joint by the marginal.Joint को marginal से भाग दें।用 joint 除以 marginal。
P(L|R) = P(R,L) / P(R) = 0.225 / 0.300 = 0.750
Multiply back to get the joint.वापस गुणा करके joint पाएँ।乘回去得到 joint。
P(R,L) = P(L|R) × P(R) = 0.750 × 0.300 = 0.225
Flip the condition: go up to the joint, then down the other side.Condition को उलटें: पहले ऊपर joint तक जाएँ, फिर दूसरी तरफ़ नीचे आएँ।反转条件:先向上到 joint,再从另一侧下来。
P(R|L) = P(L|R)·P(R) / P(L) = 0.750 × 0.300 / 0.350 = 0.643

Section 06

Deriving Everything from the Joint Table 🔄Joint Table से सब कुछ निकालना 🔄从 Joint Table 推导一切 🔄

The joint table fully describes two variables. From it alone we can get every marginal and conditional, test independence and verify Bayes' Theorem. Let's do it all with Meera's data.

Joint table दो variables का पूरा विवरण है। सिर्फ़ इसी से हर marginal और conditional, independence test और Bayes' Theorem का verification हो सकता है। चलिए मीरा के data से सब करते हैं।

Joint table 完整描述了两个变量的关系。仅凭它,就能得到每个 marginal 和 conditional、检验 independence,并验证 Bayes' Theorem。我们用 Meera 的数据全部做一遍。

🧮 Complete Analysis — All Probabilities from One Joint Tableपूरा विश्लेषण — एक Joint Table से सारी Probabilities完整分析 — 从一张 Joint Table 得到所有概率
Joint Values
P(R,L)=0.225  |  P(R,Lᶜ)=0.075  |  P(Rᶜ,L)=0.125  |  P(Rᶜ,Lᶜ)=0.575
Marginals
P(R)=0.300, P(Rᶜ)=0.700  |  P(L)=0.350, P(Lᶜ)=0.650
P(L|R)
Given rain, how likely is a late bus?बारिश हो, तो बस लेट होने की probability?下雨时,公交晚点的概率?
P(L|R) = P(R,L) / P(R) = 0.225 / 0.300 = 0.750 (75%)
On rainy days the bus is late 75% of the time.बारिश वाले दिनों में बस 75% बार लेट होती है।雨天公交有 75% 的时候晚点。
P(L|Rᶜ)
Given no rain?बारिश न हो तो?没下雨时呢?
P(L|Rᶜ) = P(Rᶜ,L) / P(Rᶜ) = 0.125 / 0.700 = 0.179 (17.9%)
Without rain, only 17.9% — a huge difference!बिना बारिश सिर्फ़ 17.9% — बहुत बड़ा अंतर!不下雨时只有 17.9%——差别巨大!
P(R|L)
Given a late bus, how likely was rain?बस लेट हो, तो बारिश की probability?公交晚点时,下雨的概率?
P(R|L) = P(R,L) / P(L) = 0.225 / 0.350 = 0.643 (64.3%)
If the bus is late, there is a 64.3% chance it rained.अगर बस लेट है, तो 64.3% संभावना है कि बारिश हुई थी।如果公交晚点,有 64.3% 的可能当天下雨。
Independence?
P(R) × P(L) = 0.300 × 0.350 = 0.105   vs   P(R,L) = 0.225
0.105 ≠ 0.225 → NOT independent.Independent नहीं।不是 independent。 Rain strongly raises bus delay.बारिश बस की देरी को बहुत बढ़ाती है।下雨显著增加公交晚点。
Verify Bayes
P(R|L) = P(L|R) × P(R) / P(L) = 0.750 × 0.300 / 0.350 = 0.643 ✓
Bayes and the direct method agree.Bayes और direct method दोनों एक ही जवाब देते हैं।Bayes 与直接计算结果一致。
Sim 5🔬 Joint Table LabJoint Table LabJoint Table 实验室

Type any four counts, or load a story. Everything updates at once: joint, marginals, conditionals, the independence test, lift and the Bayes check. Cell colour shows how big each joint probability is.

कोई भी चार counts लिखें, या कोई कहानी load करें। सब कुछ तुरंत update होता है: joint, marginals, conditionals, independence test, lift और Bayes check। Cell का रंग दिखाता है कि joint probability कितनी बड़ी है।

输入任意四个计数,或加载一个故事。所有结果即时更新:joint、marginal、conditional、independence 检验、lift 和 Bayes 验证。格子颜色表示 joint probability 的大小。

Counts (edit me)Counts (बदलकर देखें)计数(可编辑)
BBᶜ
A
Aᶜ
Joint probabilities + marginalsJoint probabilities + marginalsJoint probability + marginal

Section 07

Story 2 — The E-Commerce Platform 🛒कहानी 2 — E-Commerce Platform 🛒故事 2 — 电商平台 🛒

Customer Purchase Analysisग्राहक खरीदारी विश्लेषण顾客购买分析

An online store tracks 1,000 customers for one month. Two yes/no behaviours: did they open the promo email (E)? Did they buy (P)? The marketing team wants the joint, marginal and conditional probabilities to plan better campaigns.

एक online store एक महीने तक 1,000 ग्राहकों को track करता है। दो हाँ/ना व्यवहार: क्या उन्होंने promo email खोला (E)? क्या उन्होंने खरीदारी की (P)? Marketing team बेहतर campaigns के लिए joint, marginal और conditional probabilities जानना चाहती है।

一家网店追踪了 1,000 位顾客一个月的行为。两个是/否行为:是否打开了促销邮件(E)?是否购买(P)?市场团队希望利用 joint、marginal 和 conditional probability 设计更好的营销活动。

Joint (n=1000) Purchased (P)खरीदा (P)购买 (P) Did Not Purchase (Pᶜ)नहीं खरीदा (Pᶜ)未购买 (Pᶜ) Marginal P(E·)
Opened Email (E)Email खोला (E)打开邮件 (E)180 → 0.180220 → 0.220400 → P(E) = 0.400
Didn't Open (Eᶜ)नहीं खोला (Eᶜ)未打开 (Eᶜ)70 → 0.070530 → 0.530600 → P(Eᶜ) = 0.600
Marginal P(·P)250 → P(P) = 0.250750 → P(Pᶜ) = 0.7501.000 ✓
🧮 E-Commerce — Business InsightsE-Commerce — Business Insights电商 — 业务洞察
Baseline
Overall purchase rate (marginal):कुल खरीद दर (marginal):总体购买率(marginal): P(P) = 0.250 (25%)
Email open rate (marginal):Email खोलने की दर (marginal):邮件打开率(marginal): P(E) = 0.400 (40%)
P(P|E)
P(P|E) = P(E,P) / P(E) = 0.180 / 0.400 = 0.450 (45%)
Email openers buy at nearly twice the baseline rate!Email खोलने वाले baseline से लगभग दोगुना खरीदते हैं!打开邮件的人购买率几乎是基准的两倍!
P(P|Eᶜ)
P(P|Eᶜ) = P(Eᶜ,P) / P(Eᶜ) = 0.070 / 0.600 = 0.117 (11.7%)
Non-openers buy at less than half the baseline.Email न खोलने वाले baseline के आधे से भी कम खरीदते हैं।未打开者的购买率不到基准的一半。
P(E|P)
P(E|P) = P(E,P) / P(P) = 0.180 / 0.250 = 0.720 (72%)
72% of buyers opened the email — a strong signal for attribution.72% खरीदारों ने email खोला — attribution के लिए मज़बूत संकेत।72% 的购买者打开过邮件——这是 attribution 的强信号。
Independence?
P(E) × P(P) = 0.400 × 0.250 = 0.100   vs   P(E,P) = 0.180
0.100 ≠ 0.180 → Strongly dependent.बहुत dependent।高度 dependent。
Lift
Lift = P(P|E) / P(P) = 0.450 / 0.250 = 1.80×
Openers are 1.8× more likely to buy than average.Email खोलने वाले औसत से 1.8× ज़्यादा खरीदते हैं।打开邮件者购买的可能性是平均水平的 1.8 倍。
⚠️
Association Is Not CausationAssociation का मतलब Causation नहींAssociation 不等于 Causation

The joint table shows that opening and buying go together. It does not prove the email caused the purchase. Keen shoppers may simply open more emails. To prove cause, run an A/B test.

Joint table दिखाती है कि email खोलना और खरीदना साथ होते हैं। यह साबित नहीं करती कि email की वजह से खरीदारी हुई। हो सकता है शौकीन खरीदार वैसे ही ज़्यादा emails खोलते हों। Cause साबित करने के लिए A/B test चलाएँ।

Joint table 显示打开邮件与购买同时出现,但并不能证明是邮件导致了购买。热衷购物的人可能本来就更常打开邮件。要证明因果关系,需要做 A/B test。


Section 08

Joint Probability for Continuous Variables 🌊Continuous Variables के लिए Joint Probability 🌊连续变量的 Joint Probability 🌊

The Story: Height and Weightकहानी: लंबाई और वज़न故事:身高与体重

A researcher studies the height (H) and weight (W) of adults. Both are continuous. The joint PDF f(h, w) is like a contour map of a hill. Higher contours mean more likely combinations.

एक researcher वयस्कों की लंबाई (H) और वज़न (W) का अध्ययन करता है। दोनों continuous हैं। Joint PDF f(h, w) एक पहाड़ी के contour map जैसा है। ऊँचे contours मतलब ज़्यादा संभावित combinations।

一位研究者研究成年人的身高(H)和体重(W)。两者都是连续变量。Joint PDF f(h, w) 就像一座山的等高线图,等高线越高,组合越可能出现。

Joint PDF
f(x,y) ≥ 0
The joint density is never negative. Higher density means more likely combinations in that region.Joint density कभी negative नहीं होती। ज़्यादा density मतलब उस क्षेत्र में ज़्यादा संभावित combinations।Joint density 永远非负。密度越高,该区域的组合越可能出现。
Normalisation
∬ f(x,y) dx dy = 1
The double integral over the whole plane is 1. All the probability adds up to 100%.पूरे plane पर double integral 1 है। सारी probability मिलकर 100% होती है।在整个平面上的二重积分等于 1。所有概率加起来为 100%。
Marginal PDF of X
f_X(x) = ∫ f(x,y) dy
Integrate out Y to get X's density alone. The continuous version of summing out.Y को integrate out करके सिर्फ़ X की density पाएँ। यह sum out का continuous रूप है।积分消去 Y,得到 X 自身的密度。这是"求和消去"的连续版本。
Conditional PDF
f(x|y) = f(x,y) / f_Y(y)
Divide the joint PDF by Y's marginal density. Same idea as the discrete formula.Joint PDF को Y की marginal density से भाग दें। Discrete formula जैसा ही idea।用 joint PDF 除以 Y 的 marginal density。与离散公式思路相同。

Visualising the Bivariate NormalBivariate Normal को देखना可视化 Bivariate Normal

The bivariate normal is the most important continuous joint distribution. Its contours are ellipses. The tilt of the ellipse shows the correlation ρ. Project the cloud onto an axis and you get a normal marginal.

Bivariate normal सबसे ज़रूरी continuous joint distribution है। इसके contours ellipse होते हैं। Ellipse का झुकाव correlation ρ दिखाता है। Points के बादल को किसी axis पर project करें, तो normal marginal मिलता है।

Bivariate normal 是最重要的连续 joint distribution。它的等高线是椭圆,椭圆的倾斜程度表示 correlation ρ。把点云投影到某个坐标轴上,就得到正态的 marginal。

Sim 6🌊 Bivariate Normal PlaygroundBivariate Normal PlaygroundBivariate Normal 实验场

Change ρ and watch the points glide. Notice: the marginal histograms keep the same bell shape. Only the joint changes! Move the Y-slice to see the conditional f(x|y₀) in purple. It shifts and gets narrower as |ρ| grows.

ρ बदलें और points को खिसकते देखें। ध्यान दें: marginal histograms का bell shape वैसा ही रहता है। सिर्फ़ joint बदलता है! Y-slice को खिसकाकर बैंगनी रंग में conditional f(x|y₀) देखें। |ρ| बढ़ने पर यह खिसकता है और पतला होता है।

改变 ρ,观察点的移动。注意:marginal 直方图始终保持相同的钟形,只有 joint 在变!移动 Y 切片,查看紫色的 conditional f(x|y₀)。|ρ| 越大,它偏移得越多、也越窄。


Section 09

Story 3 — Medical Study: Disease & Risk Factor 🏥कहानी 3 — Medical Study: बीमारी और Risk Factor 🏥故事 3 — 医学研究:疾病与风险因素 🏥

An epidemiologist asks: is smoking (S) linked to lung disease (D)? She builds the joint table from 5,000 patient records.

एक epidemiologist पूछती है: क्या smoking (S) का lung disease (D) से संबंध है? वह 5,000 मरीज़ों के records से joint table बनाती है।

一位流行病学家想知道:吸烟(S)与肺病(D)是否相关?她根据 5,000 份病历建立了 joint table。

Joint (n=5000) Lung Disease (D)Lung Disease (D)肺病 (D) No Disease (Dᶜ)बीमारी नहीं (Dᶜ)无疾病 (Dᶜ) Marginal P(S·)
Smoker (S)Smoker (S)吸烟者 (S)350 → 0.070650 → 0.1301000 → P(S) = 0.200
Non-Smoker (Sᶜ)Non-Smoker (Sᶜ)不吸烟者 (Sᶜ)150 → 0.0303850 → 0.7704000 → P(Sᶜ) = 0.800
Marginal P(·D)500 → P(D) = 0.1004500 → P(Dᶜ) = 0.9001.000 ✓
🧮 Medical Epidemiology — Full AnalysisMedical Epidemiology — पूरा विश्लेषण医学流行病学 — 完整分析
Baseline
Disease prevalence:बीमारी की prevalence:患病率(prevalence): P(D) = 0.100 (10%)
Smoking rate:Smoking दर:吸烟率: P(S) = 0.200 (20%)
P(D|S)
P(D|S) = P(S,D) / P(S) = 0.070 / 0.200 = 0.350 (35%)
35% of smokers have lung disease.35% smokers को lung disease है।35% 的吸烟者患有肺病。
P(D|Sᶜ)
P(D|Sᶜ) = P(Sᶜ,D) / P(Sᶜ) = 0.030 / 0.800 = 0.0375 (3.75%)
Non-smokers have only a 3.75% risk.Non-smokers में risk सिर्फ़ 3.75% है।不吸烟者的风险只有 3.75%。
Relative Risk
RR = P(D|S) / P(D|Sᶜ) = 0.350 / 0.0375 = 9.33×
Smokers are over 9 times more likely to have lung disease.Smokers में lung disease की संभावना 9 गुना से ज़्यादा है।吸烟者患肺病的可能性是不吸烟者的 9 倍以上。
P(S|D)
P(S|D) = P(S,D) / P(D) = 0.070 / 0.100 = 0.700 (70%)
70% of patients are smokers — though smokers are only 20% of people.70% मरीज़ smokers हैं — जबकि smokers आबादी का सिर्फ़ 20% हैं।70% 的患者是吸烟者——而吸烟者只占人口的 20%。
Total Probability
P(D) = P(D|S)×P(S) + P(D|Sᶜ)×P(Sᶜ) = 0.350×0.200 + 0.0375×0.800 = 0.070 + 0.030 = 0.100 ✓
🔁
Do Not Flip the Condition by Mistakeगलती से Condition को न उलटें不要误把条件颠倒

P(D|S) = 35% but P(S|D) = 70%. They answer different questions. Mixing them up is a classic error called the confusion of the inverse. Bayes' Theorem is the correct way to flip.

P(D|S) = 35% लेकिन P(S|D) = 70%। ये अलग-अलग सवालों के जवाब हैं। इन्हें मिला देना एक आम गलती है, जिसे confusion of the inverse कहते हैं। Condition को उलटने का सही तरीका Bayes' Theorem है।

P(D|S) = 35%,但 P(S|D) = 70%。它们回答的是不同的问题。把两者混淆是一个经典错误,称为 confusion of the inverse。正确的反转方法是 Bayes' Theorem。


Section 10

Independence in Joint Distributions 🔍Joint Distributions में Independence 🔍Joint Distribution 中的 Independence 🔍

Two random variables X and Y are independent when the joint splits exactly into the product of the marginals. Then knowing X tells you nothing about Y.

दो random variables X और Y तब independent हैं जब joint ठीक-ठीक marginals के गुणनफल में बँट जाए। तब X जानने से Y के बारे में कुछ पता नहीं चलता।

当 joint 恰好等于 marginal 的乘积时,两个 random variables X 和 Y 就是 independent 的。此时知道 X 不会告诉你任何关于 Y 的信息。

Independence Condition
P(X=x, Y=y) = P(X=x)·P(Y=y)
Must hold for ALL pairs (x, y). One failing cell disproves independence.सभी जोड़ियों (x, y) के लिए सही होना चाहिए। एक भी cell गलत हुआ तो independence नहीं।必须对所有 (x, y) 成立。只要一个格子不成立,就不是 independent。
Continuous Independence
f(x,y) = f_X(x) · f_Y(y)
The joint PDF must factor at every point. A bivariate normal with ρ = 0 is independent.Joint PDF हर point पर factor होना चाहिए। ρ = 0 वाला bivariate normal independent है।Joint PDF 必须在每一点都能分解。ρ = 0 的 bivariate normal 是 independent 的。
🧮 Independence Example — Die Roll and Coin FlipIndependence उदाहरण — पासा और सिक्काIndependence 示例 — 掷骰子与抛硬币
Setup
Roll a fair die (X = 1..6) and flip a fair coin (Y = H or T). The die cannot affect the coin.एक fair पासा (X = 1..6) फेंकें और एक fair सिक्का (Y = H या T) उछालें। पासा सिक्के पर असर नहीं डाल सकता।掷一个公平骰子(X = 1..6),抛一枚公平硬币(Y = H 或 T)。骰子不会影响硬币。
Marginals
P(X=k) = 1/6, k∈{1..6}  |  P(Y=H) = P(Y=T) = 1/2
Joint (one cell)
P(X=3, Y=H) = 1/6 × 1/2 = 1/12 ≈ 0.0833
All 12 cells
Each of the 12 combinations has probability 1/12. 12 × 1/12 = 1 ✓. Every cell = marginal × marginal.12 combinations में से हर एक की probability 1/12 है। 12 × 1/12 = 1 ✓। हर cell = marginal × marginal।12 种组合中每种的概率都是 1/12。12 × 1/12 = 1 ✓。每个格子 = marginal × marginal。
Contrast
Meera's commute:मीरा का सफ़र:Meera 的通勤: P(R,L) = 0.225, P(R)×P(L) = 0.105 → Not independent.Independent नहीं।不是 independent。
🪤
Common Trap: Mutually Exclusive ≠ Independentआम गलती: Mutually Exclusive ≠ Independent常见陷阱:Mutually Exclusive ≠ Independent

If A and B can never happen together, P(A,B) = 0. But P(A)·P(B) > 0. So they are dependent — knowing A happened tells you B did not. Try "No overlap" in Sim 1.

अगर A और B कभी साथ नहीं हो सकते, तो P(A,B) = 0। लेकिन P(A)·P(B) > 0। इसलिए वे dependent हैं — A हुआ, यह जानकर पता चल जाता है कि B नहीं हुआ। Sim 1 में "कोई overlap नहीं" दबाकर देखें।

如果 A 和 B 永远不能同时发生,那么 P(A,B) = 0,但 P(A)·P(B) > 0。所以它们是 dependent 的——知道 A 发生了,就知道 B 没有发生。在 Sim 1 中试试"无重叠"。

Sim 7🧲 Same Marginals, Different Jointsवही Marginals, अलग Joints相同的 Marginal,不同的 Joint

Set P(A) and P(B). Then drag the association slider. The marginals do not change, but the joint does. The left grid is the real joint. The right grid is what independence would give. They match only at 0. Mutual information I(A;B) is zero only then.

P(A) और P(B) set करें। फिर association slider खिसकाएँ। Marginals नहीं बदलते, लेकिन joint बदलता है। बायाँ grid असली joint है। दायाँ grid वह है जो independence में होता। दोनों सिर्फ़ 0 पर match करते हैं। Mutual information I(A;B) भी सिर्फ़ तभी zero होता है।

设定 P(A) 和 P(B),然后拖动关联滑块。Marginal 不变,但 joint 在变。左边是实际的 joint,右边是 independence 情况下应有的值。只有在 0 时两者才相同,此时 mutual information I(A;B) 也为零。

Actual joint P(A,B)असली joint P(A,B)实际 joint P(A,B)
If independent: P(A)·P(B)अगर independent: P(A)·P(B)若 independent:P(A)·P(B)

Section 11

Applications in Data Science & Machine Learning 🤖Data Science और Machine Learning में उपयोग 🤖在数据科学与机器学习中的应用 🤖

Applicationउपयोग应用 Joint UsedJoint का उपयोग使用的 Joint Marginal UsedMarginal का उपयोग使用的 Marginal Conditional Derivedनिकाला गया Conditional推导的 Conditional
🧠 Naive Bayes ClassifierP(features, class)P(class) — priorP(class | features) — prediction
🎬 Recommendation SystemP(user, item) — co-occurrenceP(item) — popularityP(item | user) — personalised
🔗 Bayesian NetworksΠ P(Xᵢ | Parents)Σ over hidden nodesP(query | evidence)
📊 Exploratory Data AnalysisHeatmaps / crosstabsHistogramsGroup-wise distributions
🔍 Anomaly DetectionP(X, Y) — normal combosP(X) — normal valuesP(Y | X) — outlier check
🧬 Genomics (GWAS)P(SNP₁, SNP₂) — linkageP(SNP) — allele frequencyP(disease | SNP profile)
📉 Finance: Risk ModellingP(Asset A, Asset B)P(Asset A) — returnsP(A | B drops) — contagion
🤖 Generative AI / LLMsP(token₁, …, tokenₙ)P(token) — unigramP(tokenₙ | token₁…ₙ₋₁)
🧮
Bayesian Networks — Joint Probability at ScaleBayesian Networks — बड़े पैमाने पर Joint ProbabilityBayesian Networks — 大规模的 Joint Probability

A Bayesian network is a graph. Each node is a random variable. Each arrow is a conditional dependency. The full joint is a product of small conditionals: P(X₁,…,Xₙ) = Π P(Xᵢ | Parents(Xᵢ)). This lets us reason about dozens of variables. One giant joint table would be far too big. Any marginal or conditional can then be found by marginalisation.

Bayesian network एक graph है। हर node एक random variable है। हर तीर एक conditional dependency है। पूरा joint छोटे conditionals का गुणनफल है: P(X₁,…,Xₙ) = Π P(Xᵢ | Parents(Xᵢ))। इससे दर्जनों variables पर reasoning संभव होती है। एक विशाल joint table बहुत बड़ी होती। फिर कोई भी marginal या conditional, marginalisation से निकाला जा सकता है।

Bayesian network 是一种图。每个节点是一个 random variable,每条箭头是一个 conditional dependency。完整的 joint 是许多小 conditional 的乘积:P(X₁,…,Xₙ) = Π P(Xᵢ | Parents(Xᵢ))。这样才能同时推理几十个变量——单一的巨大 joint table 会大到无法处理。之后任何 marginal 或 conditional 都可以通过 marginalisation 求得。


Section 12

Complete Formula Referenceपूरा Formula Reference完整公式速查

Formula Expression What It Computesक्या निकालता है计算什么 Directionदिशा方向
Joint (Discrete)P(A, B) = P(A ∩ B)Chance both A and B happenA और B दोनों होने की probabilityA 和 B 同时发生的概率Both Togetherदोनों साथ同时发生
Marginal from JointP(A) = Σ_B P(A, B)A's chance, ignoring BB को ignore करके A की probability忽略 B 时 A 的概率Sum Out BB को Sum Out消去 B
Joint from ConditionalP(A,B) = P(A|B) × P(B)Joint via the multiplication ruleMultiplication rule से joint用 multiplication rule 求 jointBuild Upऊपर बनाना向上构建
Conditional from JointP(A|B) = P(A,B) / P(B)A's chance inside B's worldB की दुनिया के अंदर A की probability在 B 发生的范围内 A 的概率Restrict Downसीमित करना向下限制
Independence TestP(A,B) = P(A) × P(B)Check if variables are unrelatedजाँचें कि variables असंबंधित हैं या नहीं检查变量是否无关Factor Check
Total ProbabilityP(A) = Σ P(A|Bᵢ) × P(Bᵢ)Marginal from weighted conditionalsWeighted conditionals से marginal由加权 conditional 求 marginalSum Over Partsहिस्सों का जोड़分块求和
Bayes' TheoremP(A|B) = P(B|A)·P(A)/P(B)Flip the conditionCondition को उलटना反转条件Reverse Conditionउलटी Condition反转条件
Marginal PDFf_X(x) = ∫ f(x,y)dyX's density with Y integrated outY को integrate out करके X की density积分消去 Y 后 X 的密度Integrate Out YY को Integrate Out积分消去 Y

Section 13

The Golden Rules of Joint & Marginal ProbabilityJoint और Marginal Probability के सुनहरे नियमJoint 与 Marginal Probability 的黄金法则

🎯 12 Rules Every Data Scientist Must Master🎯 12 नियम जो हर Data Scientist को आने चाहिए🎯 每位数据科学家必须掌握的 12 条规则
1
The joint table holds everything. From it you get every marginal, every conditional, the independence test and the Bayes check. Joint table में सब कुछ है। इससे हर marginal, हर conditional, independence test और Bayes check निकलता है। Joint table 包含一切。从中可以得到每个 marginal、每个 conditional、independence 检验和 Bayes 验证。
2
Marginalisation = summing out. To get P(A), add (or integrate) the joint over every value of the other variables. Marginalisation = sum out करना। P(A) पाने के लिए बाकी variables की हर value पर joint को जोड़ें (या integrate करें)। Marginalisation = 求和消去。要得到 P(A),对其他变量的每个取值把 joint 相加(或积分)。
3
Row and column totals are marginals. The name comes from the table margins. Build the joint table first — the marginals fall out. Row और column totals ही marginals हैं। नाम table के margins से आया है। पहले joint table बनाएँ — marginals अपने-आप मिल जाते हैं। 行合计和列合计就是 marginal。名字来自表格边缘。先建 joint table,marginal 自然就出来了。
4
Golden Triangle: Joint = Conditional × Marginal. P(A,B) = P(A|B)·P(B) = P(B|A)·P(A). This symmetry is Bayes' Theorem. No need to memorise Bayes separately. Golden Triangle: Joint = Conditional × Marginal। P(A,B) = P(A|B)·P(B) = P(B|A)·P(A)। यही symmetry Bayes' Theorem है। Bayes को अलग से रटने की ज़रूरत नहीं। Golden Triangle:Joint = Conditional × Marginal。P(A,B) = P(A|B)·P(B) = P(B|A)·P(A)。这种对称性就是 Bayes' Theorem,无需单独背诵。
5
Independence must hold in every cell. P(A,B) = P(A)·P(B) for all combinations. One failing cell disproves it. Independence हर cell में सही होनी चाहिए। सभी combinations के लिए P(A,B) = P(A)·P(B)। एक भी cell गलत, तो independence नहीं। Independence 必须在每个格子都成立。所有组合都要满足 P(A,B) = P(A)·P(B)。只要一个不满足就不成立。
6
Conditional divides; joint multiplies. Joint → conditional: divide by the marginal. Conditional → joint: multiply by the marginal. Conditional में भाग; joint में गुणा। Joint → conditional: marginal से भाग दें। Conditional → joint: marginal से गुणा करें। Conditional 用除法;joint 用乘法。Joint → conditional:除以 marginal。Conditional → joint:乘以 marginal。
7
Always check the sums. All joint cells sum to 1. Each marginal sums to 1. If not, there is an arithmetic error. हमेशा जोड़ check करें। सारे joint cells का जोड़ 1, हर marginal का जोड़ 1। अगर नहीं, तो calculation में गलती है। 务必检查总和。所有 joint 格子之和为 1,每个 marginal 之和也为 1。否则就是计算出错。
8
Continuous? Swap sums for integrals. Σ becomes ∫, PMF becomes PDF. The structure stays the same. Continuous है? Sum की जगह integral। Σ बन जाता है ∫, PMF बन जाता है PDF। ढाँचा वही रहता है। 连续变量?把求和换成积分。Σ 变成 ∫,PMF 变成 PDF,结构不变。
9
Bayesian inference runs on marginalisation. Posteriors often need nuisance parameters summed out. MCMC and variational inference do this when no closed form exists. Bayesian inference, marginalisation पर चलता है। Posterior में अक्सर nuisance parameters को sum out करना पड़ता है। Closed form न हो तो MCMC और variational inference यही करते हैं। Bayesian inference 依赖 marginalisation。计算 posterior 常需把 nuisance parameters 消去。没有解析解时,MCMC 和 variational inference 完成这一步。
10
Joint vs product shows association. P(A,B) much bigger than P(A)·P(B): they go together. Much smaller: they avoid each other. Chi-square tests and mutual information use this gap. Joint बनाम product से association दिखता है। P(A,B), P(A)·P(B) से बहुत बड़ा: दोनों साथ होते हैं। बहुत छोटा: एक-दूसरे से बचते हैं। Chi-square test और mutual information इसी अंतर पर बने हैं। 比较 joint 与乘积可看出关联。P(A,B) 远大于 P(A)·P(B):常一起出现;远小于:互相回避。Chi-square 检验和 mutual information 都基于这个差距。
11
The full joint is the complete model. Generative models learn it directly. Discriminative models learn one conditional piece of it. पूरा joint ही complete model है। Generative models इसे सीधे सीखते हैं। Discriminative models इसका एक conditional हिस्सा सीखते हैं। 完整的 joint 就是完整的模型。Generative models 直接学习它,discriminative models 学习它的一个 conditional 部分。
12
Two categorical variables? Build the table first. Fill in counts and probabilities before any conditional. It prevents errors and shows every pattern at once. दो categorical variables? पहले table बनाएँ। कोई भी conditional निकालने से पहले counts और probabilities भरें। इससे गलतियाँ नहीं होतीं और सारे patterns एक साथ दिखते हैं। 两个分类变量?先建表。在计算任何 conditional 之前,先填好计数和概率。这样能避免错误,并一次看清所有规律。

Section 14

Quick Check — Test Yourself ✍️Quick Check — ख़ुद को परखें ✍️快速测验 — 自我检测 ✍️

Use Meera's commute table (200 days). Click an answer.

मीरा के सफ़र वाली table (200 दिन) का उपयोग करें। एक जवाब पर click करें।

使用 Meera 的通勤表(200 天)。点击一个答案。

1. What is the joint probability P(R, L)?Joint probability P(R, L) कितनी है?Joint probability P(R, L) 是多少?
45 of 200 days had rain AND a late bus: 45/200 = 0.225.200 में से 45 दिन बारिश और लेट बस दोनों: 45/200 = 0.225।200 天中有 45 天既下雨又晚点:45/200 = 0.225。
2. What is the marginal P(L)?Marginal P(L) कितनी है?Marginal P(L) 是多少?
Sum out rain: 0.225 + 0.125 = 0.350.बारिश को sum out करें: 0.225 + 0.125 = 0.350।消去下雨变量:0.225 + 0.125 = 0.350。
3. What is P(L | R)?P(L | R) कितनी है?P(L | R) 是多少?
Divide the joint by the marginal: 0.225 / 0.300 = 0.750.Joint को marginal से भाग दें: 0.225 / 0.300 = 0.750।用 joint 除以 marginal:0.225 / 0.300 = 0.750。
4. Are rain and bus delay independent?क्या बारिश और बस की देरी independent हैं?下雨与公交晚点是 independent 的吗?
Independence needs P(R,L) = P(R)·P(L). 0.225 ≠ 0.105, so they are dependent.Independence के लिए P(R,L) = P(R)·P(L) चाहिए। 0.225 ≠ 0.105, इसलिए ये dependent हैं।Independence 要求 P(R,L) = P(R)·P(L)。0.225 ≠ 0.105,所以它们是 dependent 的。
5. What does "marginalising out B" mean?"B को marginalise out करना" का क्या मतलब है?"把 B marginalise out"是什么意思?
Summing over every value of B removes B and leaves P(A).B की हर value पर जोड़ने से B हट जाता है और P(A) बचता है।对 B 的每个取值求和会消去 B,只剩下 P(A)。
🧮
The Unified Pictureपूरी तस्वीर एक साथ统一的全景

Joint probability is the basic unit for reasoning about many variables. Marginals show each variable alone. Conditionals show how knowing one variable changes our belief about another. The Golden Triangle links all three. The workflow is simple: build the joint table → sum to get marginals → divide to get conditionals → verify with Bayes.

Joint probability कई variables पर सोचने की बुनियादी इकाई है। Marginals हर variable को अकेले दिखाते हैं। Conditionals दिखाते हैं कि एक variable जानने से दूसरे के बारे में हमारा विश्वास कैसे बदलता है। Golden Triangle तीनों को जोड़ता है। तरीका आसान है: joint table बनाएँ → जोड़कर marginals पाएँ → भाग देकर conditionals पाएँ → Bayes से verify करें।

Joint probability 是对多个变量进行推理的基本单位。Marginal 展示每个变量本身。Conditional 展示知道一个变量后,我们对另一个变量的判断如何改变。Golden Triangle 把三者联系起来。流程很简单:建立 joint table → 求和得 marginal → 相除得 conditional → 用 Bayes 验证。