← All projects
Live Streamlit app
Machine Learning · Streamlit · Full pipeline

Madrid Rental ML Dashboard

One live app that takes about 2,085 Madrid rental listings and runs the full machine learning story: exploring the market, clustering into segments, predicting rent, and classifying high-rent homes. Everything trains live when the app starts.

Role
Solo build
Course
Machine Learning I · IE
Year
2026
Stack
Python · scikit-learn · Streamlit
The market

Madrid, in numbers.

The dataset is about 2,085 rental listings scraped from Idealista. The median asking rent is €1,400 a month, the average home is 129 m², and that works out to €16.51 per square meter.

Madrid rental heat
Median asking rent by district, from the same 2,085 listings, running €700 in Carabanchel and Puente de Vallecas to €2,500 in Salamanca. Hover or tab a district for its median and how many listings it rests on.
€700€2,500
Villaverde · no listings
Fainter fill means fewer listings behind that median.
Under the loupe
Idealista listings · real Madrid district boundaries · basemap and ring roads © OpenStreetMap contributors, © CARTO
Unsupervised

Five segments of the market.

A K-Means model groups the listings into five segments. Most homes fall into Standard Exterior Living, while a small Grand Estate segment carries by far the highest rents.

Share of listings per segment

Donut chart, share of listings per segment: Standard Exterior Living 58%, Entry-Level Interior 12%, High-Rise Exterior 11.4%, Urban Premium 10.7%, Grand Estate 7.8%.

Median rent by segment

Horizontal bar chart, median rent by segment: Grand Estate €4,500, Urban Premium €2,100, High-Rise Exterior €1,600, Standard Exterior €1,300, Entry-Level Interior €1,075.

Regression

Predicting rent.

An OLS regression with VIF filtering and RFECV feature selection estimates monthly rent. On the held-out test set it explains 78% of the variance, misses a typical listing by €469, and carries an RMSE of €733, which weights the large misses more heavily. Durbin-Watson sits at 2.05, so the residuals are not autocorrelated.

Feature effects on rent

Increases rentDecreases rent

Feature effects on predicted rent, ordered by size of effect. Central location raises rent the most, then size in square meters, then floor level. Being a special listing lowers rent, and being a studio lowers it the most.

Classification

Spotting high-rent homes.

A logistic regression flags whether a listing is high-rent, with an adjustable probability threshold. It reaches 87% accuracy and a test AUC of 0.94, with almost no gap between train and test.

ROC curve · AUC 0.94

True positive rate against false positive rate. Dashed line is a coin toss.

ROC curve for the high-rent classifier: area under the curve 0.94, well above the random-classifier diagonal, at 87% accuracy on the test set.

The build

One app, the whole pipeline.

The app covers exploratory analysis, five K-Means segments, Apriori association rules, the OLS rent predictor with a 95% prediction interval, and the logistic high-rent classifier with a ROC curve and odds ratios. I wanted anyone to be able to read the market and test a property in a few clicks, not just look at a finished chart.

Next project Trading System Automation
Get in touchEmail me anytime