我无法正确获得此梯度下降解决方案
I am unable to get this gradient descent solution correct
考虑一个 N=3 和 D=1 的线性回归模型,输入输出对如下:
yl=22, x 1=1, y2=3, x2=1, y3=3, x3=2
均方误差 (MSE) 相对于 B1 的梯度是多少(当 Bo=0 且 B1=1 时?请将答案正确到小数点后两位。
MSE Loss = sum((h - y) ** 2) / 2m
Gradient wrt b1 will be sum[(h - y) . x)] / m:
hypothesis: h = b0 + b1.x
for b0 = 0, b1 = 1:
h = x
input(x) : [ 1, 1, 2]
prediction(h) : [ 1, 1, 2]
Ground truth(y) : [ 22, 3, 3]
h - y : [-21, -2, -1]
(h - y). x : [-21, -2, -2]
gradient(b1) : (-21 - 2 - 2) / 3 = -25 / 3 = -8.3333
考虑一个 N=3 和 D=1 的线性回归模型,输入输出对如下:
yl=22, x 1=1, y2=3, x2=1, y3=3, x3=2
均方误差 (MSE) 相对于 B1 的梯度是多少(当 Bo=0 且 B1=1 时?请将答案正确到小数点后两位。
MSE Loss = sum((h - y) ** 2) / 2m
Gradient wrt b1 will be sum[(h - y) . x)] / m:
hypothesis: h = b0 + b1.x
for b0 = 0, b1 = 1:
h = x
input(x) : [ 1, 1, 2]
prediction(h) : [ 1, 1, 2]
Ground truth(y) : [ 22, 3, 3]
h - y : [-21, -2, -1]
(h - y). x : [-21, -2, -2]
gradient(b1) : (-21 - 2 - 2) / 3 = -25 / 3 = -8.3333