machine learning (7)---normal equation相对于gradient descent而言求解linear regression问题的另一种方式

2023-05-18,,

Normal equation: 一种用来linear regression问题的求解Θ的方法,另一种可以是gradient descent
仅适用于linear regression问题的求解,对其它的问题如classification problem或者feature number太大的情况下(计算量会很大)则不能使用normal equation,而应使用gradient descent来求解。

(由求导的过程推导而得)

这种方法是对cost function(J(θ),θ为n+1维向量(θ0,θ1.....θn))对各个θ求偏导,令偏导为0,这样求出对应的θ(高等数学里面求极值的方法),这         样求出的θ,使cost function的值最小

例如:  

如何求解θ    

这种求解θ的方法可不进行feature scaling,而对于用gradient descent求解θ而言,feature scaling很重要,它可使收敛速度加快。
normal equation与gradient descent两种方法优点与缺点比较

当n>10000时,即feature number>10000时,用normal equation消耗太大,这时倾向于使用gradient desccent或者其它算法
当n<1000时,使用normal equation更方便

machine learning (7)---normal equation相对于gradient descent而言求解linear regression问题的另一种方式的相关教程结束。

《machine learning (7)---normal equation相对于gradient descent而言求解linear regression问题的另一种方式.doc》

下载本文的Word格式文档,以方便收藏与打印。