斯坦福大学机器学习课程讲义第四讲―― 多变量的线性回归模型表达_第1页
斯坦福大学机器学习课程讲义第四讲―― 多变量的线性回归模型表达_第2页
斯坦福大学机器学习课程讲义第四讲―― 多变量的线性回归模型表达_第3页
斯坦福大学机器学习课程讲义第四讲―― 多变量的线性回归模型表达_第4页
斯坦福大学机器学习课程讲义第四讲―― 多变量的线性回归模型表达_第5页
已阅读5页,还剩35页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、Linear Regression with multiple variables,Multiple features,Machine Learning,Multiple features (variables).,Multiple features (variables).,Multiple features (variables).,Notation: = number of features = input (features) of training example. = value of feature in training example.,Hypothesis:,Previou

2、sly:,For convenience of notation, define .,Multivariate linear regression.,Linear Regression with multiple variables,Gradient descent for multiple variables,Machine Learning,Hypothesis:,Cost function:,Parameters:,(simultaneously update ),Gradient Descent,Repeat,Previously (n=1):,New algorithm :,Repe

3、at,(simultaneously update for ),Linear Regression with multiple variables,Gradient descent in practice I: Feature Scaling,Machine Learning,E.g. = size (0-2000 feet2) = number of bedrooms (1-5),Feature Scaling Idea: Make sure features are on a similar scale.,size (feet2),number of bedrooms,Feature Sc

4、aling,Get every feature into approximately a range.,Replace with to make features have approximately zero mean (Do not apply to ).,Mean normalization,E.g.,Linear Regression with multiple variables,Gradient descent in practice II: Learning rate,Machine Learning,Gradient descent,“Debugging”: How to ma

5、ke sure gradient descent is working correctly.,How to choose learning rate .,Example automatic convergence test:,Declare convergence if decreases by less than in one iteration.,No. of iterations,Making sure gradient descent is working correctly.,Making sure gradient descent is working correctly.,Gra

6、dient descent not working. Use smaller .,No. of iterations,No. of iterations,No. of iterations,For sufficiently small , should decrease on every iteration. But if is too small, gradient descent can be slow to converge.,Summary:,If is too small: slow convergence. If is too large: may not decrease on

7、every iteration; may not converge.,To choose , try,Linear Regression with multiple variables,Features and polynomial regression,Machine Learning,Housing prices prediction,Polynomial regression,Price (y),Size (x),Choice of features,Price (y),Size (x),Linear Regression with multiple variables,Normal e

8、quation,Machine Learning,Gradient Descent,Normal equation: Method to solve for analytically.,Intuition: If 1D,Solve for,(for every ),Examples:,Examples:,examples ; features.,E.g. If,is inverse of matrix .,Octave:,pinv(X*X)*X*y,training examples, features.,Gradient Descent,Normal Equation,No need to

9、choose . Dont need to iterate.,Need to choose . Needs many iterations.,Works well even when is large.,Need to compute,Slow if is very large.,Linear Regression with multiple variables,Normal equation and non-invertibility (optional),Machine Learning,Normal equation,What if is non-invertible? (singular/ degenerate),Octave:,pinv(X*X)*X*y,What if is non-invertible

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论