1. Guide

            

  The leftmost figure shows the result of fitting a y = θ0 + θ1x1 to a dataset. We see that the data doesn’t really lie on straight line, and so the fit is not very good. This is called underfitting.---there is only one feature, it's too few.

So, we add an extra feature x12, and fit y = θ0 + θ1x1 + θ2x2, here x2 = x12. The middle figure shows a better fitting.

The rightmost figure is the result of fitting 5-th order polynomial.This is called overfitting.---there is too many features.(compare to dataset)

  As discussed previously, and as shown in the example above, the choice of features is important to ensuring good performance of a learning algorithm.

2. LWR

  We assuming there is sufficient training data, makes the choice of features less critical.

  In the original linear regression algorithm, to make a prediction at a query point x (i.e., to evaluate h(x)), we would:

  a. Fit θ to minimize ∑i(y(i) − θT x(i))2.

  b. Output θT x.

  In contrast, the locally weighted linear regression algorithm does the following:

  a. Fit θ to minimize ∑iw(i)(y(i) − θT x(i))2.

  b. Output θT x.

  Here, the w(i)’s are non-negative valued weights. Intuitively, if w(i) is large for a particular value of i, then in picking θ, we’ll try hard to make (y(i) − θT x(i))2 small. If w(i) is small, then the (y(i) − θT x(i))2 error term will be pretty much ignored in the fit.

  A fairly standard choice for the weights is:

                          

  ps. If x is vector-valued, this is generalized to be w(i) = exp(−(x(i)−x)T (x(i)−x)/(2τ2)), or w(i) = exp(−(x(i) − x)T−1(x(i) − x)/2), for an appropriate choice of τ or ∑.

  Note that the weights depend on the particular point x at which we’re trying to evaluate x. Moreover, if |x(i) − x| is small, then w(i) is close to 1; and if |x(i) − x| is large, then w(i) is small. Hence, θ is chosen giving a much higher “weight” to the (errors on) training examples close to the query point x. (Note also that while the formula for the weights takes a form that is cosmetically similar to the density of a Gaussian distribution, the w(i)’s do not directly have anything to do with Gaussians, and in particular the w(i) are not random variables, normally distributed or otherwise.)---if |x(i) − x| is large, then w(i) is small, then the (y(i) − θT x(i))2 error term will be pretty much ignored in the fit.

  The parameter τ controls how quickly the weight of a training example falls off with distance of its x(i) from the query point x; τ is called the bandwidth parameter.

  Locally weighted linear regression is the first example we’re seeing of a non-parametric algorithm. The (unweighted) linear regression algorithm we saw earlier is known as a parametric learning algorithm, because it has a fixed, finite number of parameters (the θi’s), which are fit to the data. Once we’ve fit the θi’s and stored them away, we no longer need to keep the training data around to make future predictions. In contrast, to make predictions using locally weighted linear regression, we need to keep the entire training set around. The term “non-parametric” (roughly) refers to the fact that the amount of stuff we need to keep in order to represent the hypothesis h grows linearly with the size of the training set.(we store the dataset)

    

转载于:https://www.cnblogs.com/ustccjw/archive/2013/04/13/3017815.html

