Skip to content

alishbamateen/PredictHomePrices

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🏠 House Price Prediction with Linear Regression

This project uses a simple linear regression model to predict house prices based on house size (in square feet). It uses a dataset stored in a CSV file and visualizes both the raw data and the model's predictions.

πŸ“Š Project Overview

The goal is to:

  • Load and explore a dataset of house sizes and prices
  • Train a linear regression model using scikit-learn
  • Make predictions on unseen data
  • Visualize actual vs. predicted house prices using matplotlib

πŸ§ͺ Technologies Used

  • Python 3
  • Pandas
  • NumPy
  • Matplotlib
  • scikit-learn

πŸ“ Files

  • home_dataset.csv: CSV file containing two columns:
    • HouseSize (in sq.ft)
    • HousePrice (in millions of dollars)
  • predict_home_prices.py or your script file: contains the full code for loading data, training the model, and plotting results.

πŸ“ˆ How It Works

  1. Load the dataset using pandas
  2. Plot raw data as a scatter plot
  3. Split data into training and test sets (80/20 split)
  4. Train a linear regression model on the training data
  5. Predict house prices for the test set
  6. Visualize:
    • Blue dots = actual house prices
    • Red line = predicted prices based on the model

πŸš€ How to Run

  1. Clone the repository:
    git clone https://github.com/alishbamateen/predict_home_prices.git
    cd house-price-prediction
  2. Make sure you have the required libraries:
    pip install pandas numpy matplotlib scikit-learn
  3. Run the script:
    python predict_home_prices
    

πŸ“ Example Output

figure2

A second plot showing:

figure2

Blue dots: actual house prices (test data) Red line: predicted house prices from the linear regression model

πŸ“Œ Notes

  • The red line in the final graph may not appear properly unless x_test is sorted before plotting.
  • This project is for educational purposes and demonstrates basic regression modeling and visualization.

About

This project will create a linear regression model to predict house prices based on house sizes. Using a scatterplot of test data, the model will form a relationship between the two variables and then makes predictions.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors