Foundations of Data Science 📂 Probability · 5 of 5 106 min read

Likelihood & Maximum Likelihood Estimation

A comprehensive, story-driven tutorial on the likelihood function and MLE — covering probability vs likelihood distinction, the coin flip inspector story, analytical MLE derivation for Binomial/Normal/Poisson/Exponential distributions, log-likelihood with three custom SVG diagrams (likelihood curve, L vs log-L side-by-side, gradient ascent), logistic regression as MLE, MLE vs MAP/regularisation, consistency/efficiency/normality properties, a complete ML-to-MLE unification table, and 12 golden ru

Section 01भाग 01第 01 节

The Detective and the Evidence 🔍Detective और सबूत 🔍侦探与证据 🔍

A detective reaches a crime scene. The event is over. She cannot go back in time. But she has evidence: footprints, a broken lock, a camera timestamp. She works backwards. She asks: which story best explains this evidence?

एक detective crime scene पर पहुँचती है। घटना खत्म हो चुकी है। वह समय में पीछे नहीं जा सकती। लेकिन उसके पास सबूत हैं: पैरों के निशान, टूटा ताला, camera का timestamp। वह उल्टा सोचती है। वह पूछती है: कौन-सी कहानी इन सबूतों को सबसे अच्छे से समझाती है?

一位侦探来到犯罪现场。事情已经发生,她无法回到过去。但她有证据:脚印、被撬的锁、监控 camera 上的时间戳。她从证据倒推,问自己:哪种解释最能说明这些证据?

Maximum Likelihood Estimation (MLE) does the same with data. You have observed data. You cannot see the process that made it. You assume it follows a probability distribution with unknown parameters. MLE asks one question: "Which parameter values make this data most probable?" That answer is the Maximum Likelihood Estimate.

Maximum Likelihood Estimation (MLE) data के साथ यही करता है। आपके पास observed data है। जिस process ने यह data बनाया, वह दिखाई नहीं देता। हम मानते हैं कि data किसी probability distribution से आया है, जिसके parameters अज्ञात हैं। MLE एक ही सवाल पूछता है: "कौन-से parameter values इस data को सबसे ज़्यादा probable बनाते हैं?" यही जवाब Maximum Likelihood Estimate है।

Maximum Likelihood Estimation (MLE) 对 data 做的正是同样的事。你手里有观测到的 data,但看不到产生它的过程。我们假设 data 来自某个 probability distribution,其 parameters 未知。MLE 只问一个问题:“哪些 parameter 值能让这组 data 出现的概率最大?” 这个答案就是 Maximum Likelihood Estimate。

MLE is the most used estimation method in statistics and machine learning. Linear regression, logistic regression, neural networks and large language models are all trained with it.

MLE statistics और machine learning में सबसे ज़्यादा इस्तेमाल होने वाला estimation method है। Linear regression, logistic regression, neural networks और large language models — सब इसी से train होते हैं।

MLE 是 statistics 和 machine learning 中使用最广的估计方法。Linear regression、logistic regression、neural networks 以及 large language models 都是用它来训练的。

👀 Observe data👀 Data देखें👀 观察 data
→
📐 Assume a model📐 Model मानें📐 假设 model
→
🧮 Write L(θ)🧮 L(θ) लिखें🧮 写出 L(θ)
→
⛰️ Find the peak θ̂⛰️ Peak θ̂ खोजें⛰️ 找到峰值 θ̂
🎬 Animation — MLE in One Picture🎬 Animation — एक चित्र में MLE🎬 动画 — 一张图看懂 MLE
The orange dot tries every value of p. It remembers the best one. Then it settles on the peak. That peak is the MLE.नारंगी बिंदु p की हर value आज़माता है। वह सबसे अच्छी value याद रखता है। फिर peak पर रुक जाता है। वही peak MLE है।橙色圆点尝试 p 的每一个值,记住最好的那个,最后停在峰顶。这个峰顶就是 MLE。
💡
Probability vs Likelihood — The Core DifferenceProbability बनाम Likelihood — मुख्य अंतरProbability 与 Likelihood — 核心区别

Probability: parameters θ are fixed. Data is uncertain. We ask: how probable is data x? → P(X = x | θ).  |  Likelihood: data x is fixed (already seen). Parameters are uncertain. We ask: how plausible is each θ? → L(θ | x). Same formula, opposite question.

Probability: parameters θ तय हैं। Data अनिश्चित है। सवाल: data x कितना probable है? → P(X = x | θ)।  |  Likelihood: data x तय है (हम देख चुके हैं)। Parameters अनिश्चित हैं। सवाल: हर θ कितना plausible है? → L(θ | x)। Formula वही, सवाल उल्टा।

Probability:parameters θ 固定,data 不确定。问题:data x 出现的概率多大?→ P(X = x | θ)。 |  Likelihood:data x 固定(已经观测到),parameters 不确定。问题:每个 θ 有多合理?→ L(θ | x)。公式相同,问题方向相反。


Section 02भाग 02第 02 节

The Likelihood Function 📐Likelihood Function 📐Likelihood Function 📐

The Story: The Biased Coin Inspectorकहानी: Biased Coin का Inspector故事:检查偏币的质检员

Arjun is a quality inspector at a coin factory. He thinks a new coin is biased. He cannot see the bias directly. So he flips it 10 times: H, H, T, H, H, T, H, H, H, T. That is 7 heads and 3 tails. He wants to estimate p, the true chance of heads.

अर्जुन एक coin factory में quality inspector है। उसे लगता है कि एक नया coin biased है। वह bias को सीधे नहीं देख सकता। इसलिए वह coin को 10 बार उछालता है: H, H, T, H, H, T, H, H, H, T। यानी 7 heads और 3 tails। वह p का अनुमान लगाना चाहता है — heads आने की असली probability।

阿尔琼(Arjun)是硬币工厂的质检员。他怀疑一枚新硬币是 biased 的。他无法直接看到偏差,于是把硬币抛了 10 次:H, H, T, H, H, T, H, H, H, T,即 7 次正面、3 次反面。他想估计 p——出现正面的真实概率。

For each possible p, Arjun asks: "If the true bias were p, how probable are 7 heads in 10 flips?" The function that answers this for every p is the Likelihood Function.

हर संभावित p के लिए अर्जुन पूछता है: "अगर असली bias p होता, तो 10 में से 7 heads आने की probability कितनी होती?" जो function हर p के लिए यह जवाब देता है, उसे Likelihood Function कहते हैं।

对每一个可能的 p,他都问:“如果真实的 bias 是 p,10 次中出现 7 次正面的概率是多少?” 对每个 p 都给出这个答案的函数,就是 Likelihood Function。

