Model and Cost Function

Model and Cost Function

2-1 Model Representation

Supervised Learning:

  • Regression Problem, predict real-valued output
  • Classification Problem, predict discrete-valued output
  1. Training set
  • ( x , y ) (x,y) (x,y)–one training example
  • ( x ( i ) , y ( i ) ) (x^{(i)},y^{(i)}) (x(i),y(i)) i t h i^{th} ith training example
  1. When the target variable to be predicted is continuous, we call the learning problem a    r e g r e s s i o n    p r o b l e m ‾ \underline{a \;regression \;problem} aregressionproblem. When y can take on only a small number of discrete values , we call it a    c l a s s i f i c a t i o n    p r o b l e m ‾ \underline{a\; classification\; problem} aclassificationproblem.

在这里插入图片描述

  1. Represent h (hypothesis)

Linear Regression

h θ ( x ) = θ 0 + θ 1 x h_\theta(x)=\theta_0+\theta_1x hθ(x)=θ0+θ1x

  1. Linear regression with one variable(x) : univariate linear regression

2-2 Cost Function (Squared Error Function )

  1. Choose parameter θ i ′ s \theta_i's θis for the function h θ ( x ) = θ 0 + θ 1 x h_\theta(x)=\theta_0+\theta_1x hθ(x)=θ0+θ1x

Idea: Choose θ 0 , θ 1 \theta_0,\theta_1 θ0,θ1 so that $h_\theta(x) $ is close to y y y for training examples ( x , y ) (x,y) (x,y).

  1. Measure the accuracy of our hypothesis function by using a cost function

    在这里插入图片描述


2-3 Cost Function Intuition I

The training data set is scatter on x-y plane and we trying to get a straight line that defined by h θ ( x ) h_\theta(x) hθ(x) ,so we need to minimize the cost function.

Set θ 0 = 0 \theta_0=0 θ0=0, get the simplified function J θ = θ 1 x J_\theta=\theta_1x Jθ=θ1x.

We get the best possible line with the m i n J ( θ ) min J(\theta) minJ(θ)


2-4 Cost Function Intuition II

Add θ 0 \theta_0 θ0 ,minimize J ( θ 0 , θ 1 ) J(\theta_0,\theta_1) J(θ0,θ1)

contour plot

A contour line of a two variable function has a constant value at all points of the same line.

Want an efficient algorithm

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值