机器学习---局部加权回归
2015-09-21 11:16
555 查看
Locally weighted regression(英)
非参数学习算法
non-parametric learning algorithum
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
Output θ T θ^T x.
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
ε (i) ε^{(i)}—error term(误差项)
ε (i) ε^{(i)}~N(0,σ 2 σ^2)
取对数
log likelihood
想要取得最大值,减号的右侧需要取得最小值
右侧为cost function
二分类问题(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的简化版本。
非参数学习算法
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)})^2Output θ 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)})^2Output θ 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.似然函数
likelihood5.最大似然函数
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的简化版本。
相关文章推荐
- hadoop集群部署,内存,存储配置
- oracle中schema指的是什么?
- Spring mvc 绑定Date日期
- iOS 9部分问题
- 关于浏览器跨域问题Access-Control-Allow-Origin
- AFNetworking缓存
- linux下源码安装
- 再谈线程池——友好地关闭线程池
- JS cookie运用
- Scala教程(五)Map、Tuple、Zip实战
- 网站添加自己公司的地图(使用的百度地图)时只显示一个空白框
- Linux Tomcat日志查看实用命令
- asp.net后台导出excel的方法:使用System.Web.HttpContext.Current.Response导出excel
- Sublime Text安装Package Control
- js之DOM操作访问子结点childNodes
- Maven学习总结(四)——Maven核心概念
- ksh 注释
- jqgrid 一些要点
- MaxGap leetcode题目(桶排序)
- java SE复习笔记32