Likelihood FunctionLikelihood FunctionLikelihood Function
L(θ | x) = P(X = x | θ)
Same expression as probability. But we read it as a function of θ, with data x fixed.Probability जैसा ही expression। लेकिन इसे θ का function मानते हैं, data x तय रहता है।表达式与 probability 相同,但把它看作 θ 的函数,data x 固定不变。
For i.i.d. Observationsi.i.d. Observations के लिएi.i.d. 观测值
L(θ|x₁…xₙ) = Π P(xᵢ|θ)
If observations are independent and identically distributed, multiply their probabilities. Each point adds one factor.अगर observations independent और identically distributed हैं, तो उनकी probabilities को गुणा करें। हर point एक factor जोड़ता है।若观测值独立同分布,就把各自的概率相乘。每个数据点贡献一个因子。
Log-Likelihood (ℓ)Log-Likelihood (ℓ)Log-Likelihood (ℓ)
ℓ(θ) = Σ log P(xᵢ|θ)
Log turns products into sums. Log is always increasing, so the peak stays at the same θ.Log गुणा को जोड़ में बदल देता है। Log हमेशा बढ़ता है, इसलिए peak उसी θ पर रहता है।取 log 把乘积变成求和。log 单调递增,所以峰值仍在同一个 θ。
MLE EstimatorMLE EstimatorMLE Estimator
θ̂ = argmax_θ L(θ|x)
The θ that makes L largest. Found with calculus, or numerically with gradient ascent.वह θ जिस पर L सबसे बड़ा हो। Calculus से, या numerically gradient ascent से निकाला जाता है।使 L 最大的 θ。可用微积分求解,也可用 gradient ascent 数值求解。

Section 03भाग 03第 03 节

Computing the Likelihood — Step by Step 🧮Likelihood की गणना — Step by Step 🧮逐步计算 Likelihood 🧮

🧮 Coin Flip — Building the Likelihood Function🧮 Coin Flip — Likelihood Function बनाना🧮 抛硬币 — 构建 Likelihood Function
Observed DataObserved Data观测 Data
10 flips: 7 Heads, 3 Tails. The data is fixed. We vary p ∈ [0, 1].10 flips: 7 Heads, 3 Tails। Data तय है। हम p ∈ [0, 1] बदलते हैं।10 次:7 正 3 反。data 固定,我们改变 p ∈ [0, 1]。
ModelModelModel
Each flip ~ Bernoulli(p), independent. So 10 flips ~ Binomial(n=10, p).हर flip ~ Bernoulli(p), independent। इसलिए 10 flips ~ Binomial(n=10, p)।每次抛掷 ~ Bernoulli(p),相互独立。所以 10 次 ~ Binomial(n=10, p)。
P(7 heads | p) = C(10,7) × p⁷ × (1−p)³
L(p = 0.1)
120 × 0.0000001 × 0.729 = 0.0000087 — very unlikely!बहुत कम!几乎不可能!
L(p = 0.5)
120 × 0.0078125 × 0.125 = 0.1172 — reasonable.ठीक-ठाक।还算合理。
L(p = 0.7)
120 × 0.0823543 × 0.027 = 0.2668 — much higher!काफ़ी ज़्यादा!高得多!
L(p = 0.9)
120 × 0.4782969 × 0.001 = 0.0574 — drops again.फिर से गिर गया।又下降了。
PatternPattern规律
L rises, peaks near p = 0.7, then falls. The peak is the MLE. Try it yourself below.L बढ़ता है, p = 0.7 के पास peak बनाता है, फिर गिरता है। Peak ही MLE है। नीचे खुद आज़माएँ।L 先上升,在 p = 0.7 附近达到峰值,然后下降。峰值就是 MLE。下面亲自试试。
🪙 Simulator 1 — Coin Likelihood Explorer🪙 Simulator 1 — Coin Likelihood Explorer🪙 模拟器 1 — 硬币 Likelihood 探索器
The factory coin has a secret bias. Flip it to collect data. Move the p slider and watch L(p). Press "Jump to MLE" to land on the peak.Factory के coin का bias गुप्त है। Data इकट्ठा करने के लिए coin उछालें। p slider हिलाएँ और L(p) देखें। Peak पर जाने के लिए "Jump to MLE" दबाएँ।工厂硬币有一个隐藏的 bias。抛硬币来收集 data。拖动 p 滑块观察 L(p)。点击 “Jump to MLE” 跳到峰值。
H
p = ?
flips nflips n次数 n10
heads kheads k正面 k7
L(p)–
ℓ(p)–
MLE p̂ = k/n0.70
Notice: with more flips, the curve becomes narrower. More data means a sharper, more confident estimate.ध्यान दें: जितने ज़्यादा flips, curve उतना पतला। ज़्यादा data मतलब ज़्यादा पक्का अनुमान।注意:抛得越多,曲线越窄。data 越多,估计越精确、越有把握。

Section 04भाग 04第 04 节

Maximising the Likelihood — Calculus Approach 🎓Likelihood को Maximise करना — Calculus तरीका 🎓最大化 Likelihood — 微积分方法 🎓

To find the exact peak, take the derivative with respect to θ. Set it to zero. Solve. Products are hard to differentiate, so we first take the log. This gives the log-likelihood ℓ(θ). Log is always increasing, so the peak of ℓ is the peak of L.

सटीक peak खोजने के लिए θ के सापेक्ष derivative लें। उसे zero के बराबर रखें। हल करें। गुणा का derivative मुश्किल होता है, इसलिए पहले log लेते हैं। इससे log-likelihood ℓ(θ) मिलता है। Log हमेशा बढ़ता है, इसलिए ℓ का peak वही है जो L का।

要找到精确峰值,对 θ 求导,令其为零,然后求解。乘积求导很麻烦,所以先取 log,得到 log-likelihood ℓ(θ)。log 单调递增,所以 ℓ 的峰值就是 L 的峰值。

🧮 MLE — Binomial Parameter (Coin Flip Proof)🧮 MLE — Binomial Parameter (Coin Flip Proof)🧮 MLE — Binomial 参数(抛硬币证明)
Likelihood
L(p) = C(n,k) × pᵏ × (1−p)ⁿ⁻ᵏ   (n=10, k=7)
Log-Likelihood
ℓ(p) = log C(n,k) + k·log(p) + (n−k)·log(1−p)
ℓ(p) = constant + 7·log(p) + 3·log(1−p)
DifferentiateDerivative लें求导
dℓ/dp = 7/p − 3/(1−p)
Set to ZeroZero रखें令其为零
7/p − 3/(1−p) = 0 → 7(1−p) = 3p → 7 = 10p
MLE ResultMLE परिणामMLE 结果
p̂ = 7/10 = 0.70
The MLE is simply k/n — the observed share of heads.MLE बस k/n है — heads का observed हिस्सा।MLE 就是 k/n —— 观测到的正面比例。
Verify MaxMax की जाँच验证最大值
d²ℓ/dp² = −k/p² − (n−k)/(1−p)² < 0 → always negative, so p̂ = 0.7 is a maximum.हमेशा negative, इसलिए p̂ = 0.7 maximum है।恒为负,所以 p̂ = 0.7 是最大值。
✅
General Binomial MLE — Always k/nGeneral Binomial MLE — हमेशा k/n一般 Binomial MLE — 永远是 k/n

