Predicting the price of apartment by its features (square, floor, district, distance from the center of the city, number of rooms, year of construction).
Libraries: numpy, pandas, opendatasets, geopandas, geopy, sklearn, xgboost, mlxtend, seaborn, matplolib, time, itertools, mlflow, fastapi
-
The dataset of prices is from Kaggle.
-
The dataset of cities' disctricts were downloaded from here: Warsaw, Krakow, Poznan.
-
The final dataset for ML problem is created in data_processing.ipynb file and saved as poland_apartments_completed.csv file.
- The given problem was solved by using XGBoost Regressor. It shows the lowest MAPE (Mean absolute percentage error) = 9% in comparison with other models: Linear Regression, Ridge, Lasso, Bagging Regressor (by 26-28%), Decision Tree (17%), k-Nearest Neighbors, Random Forest, Stacked Ensembles (by 14%), Gradient Boosting (13%), AdaBoost for XGBoost (9%). Besides, the predictor of price by custom data (using XGBoost model) was built. The result is in the model_evaluation.ipynb file.
The same code for both data processing and model evaluation also contains in the Poland_apartments__full.ipynb file.
- Clone the project:
git clone https://github.com/am-tropin/poland-apartment-prices
- Go to the project directory:
cd poland-apartment-prices/app
- Start the server:
uvicorn app.main:app --reload
- Go to web-browser
http://127.0.0.1:8000/docs/
and use the following box: Get Main Predicting. Type city and district names, distance from the center of the city, floor number and number of rooms, apartment square and year of construction.
Or
- Go to web-browser and use the following link to get the same info after typing the parameters:
http://127.0.0.1:8000/price/_
Or
- Go to web-browser and use the following type of links to get the same info in clear dictionary view:
http://127.0.0.1:8000/main_predicting/Warszawa_Śródmieście_2_3_2_40_2000
- Start the MLflow UI:
mlflow ui
- Go to web-browser
http://127.0.0.1:5000/
and choose poland_apartments experiment for comparing the models.
- Clone the project:
git clone https://github.com/am-tropin/poland-apartment-prices
- Go to the project directory:
cd poland-apartment-prices/app
- Create a docker container:
docker build -t price-predictor .