1 前言
今天在做 Machine Learning的作业~
2 一元线性回归
2.1 loss函数
带有规范化的loss函数:
J
(
θ
)
=
1
2
m
∑
i
=
1
m
(
h
θ
(
x
(
i
)
)
−
y
(
i
)
)
2
+
λ
2
m
∑
j
=
1
n
(
θ
j
)
2
J(\theta)= \frac{1}{2m} \sum_{i=1}^{m} \left (h_\theta\left ( x^{\left ( i\right )}\right )-y^{\left ( i\right )} \right )^2 + \frac{\lambda}{2m}\sum_{j=1}^{n}\left (\theta_j \right )^2
J(θ)=2m1i=1∑m(hθ(x(i))−y(i))2+2mλj=1∑n(θj)2