Back to Projects
Feature Engineering / Automotive

Automobile Price Prediction

A feature-engineering-heavy pricing model for a 205-vehicle automobile dataset, paired with a PCA/t-SNE dimensionality reduction deep-dive — including an honest flag on a headline accuracy figure that needs re-validation before it's quoted publicly.

Type
Regression
Domain
Automotive
Methods
Linear Regression, PCA, t-SNE
Status
Completed — pending re-validation
FEATURE ENGINEERING
26 → 60 → 15 FEATURES
26 RAW FEATURES
60 AFTER ENCODING
15 SELECTED (R² 0.73)

The Challenge

A 15-feature linear regression model explains 73% of automobile price variance on a properly validated train/test split. A companion PCA/t-SNE analysis claims 99.93%, but that figure needs re-validation before it's trusted or quoted publicly.

Predicting vehicle price from technical specification is a classic feature-engineering problem: a 205-row automobile dataset with 26 raw features spanning categorical, numerical, and free-text fields, many of them noisy (brand name typos), correlated, or high-cardinality. The goal was a defensible, interpretable pricing model, plus a deeper look at whether dimensionality reduction could extract the true underlying structure driving price.

Approach

01
Cleaning & Encoding
Corrected brand name typos (maxda → mazda, toyouta → toyota), grouped rare brands, and applied a mix of label, binary, and one-hot encoding depending on each categorical feature's structure, expanding the feature space from 26 to 60 columns.
02
Outlier Removal & Scaling
Applied the IQR method to remove price outliers and standard scaling to normalise features, chosen over min-max scaling specifically for its better handling of remaining outliers.
03
Feature Selection
Used Mutual Information Regression and Recursive Feature Elimination to narrow 60 engineered features down to the 15 most predictive, validated against a correlation-with-price threshold.
04
Dimensionality Reduction Deep-Dive
As a companion analysis, applied PCA (retaining 95% of variance in 28 components, down from 60) and t-SNE for 2D visualisation, then compared Random Forest against Linear Regression on the reduced feature space.

Results

R² = 0.73
Linear regression on 15 selected features, held-out test set (MSE = 0.277)
60 → 28
Features reduced via PCA while retaining 95% of variance
205
Vehicle records analysed after cleaning and outlier removal

The primary model, linear regression on 15 features selected via mutual information and RFE, explained 73% of price variance on a proper train/test split, with engine size, horsepower, and curb weight standing out as the strongest price predictors, alongside a clear negative relationship between fuel efficiency and price.

The PCA deep-dive found that just three principal components, driven primarily by symboling (insurance risk rating), wheelbase, and car width, captured over 37% of total price variance, and t-SNE visualisation showed distinct clustering of vehicles into lower, medium, and high-cost bands.

Flagged for validation before this goes any further: the companion PCA/t-SNE write-up also reports a Random Forest reaching R² = 0.9993 on this same 205-row dataset. That figure is high enough, and the accompanying methodology notes thin enough on an explicit held-out test split at that stage, to warrant re-running the evaluation with a clean, PCA-fitted-on-training-only pipeline before quoting it publicly. Until re-validated, the defensible headline result is the 73% R² from the properly split linear regression model, not the 99.93% figure.

Business Impact

The validated model gives a defensible, feature-level basis for pricing strategy: engine performance and vehicle dimensions justify premium positioning, while fuel efficiency and price pull in different directions, useful for segmenting eco-focused models from performance models rather than trying to win on both axes at once. The PCA/t-SNE work is a promising direction for a lighter-weight pricing model and clearer market segmentation, but the very high accuracy figure needs to clear proper validation before it informs any real pricing decision.

Technology Stack

Python Pandas Scikit-learn PCA t-SNE Random Forest Mutual Information RFE
Interested in this work or something similar?