Skip to content

aayzaa/barcelona_rental_prices

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📈 Barcelona Rental Price Predictor 📉

A web-based predictor of rental prices of apartments in Barcelona using machine learning.

Image of the web app

Try it! 💻

Available on the following website: barcelona-rental-prices.herokuapp.com.

Select the properties of an apartment by using the sidebar widgets: number of rooms and bathrooms, the size in squared meters and the district where it is located. After that, the model will show the rental price prediction according to the apartment you inputted.

Note: take the results with a handful of salt: this is a personal project and it doesn't take into account the state of an apartment, the views, if it's furnished, if the neighbors are noisy or other types of variables that end up defining a price.

Process 👩🏽‍💻

I had come up with this idea in an earlier project, after having looked for a new apartment in Barcelona for quite a while. I was also learning my first machine learning algorithm (Hello Linear Regression!) so I decided that it could be a great opportunity to try it!

The prior project used a basic Linear Regression model that I implemented without sklearn library and it had some minor issues with data inconsistencies and the lack of a GUI.

In this new version I have improved the model to a 2-degree polynomical Ridge Regression after finding out that it's the best one performing on this data. I have also created a Streamlit powered website that's hosted in Heroku, in order to allow people who doesn't want to download the code to try it.

Current results 📊

The current model being used is a 2-degree polynomial Ridge Regression, with a Cholesky solver and an alpha of 14. The model has been selected after trying it with cross validation and several hyperparameters configurations.

The current mean absolute error is 328€, which sounds quite large when thinking of a 1000€ apartment. I find that in practice, with apartments that I could afford (sorry infinity pool in Sarria), the error was lower than that. The reason of this result is probably that the data I gathered contains several high priced apartments (10k to 18k), where an error of 300 seems more reasonable.

The current data holds about 15.000 apartments from Barcelona, and it was gathered on December 2020 from Enalquiler and Idealista.

Tools used 🛠️

Version 📌

2.0

Authors ✒️

  • Alex Ayza - Keys presser - aayzaa

License 📄

Use any of the code however you want!


⌨️ with ❤️ by aayzaa