假设是theta0 + theta1*x
。在区分theta0
和theta1
时,分别得到1
和x
。因此,您会获得x
的更新theta1
,而不是theta0
的更新。有关更多详细信息,请参阅本文档cs229-notes1。
简而言之,因为偏导数和链式规则的应用。
对于Theta 0,当采用损耗函数(MSE)相对于Theta 0的导数(或Beta 0 / Intercept)时,导数的形式为等式1最右边。
imagine...
Y = Mx + C
M = Theta 1
C = Theta 0
Loss Function = (Y - (Mx + C))^2
The derivative is in the form of f(x) * f'(x) if that makes sense. f'(x) in Theta 0 is 1 (watch the video to understand the derivate). So
2(Y - (Mx + C)) * derivative of with respect to C of (Y - (Mx + C))
= 2(Y - (Mx + C)) [disregard the 2 in front]
For Theta 1, when you take derivative of the loss function (MSE) with respect to Theta 1 (Or Beta 1 / slope ), your derivative is in the form shown the rightmost of eq1. In this case f'(x) is x, because.....
2(Y - (Mx + C)) * derivative of with respect to M of (Y - (Mx + C))
= 2(Y - (Mx + C)) * (1*x) [because the only term that is left is dx(Mx)]
以下是可以帮助您的视频https://www.youtube.com/watch?v=sDv4f4s2SB8
线性回归的损失函数由]给出>
J = {(HthetaX(i))-y}^2
并且我们有渐变=损耗的导数。因此,
DJ/Dtheta = 2*(HthetaX(i))-y)*X(i)
。现在theta0 X(i) ==1
,因此
DJ/Dtheta for Theta0 = 2*(Htheta*X(i))-y)