1. notation:

n = number of features

x(i) = input (features) of ith training example

 = value of feature j in ith training example

2. Hypothesis:

3. Cost function:

4. Gradient descent:

Repeat {

  

}

substituting cost function, then

Repeat {

  

  (simultaneously update θj for j = 0, ... n)

}

5. Mean normalization

replace xwith xi - µi to make features have approximately zero mean(Do not apply to x= 1).

ex: x_1 = (x_1 - u_1) / s_1

6. Declare convergence if J(θ) decreases by less than 10^-3 in one iteration.

if α is too small: slow convergence.

if α is too large: J(θ) may not decrease on every iteration; may not converge

7. normal equation

Octave: pinv(X'*X)*X'*y

8. comparation between gradient descent and normal equation

Gradient Descent: need to choose α

needs many iterations

          works well even when n is large

Normal Equation: No need to choose α

           Don't need to iterate

         need to compute pinv(X'X)

         slow if n is very large

9. Some problems

  what if X'T is non-invertible?

Redundant features(linearly dependent)

E.g.  x1 = size in feet^2

x2 = size in m^2

Too many features(e.g. m <= n)

Delete some features, or use regularization

Machine Learning No.2: Linear Regression with Multiple Variables的更多相关文章

  1. [Machine Learning] 多变量线性回归(Linear Regression with Multiple Variable)-特征缩放-正规方程

    我们从上一篇博客中知道了关于单变量线性回归的相关问题,例如:什么是回归,什么是代价函数,什么是梯度下降法. 本节我们讲一下多变量线性回归.依然拿房价来举例,现在我们对房价模型增加更多的特征,例如房间数 ...

  2. Machine Learning – 第2周(Linear Regression with Multiple Variables、Octave/Matlab Tutorial)

    Machine Learning – Coursera Octave for Microsoft Windows GNU Octave官网 GNU Octave帮助文档 (有900页的pdf版本) O ...

  3. CheeseZH: Stanford University: Machine Learning Ex5:Regularized Linear Regression and Bias v.s. Variance

    源码:https://github.com/cheesezhe/Coursera-Machine-Learning-Exercise/tree/master/ex5 Introduction: In ...

  4. Andrew Ng Machine Learning 专题【Linear Regression】

    此文是斯坦福大学,机器学习界 superstar - Andrew Ng 所开设的 Coursera 课程:Machine Learning 的课程笔记. 力求简洁,仅代表本人观点,不足之处希望大家探 ...

  5. 机器学习 (二) 多变量线性回归 Linear Regression with Multiple Variables

    文章内容均来自斯坦福大学的Andrew Ng教授讲解的Machine Learning课程,本文是针对该课程的个人学习笔记,如有疏漏,请以原课程所讲述内容为准.感谢博主Rachel Zhang 的个人 ...

  6. Linear regression with multiple variables(多特征的线型回归)算法实例_梯度下降解法(Gradient DesentMulti)以及正规方程解法(Normal Equation)

    ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, , ...

  7. 机器学习(三)--------多变量线性回归(Linear Regression with Multiple Variables)

    机器学习(三)--------多变量线性回归(Linear Regression with Multiple Variables) 同样是预测房价问题  如果有多个特征值 那么这种情况下  假设h表示 ...

  8. 【原】Coursera—Andrew Ng机器学习—Week 2 习题—Linear Regression with Multiple Variables 多变量线性回归

    Gradient Descent for Multiple Variables [1]多变量线性模型  代价函数 Answer:AB [2]Feature Scaling 特征缩放 Answer:D ...

  9. Coursera machine learning 第二周 quiz 答案 Linear Regression with Multiple Variables

    https://www.coursera.org/learn/machine-learning/exam/7pytE/linear-regression-with-multiple-variables ...

随机推荐

  1. 前台页面获取servlet传过来的数据

    servlet中的代码: public void doGet(HttpServletRequest request, HttpServletResponse response) throws Serv ...

  2. hdu1017(C++)

    这个题目很水,但是卡了格式和m=0的情况,wa了好多次,题目只给出N=1,感觉没说清楚 #include<iostream>using namespace std;int main(){ ...

  3. 传输层:UDP 协议

    一.传输层协议 从之前介绍的网络层协议来看,通信的两端是两台主机,IP 数据报首部就标明了这两台主机的 IP 地址.但是从传输层来看,是发送方主机中的一个进程与接收方主机中的一个进程在交换数据,因此, ...

  4. 规划设计系列3 | SketchUp+实景三维,方案现状一起看

    将SketchUp中建立的模型与实景三维模型进行集成,既可以充分发挥实景三维在地理空间记录方面的优势,又可以去除SketchUp在周边环境设计上的不足. 同时借助Wish3D Earth丰富的场景浏览 ...

  5. js 输入框增加删除操作

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  6. Java数据结构和算法(四)——栈

    stack,中文翻译为堆栈,事实上指的是栈,heap,堆. 这里讲的是数据结构的栈,不是内存分配里面的堆和栈. 栈是先进后出的数据的结构,好比你碟子一个一个堆起来.最后放的那个是堆在最上面的. 队列就 ...

  7. 怎样通过Html网页调用本地安卓app

    怎样使用html网页和本地app进行传递数据呢?经过研究.发现还是有方法的,总结了一下,大致有一下几种方式 一.通过html页面打开Android本地的app 1.首先在编写一个简单的html页面 & ...

  8. 【MVC】初识MVC

    一.MVC是什么?     MVC(Model-View-Controller),是视图-模型-控制器的框架,刚開始看见这些概念的时候,我以为是U-D-B呢?视图界面,模型是相应这数据库呢,而控制器是 ...

  9. 在VS2010中如何添加MSCOMM控件,实现串口通讯

      参考文章:http://wenku.baidu.com/link?url=MLGQojaxyHnEgngEAXG8oPnISuM9SVaDzNTvg0oTSrrJkMXIR_6MR3cO_Vnh- ...

  10. HDU 2473 Junk-Mail Filter 删点并查集

    题目来源:pid=2473">HDU 2473 Junk-Mail Filter 题意:2中操作 M x, y 将x,y 合并到一个集合 S x 将x从所在的集合去掉 自己成为一个集合 ...