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
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.
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
🙋
Ask for provider support
Evaluation results
- r_squared on Pakistani Real Estate Datasetself-reported0.913