Machine Learning Andrew Ng -4. Linear Regression with multiple variables

4.1 Multiple features (多特征量)

Multiple features (variables)

Size ( x 1 ) (x_1) (x1)Number of bedrooms ( x 2 ) (x_2) (x2)Number of floors ( x 3 ) (x_3) (x3)Age of homes ( x 4 ) (x_4) (x4)Price ( y ) (y) (y)
21045145460
14163240232
15343230315
8522136178

Notation :

  • n n n = number of features
  • x ( i ) x^{(i)} x(i)= input (features) of i t h i^{th} ith training example
  • x j ( i ) x_j^{(i)} xj(i) = value of feature j j j in i t h i^{th} ith training example

Hypothesis :

previously : h θ ( x ) = θ 0 + θ 1 x h_{\theta}(x) = \theta_0 + \theta_1x hθ(x)=θ0+θ1x

now : h θ ( x ) = θ 0 + θ 1 x 1 + θ 2 x 2 + θ 3 x 3 + θ 4 x 4 h_{\theta}(x) = \theta_0+\theta_1x_1+\theta_2x_2+\theta_3x_3+\theta_4x_4 hθ(x)=θ0+θ1x1+θ2x2+θ3x3+θ4x4

在这里插入图片描述

Multivariate linear regression 多元线性回归

4.2 Gradient descent for multiple variables

How to fit the parameters of that hypothesis ? How to use gradient descent for linear regression with multiple features ?

在这里插入图片描述

在这里插入图片描述

4.3 Gradient descent in practice I : Feature Scaling(特征缩放)

在这里插入图片描述

Feature Scaling : Get every feature into approximately a − 1 ⩽ x i ⩽ 1 -1 \leqslant x_i\leqslant 1 1xi1 range.

Mean normalization (均值归一化) :

在这里插入图片描述

4.4 Gradient descent in practice II : Learning rate

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

4.5 Features and polynomial regression (特征和多项式回归)

Choosing feature

在这里插入图片描述

The price could be a quadratic function (二次函数), or a cubic function (三次函数)

在这里插入图片描述

now feature scaling is more important

在这里插入图片描述
How to choose features ? Discuss later…

4.6 Normal equation (正规方程)

Normal equation : Method to solve for θ \theta θ analytically.

One step, you get to the optimal value right there.

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

这里X矩阵上下标大概率写错了

在这里插入图片描述

Feature Scaling is no need

When choose gradient descent when choose normal equation ?

在这里插入图片描述

4.7 Normal equation and non-invertibility

在这里插入图片描述
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值