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. source(.)/export/shell

    用户登录到Linux系统后,系统将启动一个用户shell.在这个shell中,可以使用shell命令或声明变量,也可以创建并运行shell脚本程序.运行shell脚本程序时,系统将创建一个子shell ...

  2. 【LeetCode-面试算法经典-Java实现】【139-Word Break(单词拆分)】

    [139-Word Break(单词拆分)] [LeetCode-面试算法经典-Java实现][全部题目文件夹索引] 原题 Given a string s and a dictionary of w ...

  3. mock平台架构及实现

    转载: http://blog.csdn.net/xkhgnc_6666/article/details/51757209 在测试过程中有些情况通过手工测试是无法测试出来的或是非常难复现,比如网络异常 ...

  4. JAVA_StandardServer await create[8005]怎么办

    Tomcat 6.0 错误信息: 严重: StandardServer.await:create[8005]: java.net.BindException: Address already in u ...

  5. Linux 的计划任务(运维基础|可用于提权)

    Linux操作系统定时任务系统 Cron 入门 先写笔记: crontab -u //设定某个用户的cron服务,一般root用户在执行这个命令的时候需要此参数 crontab -l //列出某个用户 ...

  6. odoo图片显示

        如果在odoo客户端展示图片, 可以用 url( data:image/png;base64, 图片base64编码过的内容) 展示, 例如     url(data:image/png;ba ...

  7. OCP学习基本知识点总结

     下面是我总结的OCP教程的知识点.以备參考之用. 1, What's Oracle Server? ·         It's a database management system that ...

  8. shell脚本实现定时重启任务并输出日志信息

    #!/bin/bash #当前日期 time=`date` pidno=`ps aux|grep adserver-beta|grep -v "grep"|awk '{print ...

  9. 自定义带下划线文本的UIButton

    转载自 http://mobile.51cto.com/hot-404798.htm,略有改动 UnderLineButton.h代码 @interface UnderLineButton : UIB ...

  10. UIView属性的动画

    //标记着动画块的开始,第一个参数表示动画的名字,起到标识作用 [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDurat ...