Used-Car Price Prediction
An MSc project building an explainable machine-learning pricing model — because an accurate price nobody can interrogate doesn't get trusted.
Client
Aston University (MSc Data Analytics project)
Role
Data Scientist (independent research project)
Deliverables
Python ML pipeline + SHAP explainability report
2/3 variance explained
Explainable predictions
Highest MSc grade
This was an MSc data analytics project at Aston University, built around a genuinely practical problem: used-car listings are messy, and even when a price prediction is accurate, buyers and sellers rarely trust a number they can’t interrogate. The brief I set myself was to build a pricing model that was not only accurate, but explainable — able to show exactly why it predicted the price it did for any individual car.
Understanding the data before the model
The raw listings had inconsistent mileage units, missing gearbox and fuel entries, and duplicate listings. A meaningful share of the project’s time went into simply cleaning this to a standard, usable structure before any modelling began.
Choosing explainability as a design constraint
Many pricing models optimise purely for accuracy. I treated explainability as an equal requirement from the outset, which shaped the model choice (tree-based, SHAP-compatible) rather than the more common approach of picking the most accurate model first and only later trying to explain it.
XGBoost over a black-box alternative
XGBoost gave strong predictive performance while remaining fully compatible with SHAP’s exact tree-explainer methods, unlike some higher-capacity models that only support approximate explanations.
SHAP per-prediction, not just global feature importance
Rather than only reporting which features mattered on average, the model surfaced a SHAP breakdown for each individual prediction, so a specific car’s price could be justified feature by feature.
Results
- Model explained around two-thirds of price variance on unseen cars
- Meaningfully improved transparency in pricing and negotiation reasoning
- Awarded the highest grade in the MSc cohort for its explainability and structure
Reflections
The project reinforced something that’s easy to forget when chasing accuracy metrics: a model that can’t explain itself is a much harder sell in any real pricing conversation. Building the explainability in from the start, rather than retrofitting it, made the whole model far more useful than the accuracy score alone suggests.
A model nobody can explain doesn't get trusted
Accuracy alone wasn't the brief; every prediction needed a reason attached, which is why SHAP was central to the design from the start, not bolted on afterward.
Clean data before clever models
The biggest early risk was messy, inconsistent listings, not model choice, so most of the early effort went into standardising mileage, engine size, fuel type, gearbox and colour fields before any training began.
Benchmark before you tune
A baseline model came first specifically to make later XGBoost tuning measurable, rather than tuning blind.
Cleaning real listings
Raw used-car listings were standardised across mileage, engine size, fuel type, gearbox and colour, removing inconsistent or contradictory entries that would otherwise mislead the model.
Establishing a baseline
A simpler baseline regression was trained first, purely so the eventual XGBoost model's improvement could be measured against something, not just assumed.
Training and tuning with XGBoost
Gradient-boosted trees were trained and tuned via scikit-learn's pipeline tools to capture non-linear pricing relationships that simpler models missed.
Explaining every prediction with SHAP
SHAP values were layered on top of the trained model so each individual price prediction came with a feature-by-feature explanation (for example, showing that lower mileage was pushing a specific prediction higher).
Visualising the patterns
Matplotlib visuals surfaced the broader feature-price relationships and trends the SHAP values revealed across the full dataset, not just single predictions.
Interested in a similar engagement? Get in touch — I'm available for new SEO and analytics projects.