房价训练集(俄勒冈州,波特兰市)

Size in \(feet^2\) (x) Price ($) in 1000's (y)
2104 460
1416 232
1534 315
852 178

假设函数: \(h_\theta(x) = \theta_0 + \theta_1x\)

参数:\(\theta_{i's}\)

如何选择 \(\theta_{i's}\)?
想法:对于我们的训练样例 \((x, y)\),选择\(\theta_0, \theta_1\),使\(h_\theta(x)\)靠近\(y\)

Cost Function 损失函数

\[J(\theta_0,\theta_1) = 1/2m\sum_{i=1}^m(h_\theta(x^{(i)}) - y^{(i)})^2 \]

m:训练样本数

总结

假设函数

\[h_\theta(x) = \theta_0 + \theta_1x \]

参数: \(\theta_0, \theta_1\)
损失函数: 均方误差函数(Squared error function)**

\[J(\theta_0,\theta_1) = 1/2m\sum_{i=1}^m(h_\theta(x^{(i)}) - y^{(i)})^2 \]

目标: \(\begin{matrix} minimize J(\theta_0,\theta_1)\\ \theta_0,\theta_1 \end{matrix}\)

简化:

假设函数:

\[h_\theta(x) = \theta_1x \]

参数: \(\theta_1\)
损失函数:

\[J(\theta_1) = 1/2m\sum_{i=1}^m(h_\theta(x^{(i)}) - y^{(i)})^2 \]

目标: \(\begin{matrix} minimize J(\theta_1)\\ \theta_1 \end{matrix}\)

相关文章:

  • 2022-02-10
  • 2021-06-04
  • 2021-09-09
  • 2022-02-19
  • 2021-12-29
  • 2021-09-17
  • 2021-07-29
  • 2022-12-23
猜你喜欢
  • 2021-06-24
  • 2021-07-30
  • 2021-11-22
  • 2021-04-07
  • 2022-01-17
  • 2022-12-23
相关资源
相似解决方案