The proof works for any n and k. For k successes in n trials, p̂ = k/n. The MLE of a proportion is just the observed frequency. MLE matches common sense here.

यह proof किसी भी n और k के लिए सही है। n trials में k successes हों तो p̂ = k/n। किसी proportion का MLE बस observed frequency है। यहाँ MLE common sense से मेल खाता है।

这个证明对任意 n 和 k 都成立。n 次试验中有 k 次成功,则 p̂ = k/n。比例的 MLE 就是观测频率,MLE 与常识一致。


Section 05भाग 05第 05 节

MLE for the Normal Distribution 📊Normal Distribution के लिए MLE 📊Normal Distribution 的 MLE 📊

The Story: Measuring Reaction Timeकहानी: Reaction Time मापना故事:测量反应时间

A neuroscientist measures the reaction times of 5 people: 240, 255, 261, 248, 271 ms. She assumes the times follow a Normal distribution N(μ, σ²). She does not know μ or σ². She uses MLE to estimate both from her 5 readings.

एक neuroscientist 5 लोगों का reaction time मापती है: 240, 255, 261, 248, 271 ms। वह मानती है कि ये समय Normal distribution N(μ, σ²) को follow करते हैं। उसे μ और σ² नहीं पता। वह MLE से 5 readings से दोनों का अनुमान लगाती है।

一位神经科学家测量了 5 个人的反应时间:240, 255, 261, 248, 271 ms。她假设这些时间服从 Normal distribution N(μ, σ²),但不知道 μ 和 σ²。她用 MLE 从这 5 个数据同时估计两者。

🧮 MLE for Normal — Deriving μ̂ and σ̂²🧮 Normal के लिए MLE — μ̂ और σ̂² निकालना🧮 Normal 的 MLE — 推导 μ̂ 与 σ̂²
Data
x = {240, 255, 261, 248, 271}, n = 5
Normal PDF
f(xᵢ | μ, σ²) = (1/√2πσ²) × exp[−(xᵢ−μ)²/(2σ²)]
Joint Likelihood
L(μ,σ²) = (2πσ²)^(−n/2) × exp[−Σ(xᵢ−μ)²/(2σ²)]
Log-Likelihood
ℓ(μ,σ²) = −(n/2)log(2π) − (n/2)log(σ²) − Σ(xᵢ−μ)²/(2σ²)
∂ℓ/∂μ = 0
Σ(xᵢ−μ)/σ² = 0 → μ̂ = x̄ — the sample meansample mean样本均值
∂ℓ/∂σ² = 0
−n/(2σ²) + Σ(xᵢ−μ)²/(2σ⁴) = 0 → σ̂² = (1/n)Σ(xᵢ−x̄)²
Compute μ̂μ̂ निकालें计算 μ̂
(240+255+261+248+271)/5 = 1275/5 = 255.0 ms
Compute σ̂²σ̂² निकालें计算 σ̂²
DeviationsDeviations偏差: −15, 0, 6, −7, 16 → squaressquares平方: 225, 0, 36, 49, 256 → Σ = 566
σ̂² = 566/5 = 113.2 ms²  |  σ̂ = 10.64 ms
📊 Simulator 2 — Fit a Bell Curve by Hand📊 Simulator 2 — हाथ से Bell Curve Fit करें📊 模拟器 2 — 亲手拟合钟形曲线
Each purple line shows how likely one data point is under your curve. Move μ and σ to make ℓ as large as you can. Then press "Fit with MLE". Click the chart to add your own points.हर बैंगनी रेखा दिखाती है कि आपके curve के हिसाब से एक data point कितना likely है। μ और σ हिलाकर ℓ को जितना हो सके बड़ा करें। फिर "Fit with MLE" दबाएँ। अपने points जोड़ने के लिए chart पर click करें।每条紫线表示在你的曲线下某个数据点的可能性。调节 μ 和 σ,让 ℓ 尽量大。然后点击 “Fit with MLE”。点击图表可添加你自己的数据点。
points npoints n点数 n5
your ℓ(μ,σ)आपका ℓ(μ,σ)你的 ℓ(μ,σ)–
best ℓ (MLE)सबसे अच्छा ℓ (MLE)最佳 ℓ (MLE)–
μ̂ = x̄–
σ̂ (÷n)–
s (÷(n−1))–
⚠️
MLE Variance is BiasedMLE Variance Biased होता हैMLE 的方差是有偏的

