📘 Lesson  ·  Lesson 92

House Price Prediction

House Price Prediction

About this Project

💡 At a Glance

A classic beginner ML project: predict a house price from its size using Linear Regression.

The Program

Python
from sklearn.linear_model import LinearRegression
import numpy as np

# size (sq ft) -> price
X = np.array([[500],[1000],[1500],[2000]])
y = np.array([150000, 250000, 350000, 450000])

model = LinearRegression()
model.fit(X, y)

pred = model.predict([[1200]])
print("Predicted price:", int(pred[0]))
Predicted price: 290000

How it Works

  • We train the model on size→price pairs.
  • fit() learns the relationship; predict() estimates a new price.

Summary

  • Linear Regression learns a straight-line relationship between input and output.
  • Use fit() to train and predict() to estimate new values.

इस Project के बारे में

💡 एक नज़र में

Classic beginner ML project: Linear Regression से size के आधार पर house price predict करना।

Program

Python
from sklearn.linear_model import LinearRegression
import numpy as np

# size (sq ft) -> price
X = np.array([[500],[1000],[1500],[2000]])
y = np.array([150000, 250000, 350000, 450000])

model = LinearRegression()
model.fit(X, y)

pred = model.predict([[1200]])
print("Predicted price:", int(pred[0]))
Predicted price: 290000

कैसे काम करता है

  • हम model को size→price pairs पर train करते हैं।
  • fit() रिश्ता सीखता है; predict() नई price अनुमानित करता है।

सारांश

  • Linear Regression input और output के बीच सीधी रेखा का रिश्ता सीखता है।
  • Train को fit() और नई values को predict() use करें।
← Back to Python Tutorial
🔗

Share this topic with a friend

यह topic किसी दोस्त को भेजें

Found it useful? Send it to a classmate learning the same thing.

अच्छा लगा? जो दोस्त यही सीख रहा है, उसे भेज दीजिए।

\n