MACHINE LEARNING • LESSON 1 • OUR FIRST PROBLEM

House Price Prediction

Let's solve our first Machine Learning problem: Can we use information about a house to predict its price?

The Problem

Imagine that you are helping someone estimate the price of a house.

You know the size of several houses and you also know how much those houses were sold for.

Now someone shows you a new house and asks:

"How much do you think this house will cost?"

We don't know the exact price yet. But perhaps the previous houses can help us make a reasonable prediction.

Let's Look at the Data

Suppose we have information about three houses:

House Size Actual Price
1,000 sq ft ₹50 lakh
1,200 sq ft ₹60 lakh
1,400 sq ft ₹70 lakh

Look carefully at the numbers.

As the house size increases, the price also increases.

OBSERVATION Bigger houses in this example have higher prices.

Can We Find a Pattern?

Instead of immediately using a Machine Learning algorithm, let's try to find the relationship ourselves.

Compare the first two houses.

Size increase 1,200 − 1,000 = 200 sq ft
Price increase ₹60 lakh − ₹50 lakh = ₹10 lakh

So an additional 200 square feet is associated with an additional ₹10 lakh in this simple example.

How Much Does 1 Square Foot Add?

We can divide the price increase by the size increase.

₹10 lakh ÷ 200 sq ft
= ₹0.05 lakh per sq ft

₹0.05 lakh is ₹5,000.

In this simplified example, every additional square foot is associated with about ₹5,000 of additional price.

We Can Write the Relationship as a Formula

We found that the price increases by ₹0.05 lakh for every additional square foot.

That gives us a simple relationship:

Price = 0.05 × Size

Let's check whether this formula works for our examples.

1,000 sq ft 0.05 × 1,000 = ₹50 lakh
1,200 sq ft 0.05 × 1,200 = ₹60 lakh
1,400 sq ft 0.05 × 1,400 = ₹70 lakh

Now Predict the Price of a New House

Suppose a new house has a size of:

NEW HOUSE 1,500 sq ft

We can use the relationship we found:

Price = 0.05 × Size
Price = 0.05 × 1,500
Price = ₹75 lakh
OUR PREDICTION ₹75 lakh

We didn't know the actual price of the new house. We used the relationship found from the previous examples to make a prediction.

What Did We Actually Do?

We started with examples where both the house size and price were known.

1. EXAMPLES Known house sizes and prices
2. RELATIONSHIP Price = 0.05 × Size
3. PREDICTION 1,500 sq ft → ₹75 lakh
This is the basic idea behind Machine Learning.

We used mathematics manually here. Later, we will give the examples to a Machine Learning algorithm and let it learn the relationship for us.

But Real Predictions Aren't Perfect

Our example was deliberately simple.

In the real world, house prices do not depend only on size.

Location A house in a popular area may cost more.
Number of Bedrooms Two houses with the same size may have different numbers of bedrooms.
Age Older and newer houses can have different prices.
Condition A well-maintained house may be worth more.

So the formula:

Price = 0.05 × Size

is useful for understanding the basic idea, but it would not be enough to accurately predict every real-world house price.

More data does not automatically mean perfect predictions.

The model also needs useful information that is related to the thing we are trying to predict.

KEY IDEA

Machine Learning uses examples to find relationships that can help us predict new values.

In our simple example, we used house size and known prices to find a relationship. We then used that relationship to estimate the price of a new house.