没有合适的资源?快使用搜索试试~ 我知道了~
首页梁劲机器学习笔记-全面简单Getting Started With MachineLearning (all in one)_部分2
梁劲机器学习笔记-全面简单Getting Started With MachineLearning (all in one)_部分2。详细、明了地介绍了机器学习中的相关概念、数学知识和各种经典算法。以浅显易懂的方式去讲解它,降低大家的学习门槛。因为文件较大因此分为两部分。第一部分请到我的资源页寻找下载
资源详情
资源评论
资源推荐
Created by: Jim Liang
:: Linear Regression
Multiple Linear Regression
For convenience of notation, we can define !
"
=1. Thus, we simplify the equation of multiple linear regression as follow.
Equation :
In the multiple regression setting, because of the potentially large number of predictors,
it is more efficient to use matrices to define the regression model and the subsequent
analyses
1
1 Source: https://onlinecourses.science.psu.edu/stat501/node/382
#$ % &
'
( &
)
*
)
( &
+
*
+
( &
,
*
,
( - (&
.
*
/
#$ % &
'
*
'
( &
)
*
)
( &
+
*
+
( &
,
*
,
( - (&
.
*
/
For convenience of notation, define *
'
=1, then
0 =
*
'
*
)
*
+
1
*
/
& =
&
'
&
)
&
+
1
&
/
#$ % &
'
*
'
( &
)
*
)
( &
+
*
+
( &
,
*
,
( - (&
.
*
/
#$ % &
2
0
&
'
&
)
&
+
3 &
/
*
'
*
)
*
+
1
*
/
&
2
0
Linear Regression With Multiple Variables (8mins)
https://youtu.be/Q4GNLhRtZNc (by Andrew Ng)
Created by: Jim Liang
:: Linear Regression
Multiple Linear Regression
For multiple linear regression model,
We define the cost function:
!"#
$
%#
&
%'%#
(
) =
&
*+
,
-./
0
1
2
3 41
2
*
56787 91 : 6 ; : #
$
<#
&
;
&
<#
*
;
*
<#
=
;
=
< '<#
>
;
(
:
?
-.@
A
#
B
;
2
C"D) =
E
FG
,
H.E
G
I
H
3"D
$
<
D
&
J
E
<
D
*
J
F
<
D
=
J
K
<
'
<
D
>
J
L
)
F
we want the hyper-plane that “best fits’ the training samples. In other
words, we seek the linear function of X that minimizes the sum of
squared residuals (error) from Y
1
Example: predict I with 2 predictors J
E
, J
F
1 & Figure Source: The Elements of Statistical Learning by Trevor Hastie,etc
How to find the appropriate parameter D
M
%D
E
%'%D
L
in order
to minimize the cost function/loss function !"#)?
• Normal Equation
• Gradient Descent
+ is number of training instances
Created by: Jim Liang
:: Linear Regression
Multiple Linear Regression
Example:, we can use Normal Equation to find the value of the coefficients/parameters ! that minimizes the cost function
Size (feet
2
) Number of
bedrooms
Number of
floors
Age of home
(years)
Price ($1000)
1 2104 5 1 45 460
1 1416 3 2 40 232
1 1534 3 2 30 315
1 852 2 1 36 178
"
#
"
$
"
%
"
&
'"
(
example
) =
*+,
-.-
./0
/12
3 =
/ -/,* 0 / *0
/ /*/+ . - *,
/ /0.* . - .,
/ 20- - / .+
• The inputs can be represented as an X matrix in which each row is sample and
each column is a dimension.
• The outputs can be represented as y matrix in which each row is a sample.
! 4 5
6
5
78
9 5
6
9 )
:) 4 !
;
5
<
' 4 =
,
>
=
/
"
#
>
=
-
"
$
>
=
.
"
%
>
=
*
"
&
// value of ! that minimizes the cost function can be solved by this equation
Created by: Jim Liang
repeat until convergence {
// Simultaneously update !
j,
for every j=0,1, …,n
}
!
"#
$#%#!
"###
&
'######
(
(
!
"
)*
!
+
Gradient
,
!
-*!+ is the partial derivatives of
the cost function with respect to the
parameters !
.
/!
0
/1/!
2
:: Linear Regression
Multiple Linear regression
Use Gradient Descent to find the value of parameters ! that minimize the cost function - !
Gradient Descent for multiple Linear Regression :
Hypothesis: 3
!
*4+ = !
5
6 % !
.
4
.
7!
0
4
0
7!
8
4
8
7!
9
4
9
7 17!
:
4
2
Parameters: !*!
.
/!
0
/1/!
2
+
Cost Function:
Gradient ;
!
)*
!
+:
Gradient Descent:
Repeat until convergence {
}
-*!
.
/!
0
/1/!
2
+ =
0
8<
=
>?@
A
3
!
*4
*
B
+
+C D
*
B
+
8
E
E!
"
- ! =
0
<
=
>?@
A
3
!
*4
*
B
+
+C D
*
B
+
4
F
*
B
+
4
F
*
B
+
is the j
th
features of i
th
observation
!
"#
$#%#!
"###
&
'##
@
A
G
>?@
A
3
!
*4
*
B
+
+C D
*
B
+
4
F
*
B
+
*Simultaneously update !
j,
for every j=0,1, …,n )
Source of content: Andrew Ng, https://youtu.be/pkJjoro-b5c
Detail
Created by: Jim Liang
repeat until convergence {
}
:: Linear Regression
Multiple Linear regression
Use Gradient Descent to find the value of parameters ! that minimize the cost function J (!)
Gradient Descent for multiple Linear Regression :
!
"#
$#%#!
"###
&
'##
(
)
*
+,(
)
-
!
./
.
0
1
1 2 3
.
0
1
/
4
.
0
1
.Simultaneously update !
j,
for every j=0,1, …,n )
Size (feet
2
) Number of
bedrooms
Number of
floors
Age of home
(years)
Price ($1000)
2104 5 1 45 460
1416 3 2 40 232
1534 3 2 30 315
852 2 1 36 178
… … … … …
5
6
5
7
5
8
5
9
:
example
;
: % -
!
./1 % !
<
/
<
= !
>
/
>
= !
?
/
?
= !
@
/
@
=!
A
/
A
!
<#
$#%#!
<##
&
'##
(
)
*
+,(
)
-
!
./
.
0
1
1 2 3
.
0
1
/
<
.
0
1
!
>#
$#%#!
>##
&
'##
(
)
*
+,(
)
-
!
./
.
0
1
1 2 3
.
0
1
/
>
.
0
1
!
?#
$#%#!
?##
&
'##
(
)
*
+,(
)
-
!
./
.
0
1
1 2 3
.
0
1
/
?
.
0
1
!
@#
$#%#!
@##
&
'##
(
)
*
+,(
)
-
!
./
.
0
1
1 2 3
.
0
1
/
@
.
0
1
!
A#
$#%#!
A##
&
'##
(
)
*
+,(
)
-
!
./
.
0
1
1 2 3
.
0
1
/
A
.
0
1
Video: Gradient Descent For Multiple Variables (5mins)
https://youtu.be/pkJjoro-b5c
剩余294页未读,继续阅读
流水不毒
- 粉丝: 50
- 资源: 117
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- zigbee-cluster-library-specification
- JSBSim Reference Manual
- c++校园超市商品信息管理系统课程设计说明书(含源代码) (2).pdf
- 建筑供配电系统相关课件.pptx
- 企业管理规章制度及管理模式.doc
- vb打开摄像头.doc
- 云计算-可信计算中认证协议改进方案.pdf
- [详细完整版]单片机编程4.ppt
- c语言常用算法.pdf
- c++经典程序代码大全.pdf
- 单片机数字时钟资料.doc
- 11项目管理前沿1.0.pptx
- 基于ssm的“魅力”繁峙宣传网站的设计与实现论文.doc
- 智慧交通综合解决方案.pptx
- 建筑防潮设计-PowerPointPresentati.pptx
- SPC统计过程控制程序.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0