M1-036M1: Mathematics & Statistics Fundamentals估计理论 (MLE/MAP)Easy
⚡Flashcard Drill➔Mastery:

Define Maximum Likelihood Estimation (MLE) with a Complete End-to-End Derivation

📐 Mathematical Definition
θ^MLE=arg⁡max⁡θ∑ilog⁡p(xi∣θ)\hat\theta_{MLE}=\arg\max_\theta\sum_i\log p(x_i\mid\theta)
⚡ One-Sentence Core Answer
MLE finds parameter values that maximize the probability of generating the observed sample dataset: θ^MLE=arg⁡max⁡θ∑i=1Nlog⁡p(xi∣θ)\hat{\theta}_{\text{MLE}} = \arg\max_\theta \sum_{i=1}^N \log p(x_i\mid \theta).

📌 Key Takeaways

  • •
    Principle: Treats data DD as fixed and parameter θ\theta as the variable to optimize.
  • •
    Log-likelihood: Logarithm transforms product of probabilities into a sum of log-densities, simplifying derivatives and avoiding underflow.
  • •
    Score function: First derivative ∇θℓ(θ)=0\nabla_\theta \ell(\theta) = 0; information matrix evaluated via negative Hessian.

📐 Mathematical Derivations

Complete example: Estimating Gaussian parameters θ=(μ,σ2)\theta = (\mu, \sigma^2) from i.i.d. Sample x1,…,xN∼N(μ,σ2)x_1, \dots, x_N \sim \mathcal{N}(\mu, \sigma^2). The likelihood is L(μ,σ2)=∏i=1N12πσ2exp⁡(−(xi−μ)22σ2)L(\mu, \sigma^2) = \prod_{i=1}^N \frac{1}{\sqrt{2\pi\sigma^2}} \exp\left(-\frac{(x_i - \mu)^2}{2\sigma^2}\right). The log-likelihood is ℓ(μ,σ2)=−N2log⁡(2π)−N2log⁡(σ2)−12σ2∑i=1N(xi−μ)2\ell(\mu, \sigma^2) = -\frac{N}{2}\log(2\pi) - \frac{N}{2}\log(\sigma^2) - \frac{1}{2\sigma^2}\sum_{i=1}^N (x_i - \mu)^2. Setting ∂ℓ∂μ=1σ2∑i=1N(xi−μ)=0  ⟹  μ^MLE=1N∑i=1Nxi\frac{\partial \ell}{\partial \mu} = \frac{1}{\sigma^2}\sum_{i=1}^N (x_i - \mu) = 0 \implies \hat{\mu}_{\text{MLE}} = \frac{1}{N}\sum_{i=1}^N x_i. Setting ∂ℓ∂σ2=−N2σ2+12(σ2)2∑i=1N(xi−μ)2=0  ⟹  σ^MLE2=1N∑i=1N(xi−μ^)2\frac{\partial \ell}{\partial \sigma^2} = -\frac{N}{2\sigma^2} + \frac{1}{2(\sigma^2)^2}\sum_{i=1}^N (x_i - \mu)^2 = 0 \implies \hat{\sigma}_{\text{MLE}}^2 = \frac{1}{N}\sum_{i=1}^N (x_i - \hat{\mu})^2. Note that σ^MLE2\hat{\sigma}_{\text{MLE}}^2 is biased (E[σ^2]=N−1Nσ2E[\hat{\sigma}^2] = \frac{N-1}{N}\sigma^2).

🏭 Production Trade-offs

MLE has optimal asymptotic properties under regularity conditions: it is asymptotically unbiased, asymptotically normal, and achieves the Cramér-Rao Lower Bound (asymptotically efficient). However, in finite small-sample regimes, MLE suffers from severe overfitting (e.g. Estimating CTR from 2 clicks out of 2 impressions yields p^=1.0\hat{p} = 1.0), necessitating Bayesian priors or smoothing.
⚠️ Common Interview Pitfalls
  • ✕
    Assuming MLE is always unbiased (as demonstrated by Gaussian variance 1N\frac{1}{N} vs 1N−1\frac{1}{N-1}).
  • ✕
    Applying MLE when regularity conditions fail (e.g. Estimating support boundary θ\theta in U(0,θ)\mathcal{U}(0, \theta) where likelihood derivative is non-zero everywhere).
🎯 Interviewer Follow-up Inquiries
  • ?
    What is the MLE estimator for the upper bound of a Uniform distribution U(0,θ)\mathcal{U}(0, \theta)?
  • ?
    How does the Fisher Information matrix dictate the asymptotic covariance of MLE estimators?
⚡
Test muscle memory on this topic via 3-Layer Flashcards
Active Recall: Mentally formulate Prompt ➔ Math Derivation ➔ Benchmark Implementation in 3 minutes.
🎯 Drill This Card Now➔
📚

Associated Knowledge Base Guides & Mindmaps

Explore the comprehensive technical article, exam cards, and global architecture tree.

← PreviousM1-035: Enumerate Common Sources of Numerical Instability in Deep Learning and Their Standard Industrial Mitigations📋Back to BankNext →M1-037: Define Maximum A Posteriori (MAP) Estimation and Explain Its Exact Connection to MLE and Regularization
中文速览与面试要点

定义最大似然估计(MLE),并给出一个完整例子。

MLE 选择让观测数据出现概率最大的参数;对高斯似然求导即得样本均值与方差。

核心要点

  • MLE 的构造:写出似然 L(θ)=Πᵢp(xᵢ|θ),取对数把乘积变求和 ℓ(θ)=Σᵢlog p(xᵢ|θ),再对 θ 求导置零。 完整例子(高斯) :ℓ(μ,σ²)=−n/2·log(2πσ²)−(1/2σ²)Σ(xᵢ−μ)²;对 μ 求导得 μ̂=(1/n)Σxᵢ(样本均值);对 σ² 求导得 σ̂²=(1/n)Σ(xᵢ−μ̂)²(注意分母是 n 而非 n−1,故是有偏估计)。 另一例子(Bernoulli) :ℓ(p)=k log p+(n−k)log(1−p),求导得 p̂=k/n,即样本频率。MLE 的关键性质是 参数化不变性 ——若 θ̂ 是 θ 的 MLE,则 g(θ̂) 是 g(θ) 的 MLE(对任意函数 g),这使其应用极广。
  • 三个必须掌握的要点:① 似然不是概率 ——L(θ) 对 θ 不归一化(∫L(θ)dθ 通常不为 1),只有作为 θ 的函数才有意义;② MLE 的偏差 ——高斯方差估计 (1/n)Σ(xᵢ−μ̂)² 的期望是 (n−1)/n·σ²,故系统性低估,这就是 Bessel 校正(除以 n−1)的来源;在小样本下偏差显著,n→∞ 时消失(渐近无偏);③ MLE 的渐近性质 ——在正则条件下,√n(θ̂−θ)→N(0, I(θ)⁻¹)(I 为 Fisher 信息矩阵),即渐近正态且达到 Cramér-Rao 下界(渐近有效)。这使我们可以用 Fisher 信息构造置信区间,也是很多统计检验的理论基础。实践中 MLE 的失效情形包括:参数在边界(如方差为 0)、模型不可辨识(GMM 的标签置换)、完全分离(逻辑回归中可分数据导致系数发散)。
  • 似然不是概率(对参数不归一化)
  • MLE 在小样本下可能过拟合(如方差估计有偏)

常见陷阱

  • 把似然当概率使用
  • 忽略小样本下 MLE 的偏差(方差估计需 Bessel 校正)