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

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


了解详情 >

Linear Regression Cost Function & Gradient descent

1. Linear Regression

How to choose parameters

2. Cost Function

Choose $\theta0,\theta_1$ so that $h{\theta} (x)$ is close to $y$ for our training examples ${(x, y)}$

Title fmt
Hypothesis $h_{\theta} (x) = \theta_0 + \theta_1 x$
Parameters $\theta_0 、\theta_1$
Cost Function $J(\theta0,\theta_1) = {\frac {1} {2m}} \sum{i=1}^m (h_{\theta} (x^{i}) - (y^{i}))^2$
Goal $minimize J(\theta_0,\theta_1)$

3. Simplified Fmt

$\theta_0$ = 0

hypothesis function $h_{\theta} (x)$ cost function $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