Processing math: 100%

2/19/17

Cost Function

[Ex]
Here is our training set and hypothesis as below:
Size in feet2(x)Price($) in 1000s(y)210446014162321534315852178......

In this example, we want to fit a straight line to predict the house price, then we set a simple model.
Hypothesis: hθ(x)=θ0+θ1x

It's a simple regression problem, you can choose any number for θ0 and θ1, so that we can get the hθ(x) and it's meaning the value which the model predict to the input x. As a prediction model, we want the difference between hθ(x) and y to be small, in other words
is this hypothesis good fit to the data?

We can measure the accuracy of our hypothesis function by using a cost function or called squared error function, in other words it's almost the same as MSE in statistics.

[Def]
J(θ0,θ1)=12mmi=1(ˆyiyi)2=12mmi=1(hθ(xi)yi)2
m: the number of training example
hθ(x): form of hypothesis




No comments:

Post a Comment