Used Car Price Prediction.
Rusty Bargain is a secondhand car service developing an app that allows users to quickly estimate their car’s market value. The goal of this project was to build a model capable of predicting a car’s price based on its characteristics.
CLIENT:
Rusty Bargain
DATE:
May 07, 2025
PROJECT:
Data Preparation
The process began with a thorough inspection and cleaning of the dataset to ensure reliability. I removed columns that did not contribute to the prediction task and standardized inconsistent values across key categorical features, for example, replacing entries like “petrol” with “gasoline” to unify terminology.
I then filtered the dataset to include only cars registered between 1990 and 2019, which represented about 97.5% of all records. This range excluded incomplete or unrealistic entries from earlier and later years. Certain categorical features were converted into binary indicators, such as transforming the “Repaired?” field into 1 for Yes and 0 for No, allowing the models to process them numerically.
To understand the structure of the data, I explored the distribution of car prices, the relationship between price and vehicle type, and the correlations among numerical variables. These visualizations revealed a heavy right-skew in price distribution, suggesting the presence of inflated or erroneous values. I applied a custom outlier removal function to clean such inconsistencies, ensuring that only realistic listings remained.
A similar approach was used for engine power, where both histograms and boxplots helped identify and exclude extreme values. After these steps, the data was properly balanced, consistent, and ready for modeling.
Model Traning
I built two modeling pipelines:
- One with One-Hot Encoding (OHE) for categorical variables.
- Another without OHE, relying on algorithms that natively handle categorical data.
Both pipelines included a StandardScaler for numeric features.
I tried and compared eight models: XGBoost, LightGBM, CatBoost, RandomForest, DecisionTree, Linear Regression.
The XGBoost model achieved the lowest RMSE on the test set, closely followed by LightGBM. Both models offered high accuracy and fast training times, making them ideal for real-time deployment.



