Model Definition
- Hypothesis (Model):
- Parameters:
(weight),
(bias)
- Cost Function:
- Objective: Minimize
with respect to
and
- Training Dataset:
| Size (sq ft) | Price ($1000s) |
|---|---|
| 1000 | 230.0 |
| 1500 | 330.0 |
| 2000 | 430.0 |
| 2500 | 530.0 |
| 3000 | 630.0 |
Case-1
Consider the model:
This model consistently underestimates housing prices when above training dataset considered Figure 1:
- Red x-shaped observations representing housing prices (in $1000s) vs size (sq ft)
- A bold black line for the model
, which does not fit the data well

Figure 2 shows the cost function as a 3D surface:
- The surface shows how cost varies with different values of
and
- The purple dot marks the cost at
,
, with dashed lines indicating the height (cost value)

Figure 3 presents a contour plot of the cost function :
- Each contour line represents combinations of
and
that yield the same cost
- The red dot marks the location of the current model parameters
,

Case-2
Consider the model:
This model significantly overestimates housing prices, especially for smaller homes. Figure 4 shows:
- Red x-shaped observations representing housing prices vs home size
- A bold black line for the model
, which does not fit the data well

Figure 5 shows the cost function as a 3D surface:
- The surface illustrates how cost varies with different values of
and
- The purple dot marks the cost at
,

Figure 6 presents a contour plot of the cost function :
- Each contour line represents combinations of
and
that yield the same cost
- The red dot marks the location of the current model parameters

Case-3: Best Fit Model
This model provides the lowest cost and aligns closely with the observed data. Figure 7 shows:
- Red x-shaped observations representing housing prices vs home size
- A bold black line for the model
, which fits the data very well

Figure 8 shows the cost function as a 3D surface:
- The surface illustrates how cost varies with different values of
and
- The purple dot marks the minimum cost at
,

Figure 9 presents a contour plot of the cost function :
- Each contour line represents combinations of
and
that yield the same cost
- The red dot marks the location of the optimal model parameters


Leave a Reply