Case Study · 2026

Madalali: What Predicts a Rent

A rent-prediction model for Dar es Salaam built from 30,220 Instagram broker listings, told as a data essay: four models in order of ambition, SHAP on the winner, and a calculator that turns a budget into wards you can actually afford.

The Madalali Issue 02 opening spread: What predicts the price of a home in Dar es Salaam
13,245
rentals modelled
4
models compared
70%
from two features
The problem

There is no MLS in Dar es Salaam. The rental market runs through madalali (brokers) posting to Instagram, and a listing is a caption, not a record: the price shows up as "2.5 Laki", the size as "vyumba vitatu", the location as a neighbourhood name spelled three different ways. Nobody can tell you what actually drives a rent, because nobody has the market in a table.

The approach

Turn 30,220 broker captions into 13,245 deduplicated rentals with eight structured features, then climb a ladder of models rather than jumping to the fanciest one: predict the neighbourhood median, then a regularised line, then a forest, then gradient boosting. Each rung has to beat the one below it to earn its place. Then interrogate the winner with SHAP and publish what it learned, as an essay with the figures inline rather than a notebook nobody opens.

The finding

70% of the model's predictive power comes from two features: the number of bedrooms (36%) and the neighbourhood (34%), in almost equal measure. Everything else combined (furnishing, amenities, property type, payment terms, timing) is the other 30%.

That revises the received wisdom. Location is not the whole story: where a home is and how big it is matter about equally.

What I built
01

A model ladder

Median baseline, ridge and lasso, random forest, XGBoost. Four rungs, each one accountable to the last.

SHAP

Explained, not just scored

Importance bars, a beeswarm and a partial-dependence curve, so the model says which way each feature pushes, not just how much.

TSH

A rent calculator

Type a monthly budget and get the wards in reach, the brokers who post there, and what to search on Instagram.

§

An essay, not a notebook

The whole thing reads as a magazine issue: the method is the narrative, and every figure opens full-screen.

In the issue
Four model cards: predict the median, draw a straight line, let a forest vote, boost the errors away
The ladder: every model has to beat the rung below it
Three SHAP figure cards: importance bars, beeswarm, and the bedroom partial-dependence curve
What the winner learned, ranked: importance, beeswarm, partial dependence
Scoreboard table comparing MAE, MAPE and R squared across the four models
The scoreboard, on a test set split by property rather than by row
Key decisions
01

Split by property, not by row. Brokers repost the same flat across accounts. A careless random split lets the answer leak from train into test and makes a mediocre model look excellent.

02

Drop the features that already know the price. Affordability tier and price per bedroom are derived from price, so feeding them back in is predicting price from price. The price was also masked out of the caption before any text was read from it.

03

Publish the ceiling, not just the score. The target itself is an LLM extraction that is only about 73% consistent on re-run, so part of the remaining error is the label rather than the model. Saying so is the difference between an honest number and an impressive one.

04

Asking prices, stated up front. The model predicts what a dalali will advertise, not what a home is worth. That caveat is in the opening paragraph, not the footnotes.

Try it on your own budget.

Tell the calculator what you can pay a month. It shows which wards are in reach.

Open the rent calculator