File size: 3,680 Bytes
50954db 4d2122a 50954db 4d2122a 50954db 4d2122a 50954db 4d2122a 50954db 4d2122a 50954db | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | ---
license: mit
tags:
- machine-learning
- house-price-prediction
- random-forest
- real-estate
- pakistan
- regression
datasets:
- real-estate
language:
- en
model-index:
- name: House Price Prediction Model
results:
- task:
type: tabular-regression
dataset:
name: Pakistani Real Estate Dataset
type: real-estate
metrics:
- type: r_squared
value: 0.9133
---
# House Price Prediction Model
This is a trained machine learning model for predicting house prices using a RandomForest regression algorithm. The model takes into account various property features such as location, size, number of bedrooms/bathrooms, and property type to provide accurate price estimates.
## Model Details
- **Algorithm**: RandomForest Regressor
- **Features Used**: property_type, location, city, baths, purpose, bedrooms, Area_in_Marla
- **Performance**: R² Score of approximately 0.9133
- **Training Data**: Pakistani real estate market data
## Model Architecture
The model is a pre-trained RandomForest regressor that includes:
- Label encoders for categorical variables
- Feature engineering for property characteristics
- Preprocessing pipeline for input data transformation
## Usage
```python
import pickle
import pandas as pd
from huggingface_hub import hf_hub_download
# Download and load the model from Hugging Face
model_path = hf_hub_download(
repo_id="RayyanAhmed9477/house-price-prediction-model",
filename="house_price_model.pkl"
)
# Load the model
with open(model_path, 'rb') as f:
model_data = pickle.load(f)
# Prepare input data
input_data = pd.DataFrame([{
'property_type': 'House',
'location': 'DHA Defence',
'city': 'Lahore',
'baths': 3,
'purpose': 'For Sale',
'bedrooms': 4,
'Area_in_Marla': 5.0
}])
# Encode categorical variables
for col in ['property_type', 'location', 'city', 'purpose']:
if col in model_data['label_encoders']:
le = model_data['label_encoders'][col]
try:
input_data[col] = le.transform([str(input_data[col].iloc[0])])
except ValueError:
# Handle unknown categories by using the most frequent one
input_data[col] = le.transform([le.classes_[0]])
# Make prediction
prediction = model_data['model'].predict(input_data[model_data['feature_columns']])[0]
print(f"Predicted Price: {prediction}")
```
## Dataset Information
The model was trained on a Pakistani real estate dataset containing property features and their corresponding prices. The model considers various factors like location, city, property type, and physical characteristics of the property.
## Intended Use
This model is designed to help:
- Real estate agents estimate property values
- Home buyers and sellers understand market prices
- Property investors evaluate investment opportunities
## Limitations
- The model is trained on Pakistani real estate data and may not generalize to other regions
- Predictions are based on historical data and market conditions may change
- Accuracy may vary for extremely unique or luxury properties
## Training Details
- **Algorithm**: RandomForest Regressor with 100 estimators
- **Features**: 7 input features (property type, location, city, baths, purpose, bedrooms, area)
- **R² Score**: 0.9133
- **Training Framework**: scikit-learn
- **Target Variable**: Property price in PKR
## Model Card Authors
- Rayyan Ahmed
## How to Cite
If you use this model in your research, please cite it as:
```
House Price Prediction Model by Rayyan Ahmed
Available at: https://huggingface.co/RayyanAhmed9477/house-price-prediction-model
```
## License
This model is licensed under the MIT License. |