h θ ( x ) = θ 0 + θ 1 x {\displaystyle h_{\theta }(x)=\theta _{0}+\theta _{1}x}
J ( θ 0 , θ 1 ) {\displaystyle J(\theta _{0},\theta _{1})}
J ( θ 0 , θ 1 ) = 1 2 m ∑ i = 1 m ( h θ ( x ( i ) ) − y ( i ) ) 2 {\displaystyle J(\theta _{0},\theta _{1})={\frac {1}{2m}}\sum _{i=1}^{m}(h_{\theta }(x^{(i)})-y^{(i)})^{2}}
θ j := θ j − α ∂ ∂ θ j J ( θ 0 , θ 1 ) {\displaystyle \theta _{j}:=\theta _{j}-\alpha {\frac {\partial }{\partial \theta _{j}}}J(\theta _{0},\theta _{1})}
t 0 := θ 0 − α ∂ ∂ θ 0 J ( θ 0 , θ 1 ) {\displaystyle t_{0}:=\theta _{0}-\alpha {\frac {\partial }{\partial \theta _{0}}}J(\theta _{0},\theta _{1})}
t 1 := θ 1 − α ∂ ∂ θ 0 J ( θ 0 , θ 1 ) {\displaystyle t_{1}:=\theta _{1}-\alpha {\frac {\partial }{\partial \theta _{0}}}J(\theta _{0},\theta _{1})}
θ 0 := t 0 {\displaystyle \theta _{0}:=t_{0}}
θ 1 := t 1 {\displaystyle \theta _{1}:=t_{1}}
θ 0 {\displaystyle \theta _{0}}