一、多项式拟合polynomial curve fitting
对于给定的(x,t), x为变量,t为对应观察值。
Ground truth:
Observed data: ,其中
是高斯噪声
要求:找到输出x和输出t的对应关系,对于给定的x能够预测出t的值(i.e., 找到t关于x的函数,)
分析困难点:
- 数据有限
- 数据存在噪声
设拟合函数为 ,
并定义误差,其中
表示当
时的真实值,N表示样本个数(上图中蓝点的个数)。
接下来就是寻找一个使得
最小,常用方法是梯度下降(gradient descent)
梯度下降法传送门:深入浅出--梯度下降法及其实现
本例中,设初始 ,学习率为
则梯度为,代入观察值
,
得第一次更新后得权重 ,其中
代入观察值,
得第二次更新后得权重
...
代入观察值(具体多少次视情况而定),
得第n次更新后得权重
在了解完梯度下降的算法后,需要设置m的数值,一个合适的模型往往也意味着拥有合适的m,合适的参数,对于线性拟合来说:
m = 0 常值函数
m = 1 一次函数,一条倾斜直线
m = 2 二次函数,抛物线
...
从上图可以看出随着m的增加,出现过拟合的可能性越高,因此选择合适的m很重要,而防止过拟合的常用方法有:
1.增加样本空间
2.调整的计算方式
增加样本空间
上面两图分别是当m=9时,用梯度下降法,最小化所得最终的图像表示,可以看出随着样本数量的大量增加,过拟合可以被有效解决。
调整
的计算方式
增加惩罚机制,因为随着m的增加,次数越高的x,前面系数也往往会越大
二、贝叶斯定理Bayes theorem
基本概念:
- 联合概率
:A=a和B=b同时发生的概率
- 条件概率
:在B=b发生的条件下,A=a的概率
- (A、B需满足独立性)
其中,A、B为两方面属性
贝叶斯定理:
,
其中
Bayes theorem application: medical test
A laboratory of blood test is 99 percent effective in detecting a certain disease when it is, in fact, present. However, the test also yields a ‘false positive’ result for 1 percent of the healthy persons tested. (That is, if a healthy person is tested, then, with probability 0.01, the test result will imply he or she has the disease). if 0.1 percent of the population actually has the disease, what is the probability a person has the disease given that his test result is positive?
Examples from: Seldom Ross: Introduction to Probability and Statistics for Engineers and Scientists. 2004.
设:
D = ‘person has the disease’
E = ‘test is positive’
Dc = ‘person does not have the disease’
参考文献:
深入浅出--梯度下降法及其实现