Skip to content

Karachi Used-Car Price Model

I scraped about 15.7k used-car listings for Karachi, cleaned them and trained a model that predicts the asking price with a 6.4% median error.

Year
2025
Role
Solo
Status
Private · client
Context
Lab
The modeling notebook: predicted against actual listing price for 2,518 test cars, hugging the perfect-prediction line
Machine learning · Tabular data2025

Results

  • 6.4%

    median price error

    Held-out listings, R² 0.96

  • 6.6%

    lookup baseline

    Median price of the same model at the same age

  • 15,171

    cleaned listings

    Scraped 13 Dec 2025

The scraper reads the schema.org JSON-LD block on each PakWheels listing card instead of the visible HTML, so layout changes don’t break it, and it collects only vehicle attributes and prices, no seller details.

A HistGradientBoosting model predicts the listing price of a held-out car with a 6.4% median error (R² 0.96). The honest part: a simple lookup of the median price for the same model at the same age already gets 6.6%. Most of the signal is in make, model and age, and the model earns its keep on the expensive tail and on rare combinations.

The EDA notebook: engine size and mileage plotted against listing price
The EDA notebook: engine size and mileage plotted against listing price
Permutation feature importance from the notebook: age, engine and variant lead
Permutation feature importance from the notebook: age, engine and variant lead