Skip to content
← All projects
MACHINE LEARNING

Real-estate estimator

EVOLVING

The problem

Online property estimates give you a number without saying where it comes from. Hard to trust, and even harder to discuss. Almost none of them says how wrong it can be, either.

What I’m building

A machine-learning model, trained on the sales actually recorded in France, estimates a price range for an apartment or a house in one of the ten large cities. Each result states the method used, and the error of that method has been measured on sales the model had never seen.

There is no LLM in the estimate: predicting a price from hundreds of thousands of sales is a job for a statistical model, not a language model. A plain-language explanation by an LLM is planned next; it will put the model’s numbers into words, without ever producing or changing them.

The demo

You enter the town, the property type and the floor area, and optionally the address for a more precise estimate. You get a range, the method used and the town statistics it relies on.

Type the start of the name, then pick from the list.

Property type

Why machine learning

The simplest approach is the median: the median price per m² of the town’s sales, multiplied by the floor area. It is easy to explain, so it is the baseline the model has to beat. On the 83,310 sales of 2025, it is off by 17.4% (median error: half of the estimates do better than that).

Two models do better, and the address is what makes the difference:

  • The “town” model (town, property type, area, year) goes down to 16.5%. The gain is modest: it doesn’t know where in the town the property is.
  • The “address” model (property type, area, year, position) goes down to 13.9%, and its range is about a quarter narrower than the median’s, for the same share of sales inside it. Two streets of the same city don’t sell for the same price: a town median blurs them, the position tells them apart.

The number of rooms and the plot size add almost nothing (16.2% instead of 16.5% for the “town” model), so the form doesn’t ask for them.

How it works

  1. The data. The DVF (property transaction records) are published by the French state: every home sale with its price, floor area and position. I use five years, 2021 to 2025, for the ten départements of the ten cities.
  2. The cleaning. A line in the file is not a sale but a lot of a sale. I keep standard sales of a single home, with a price per m² that is plausible for their town (€10,000/m² is a typo in the Marne, a common price in Paris). I set aside off-plan sales, exchanges, land, symbolic €1 sales and typing errors. 432,579 sales remain.
  3. The training. The model learns the price per m², which is steadier from one property to another than the total price, recovered by multiplying by the area. It is gradient boosting (scikit-learn): chained decision trees, each one correcting the errors of the previous ones.
  4. The range. For each model, I train three: one for the 25th percentile, one for the median, one for the 75th. The range runs from the first to the third: it is the zone where half of the comparable sales fall, not a guarantee.
  5. The address. The browser asks the French state’s geocoding service for the coordinates of the address, then sends them to the site’s server, which passes them on to the API. The API checks that they are inside the chosen town by looking at the neighbouring sales. They are not kept: requests are not even logged.
  6. The safeguards. The API refuses an area that sales have never shown (the range depends on the property type and is displayed in the form): a decision tree cannot extrapolate, it would repeat the price of its last leaf. When a town doesn’t have enough sales of a property type (a house in Paris’s 1st arrondissement), it uses the median of the whole city and says so.

How the error is measured

Measuring a model on the sales it learned from proves nothing. So I do it the way it works in real life:

  • The split is by time. The model learns from 2021 to 2024 and is tested on 2025: it predicts the future from the past, never the reverse, without seeing the price of the sales it estimates.
  • No tuning on the test. The settings are scikit-learn’s defaults (except the number of iterations, set to 300): tuning them on 2025 would make the measure too optimistic.
  • A solid baseline. I compare with the median of the last year, which estimates 2025 better than the median of four years (17.4% against 18.2%), not with an easy-to-beat reference.
  • Results by city and by property type, because a good overall result can hide a local failure.

Once measured, the model put online is retrained on all the years, 2025 included.

Under the hood

The estimate runs on a Python API (FastAPI) hosted on my own server, behind HTTPS; it loads the models once at startup. No LLM, so no prompt and no cost per request. The measured errors, the cost per request and the latency are shown below: the latency is that of your last estimate, and the errors are read live from the API.

Model
Gradient boosting (scikit-learn)
Cost / request
€0
Latency
—
Prompt
none (no LLM)

Architecture

  1. Browser
  2. Astro site (Vercel)
  3. Site route (adds the key)
  4. api.tatane.me (Caddy, HTTPS)
  5. FastAPI (Docker)
  6. scikit-learn models + CSV
Hosting
Pages and three server routes on Vercel. The API runs on an Ubuntu VPS, in Docker Compose: only Caddy is reachable from the Internet.
What is exposed
Three routes on the site. The API only accepts calls with a key, kept on the site's server: never in the browser.
Data and privacy
DVF sales (data.gouv.fr, Licence Ouverte 2.0). The coordinates of an address are neither stored nor logged.
Safeguards
Per-visitor limit, API key, requests from other sites refused, bounded area, HTTPS (HSTS), container without root. No cost per request (no LLM).
Real measurements
Error per method (tested on 2025), latency, model date and version: shown above, read live from the API.
How the site is built →

The limits

It is an order of magnitude drawn from past sales, not an appraisal. The condition of the property, the floor, a balcony, a parking space or renovations are not taken into account, and off-plan sales or sales of several homes are excluded: the estimate describes the market of “standard” homes.

A median error of 13.9% means that one estimate in two falls within 14% of the real price, so the other half is further off: that is what the range is for.

Houses are rare in big cities (745 sales in Paris in five years): their estimates are less precise, hence the fallback on the city median when an arrondissement doesn’t have enough of them. Strasbourg is not covered, because Alsace-Moselle is not in the DVF: Rennes takes its place.

What I take from it

  • The position of the property matters most. It takes the error from 17.4% to 13.9%; the rest (rooms, plot) barely changes the result.
  • Recent prices matter. A median over the last year estimates 2025 better than a median over four years, and the year is a variable of the model.
  • The gain varies by city. With the address, Toulouse’s median error goes from 22.2% to 13.3%, while Paris’s, already steady, goes from 13.7% to 12.3%.
  • The ranges are calibrated. For each method, about half of the real sales fall within the announced interval.

Next: automatic deployment after passing tests, then a plain-language explanation of each estimate by an LLM.