The MLE divides by n. The unbiased sample variance divides by n−1 (Bessel's correction). So σ̂² slightly underestimates the true variance. For large n the gap is tiny. For small n it matters. Compare σ̂ and s in the simulator above.

MLE n से भाग देता है। Unbiased sample variance n−1 से भाग देता है (Bessel's correction)। इसलिए σ̂² असली variance को थोड़ा कम आँकता है। बड़े n पर अंतर बहुत छोटा है। छोटे n पर यह मायने रखता है। ऊपर simulator में σ̂ और s की तुलना करें।

MLE 除以 n,而无偏样本方差除以 n−1(Bessel's correction)。所以 σ̂² 会略微低估真实方差。n 大时差距很小,n 小时影响明显。可在上面的模拟器中对比 σ̂ 和 s。

Normal MeanNormal MeanNormal 均值
μ̂ = x̄ = (1/n) Σxᵢ
The sample mean. Unbiased and intuitive.Sample mean। Unbiased और सहज।样本均值,无偏且直观。
Normal VarianceNormal VarianceNormal 方差
σ̂² = (1/n) Σ(xᵢ − x̄)²
Biased (÷n). For small samples, s² with ÷(n−1) is often preferred.Biased (÷n)। छोटे samples के लिए ÷(n−1) वाला s² अक्सर बेहतर है।有偏(÷n)。小样本时常用 ÷(n−1) 的 s²。
Poisson RatePoisson RatePoisson 速率
λ̂ = x̄
For count data, the MLE is the sample mean.Count data के लिए MLE sample mean है।对计数 data,MLE 就是样本均值。
Exponential RateExponential RateExponential 速率
λ̂ = n / Σxᵢ = 1/x̄
For waiting times, the MLE is 1 ÷ mean wait.Waiting time के लिए MLE = 1 ÷ औसत wait।对等待时间,MLE = 1 ÷ 平均等待时间。

Section 06भाग 06第 06 节

Log-Likelihood — Why It Matters 📉Log-Likelihood — यह क्यों ज़रूरी है 📉Log-Likelihood — 为什么重要 📉

The Story: The Astronomy Data Problemकहानी: Astronomy Data की समस्या故事:天文 data 难题

An astronomer has photon counts from 10,000 stars. The likelihood is a product of 10,000 numbers, each between 0 and 1. A computer rounds this product to zero. This is called underflow. The log-likelihood turns the product into a safe sum.

एक astronomer के पास 10,000 तारों के photon counts हैं। Likelihood 10,000 संख्याओं का गुणा है, हर संख्या 0 और 1 के बीच। Computer इस गुणनफल को zero कर देता है। इसे underflow कहते हैं। Log-likelihood गुणा को एक सुरक्षित जोड़ में बदल देता है।

一位天文学家有 10,000 颗恒星的光子计数。Likelihood 是 10,000 个介于 0 和 1 之间的数的乘积,计算机会把它舍入为零,这叫 underflow。Log-likelihood 把乘积变成安全的求和。

📉 Simulator 3 — Underflow vs Log: Same Peak, Safer Math📉 Simulator 3 — Underflow बनाम Log: वही Peak, सुरक्षित गणित📉 模拟器 3 — Underflow 与 Log:同一个峰值,更安全的计算
60% of the flips are heads. Increase n. Watch the raw product hit 0 while the log-sum stays fine. Both curves peak at the same p̂.60% flips heads हैं। n बढ़ाएँ। देखें कि raw product 0 हो जाता है, जबकि log-sum ठीक रहता है। दोनों curves का peak एक ही p̂ पर है।60% 的抛掷是正面。增大 n,观察原始乘积变成 0,而 log 求和依然正常。两条曲线的峰值都在同一个 p̂。
raw product Π P(xᵢ|p)raw product Π P(xᵢ|p)原始乘积 Π P(xᵢ|p)–
log-sum ℓ(p)log-sum ℓ(p)log 求和 ℓ(p)–
p̂0.60
🧮 Log-Likelihood — Numerical Example (5 Coin Flips)🧮 Log-Likelihood — Numerical उदाहरण (5 Coin Flips)🧮 Log-Likelihood — 数值示例(5 次抛硬币)
Data
H, H, T, H, T (3 heads, 2 tails)(3 heads, 2 tails)(3 正 2 反)
Likelihood
L(p) = p × p × (1−p) × p × (1−p) = p³(1−p)²
Log-Likelihood
ℓ(p) = 3·log(p) + 2·log(1−p) — products become sums.गुणा जोड़ बन गया।乘积变成了求和。
p = 0.6
3×(−0.5108) + 2×(−0.9163) = −1.532 − 1.833 = −3.365
MLE
dℓ/dp = 3/p − 2/(1−p) = 0 → p̂ = 3/5 = 0.60 (k/n)
📐
Three Reasons to Use Log-LikelihoodLog-Likelihood इस्तेमाल करने के तीन कारण使用 Log-Likelihood 的三个理由

1. Stability: sums of logs never underflow.  |  2. Easy calculus: sums are easy to differentiate term by term.  |  3. Nice shape: for many models the negative log-likelihood is convex. So it has one global minimum, and gradient methods work well.

1. Stability: logs का जोड़ कभी underflow नहीं होता।  |  2. आसान calculus: जोड़ का derivative हर term पर अलग से लेना आसान है।  |  3. अच्छा आकार: कई models में negative log-likelihood convex होता है। इसका एक ही global minimum होता है, और gradient methods अच्छे से काम करते हैं।

1. 稳定:log 求和不会 underflow。 |  2. 求导简单:求和可以逐项求导。 |  3. 形状好:许多模型的 negative log-likelihood 是 convex 的,只有一个全局最小值,gradient 方法效果好。


Section 07भाग 07第 07 节

MLE for Logistic Regression 🤖Logistic Regression के लिए MLE 🤖Logistic Regression 的 MLE 🤖

The Story: Predicting Loan Defaultकहानी: Loan Default का अनुमान故事:预测贷款违约

A bank wants to predict if a person will default (Y=1) or repay (Y=0) from their income X. The model is P(Y=1|X) = σ(β₀ + β₁X), where σ is the sigmoid. There is no closed-form answer for β₀ and β₁. So we climb the log-likelihood step by step with gradient ascent. This is exactly how logistic regression and neural networks are trained.

एक bank income X से अनुमान लगाना चाहता है कि व्यक्ति default करेगा (Y=1) या loan चुकाएगा (Y=0)। Model है P(Y=1|X) = σ(β₀ + β₁X), जहाँ σ sigmoid है। β₀ और β₁ का कोई closed-form जवाब नहीं है। इसलिए हम gradient ascent से log-likelihood पर कदम-दर-कदम चढ़ते हैं। Logistic regression और neural networks ठीक इसी तरह train होते हैं।

银行想根据收入 X 预测一个人会违约(Y=1)还是还款(Y=0)。模型是 P(Y=1|X) = σ(β₀ + β₁X),σ 是 sigmoid。β₀ 和 β₁ 没有 closed-form 解,所以用 gradient ascent 一步步爬上 log-likelihood。logistic regression 和 neural networks 正是这样训练的。

ModelModelModel
P(Y=1|x) = σ(β₀+β₁x)
σ(z) = 1/(1+e⁻ᶻ) maps any number into (0, 1).σ(z) = 1/(1+e⁻ᶻ) किसी भी संख्या को (0, 1) में बदल देता है।σ(z) = 1/(1+e⁻ᶻ) 把任意实数映射到 (0, 1)。
Bernoulli Log-LikelihoodBernoulli Log-LikelihoodBernoulli Log-Likelihood
ℓ(β) = Σ[yᵢ log p̂ᵢ + (1−yᵢ) log(1−p̂ᵢ)]
A "1" adds log p̂. A "0" adds log(1−p̂)."1" पर log p̂ जुड़ता है। "0" पर log(1−p̂)।“1” 贡献 log p̂,“0” 贡献 log(1−p̂)。
Cross-Entropy Loss
Loss = −(1/n) · ℓ(β)
Minimising cross-entropy = maximising likelihood. Training a classifier IS MLE.Cross-entropy को minimise करना = likelihood को maximise करना। Classifier की training ही MLE है।最小化 cross-entropy = 最大化 likelihood。训练分类器就是 MLE。
Gradient Ascent
β ← β + η · ∂ℓ/∂β
Move β uphill. η is the learning rate.β को ऊपर की ओर ले जाएँ। η learning rate है।让 β 往上坡走,η 是 learning rate。
🧮 Comparing Two Trial β Values🧮 दो Trial β Values की तुलना🧮 比较两组试验 β 值
Mini Datasetछोटा Dataset小数据集
Person 1: income 50k, defaulted (Y=1) · Person 2: 80k, repaid (Y=0) · Person 3: 40k, defaulted (Y=1)व्यक्ति 1: income 50k, default (Y=1) · व्यक्ति 2: 80k, चुकाया (Y=0) · व्यक्ति 3: 40k, default (Y=1)第 1 人:收入 50k,违约 (Y=1) · 第 2 人:80k,还款 (Y=0) · 第 3 人:40k,违约 (Y=1)
Bad trialखराब trial差的试验
β₀ = −4, β₁ = +0.06 → P₁ = σ(−1) = 0.269, P₂ = σ(0.8) = 0.690, P₃ = σ(−1.6) = 0.168
ℓ = log 0.269 + log(1−0.690) + log 0.168 = −1.313 − 1.171 − 1.784 = −4.27
It says richer people default more — the opposite of the data.यह कहता है कि ज़्यादा income वाले ज़्यादा default करते हैं — data के उल्टा।它认为收入越高越容易违约——与 data 相反。
Better trialबेहतर trial更好的试验
β₀ = +4, β₁ = −0.08 → P₁ = σ(0) = 0.500, P₂ = σ(−2.4) = 0.083, P₃ = σ(0.8) = 0.690
ℓ = log 0.500 + log 0.917 + log 0.690 = −0.693 − 0.087 − 0.371 = −1.15
Interpretationअर्थ解读
Higher (less negative) ℓ = better fit. Gradient ascent keeps moving β toward higher ℓ. This is what ज़्यादा (कम negative) ℓ = बेहतर fit। Gradient ascent β को लगातार ऊँचे ℓ की ओर ले जाता है। यही काम ℓ 越高(越不负)= 拟合越好。gradient ascent 不断把 β 推向更高的 ℓ。这正是 sklearn LogisticRegression().fit() does inside (it also adds L2 regularisation by default). अंदर करता है (default रूप से यह L2 regularisation भी जोड़ता है)। 在内部做的事(默认还会加 L2 regularisation)。
🤖 Simulator 4 — Train Logistic Regression by Gradient Ascent🤖 Simulator 4 — Gradient Ascent से Logistic Regression Train करें🤖 模拟器 4 — 用 Gradient Ascent 训练 Logistic Regression
Red dots defaulted (Y=1). Green dots repaid (Y=0). Press Play. The blue sigmoid curve learns, and ℓ climbs. Click a dot to flip its label. Try a big learning rate to see wobbling.लाल बिंदु = default (Y=1)। हरे बिंदु = चुकाया (Y=0)। Play दबाएँ। नीली sigmoid curve सीखती है और ℓ ऊपर चढ़ता है। किसी बिंदु पर click करके उसका label बदलें। बड़ा learning rate आज़माकर डगमगाहट देखें।红点表示违约 (Y=1),绿点表示还款 (Y=0)。点击 Play,蓝色 sigmoid 曲线开始学习,ℓ 不断上升。点击某个点可翻转其标签。试试大的 learning rate,看看震荡。
iterationiteration迭代次数0
β₀0
β₁ (per 10k)(प्रति 10k)(每 10k)0
ℓ(β)–
accuracyaccuracy准确率–
Model used here: P(default) = σ(β₀ + β₁·(income − 50)/10). Centering income makes the climb smooth. A negative β₁ means more income → less default risk.यहाँ model: P(default) = σ(β₀ + β₁·(income − 50)/10)। Income को center करने से चढ़ाई smooth होती है। Negative β₁ का मतलब: ज़्यादा income → कम default risk।此处模型:P(default) = σ(β₀ + β₁·(income − 50)/10)。对收入做中心化让爬升更平稳。β₁ 为负表示收入越高 → 违约风险越低。

Section 08भाग 08第 08 节

MLE for the Poisson Distribution 📦Poisson Distribution के लिए MLE 📦Poisson Distribution 的 MLE 📦

The Story: The Call Centre Managerकहानी: Call Centre Manager故事:呼叫中心经理

Priya runs a call centre. Over 8 hours she counts calls per hour: 3, 5, 2, 8, 4, 6, 3, 5. She models calls as a Poisson process with unknown rate λ. She wants the MLE of λ to plan staff.

प्रिया एक call centre चलाती है। 8 घंटों में वह हर घंटे की calls गिनती है: 3, 5, 2, 8, 4, 6, 3, 5। वह calls को अज्ञात rate λ वाले Poisson process से model करती है। Staff की योजना के लिए उसे λ का MLE चाहिए।

Priya 管理一个呼叫中心。8 小时内她记录了每小时的来电数:3, 5, 2, 8, 4, 6, 3, 5。她用速率 λ 未知的 Poisson 过程建模,想求 λ 的 MLE 来安排人手。

🧮 Poisson MLE — Call Centre Rate🧮 Poisson MLE — Call Centre Rate🧮 Poisson MLE — 呼叫中心速率
Data
x = {3, 5, 2, 8, 4, 6, 3, 5}, n = 8, Σxᵢ = 36
Poisson PMF
P(X=k | λ) = e^(−λ) λᵏ / k!
Log-Likelihood
ℓ(λ) = −nλ + (Σxᵢ)·log(λ) − Σlog(xᵢ!) = −8λ + 36·log(λ) − constant
DifferentiateDerivative लें求导
dℓ/dλ = −8 + 36/λ
Set to ZeroZero रखें令其为零
λ̂ = 36/8 = 4.5 calls/hour4.5 calls/घंटा每小时 4.5 通
General ResultGeneral परिणाम一般结论
λ̂ = x̄ — the sample mean.sample mean।样本均值。
Business UseBusiness उपयोग业务应用
P(X > 8) = 1 − Poisson_CDF(8; 4.5) ≈ 4.0% — about 1 hour in 25 will be a rush hour with 9+ calls. Priya plans extra staff for it.लगभग हर 25 में से 1 घंटे में 9+ calls आएँगी। प्रिया इसके लिए extra staff रखती है।大约每 25 小时中有 1 小时会有 9 通以上的来电。Priya 为此安排额外人手。

Section 09भाग 09第 09 节

Numerical MLE — When Calculus Fails 🔢Numerical MLE — जब Calculus काम न करे 🔢数值 MLE — 当微积分行不通时 🔢

Many real models have no closed-form answer. Mixture models are a common example: customer lifetimes, pixel intensities, gene expression. Here we use numerical methods: gradient ascent, the EM algorithm, or other optimisers. The idea is simple: start with a guess, then keep stepping uphill.

कई असली models का कोई closed-form जवाब नहीं होता। Mixture models इसका आम उदाहरण हैं: customer lifetimes, pixel intensities, gene expression। यहाँ numerical methods इस्तेमाल होते हैं: gradient ascent, EM algorithm या अन्य optimisers। Idea सरल है: एक अनुमान से शुरू करें, फिर ऊपर की ओर कदम बढ़ाते रहें।

许多实际模型没有 closed-form 解,mixture models 就是常见例子:客户生命周期、像素强度、基因表达。这时使用数值方法:gradient ascent、EM algorithm 或其他优化器。思路很简单:从一个猜测出发,不断往上坡走。

⛰️ Simulator 5 — Gradient Ascent Climbs the Likelihood Hill⛰️ Simulator 5 — Gradient Ascent Likelihood पहाड़ी पर चढ़ता है⛰️ 模拟器 5 — Gradient Ascent 爬上 Likelihood 山
This is Priya's call data. Pretend we don't know λ̂ = x̄. Pick a starting λ and a learning rate. Press Play. Small η = slow but safe. Large η = jumps over the peak.यह प्रिया का call data है। मान लें हमें λ̂ = x̄ नहीं पता। शुरुआती λ और learning rate चुनें। Play दबाएँ। छोटा η = धीमा लेकिन सुरक्षित। बड़ा η = peak के ऊपर से कूद जाता है।这是 Priya 的来电 data。假设我们不知道 λ̂ = x̄。选择初始 λ 和 learning rate,点击 Play。η 小 = 慢但稳;η 大 = 会跳过峰值。
stepstep步数0
current λवर्तमान λ当前 λ–
dℓ/dλ–
true MLE λ̂ = x̄असली MLE λ̂ = x̄真正的 MLE λ̂ = x̄4.50
MethodMethod方法 How It Worksकैसे काम करता है原理 Best Forकिसके लिए अच्छा适用场景 Used Inकहाँ इस्तेमाल应用
Analytical MLEdℓ/dθ = 0 → θ̂Simple distributions (Normal, Binomial, Poisson)सरल distributions (Normal, Binomial, Poisson)简单分布(Normal、Binomial、Poisson)Closed-form textbook resultsClosed-form textbook परिणाम教科书中的 closed-form 结果
Gradient Ascentβ ← β + η·∂ℓ/∂βSmooth, differentiable ℓSmooth, differentiable ℓ光滑可导的 ℓLogistic regression, GLMs
Newton-RaphsonUses 2nd derivative (Hessian)2nd derivative (Hessian) इस्तेमाल करता है使用二阶导数(Hessian)Fast near the peakPeak के पास तेज़在峰值附近收敛快GLMs, survival models
EM AlgorithmAlternates E-step and M-stepE-step और M-step बारी-बारी सेE-step 与 M-step 交替Latent variable / mixture modelsLatent variable / mixture models隐变量 / mixture modelsGMMs, HMMs
BFGS / L-BFGSQuasi-Newton, approximates HessianQuasi-Newton, Hessian का अनुमानQuasi-Newton,近似 HessianMany parametersबहुत सारे parameters参数很多时scipy.optimize, ML libraries
SGD / AdamGradient on mini-batchesMini-batches पर gradient在 mini-batch 上求 gradientHuge datasets, deep learningबहुत बड़े datasets, deep learning超大数据集、deep learningPyTorch, TensorFlow

Section 10भाग 10第 10 节

Properties of MLE — Why It Is So Widely Used ⭐MLE के गुण — यह इतना क्यों इस्तेमाल होता है ⭐MLE 的性质 — 为什么用得这么广 ⭐

ConsistencyConsistencyConsistency
θ̂→θ
  • As n→∞, θ̂ approaches the true θ
  • More data = more accurate
  • Holds under mild regularity conditions
  • Asymptotically unbiased
  • n→∞ होने पर θ̂ असली θ के पास पहुँचता है
  • ज़्यादा data = ज़्यादा सटीक
  • हल्की regularity conditions में सही
  • Asymptotically unbiased
  • n→∞ 时 θ̂ 趋近真实 θ
  • data 越多越准确
  • 在温和的 regularity 条件下成立
  • Asymptotically unbiased
Asymptotic NormalityAsymptotic NormalityAsymptotic Normality
θ̂ ~ N
  • For large n, θ̂ is roughly Normal
  • Gives confidence intervals
  • Gives hypothesis tests
  • Variance ≈ 1 / Fisher Information
  • बड़े n पर θ̂ लगभग Normal होता है
  • Confidence intervals मिलते हैं
  • Hypothesis tests मिलते हैं
  • Variance ≈ 1 / Fisher Information
  • n 大时 θ̂ 近似 Normal
  • 可得 confidence intervals
  • 可做 hypothesis tests
  • 方差 ≈ 1 / Fisher Information
EfficiencyEfficiencyEfficiency
CRLB
  • Reaches the Cramér-Rao lower bound as n grows
  • Lowest possible variance for large n
  • "Best possible" in the long run
  • n बढ़ने पर Cramér-Rao lower bound तक पहुँचता है
  • बड़े n पर सबसे कम variance
  • लंबे समय में "सबसे अच्छा"
  • n 增大时达到 Cramér-Rao 下界
  • 大样本下方差最小
  • 长期来看是“最好的”
🎯 Simulator 6 — Watch Consistency Happen🎯 Simulator 6 — Consistency होते हुए देखें🎯 模拟器 6 — 亲眼看到 Consistency
Set a true p. Press Run. The computer flips up to 2,000 coins and updates p̂ = k/n after each flip. Early on p̂ jumps around. Later it settles near the true p. The blue band shrinks like 1/√n — that is asymptotic normality.असली p चुनें। Run दबाएँ। Computer 2,000 तक coins उछालता है और हर flip के बाद p̂ = k/n update करता है। शुरू में p̂ उछलता है। बाद में असली p के पास टिक जाता है। नीला band 1/√n की तरह सिकुड़ता है — यही asymptotic normality है।设定真实 p,点击 Run。计算机最多抛 2,000 次,每次更新 p̂ = k/n。开始时 p̂ 波动很大,之后稳定在真实 p 附近。蓝色带按 1/√n 收窄——这就是 asymptotic normality。
flips nflips n次数 n0
p̂ = k/n–
error |p̂ − p|error |p̂ − p|误差 |p̂ − p|–
⚠️
Limitations of MLEMLE की सीमाएँMLE 的局限

Small samples: can be biased (e.g. variance).  |  Wrong model: if the assumed distribution is wrong, the MLE is the best fit to the wrong model.  |  Overfitting: MLE fits training data as closely as it can; use regularisation.  |  Many peaks: some likelihoods have several peaks; gradient methods may stop at a local one.

छोटे samples: biased हो सकता है (जैसे variance)।  |  गलत model: अगर मानी गई distribution गलत है, तो MLE गलत model का सबसे अच्छा fit है।  |  Overfitting: MLE training data से जितना हो सके उतना fit करता है; regularisation इस्तेमाल करें।  |  कई peaks: कुछ likelihoods में कई peaks होते हैं; gradient methods किसी local peak पर रुक सकते हैं।

小样本:可能有偏(如方差)。 |  模型错误:若假设的分布错了,MLE 只是错误模型的最佳拟合。 |  Overfitting:MLE 尽可能贴合训练 data,需用 regularisation。 |  多峰:有些 likelihood 有多个峰,gradient 方法可能停在局部峰。


Section 11भाग 11第 11 节

MLE vs MAP — Adding Prior Knowledge 🧠MLE बनाम MAP — Prior Knowledge जोड़ना 🧠MLE 与 MAP — 加入先验知识 🧠

MLE uses only the data. Maximum A Posteriori (MAP) also uses a prior — what we believed before seeing data. MAP maximises the posterior: P(θ|data) ∝ L(θ|data) × P(θ).

MLE सिर्फ़ data इस्तेमाल करता है। Maximum A Posteriori (MAP) एक prior भी इस्तेमाल करता है — data देखने से पहले हमारा विश्वास। MAP posterior को maximise करता है: P(θ|data) ∝ L(θ|data) × P(θ)।

MLE 只用 data。Maximum A Posteriori (MAP) 还使用 prior——看到 data 之前的信念。MAP 最大化 posterior:P(θ|data) ∝ L(θ|data) × P(θ)。

🧠 Simulator 7 — MLE vs MAP Tug of War🧠 Simulator 7 — MLE बनाम MAP की रस्साकशी🧠 模拟器 7 — MLE 与 MAP 的拔河
You flip a coin 3 times and get 3 heads. MLE says p̂ = 1.0 — "this coin never lands tails!" That is overfitting. A prior that says "coins are usually fair" pulls MAP back toward 0.5. Add more flips and watch the prior lose its pull.आप coin 3 बार उछालते हैं और 3 heads आते हैं। MLE कहता है p̂ = 1.0 — "यह coin कभी tails नहीं देगा!" यह overfitting है। "Coins आमतौर पर fair होते हैं" वाला prior MAP को 0.5 की ओर खींचता है। ज़्यादा flips जोड़ें और देखें कि prior की पकड़ कमज़ोर होती जाती है।抛 3 次得到 3 次正面。MLE 说 p̂ = 1.0——“这枚硬币永远不会反面!” 这就是 overfitting。“硬币通常是公平的” 这个 prior 把 MAP 拉回 0.5。增加抛掷次数,看 prior 的拉力逐渐减弱。
MLE = k/n–
MAP = (k+a−1)/(n+2a−2)–
gapअंतर差距–
a = 1 is a flat prior ("no opinion"). Then MAP = MLE exactly.a = 1 एक flat prior है ("कोई राय नहीं")। तब MAP बिल्कुल MLE के बराबर होता है।a = 1 是平坦 prior(“没有看法”),此时 MAP 与 MLE 完全相同。
Featureविशेषता特征MLEMAP
Objectiveलक्ष्य目标max L(θ|data)max L(θ|data)·P(θ)
Uses prior?Prior इस्तेमाल?使用 prior?No — data onlyनहीं — सिर्फ़ data否 — 只用 dataYes — data + priorहाँ — data + prior是 — data + prior
Small dataकम datadata 少时Can overfit badlyबुरी तरह overfit हो सकता है可能严重 overfitPrior keeps it stablePrior इसे stable रखता हैprior 让它保持稳定
Large dataज़्यादा datadata 多时Works wellअच्छा काम करता है效果很好Prior fades; MAP → MLEPrior फीका पड़ता है; MAP → MLEprior 影响消失;MAP → MLE
ML equivalentML में समकक्षML 中的对应No regularisationकोई regularisation नहीं无 regularisationL2 regularisation (Gaussian prior)L2 regularisation (Gaussian prior)L2 regularisation(Gaussian prior)
Log-objectivelog L(θ|data)log L(θ|data) + log P(θ)
School of thoughtविचारधारा学派FrequentistBayesian
💡
L2 Regularisation IS MAP with a Gaussian PriorL2 Regularisation = Gaussian Prior वाला MAPL2 Regularisation 就是 Gaussian Prior 下的 MAP

Ridge / L2 adds λ‖θ‖² to the loss. That term equals −log P(θ) (up to a constant) for a Gaussian prior P(θ) = N(0, σ²). So every L2-regularised model is a MAP estimator in disguise. L1 matches a Laplace prior.

Ridge / L2 loss में λ‖θ‖² जोड़ता है। Gaussian prior P(θ) = N(0, σ²) के लिए यह term (एक constant छोड़कर) −log P(θ) के बराबर है। इसलिए हर L2-regularised model असल में एक MAP estimator है। L1 Laplace prior से मेल खाता है।

Ridge / L2 在 loss 中加上 λ‖θ‖²。对 Gaussian prior P(θ) = N(0, σ²),这一项(相差一个常数)等于 −log P(θ)。所以每个 L2-regularised 模型本质上都是 MAP estimator。L1 对应 Laplace prior。


Section 12भाग 12第 12 节

MLE Across Machine Learning — The Unified View 🤖Machine Learning में MLE — एकीकृत नज़रिया 🤖贯穿 Machine Learning 的 MLE — 统一视角 🤖

ML AlgorithmML AlgorithmML 算法 Assumed Distributionमानी गई Distribution假设的分布 −Log-Likelihood = Loss−Log-Likelihood = Loss−Log-Likelihood = Loss How It Is Fittedकैसे Fit होता है拟合方式
Linear RegressionNormal errors ε ~ N(0,σ²)Normal errors ε ~ N(0,σ²)Normal 误差 ε ~ N(0,σ²)Mean Squared Error (MSE)Ordinary Least Squares (OLS)
Logistic RegressionBernoulli outputsBernoulli outputsBernoulli 输出Binary Cross-EntropyGradient ascent / NewtonGradient ascent / NewtonGradient ascent / Newton
Softmax RegressionCategorical outputsCategorical outputsCategorical 输出Categorical Cross-EntropyGradient methodsGradient methodsGradient 方法
Naive BayesClass-conditional distributionsClass-conditional distributions类条件分布Joint log-likelihoodJoint log-likelihood联合 log-likelihoodCounting frequenciesFrequencies गिनना统计频率
Gaussian Mixture ModelMixture of NormalsNormals का mixture多个 Normal 的混合Mixture log-likelihoodMixture log-likelihoodMixture log-likelihoodEM Algorithm
Deep Neural NetworkTask-dependentTask पर निर्भर取决于任务MSE / Cross-EntropySGD / Adam
Cox Survival ModelHazard modelHazard modelHazard 模型Partial log-likelihoodNewton-Raphson
Large Language ModelsNext-token categoricalNext-token categorical下一个 token 的 categorical−Σ log P(token|context)SGD / Adam
🧮
The Deep Linkगहरा संबंध深层联系

Every row above does the same thing: find parameters that make the observed data most probable. With Gaussian errors, minimising MSE IS maximising likelihood. With categorical outputs, minimising cross-entropy IS maximising likelihood. MLE explains why ML training works.

ऊपर की हर पंक्ति एक ही काम करती है: ऐसे parameters खोजो जो observed data को सबसे ज़्यादा probable बनाएँ। Gaussian errors के साथ MSE को minimise करना ही likelihood को maximise करना है। Categorical outputs के साथ cross-entropy को minimise करना ही likelihood को maximise करना है। MLE बताता है कि ML training क्यों काम करती है।

上表每一行做的都是同一件事:找到让观测 data 概率最大的 parameters。在 Gaussian 误差下,最小化 MSE 就是最大化 likelihood;在 categorical 输出下,最小化 cross-entropy 就是最大化 likelihood。MLE 解释了 ML 训练为什么有效。


Section 13भाग 13第 13 节

Complete MLE Reference — All Distributionsपूरा MLE Reference — सभी Distributions完整 MLE 速查表 — 各种分布

DistributionParameter(s)MLE EstimateMLE EstimateMLE 估计Intuitionसहज अर्थ直观理解
Bernoulli(p)pp̂ = k/nObserved proportionObserved अनुपात观测比例
Binomial(n,p)pp̂ = k/nObserved success rateObserved success rate观测成功率
Poisson(λ)λλ̂ = x̄Mean of the countsCounts का mean计数的均值
Normal(μ, σ²)μ, σ²μ̂ = x̄, σ̂² = (1/n)Σ(xᵢ−x̄)²Sample mean & biased varianceSample mean और biased variance样本均值与有偏方差
Exponential(λ)λλ̂ = 1/x̄1 ÷ mean waiting time1 ÷ औसत waiting time1 ÷ 平均等待时间
Uniform(a,b)a, bâ = min(xᵢ), b̂ = max(xᵢ)Observed range (biased: too narrow)Observed range (biased: बहुत संकरा)观测范围(有偏:偏窄)
Geometric(p)pp̂ = 1/x̄1 ÷ mean trials to first success1 ÷ पहली success तक औसत trials1 ÷ 首次成功的平均试验次数
Beta(α,β)α, βNumerical (Newton)Numerical (Newton)数值解(Newton)No closed form; start from method-of-moments guessClosed form नहीं; method-of-moments अनुमान से शुरू करें无 closed form;从 method-of-moments 初值开始

Section 14भाग 14第 14 节

The Golden Rules of MLEMLE के सुनहरे नियमMLE 黄金法则

🎯 12 Rules Every Data Scientist Must Know🎯 12 नियम जो हर Data Scientist को पता होने चाहिए🎯 每位 Data Scientist 必须掌握的 12 条法则
1
Likelihood is not probability. P(data | θ) fixes θ. L(θ | data) fixes the data. Same formula, different question.Likelihood, probability नहीं है। P(data | θ) में θ तय है। L(θ | data) में data तय है। Formula वही, सवाल अलग।Likelihood 不是 probability。P(data | θ) 固定 θ;L(θ | data) 固定 data。公式相同,问题不同。
2
Work with log-likelihood. Raw products underflow. Log-sums stay stable. The argmax does not change.Log-likelihood के साथ काम करें। Raw products underflow होते हैं। Log-sums stable रहते हैं। Argmax नहीं बदलता।使用 log-likelihood。原始乘积会 underflow,log 求和保持稳定,argmax 不变。
3
Simple models give simple answers. Binomial p̂ = k/n. Normal μ̂ = x̄. Poisson λ̂ = x̄. Exponential λ̂ = 1/x̄.सरल models, सरल जवाब। Binomial p̂ = k/n। Normal μ̂ = x̄। Poisson λ̂ = x̄। Exponential λ̂ = 1/x̄।简单模型,简单答案。Binomial p̂ = k/n;Normal μ̂ = x̄;Poisson λ̂ = x̄;Exponential λ̂ = 1/x̄。
4
The Normal variance MLE is biased. It divides by n. For small samples, use s² with n−1.Normal variance का MLE biased है। यह n से भाग देता है। छोटे samples में n−1 वाला s² इस्तेमाल करें।Normal 方差的 MLE 有偏。它除以 n。小样本请用除以 n−1 的 s²。
5
MSE = MLE under Gaussian errors. Least squares hides a Normal assumption.Gaussian errors में MSE = MLE। Least squares में एक Normal assumption छिपी है।Gaussian 误差下 MSE = MLE。最小二乘里隐含着 Normal 假设。
6
Cross-entropy = negative log-likelihood. Training a classifier is MLE.Cross-entropy = negative log-likelihood। Classifier की training MLE है।Cross-entropy = negative log-likelihood。训练分类器就是 MLE。
7
Choose the model first. MLE gives the best parameters for the model you pick. A wrong model gives a confident wrong answer.पहले model चुनें। MLE आपके चुने model के लिए सबसे अच्छे parameters देता है। गलत model = आत्मविश्वास से भरा गलत जवाब।先选模型。MLE 给出所选模型的最佳 parameters。模型错了,就会得到“很自信的错误答案”。
8
L2 = Gaussian prior, L1 = Laplace prior. Every regularised model is a MAP estimate.L2 = Gaussian prior, L1 = Laplace prior। हर regularised model एक MAP estimate है।L2 = Gaussian prior,L1 = Laplace prior。每个 regularised 模型都是 MAP 估计。
9
Check the second derivative. dℓ/dθ = 0 is not enough. Confirm d²ℓ/dθ² < 0 (or a negative-definite Hessian).Second derivative जाँचें। dℓ/dθ = 0 काफ़ी नहीं। d²ℓ/dθ² < 0 (या negative-definite Hessian) की पुष्टि करें।检查二阶导数。dℓ/dθ = 0 还不够,需确认 d²ℓ/dθ² < 0(或 Hessian 负定)。
10
For i.i.d. data, ℓ is a sum. So you can split it into mini-batches. That is why SGD works.i.i.d. data में ℓ एक जोड़ है। इसलिए इसे mini-batches में बाँट सकते हैं। इसी वजह से SGD काम करता है।i.i.d. data 的 ℓ 是一个求和。所以可以拆成 mini-batch,这就是 SGD 有效的原因。
11
Great with big data, risky with small data. For small n, add a prior (MAP) or regularisation.बड़े data में बढ़िया, छोटे data में जोखिम। छोटे n पर prior (MAP) या regularisation जोड़ें।大数据下表现出色,小数据下有风险。n 小时加 prior(MAP)或 regularisation。
12
Likelihood powers testing too. The likelihood-ratio statistic −2 log[L(θ₀)/L(θ̂)] is roughly chi-square under H₀. Wald tests, score tests, AIC and BIC all come from the likelihood.Testing भी likelihood से चलता है। Likelihood-ratio statistic −2 log[L(θ₀)/L(θ̂)], H₀ के तहत लगभग chi-square होता है। Wald tests, score tests, AIC और BIC — सब likelihood से आते हैं।检验也靠 likelihood。似然比统计量 −2 log[L(θ₀)/L(θ̂)] 在 H₀ 下近似 chi-square。Wald 检验、score 检验、AIC、BIC 都源自 likelihood。
🧮
MLE — The Engine Behind Modern Statistics and MLMLE — आधुनिक Statistics और ML का इंजनMLE — 现代 Statistics 与 ML 的引擎

The detective and the deep learning system follow the same logic. Observe data. Assume a model. Find the parameters that make the data most probable. That is the likelihood. Maximise it. That is MLE. The best explanation of the data is the one that would have made that data most likely.

Detective और deep learning system एक ही तर्क अपनाते हैं। Data देखो। एक model मानो। वे parameters खोजो जो data को सबसे ज़्यादा probable बनाएँ। यही likelihood है। इसे maximise करो। यही MLE है। Data की सबसे अच्छी व्याख्या वह है जो उस data को सबसे ज़्यादा likely बना देती।

侦探和 deep learning 系统遵循同样的逻辑:观察 data,假设模型,找到让 data 概率最大的 parameters。这就是 likelihood,把它最大化,就是 MLE。对 data 最好的解释,就是最能让这些 data 出现的那个解释。

You have completed Probability. View all sections →