README.md
April 2, 2025 Β· View on GitHub
π Asturias Housing Price Predictor
π Project Description
This project applies Machine Learning techniques to predict housing prices in Asturias, Spain, using real-world data collected from Idealista.
The dataset includes information such as:
- Property type
- Location (neighborhood, municipality, district)
- Built area (square meters)
- Number of bedrooms and bathrooms
- Selling price
The goal is to develop a tool that helps buyers, real estate agents, or analysts to make informed decisions in the property market.
π― Objectives
- π§ Predict housing prices based on property features.
- π Identify the most influential variables affecting price (square meters, location, etc.).
- βοΈ Compare different Machine Learning models to choose the most suitable one.
- π Provide a practical solution for analyzing the real estate market in Asturias.
π Project Structure
π ML_AsturiasHousingPricePredictor/ βββ π src/ β βββ π data_sample/ β β βββ cleaned_dataset.csv β β βββ scrap_data_asturias.csv β βββ π img/ β β βββ additional_features.png β β βββ correlation_heatmap_extended.png β β βββ ... β βββ π models/ β β βββ xgb_full_model.pkl β β βββ xgb_reduced_model.pkl β βββ π notebooks/ β β βββ eda.ipynb β β βββ preprocessing.ipynb β βββ π results_notebook/ β β βββ final_results.ipynb β βββ π utils/ β βββ bootcampviztools.py β βββ toolbox_ML.py β βββ .gitignore βββ README.md βββ requirements.txt
π οΈ Technologies Used
- Python
- Pandas, NumPy
- Matplotlib, Seaborn
- Scikit-learn
- XGBoost, CatBoost, LightGBM
- Jupyter Notebook
π How to Run the Project
- Clone the repository:
git clone https://github.com/apvwbm/ML_AsturiasHousingPricePredictor.git cd ML_AsturiasHousingPricePredictor - (Optional) Create a virtual environment:
python -m venv venv source venv/bin/activate # macOS/Linux venv\Scripts\activate # Windows - Install the dependencies:
pip install -r requirements.txt - Explore the notebooks:
jupyter notebook src/notebooks/*.ipynb - Check the final results:
jupyter notebook src/results_notebook/final_results.ipynb
π Results
The selected model was XGBoost, trained using only the 7 most influential features according to permutation_importance. It achieved the following results:
- MAE: β¬7,446
- RMSE: β¬46,321
- RΒ²: 0.9175
π This demonstrates that precise and efficient housing price predictions are achievable even with a reduced set of variables.
β Conclusions
- The model can estimate housing prices in Asturias with an accuracy of 91.7% (RΒ²).
- Built area and neighborhood location are the most determining factors.
- The number of features was successfully reduced without sacrificing accuracy, enhancing efficiency.
- This approach is adaptable to other regions and serves as a basis for automated valuation tools.
π€ Author
Aitor PΓ©rez