Locally weighted linear regression相关推荐

  1. 机器学习:局部加权线性回归(Locally Weighted Linear Regression)

    线性回归 先复习一下线性回归的损失函数: 我们的目标是使该函数最小,用矩阵表示为: 对参数w求导得: 令上式等于0可估计出回归系数w得最优解: 但线性回归往往容易欠拟合,除了使用更复杂得函数拟合,还可 ...

  2. 局部加权线性回归(Locally weighted linear regression)

    这里有现成的,引用一下.http://www.cnblogs.com/czdbest/p/5767138.html 转载于:https://www.cnblogs.com/imageSet/p/757 ...

  3. 局部加权线性回归(Local Weighted Linear Regression)+局部加权回归+局部线性回归

    局部加权线性回归(Local Weighted Linear Regression)+局部加权回归+局部线性回归 locally weighted scatterplot smoothing,LOWE ...

  4. python123英文字符的鲁棒_Robust Locally Weighted Regression 鲁棒局部加权回归 -R实现

    鲁棒局部加权回归 Ljt 作为一个初学者,水平有限,欢迎交流指正. 算法参考文献: (1) Robust Locally Weighted Regression and Smoothing Scatt ...

  5. 西瓜书+实战+吴恩达机器学习(四)监督学习之线性回归 Linear Regression

    文章目录 0. 前言 1. 线性回归参数求解方法 2. 线性回归正则化 2.1. 岭回归 2.2. LASSO 3. 局部加权线性回归 4. 广义线性模型 如果这篇文章对你有一点小小的帮助,请给个关注 ...

  6. 机器学习实战(七)线性回归(Linear Regression)

    目录 0. 前言 1. 假设函数(Hypothesis) 2. 标准线性回归 2.1. 代价函数(Cost Function) 2.2. 梯度下降(Gradient Descent) 2.3. 特征缩 ...

  7. 多元线性回归算法: 线性回归Linear Regression、岭回归Ridge regression、Lasso回归、主成分回归PCR、偏最小二乘PLS

    0. 问题描述 输入数据:X=(x1,x2,....,xm)\mathbf{X} = (x_1, x_2,...., x_m)X=(x1​,x2​,....,xm​), 相应标签 Y=(y1,y2,. ...

  8. Linear Regression(线性回归)

    线性回归原理: 线性回归应该是机器学习最基本的问题了.它是利用称为线性回归方程的最小平方函数对一个或多个自变量和因变量之间关系进行建模的一种回归分析,这种函数是一个或多个称为回归系数的模型参数的线性组 ...

  9. 机器学习笔记(一)-局部加权回归(Locally weighted regression)LWR

    在网上通过看斯坦福大学的机器学习课程,觉得讲的非常好.同时,为了加强自己的记忆,决定将自己学到的东西和一些理解记录下来,希望有所收获.废话不多说,直接开始笔记: 局部加权回归(locally weig ...

  10. R语言lowess函数数据平滑实战(Locally Weighted Regression, Loess)

    R语言lowess函数数据平滑实战(Locally Weighted Regression, Loess) 目录 R语言lowess函数数据平滑实战(Locally Weighted Regressi ...

最新文章

  1. mysql 存储引擎 面试_搞定PHP面试 - MySQL基础知识点整理 - 存储引擎
  2. [Embeding-3]综述:词嵌入以及与分布式语义模型的关联
  3. 有关打印、收藏等的JS代码(打印等主要使用了一个IE组件来实现)
  4. c语言变长数组_2018级C语言大作业 - 祖玛
  5. 掌握 ASP.NET 之路:自定义实体类简介 来源 :msdn
  6. 【刷题】BZOJ 4176 Lucas的数论
  7. c#获取文件夹路径(转载)
  8. 中石化shell_中石化壳牌(江苏)加油站百日攻坚创效分享
  9. zabbix安装与配置
  10. UVA10192 Vacation【LCS+DP+记忆化递归】
  11. python爬虫代码-Python爬虫教程:200行代码实现一个滑动验证码
  12. linux实验的试验环境,Linux基本环境_实验日志解析.docx
  13. msdtc与oracle,如何解决在Win2003的Oracle链接服务器上MSDTC事务失败问题
  14. 电工技师技能实训考核装置QY-W601C
  15. 彻底删除的文件也能找回
  16. vgc机器人编程1到13题_工业机器人编程与实操期末试题
  17. SAD算法的OpenCV实现
  18. 示波器电流探头可分为无源和有源两类,它们的区别是什么?
  19. P1251 餐巾计划问题 解题报告
  20. 机器学习和深度学习训练常见问题

热门文章

  1. 【HDU4691】Front compression(求给定两个子串/后缀的最长公共前缀---后缀数组+st表+一点思维)
  2. mysql的空白值mac,Mac下mysql安装启动遇到的坑,及数据库常用指令
  3. dat关闭某进程_电脑程序卡住怎么办?结束进程只需要这三个键
  4. C/C++[codeup 1934,1932,1935]查找
  5. 自动驾驶7-3 自动驾驶汽车简介全面总结
  6. python笔记:统计字符串里各种字符的个数 + pandas删除某列
  7. 432.全O(1)的数据结构
  8. 327.区间和的个数
  9. 126.单词接龙II
  10. 第二章随机过程的基本知识part I