您的位置:首页 > 其它

机器学习---局部加权回归

2015-09-21 11:16 555 查看
Locally weighted regression(英)

非参数学习算法

non-parametric learning algorithum

1过拟合和欠拟合



y=θ 0 +θ 1 x y = θ_0 + θ_1x



y=θ 0 +θ 1 x+θ 2 x 2 y = θ_0 +θ_1x +θ_2x^2



y=θ 0 +θ 1 x+θ 2 x 2 +θ 3 x 3 +θ 4 x 4 +θ 5 x 5 y = θ_0 +θ_1x +θ_2x^2+θ_3x^3+θ_4x^4+θ_5x^5

y=∑ 5 j=0 θ j x j y = \sum_{j=0}^5{θ_jx^j}

图片1为欠拟合—underfitting

图片3为过拟合—overfitting

2.局部加权回归

1.original linear regression algorithm

Fit θ to minimize ∑ i (y (i) −θ T x (i) ) 2 \sum_i(y^{(i)}-θ^Tx^{(i)})^2

Output θ T θ^T x.

2.locally weighted linear regression algorithm

Fit θ to minimize ∑ i w (i) (y (i) −θ T x (i) ) 2 \sum_iw^{(i)}(y^{(i)}-θ^Tx^{(i)})^2

Output θ T θ^T x

A fairly standard choice for the weight

w (i) =exp(−(x (i) −x) 2 2τ 2 ) w^{(i)}=exp({-{{(x^{(i)}-x)^2}\over2τ^2}})

τ—波长函数(bandwidth parameter),非正式而言,它控制了权值随距离下降的速率

If |x (i) −x x^{(i)}-x | small ,then w (i) ≈1 w^{(i)}\approx 1

If |x (i) −x x^{(i)}-x | large ,then w (i) ≈0 w^{(i)}\approx 0

3.Probabilistric interpretation

y (i) =θ T x (i) +ε (i) y^{(i)}=θ^Tx^{(i)}+ε^{(i)}

ε (i) ε^{(i)}—error term(误差项)

ε (i) ε^{(i)}~N(0,σ 2 σ^2)





4.似然函数

likelihood





5.最大似然函数

maximum likelihood

取对数

log likelihood



想要取得最大值,减号的右侧需要取得最小值

右侧为cost function

3.Classification and logistic regression

垃圾邮件分类器

二分类问题(binary classification )

label

1 为positive class

0 为negative class

输入x (i) x^{(i)}可以是邮件部分分离出的某些特性(features)

当忽略掉y是离散值,由传统的线性回归算法预测y值。

h θ (x) h_θ(x)不应该比1大,或者比0小

选择了如下函数表达





函数表示的图像:



上述函数为logistic function 或者 sigmoid function

神经元的非线性作用函数

求取g(z)的导数—derivative



不得不佩服这些搞研究的,总喜欢归纳简洁的东西。

来了一个假设



所以又来一顿数学推导



取似然函数L(θ)





求取最大似然函数

在线性回归中我们经常用到梯度下降法(gradient ascent),迭代规则为:θ:=θ+α▽ θ ι(θ) θ:=θ+α▽_θι(θ)

推导出了最终的公式:



当我们强行的仅仅想要简单的输出为0或者1的时候,函数为:



h θ (x)=g(θ T x) h_θ(x)=g(θ^Tx)

得到相同的规则



以上便是感知器算法,英文为 perceptron learning algorithm

可以说感知器算法,是logistic algorithm的简化版本。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: