In Issue 01 we said the model was the next post. This is that post. We taught four machines to read 30,220 broker listings and predict the rent. A caveat that is not fine print: these are asking prices, not sale prices. The model predicts what a dalali will advertise, not what a home is worth.
of the model's predictive power comes from just two features: location and the number of bedrooms, in almost equal measure (≈35% each, by SHAP). Everything else combined is the other 30%.
This revises Issue 01's hunch. The address is not the whole story: where a home is and how big it is matter about equally. Furnishing, amenities, property type and payment terms barely move the needle.
Tell the calculator what you can pay a month. It shows which wards are in reach, the dalalis who post there, and what to search on Instagram.
Guess the neighbourhood's median rent for every listing. A model that can't beat this has learned nothing. It is also already a strong hint that location dominates.
Each feature gets a number you can read aloud. Ridge shrinks the noise; Lasso prunes it. It cannot bend, though. A pool matters more in Masaki than Kimara, and a line can't say so.
Non-linearity and interactions for free, no scaling required. It captures "amenity X matters only in tier Y" without being told. Importances tilt toward high-cardinality features, so with 77 neighbourhoods, read them with care.
Each tree fixes the last one's mistakes. Tuned by cross-validation with early stopping, and never on the test set, which we touch exactly once, at the end.
Bedrooms (36%) and neighbourhood (34%) are co-dominant, together 70%. Everything else combined is the other 30%.
Beyond which feature matters: which way it pushes, and where it interacts. The honest view of a black box.
1→2 bedrooms is not 3→4. The curve shows the diminishing return a straight line couldn't.
| Model | MAE (TSH) | MAPE | R² (log) |
|---|---|---|---|
| Baseline: neighbourhood median | 456,696 | 70.6% | 0.29 |
| Ridge / Lasso regression | 375,744 | 50.9% | 0.527 |
| Random Forest | 365,628 | 49.5% | 0.535 |
| XGBoost→ | 364,446 | 48.5% | 0.550 |
Scored on a held-out test set split by property, not by row, because brokers repost the same flat, and a careless split would let the answer leak from train into test. The ceiling is not 100%: the target itself is an LLM extraction that is ~73% consistent on re-run, so some error is the label, not the model. We will say which is which.
A formal portal hands you clean fields. A dalali hands you a caption. Before a model sees anything, the price has to be parsed out of “2.5 Laki” and the bedrooms out of “vyumba vitatu”, and roughly one listing in four disagrees with itself on re-extraction. You are modelling a noisy target before you start.
Then there are the traps that make a first model look brilliant and be wrong. We dropped affordability_tier, because it is assigned from price, so feeding it back in is predicting price from price. We dropped price_per_bedroom for the same reason. We masked the price out of the caption before reading any text from it. And we split by property, not by row.
None of this makes the model more accurate. It makes the accuracy honest, which, for a post whose whole point is what the model learned, is the only number worth printing.
target = log(price_tsh) # rentals only, to start
features = bedrooms, property_type, neighbourhood,
furnished, amenities(count+top-k),
payment_terms, post_month, log1p(likes)
dropped = affordability_tier, price_per_bedroom, # price-derived
price_original, price_usd, currency # target leakage
split = by property / source_account, deduped # no repost leakage
ladder = median → ridge/lasso → random forest → xgboost
tuning = k-fold CV + early stopping; test touched once
stack = python · pandas · scikit-learn · xgboost · shap
note = asking prices · one scrape window · one city
A single scrape from one window (Jan 2025 to Apr 2026); the market may have moved since. This is an informal opinion, not advice, and we accept no liability for decisions made from it. For authoritative figures see the Tanzania National Bureau of Statistics.