Understanding the hypothesis graph in cost function. | Coursera Community
Solved

# Understanding the hypothesis graph in cost function.

• 2 replies
• 187 views

+1
• Newcomer
In the Machine Learning course by Andrew Ng - https://www.coursera.org/learn/machine-learning/lecture/rkTp3/cost-function - under the Model and Cost function part, in the video labeled as Cost function at 1:57 there are 3 graphs helping us visualize the value of the parameters. What I am unable to understand is the third graph. In the x axis the theta 1 parameter which is 0.5 is not visible although theta 0 has been correctly marked on the y axis. Please help me understand this graph better.

icon

Best answer by THANGA MANICKAM M 13 February 2019, 17:53

The equation is h(x) = theta0 + theta1 * x .
theta0 = 1, theta1 = 0.5 .
The graph is plotted between x and h(x) .
1) Consider x = 0. h(x) = 1 + 0.5 * 0 = 1 . There fore for x = 0 , h(x) = 1.
2) Consider x = 1. h(x) = 1 + 0.5 * 1 = 1.5 . Therefore for x = 1, h(x) = 1.5 .
3) Consider x = 2. h(x) = 1 + 0.5 * 2 = 2 . Therefore for x = 2, h(x) = 2 .
If you join these points (0,1) , (1,1.5) and (2,2) you will get a straight line as shown in third graph.
Theta1 decides the slope of the graph (i.e inclination of the graph)
View original

### 2 replies

Userlevel 3
+5
The equation is h(x) = theta0 + theta1 * x .
theta0 = 1, theta1 = 0.5 .
The graph is plotted between x and h(x) .
1) Consider x = 0. h(x) = 1 + 0.5 * 0 = 1 . There fore for x = 0 , h(x) = 1.
2) Consider x = 1. h(x) = 1 + 0.5 * 1 = 1.5 . Therefore for x = 1, h(x) = 1.5 .
3) Consider x = 2. h(x) = 1 + 0.5 * 2 = 2 . Therefore for x = 2, h(x) = 2 .
If you join these points (0,1) , (1,1.5) and (2,2) you will get a straight line as shown in third graph.
Theta1 decides the slope of the graph (i.e inclination of the graph)
+1
Thanks @THANGA MANICKAM M. This was really helpful.