【科研基础】PRML

补充

MSE as Maximum Likelihood

MSE as Maximum Likelihood: A Deep Dive into Machine Learning’s Intersection with Statistics
Where does the Mean Squared Error come from?
The beauty of MSE lies in its simplicity and interpretability. By squaring the errors, we grant more weight to larger discrepancies, rendering the model sensitive to more significant errors. Moreover, the squaring process ensures that the error metric is always positive.
In essence, MLE aims to find the model parameters that maximize the likelihood of the observed data.

  • the connection between MSE and MLE
    assume that the model’s errors are normally distributed – a common assumption in many statistical models. When we model errors with a normal distribution, the process of MLE, which maximizes the likelihood of the observed data, turns equivalent to minimizing the MSE.
    the log-likelihood for normally distributed errors. It simplifies to a constant subtracted from the MSE.
    p s ^ ( s ^ ∣ s , f ) = N ( s ∣ f ( x ) , σ 2 ) p_{\mathbf{\hat s}}(\mathbf{\hat s}|\mathbf{s},f)=\mathcal{N}(\mathbf{s}|f(x),\sigma^2) ps^(s^s,f)=N(sf(x),σ2)

1-Introduction

Supervised / unsupervised learning

P3

Overfitting

p6
p9:
For a given model complexity, the over-fitting problem become less severe as the size of the data set increases.
Choose the complexity of the model according to the complexity of the problem being solved.
Least squares approach to finding the model parameters represents a specific case of maximum likelihood.
(更加详细的证明见p141 3.1.1求似然函数,取对数,求期望,求导数)
当误差项服从正态分布时,最小二乘法估计与最大似然估计是一致的,分析如下:

  • 在回归分析中,最小二乘法用于寻找模型参数,使得预测值与实际观测值之间的平方误差和最小化。对于线性回归模型: y = X β + ϵ y=X\beta+\epsilon y=+ϵ,其中 y y y是观测值向量, X X X是设计矩阵, β \beta β是待估参数向量, ϵ \epsilon ϵ是误差向量。最小二乘估计通过最小化平方误差和来找到参数 β : \beta: β: β ^ L S = arg ⁡ min ⁡ β ∥ y − X β ∥ 2 \hat{\beta}_{LS}=\arg\min_\beta\|y-X\beta\|^2 β^LS=argminβy2
    这个优化问题的解是: β ^ L S = ( X T X ) − 1 X T y \hat{\beta}_{LS}=(X^TX)^{-1}X^Ty β^LS=(XTX)1XTy.
  • 最大似然估计的目标是找到使得观测数据概率最大的参数值。在回归模型中,如果我们假设误差项 ϵ \epsilon ϵ服从正态分布 ϵ ∼ N ( 0 , σ 2 I ) \epsilon\sim\mathcal{N}(0,\sigma^2I) ϵN(0,σ2I) ,那么观测值 y y y也服从正态分布: y ∼ N ( X β , σ 2 I ) y\sim\mathcal{N}(X\beta,\sigma^2I) yN(,σ2I)
    观测数据的似然函数为: L ( β , σ 2 ) = P ( y ∣ β , σ 2 ) = 1 ( 2 π σ 2 ) n / 2 exp ⁡ ( − 1 2 σ 2 ( y − X β ) T ( y − X β ) ) L(\beta,\sigma^2)=P(y|\beta,\sigma^2)=\frac{1}{(2\pi\sigma^2)^{n/2}}\exp\left(-\frac{1}{2\sigma^2}(y-X\beta)^T(y-X\beta)\right) L(β,σ2)=P(yβ,σ2)=(2πσ2)n/21exp(2σ21(y)T(y))
    对数似然函数为: log ⁡ L ( β , σ 2 ) = − n 2 log ⁡ ( 2 π σ 2 ) − 1 2 σ 2 ( y − X β ) T ( y − X β ) \log L(\beta,\sigma^2)=-\frac{n}{2}\log(2\pi\sigma^2)-\frac{1}{2\sigma^2}(y-X\beta)^T(y-X\beta) logL(β,σ2)=2nlog(2πσ2)2σ21(y)T(y)
    为了找到最大似然估计 β ^ M L E \hat{\beta}_{MLE} β^MLE,我们对 log ⁡ L ( β , σ 2 ) \log L(\beta,\sigma^2) logL(β,σ2)关于 β \beta β取偏导数并令其为零: ∂ log ⁡ L ( β , σ 2 ) ∂ β = 1 σ 2 X T ( y − X β ) = 0 \frac{\partial\log L(\beta,\sigma^2)}{\partial\beta}=\frac{1}{\sigma^2}X^T(y-X\beta)=0 βlogL(β,σ2)=σ21XT(y)=0
    解这个方程得到: X T y = X T X β X^{T}y=X^{T}X\beta XTy=XT, β ^ M L E = ( X T X ) − 1 X T y \hat{\beta}_{MLE}=(X^TX)^{-1}X^Ty β^MLE=(XTX)1XTy这正是最小二乘估计的解。

