抱歉,您的浏览器无法访问本站

本页面需要浏览器支持(启用)JavaScript


了解详情 >

Linear Regression Cost Function & Gradient descent

1. Linear Regression

How to choose parameters

2. Cost Function

Choose θ0θ1\theta_0,\theta_1 so that hθ(x)h_{\theta} (x) is close to yy for our training examples (x,y){(x, y)}

Title fmt
Hypothesis hθ(x)=θ0+θ1xh_{\theta} (x) = \theta_0 + \theta_1 x
Parameters θ0θ1\theta_0 、\theta_1
Cost Function J(θ0θ1)=12mi=1m(hθ(xi)(yi))2J(\theta_0,\theta_1) = {\frac {1} {2m}} \sum_{i=1}^m (h_{\theta} (x^{i}) - (y^{i}))^2
Goal minimizeJ(θ0θ1)minimize J(\theta_0,\theta_1)

3. Simplified Fmt

θ0\theta_0 = 0

hypothesis function hθ(x)h_{\theta} (x) cost function J(θ1)J(\theta_1)

cost

4. Cost function visable

cost

把 x, y 想象成向量,确定的向量,向量再想象为一个确定的数,总之它是一个二次函数,抽象的想一下,会不会理解

  • contour plots
  • contour figures

cost

5. Gradient descent target

Gradient descent

6. Gradient descent visable

Local optimization

Convex function

Global optimization

7. Gradient descent algorithm

$ \alpha $ : learning rate

Gradient descent

8. Gradient descent only $ \theta_{1} $

Gradient descent for one param : $ \theta_{1} $

Gradient descent

Gradient descent

Gradient descent

9. Linear Regression Model

Gradient descent

9.1 Batch Gradient Descent

Batch : Each step of gradient descent uses all the training examples

Gradient descent

Coursera Learning Notes

Comments