This project is a simple House Price Predictor using Linear Regression. It takes input features such as square footage, number of bedrooms, and number of bathrooms to predict house prices. The dataset is generated within the script, and the model is trained using scikit-learn.
- Uses a Linear Regression model.
- Splits data into training (80%) and testing (20%) sets.
- Evaluates the model using Mean Absolute Error (MAE), Mean Squared Error (MSE), and Root Mean Squared Error (RMSE).
- Visualizes the Actual vs. Predicted house prices using Matplotlib.
Ensure you have Python 3.10 installed along with the required libraries:
pip install pandas numpy matplotlib scikit-learn
Run the Python script:
python house_price_predictor.py
- Dataset Creation:
- A sample dataset is created using pandas.
- Data Preprocessing:
- Splitting into independent (
Square_Feet
,Bedrooms
,Bathrooms
) and dependent (Price
) variables. - Splitting into training (80%) and testing (20%) datasets.
- Splitting into independent (
- Model Training:
- Using Linear Regression to fit the training data.
- Prediction & Evaluation:
- Predicts house prices on the test set.
- Evaluates the model using MAE, MSE, and RMSE.
- Visualization:
- A scatter plot comparing actual vs. predicted prices.
Trained Data: (8,3)
Tested Data: (3,3)
The Mean Absolute Error is: 1.9402553637822468e-11
The Mean Squared Error is: 1.1293772630057337e-21
The Root Mean Squared Error: 3.3606208697288864e-11
(A perfect prediction may appear in this example due to the simplicity of the dataset.)
The script generates a scatter plot comparing the actual and predicted house prices with an ideal fit line (y = x
).
Developed using Python, scikit-learn, pandas, numpy, and Matplotlib.