How this house price model works
This tool is a small, real machine-learning model, not a lookup table. It learned how listed flat prices in India relate to things like city, locality, size and number of bedrooms, from tens of thousands of past listings. Here's how it was built, and what it can and can't tell you.
1. The data
The model is trained on a public dataset of residential listings from Magicbricks, collected in 2023 and published on Kaggle under the CDLA-Sharing-1.0 licence. Each listing has an asking price, carpet or super built-up area, number of bedrooms and bathrooms, floor, furnishing, car parking, whether it is new or resale, the city and the project or locality name. Almost all of the rows are apartments, so the tool is meant for flats, not independent houses or plots.
Raw scraped data is messy. Many listings appeared several times, so duplicates were removed first, which cut the data from 187,531 rows to 63,204. Prices written as "75 Lac" or "1.2 Cr" were converted to rupees, and areas in square yards or square metres were converted to square feet. Rows that were clearly wrong were dropped, such as a 3 BHK listed at 200 sq ft, or a parking count of 402 that described the whole project. Within each city, the most extreme 1% of prices per square foot at each end were removed. Cities with fewer than 150 usable listings were left out.
2. The features
Location matters more than anything else in real estate, but there are thousands of locality names. Instead of asking you to pick one, the model groups each city's localities into three tiers using the median price per square foot in that locality: Budget (the cheapest third), Mid and Premium (the costliest third). These tiers are calculated only from the training data. The model also uses the city's overall median rate, the area (on a log scale), whether the area is carpet or super built-up, BHK, bathrooms, floor, total floors in the building, furnishing, parking and new vs resale.
3. Training
The model is a gradient-boosted tree ensemble. It builds 250 small decision trees one after another, and each new tree corrects the errors left by the earlier ones. It predicts the logarithm of the price, because errors in property prices are roughly proportional. Being ₹5 lakh off matters a lot for a ₹30 lakh flat and much less for a ₹3 crore one. We added monotonic constraints so that, with everything else equal, a bigger area or a costlier location can never lower the estimate. That keeps the price-vs-area chart sensible. After training, the trees were exported to a compact JSON file (about 115 KB), and a few lines of JavaScript walk through them in your browser. We checked that the browser's predictions match the Python model's.
4. Evaluation
Before training, 20% of listings were set aside as a test set that the model never saw. On those 11,809 listings, the model explains about 81% of the variation in price (R² = 0.81). The mean absolute error is ₹23.9 lakh, which expensive flats pull upwards, and the median error is about 18%. A simple ridge regression on the same inputs scores R² 0.84 on log price, against 0.85 for the boosted trees. Most of the power comes from size and location. The "likely range" you see is based on the model's actual errors: about 80% of test listings fell inside it.
The importance chart shows that area and location (city + locality tier) together account for most of what the model relies on. Furnishing, floor and new vs resale move the estimate only a little. In this data, much of their effect is already captured by location and size.
5. Limitations: please read
- Asking prices, not sale prices. Listings show what sellers asked for. Actual deals often close lower, and the registered value (circle rate) can differ again.
- 2023 data. Prices in many cities have changed since then, so treat the estimate as a 2023-level reference point.
- Tiers are coarse. Two localities in the same tier can differ a lot. So can two buildings on the same road.
- Missing factors. The model doesn't know a building's age, condition, view, amenities, builder reputation, legal status or distance to a metro station.
- Uneven coverage. Some cities have only a few hundred listings, and Mumbai city proper has fewer than Delhi or Bengaluru. Estimates for small cities and very large or unusual flats are less reliable.
- Not advice. Don't use this for buying, selling, loan, tax or legal decisions. Use a registered valuer, recent registration data and a lawyer for that.
Used sensibly, the tool is good for a quick reality check. You can compare cities, see roughly how much an extra 200 sq ft or a premium locality adds, or learn how a real ML workflow fits together. If you're planning a purchase, our guides on building an emergency fund and the 50/30/20 budget in India may also help.