Downloads · 30 days
0
RayyanAhmed9477/house-price-prediction-model
house-price-prediction-model is a machine learning model from RayyanAhmed9477. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
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/bathroo…
Downloads · 30 days
0
Access
Public
Updated Nov 3, 2025
Repo size
268 MB
Likes
1
Public
Click a slice to open those files.
.pkl268 MB · 98%
From the Hugging Face model README
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.
The model is a pre-trained RandomForest regressor that includes:
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}")
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.
This model is designed to help:
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
This model is licensed under the MIT License.