Machine Learning No.2: Linear Regression with Multiple Variables
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 xi with xi - µi to make features have approximately zero mean(Do not apply to x0 = 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的更多相关文章
- [Machine Learning] 多变量线性回归(Linear Regression with Multiple Variable)-特征缩放-正规方程
我们从上一篇博客中知道了关于单变量线性回归的相关问题,例如:什么是回归,什么是代价函数,什么是梯度下降法. 本节我们讲一下多变量线性回归.依然拿房价来举例,现在我们对房价模型增加更多的特征,例如房间数 ...
- 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 ...
- 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 ...
- Andrew Ng Machine Learning 专题【Linear Regression】
此文是斯坦福大学,机器学习界 superstar - Andrew Ng 所开设的 Coursera 课程:Machine Learning 的课程笔记. 力求简洁,仅代表本人观点,不足之处希望大家探 ...
- 机器学习 (二) 多变量线性回归 Linear Regression with Multiple Variables
文章内容均来自斯坦福大学的Andrew Ng教授讲解的Machine Learning课程,本文是针对该课程的个人学习笔记,如有疏漏,请以原课程所讲述内容为准.感谢博主Rachel Zhang 的个人 ...
- Linear regression with multiple variables(多特征的线型回归)算法实例_梯度下降解法(Gradient DesentMulti)以及正规方程解法(Normal Equation)
,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, , ...
- 机器学习(三)--------多变量线性回归(Linear Regression with Multiple Variables)
机器学习(三)--------多变量线性回归(Linear Regression with Multiple Variables) 同样是预测房价问题 如果有多个特征值 那么这种情况下 假设h表示 ...
- 【原】Coursera—Andrew Ng机器学习—Week 2 习题—Linear Regression with Multiple Variables 多变量线性回归
Gradient Descent for Multiple Variables [1]多变量线性模型 代价函数 Answer:AB [2]Feature Scaling 特征缩放 Answer:D ...
- Coursera machine learning 第二周 quiz 答案 Linear Regression with Multiple Variables
https://www.coursera.org/learn/machine-learning/exam/7pytE/linear-regression-with-multiple-variables ...
随机推荐
- 某音乐类App评论相关API的分析及SQL注入尝试
关键字:APIfen.工具使用.sql注入 涉及工具/包:Fiddler.Burpsuite.Js2Py.Closure Compiler.selenium.phantomjs.sqlmap 摘要: ...
- .NET Core R2安装及示例教程
.NET Core R2安装及示例教程 Install for Windows - Visual Studio 2015 1 Download Visual Studio 2015 Make sure ...
- haproxy mod tcp配置 按hostname 来定向服务器
需求 tcp 链接服务器, 服务器端根据不同的域名 定向到不同的内网服务器上: 参考资料 https://serverfault.com/questions/643131/proxying-tcp-b ...
- struts2获取ServletContext对象
CreateTime--2017年9月7日09:24:40 Author:Marydon struts2获取ServletContext对象 需要导入: import javax.servlet. ...
- spring 官方文档
英文 http://docs.spring.io/spring/docs/current/spring-framework-reference/htmlsingle/ 翻译(1-6章) http:// ...
- Android Activity间动画跳转
本博文主要介绍activity间动画跳转的问题,在这里讲一下怎么设置全部activity的动画跳转和退出跳转.事实上有些软件已经这样做了.比方我们都比較熟悉的大众点评网. 以下我们通过一个实例来看一下 ...
- AspectJ学习笔记2-Eclipse中AspectJ插件AJDT的正确安装方法
接着之前一篇日志. 这个事情也挺无语的.简单记录一下. 在这里:http://www.eclipse.org/ajdt/ 能够下载最新的Eclipse Plugin.下载解压之后,一般来说.直接把解压 ...
- GitHub使用问题(遇到一个记一个)
1.如何创建文件夹: 如图,Create new files,点击后,若需要创建文件,输入文件名即可,但如果创建的是文件夹,需要在文件夹名后 加一个 '/'斜杠,然后就变成文件夹了
- Office 365 开发入门
<Office 365 开发入门指南>公开邀请试读,欢迎反馈 终于等来了这一天,可以为我的这本新书画上一个句号.我记得是在今年的2月份从西雅图回来之后,就萌发了要为中国的Office 36 ...
- Python 时间格式化(转)
From:http://www.cnblogs.com/65702708/archive/2011/04/17/2018936.html http://www.wklken.me/posts/2015 ...