2. The Data
• The model seeks to use linear regression to predict profit based on
population
• The data is formatted in a matrix-based text file and provides
population averages
• The model takes the data and minimizes error in order to draw a line
most effectively plotting the predictions of profit as it relates to
population
3. Using Octave to find the cost of an iteration
J = 32.073
With theta = [0 ; 0]
Cost computed = 32.072734
Expected cost value (approx) 32.07
J = 54.242
With theta = [-1 ; 2]
Cost computed = 54.242455
Expected cost value (approx) 54.24
5. Using the cost function in gradient descent to
find the local minimum cost
J = 4.4834
Theta found by gradient descent:
-3.630291
1.166362
Expected theta values (approx)
-3.6303
1.1664
For population = 35,000, we predict a profit of 4519.767868
For population = 70,000, we predict a profit of 45342.450129
7. Takeaways
The model is providing a means to predict profit through the formula:
F(x) = theta0 + theta1(x)
where theta0 and theta1 are optimized to produce the least mean
squared error.
So in this case theta0 = -3.63 and theta1 = 1.166