The over-fitting problem can be understood as a general property of maximum likelihood.
最大似然估计旨在找到一组参数,使得在给定数据集上的似然函数最大化。然而,如果模型过于复杂(即,参数过多或模型自由度过高),它可能会“记住”训练数据中的噪声和异常值,从而导致过拟合。过拟合的本质在于模型对训练数据拟合得过于紧密,无法很好地泛化到未见过的数据。为什么最大似然估计容易过拟合?1.模型复杂度高,如果模型有太多参数,它可能会精确拟合训练数据,包括数据中的噪声。2.数据不足,当数据量较小时,复杂模型更容易过拟合,因为它可以在有限的数据上找到各种模式,而这些模式在更大的数据集上可能并不成立。3.缺乏正则化,最大似然估计本身不包含对模型复杂度的惩罚。如果不使用任何形式的正则化,模型参数可能会变得很大,以便在训练数据上达到最大似然。总结:在不施加额外约束的情况下,过拟合是最大似然的直接结果。

Adopting a Bayesian approach, the over-fitting problem can be avoided.
1.通过先验分布,引入对参数的约束,避免参数估计过大或过小。先验分布: p ( w ) ∼ N ( 0 , λ − 1 I ) p(\mathbf{w})\sim\mathcal{N}(0,\lambda^{-1}I) p(w)N(0,λ1I),似然函数: p ( y ∣ X , w ) p(\mathbf{y}|X,\mathbf{w}) p(yX,w),后验分布: p ( w ∣ y , X ) ∝ p ( y ∣ X , w ) p ( w ) p(\mathbf{w}|\mathbf{y},X)\propto p(\mathbf{y}|X,\mathbf{w})p(\mathbf{w}) p(wy,X)p(yX,w)p(w)。通过最大化后验分布,可以得到参数的贝叶斯估计: w ^ B a y e s = arg ⁡ max ⁡ w p ( w ∣ y , X ) \hat{\mathbf{w}}_{Bayes}=\arg\max_\mathbf{w}p(\mathbf{w}|\mathbf{y},X) w^Bayes=argmaxwp(wy,X)这相当于在损失函数中加入正则化项: w B a y e s = arg ⁡ min ⁡ w ( ∑ i = 1 N ( y i − f ( x i ; w ) ) 2 + λ ∥ w ∥ 2 ) \mathbf{w}_{Bayes}=\arg\min_{\mathbf{w}}\left(\sum_{i=1}^{N}(y_{i}-f(x_{i};\mathbf{w}))^{2}+\lambda\|\mathbf{w}\|^{2}\right) wBayes=argminw(i=1N(yif(xi;w))2+λw2)
2.模型复杂度的自动调整:当数据量较小时,先验分布对后验分布的影响较大,从而抑制参数的过度拟合。当数据量较大时,数据的贡献更多地影响后验分布,使得参数估计更加准确。

p10
Regularization
E ~ ( w ) = 1 2 ∑ n = 1 N { y ( x n , w ) − t n } 2 + λ 2 ∥ w ∥ 2 \widetilde{E}(\mathbf{w})=\frac{1}{2}\sum_{n=1}^{N}\left\{y(x_n,\mathbf{w})-t_n\right\}^2+\frac{\lambda}{2}\|\mathbf{w}\|^2 E (w)=21n=1N{ y(xn,w)tn}2+2λw2
where ∥ w ∥ 2 ≡ w T w = w 0 2 + w 1 2 + … + w M 2 \| \mathbf{w} \| ^2\equiv \mathbf{w} ^{\mathrm{T} }\mathbf{w} = w_0^2+ w_1

  • 11
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

|7_7|

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值