Cost Function

Cost Function :-

A cost function is plotted based on the following equation,

J(θ0,θ1)
=2m1i=1m(hθ(xi)yi)2
  


J(θ0,θ1) - Cost Function
m - No.of input values
hθ(xi) - Value of Hypothesis function on iᵗʰ input.
yi - Actual value on iᵗʰ input.

It is basically the average(mean) of differences between squares of hypothesis value and actual values. As the value of cost function reduces the accuracy will be better.
So we will be trying to keep J(θ₁,θ၀) minimum. (0 in ideal case).
The cost function plot will be a 3D figure with,

θ၀ - x axis
θ₁ - y axis
 J(θ₁,θ၀) - z axis

The graph will look like a set of concave dips and the minimum height of the graph will provide best value of θ₁ and θ၀.

For convenience, we are skipping θ၀ for now and plots θ₁ vs J(θ₁)
Here, h(θ) = xθ₁ and best value for θ₁ is marked in red. One more concept gradient descent will help us to find the minimum value of Cost function.

On Next - Gradient Descent

Comments

Popular posts from this blog

Unsupervised Learning

Automate Blog Post creation using Blogger APIs and Python

Setting up Python Flask server on internet via Port forwarding

The beginning of Data Quest

Setting up Jupyter Lab integrated with Python, Julia, R on Windows Subsystem for Linux (Ubuntu)