美文网首页机器学习
Linear regression with one varia

Linear regression with one varia

作者: spraysss | 来源:发表于2020-01-27 13:20 被阅读0次

Housing Prices

Hypothesis:

h_{\theta}(x)=\theta_0+\theta_1x

Parameters:

\theta_0\theta_1

Cost function:

Squared error
J(\theta_0,\theta_1)=\frac{1}{2m}\sum_{i=1}^{m}(h_\theta(x^i)-y^i)^2

Goal

Min J(\theta_0,\theta_1)

Gradient descent

  • start with some \theta_0,\theta_1
  • keep changing \theta_0,\theta_1 to reduce J(\theta_0,\theta_1) until we hopefully end up at a minimum

Gradient descent algorithm

repeat until convergence {
\space \theta_j:=\theta_j-\alpha\frac{\partial}{\partial\theta_j}J(\theta_0,\theta_1) (for \space j=0 \space and \space j=1)
}
Note : the Correct way is simultaneous update

  • temp0:=\theta_0:=\theta_0-\alpha\frac{\partial}{\partial\theta_0}J(\theta_0,\theta_1)
  • temp1:=\theta_1:=\theta_1-\alpha\frac{\partial}{\partial\theta_1}J(\theta_0,\theta_1)
  • \theta_0:=temp0
  • \theta_1:=temp1

相关文章

网友评论

    本文标题:Linear regression with one varia

    本文链接:https://www.haomeiwen.com/subject/mndpgctx.html