Automobile Price Prediction: PCA & t-SNE Analysis

Automobile Price Prediction Analysis

Implementing PCA and t-SNE for Dimensionality Reduction in Real-World Automotive Data

205
Automobile Records
26→60→28
Feature Transformation
99.93%
Model Accuracy

Complete Process Workflow

1

Data Exploration & Preparation

Load automobiles.csv dataset and perform initial data exploration

Key Actions:
• Loaded 205 rows, 26 features
• Corrected brand name typos (maxda→mazda, toyouta→toyota)
• Created Brand_Modified feature grouping rare brands as 'Other'
• Dropped unnecessary columns (car_ID, CarName)
2

Data Preprocessing

Handle missing values and prepare data for encoding

Key Actions:
• Imputed missing values in Brand_Modified and Count
• Verified data integrity and consistency
• Prepared categorical variables for encoding
• Final check for null values
3

Categorical Encoding

Transform categorical variables into numerical representations

Key Actions:
• Label encoding for cylindernumber (four→4, six→6, etc.)
• Binary encoding for fueltype, aspiration, enginelocation
• One-hot encoding for remaining categorical variables
• Feature expansion from 26 to 60 columns
4

Data Cleaning & Outlier Removal

Remove outliers and ensure data quality

Key Actions:
• Applied IQR method for outlier detection
• Removed price outliers (range: 5,000 to 25,000)
• Converted float64 to integers for consistency
• Created clean dataset (x_clean)
5

Data Normalisation

Apply StandardScaler for feature normalisation

Key Actions:
• Applied StandardScaler (mean=0, std=1)
• Maintained original data distribution shape
• Created standardised dataset (x_clean_standard)
• Prepared data for dimensionality reduction
6

Principal Component Analysis

Apply PCA for dimensionality reduction

Key Actions:
• Applied PCA with n_components=0.95 (95% variance)
• Reduced from 60 to 28 principal components
• PC1 (symboling): 19.70% variance explained
• PC2 (wheelbase): 10.98% variance explained
7

Feature Importance Analysis

Calculate mutual information scores for feature ranking

Key Actions:
• Calculated mutual information regression scores
• Top features: PC1 (symboling), PC2 (wheelbase), PC4 (carwidth)
• Identified least informative components
• Validated PCA results with statistical measures
8

t-SNE Visualisation & Modelling

Apply t-SNE for visualisation and build predictive models

Key Actions:
• Applied t-SNE for 2D visualisation (perplexity=15)
• Created price categories: Lower, Medium, High Cost
• Built Random Forest (R²=0.9993) and Linear Regression models
• Validated model performance and accuracy

Comprehensive Visual Guide

Principal Component Analysis (PCA)

Dimensionality reduction technique that transforms correlated features into uncorrelated principal components while preserving maximum variance.

95% Variance Retained 60→28 Features Linear Transformation

Key Components:

  • PC1 (symboling): 19.70% variance
  • PC2 (wheelbase): 10.98% variance
  • PC3 (carlength): 7.13% variance

t-Distributed Stochastic Neighbour Embedding

Non-linear dimensionality reduction technique for visualising high-dimensional data in 2D space whilst preserving local structure.

2D Visualisation Perplexity=15 Non-linear

Visualisation Results:

  • Clear price category clustering
  • Component 1: 55.17% variance
  • Component 2: 44.83% variance

Mutual Information Analysis

Statistical measure to quantify the dependency between features and target variable, identifying the most informative components.

Feature Ranking Information Theory Statistical Validation

Top Features by MI Score:

  • PC1 (symboling): 1.018
  • PC2 (wheelbase): 0.413
  • PC4 (carwidth): 0.289

Predictive Modelling Results

Comparison of Random Forest Regression and Linear Regression models for automobile price prediction using dimensionality-reduced features.

Random Forest Winner Non-linear Relationships Cross-validation

Model Performance:

  • Random Forest: R² = 0.9993
  • Linear Regression: R² = 0.8544
  • Superior non-linear modelling

Key Findings & Conclusions

Dimensionality Reduction Success

PCA successfully reduced feature space from 60 to 28 dimensions whilst retaining 95% of variance. This significant reduction improves computational efficiency without sacrificing predictive power.

Most Important Features Identified

The top three most informative features for price prediction are: symboling (19.70%), wheelbase (10.98%), and carwidth (7.13%) of total variance.

Non-linear Relationships Discovered

Random Forest significantly outperformed Linear Regression with R² = 0.9993 vs 0.8544, indicating strong non-linear relationships in automotive pricing data.

Price Clustering Patterns

t-SNE visualisation revealed distinct clustering of automobiles into price categories, with clear separation between lower, medium, and high-cost vehicles.

Feature Engineering Impact

Categorical encoding expanded the dataset from 26 to 60 features, providing richer representation whilst outlier removal improved model stability.

Model Reliability

The final Random Forest model achieved MSE = 0.0005 and R² = 0.9993, demonstrating exceptional predictive accuracy for real-world application.

Business Implications & Recommendations

Pricing Strategy Optimisation

Focus pricing decisions on the three most influential factors: symboling (insurance risk rating), wheelbase (vehicle size), and carwidth (interior space). These features explain over 37% of price variance and should guide premium positioning strategies.

Market Positioning Insights

The clear clustering of vehicles by price categories suggests distinct market segments. Manufacturers can leverage these insights to position new models within optimal price brackets and identify potential market gaps.

Predictive Pricing Model Implementation

Deploy the Random Forest model with 99.93% accuracy for dynamic pricing strategies, inventory valuation, and competitive analysis. The model's exceptional performance enables confident real-time pricing decisions.

Feature Development Priority

R&D investments should prioritise features with high mutual information scores. Symboling improvements (safety ratings) and optimal wheelbase design provide maximum impact on market value and customer appeal.

Data-Driven Decision Making

Implement dimensionality reduction techniques across other automotive datasets to identify key value drivers efficiently. PCA's 53% feature reduction demonstrates significant computational savings without accuracy loss.

Competitive Intelligence

Use t-SNE visualisations to map competitor vehicles within price-feature space, identifying positioning opportunities and understanding market dynamics through cluster analysis of automotive specifications.