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 ...
随机推荐
- python的安全插件
1.PyFuzz (0.1.3) - Simple fuzz testing for u ...
- ylb:SQL 表的高级查询-多表连接和子查询
ylbtech-SQL Server: SQL Server-表的高级查询-多表连接和子查询 SQL Server 表的高级查询-多表连接和子查询. 1,ylb:表的高级查询-多表连接和子查询 返回顶 ...
- 转:maven2创建一个eclipse工程,设置M2_REPO
from: http://tonychanhoho.iteye.com/blog/1584324 M2_REPO是一个用来定义 maven 2仓库在硬盘中的存储位置,windows默认是C:\User ...
- es6 - 模板
'use strict'; // es5 let name = 'mrs'; let qb = 20; function logs() { return 'goods!'; } let html = ...
- Android设计中的尺寸问题
Android把屏幕大小分成四种:small, normal, large, xlarge; 屏幕密度分成:low(ldpi), medium(mdpi), high(hdpi), extra hig ...
- Vue 内容分发slot
1.概述 内容分发:混合父组件的内容与子组件自己的模板. 2.单个插槽 当子组件模板只有一个没有属性的插槽时,父组件传入的整个内容片段将插入到插槽所在的 DOM 位置,并替换掉插槽标签本身. 最初在 ...
- 【Python】使用制表符换行符来添加空白
在编程中,在打印时,有时候需要显示出来的数据看着舒服一点,那么使用制表符(\t).换行符(\n)即可轻松实现 >>> print('zhangsan')zhangsan 加入制表符后 ...
- jq:正则表达式
var checkNum = /^[A-Za-z0-9]+$/; 注意没有引号 checkNum.test(这里添加待匹配的字符串); var textNull=/^\s*$/; if(textN ...
- JS创建表单提交备份
//保存 function saveFT() { var data = { createDate: GetDateStr(0), name: $("#txtName").val() ...
- cmake学习之- cmake_parse_arguments
最后更新: 2019-06-08 一.指令介绍 cmake_parse_arguments 为解析函数(function)或 宏(macros) 参数的命令: cmake_parse_argument ...