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 ...
随机推荐
- supervisor开机自启动方法
配置service类型服务 #!/bin/bash # # supervisord This scripts turns supervisord on # # Author: Mike McGrath ...
- FTP经典常用命令
FTP命令是Internet用户使用最频繁的命令之一,不论是在DOS还是UNIX操作系统下使用FTP,都会遇到大量的FTP内部命令. 熟悉并灵活应用FTP的内部命令,可以大大方便使用者,并收到事半功倍 ...
- extern static const abstract virtual
extern static const abstract virtual const const.常量,初始化过后值不能再变化的变量.
- 手动编译高速扫描器MasScan
常见的端口扫描器有NMAP,ZMAP,superScan等,我们使用后各有千秋,ZMAP号称44分钟扫全球ip,那么有没有比ZMAP更快的端口扫描器呢,今天我们来研究下masscan,这款扫描器号称3 ...
- vue2.X props 数据传递 实现组件内数据与组件外的数据的双向绑定
vue2.0 禁止 子组件修改父组件数据 在Vue2中组件的props的数据流动改为了只能单向流动,即只能由组件外(调用组件方)通过组件的DOM属性attribute传递props给组件内,组件内只能 ...
- C/C++中作用域详解(转)
作用域规则告诉我们一个变量的有效范围,它在哪儿创建,在哪儿销毁(也就是说超出了作用域).变量的有效作用域从它的定义点开始,到和定义变量之前最邻近的开括号配对的第一个闭括号.也就是说,作用域由变量所在的 ...
- 面向对象在JavaScript中的接口实现
接口是面向对象编程的基础.它是一组包括了函数型方法的数据结构,与类一样.都是编程语言中比較抽象的概念.比方生活中的接口.机顶盒.人们利用它来实现收看不同频道和信号的节目,它宛如对不同类型的信息进行集合 ...
- 在Mac上ppt导出pdf
Step1:打开要操作的ppt,然后Command+P(print),出来打印的界面 Step2:在左下端选择Save as PDF就可以
- java集合归纳
学习自: http://android.blog.51cto.com/268543/400557/ MAP Collection 堆栈队列操作尽可能考虑 linkedlist 多线程同步操作尽可能考虑 ...
- Android有关surfaceView又一次创建的问题。
近期在做一个Android视频播放器的项目.遇到一个问题,就是锁屏之后.surfaceview就会被销毁掉,然后就会出现各种错误.到csdn论坛去发帖提问,各种所谓的大神都说,解锁屏在又一次创建一个, ...