考虑具有输入输出对的N = 3和D = 1的线性回归模型,如下所示:
yl = 22,x 1 = 1,y2 = 3,x2 = 1,y3 = 3,x3 = 2
当Bo = 0和B1 = 1时,均方误差(MSE)相对于B1的斜率是多少?请正确回答两位小数。
答案 0 :(得分:0)
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