线性回归 及 正则化 公式推导
- 基础公式:
∂BA/∂A = BT
∂ATB/∂A = B
∂ATBA/∂A = 2BA
- 模型函数:
hθ(x) = xθ
- 无正则化损失函数:
J(θ) = 1/2(Xθ-Y)2
令偏导∂J(θ)/∂θ等于0,得:
θ = (XTX)-1XTY
- 正则化损失函数:
J(θ) = 1/2(Xθ-Y)2+1/2λθ2
令偏导∂J(θ)/∂θ等于0,得:
θ = (XTX+λI)-1XTY
参考文献:
https://blog.csdn.net/fleurdalis/article/details/54931721
https://blog.csdn.net/u013363719/article/details/22752893