Skip to content

JayRawal316/CodeAlpha-Car-Price-Prediction

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

3 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿš— Car Price Prediction using Machine Learning

Python Scikit-Learn Pandas NumPy Matplotlib Seaborn License Status


๐Ÿ“Œ Project Overview

This project predicts the selling price of used cars using Machine Learning regression algorithms.

The objective is to build a highly accurate regression model capable of estimating the resale value of a vehicle based on its characteristics such as manufacturing year, present price, fuel type, transmission, seller type, driven kilometers, and ownership history.

This project was developed as part of the CodeAlpha Data Science Internship.


โญ Key Features

  • Data Cleaning & Preprocessing
  • Feature Engineering (Car Age)
  • Exploratory Data Analysis (EDA)
  • Comparison of Multiple Regression Algorithms
  • Hyperparameter Tuning using RandomizedSearchCV
  • Model Evaluation using MAE, RMSE and Rยฒ Score
  • Feature Importance Visualization
  • Actual vs Predicted Analysis
  • Residual Analysis
  • Model Saving using Joblib
  • Future Price Prediction

๐Ÿ“‚ Dataset Information

Dataset: Used Car Price Prediction

Source: Kaggle

Records: 301

Target Variable: Selling_Price


๐ŸŽฏ Problem Statement

The resale value of a used vehicle depends on multiple factors such as manufacturing year, fuel type, transmission type, ownership history and vehicle condition.

The goal of this project is to build a Machine Learning model capable of predicting the expected selling price of a used car with high accuracy.


๐Ÿ”„ Project Workflow

Dataset
    โ”‚
    โ–ผ
Data Preprocessing
    โ”‚
    โ–ผ
Exploratory Data Analysis
    โ”‚
    โ–ผ
Feature Engineering
    โ”‚
    โ–ผ
Train-Test Split
    โ”‚
    โ–ผ
Model Training
    โ”‚
    โ–ผ
Model Evaluation
    โ”‚
    โ–ผ
Best Model Selection
    โ”‚
    โ–ผ
Save Model
    โ”‚
    โ–ผ
Price Prediction

๐Ÿ“ Project Structure

CodeAlpha-Car-Price-Prediction/
โ”‚
โ”œโ”€โ”€ data/
โ”‚   โ””โ”€โ”€ car data.csv
โ”‚
โ”œโ”€โ”€ images/
โ”‚   โ”œโ”€โ”€ selling_price_distribution.png
โ”‚   โ”œโ”€โ”€ correlation_heatmap.png
โ”‚   โ”œโ”€โ”€ boxplot.png
โ”‚   โ”œโ”€โ”€ feature_importance.png
โ”‚   โ”œโ”€โ”€ actual_vs_predicted.png
โ”‚   โ””โ”€โ”€ residual_plot.png
โ”‚
โ”œโ”€โ”€ models/
โ”‚   โ””โ”€โ”€ car_price_model.pkl
โ”‚
โ”œโ”€โ”€ notebook/
โ”‚   โ””โ”€โ”€ Car_Price_Prediction_EDA.ipynb
โ”‚
โ”œโ”€โ”€ reports/
โ”‚   โ””โ”€โ”€ Car_Price_Prediction_Report.pdf
โ”‚   
โ”‚
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ train_model.py
โ”‚   โ”œโ”€โ”€ predict.py
โ”‚   โ””โ”€โ”€ data_preprocessing.py
โ”‚
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ LICENSE
โ””โ”€โ”€ .gitignore

โš™๏ธ Technologies Used

  • Python
  • Pandas
  • NumPy
  • Matplotlib
  • Seaborn
  • Scikit-Learn
  • Joblib
  • Jupyter Notebook
  • VS Code

๐Ÿ“Š Exploratory Data Analysis

The dataset was analyzed using several visualization techniques.

  • Selling Price Distribution
  • Correlation Heatmap
  • Selling Price by Fuel Type
  • Feature Importance
  • Actual vs Predicted Plot
  • Residual Plot

โš™๏ธ Data Preprocessing

The following preprocessing steps were performed:

  • Missing Value Check
  • Feature Engineering (Car Age = 2026 โˆ’ Manufacturing Year)
  • One-Hot Encoding
  • Removal of Unnecessary Columns
  • Train-Test Split (80:20)

๐Ÿค– Machine Learning Models

The following regression algorithms were trained and compared:

  • Linear Regression
  • Decision Tree Regressor
  • Random Forest Regressor
  • Gradient Boosting Regressor

๐Ÿ“ˆ Model Performance

Model MAE RMSE Rยฒ Score
Linear Regression 1.2164 1.8658 0.8487
Decision Tree 0.6966 1.0454 0.9526
Random Forest 0.6369 0.9664 0.9595
Gradient Boosting 0.5899 0.9394 0.9617

๐Ÿ† Best Model

Gradient Boosting Regressor achieved the best prediction accuracy.

Performance

  • MAE : 0.5899
  • RMSE : 0.9394
  • Rยฒ Score : 0.9617

The trained model was saved as:

models/car_price_model.pkl

๐Ÿ“Œ Project Outputs

The project successfully generates:

  • Trained Machine Learning Model (models/car_price_model.pkl)
  • Selling Price Prediction
  • Model Evaluation Metrics
  • Feature Importance Analysis
  • Actual vs Predicted Comparison
  • Residual Analysis
  • EDA Visualizations

๐Ÿ“ท Project Visualizations

Selling Price Distribution

Selling Price Distribution


Correlation Heatmap

Correlation Heatmap


Selling Price by Fuel Type

Box Plot


Feature Importance

Feature Importance


Actual vs Predicted

Actual vs Predicted


Residual Plot

Residual Plot


โ–ถ๏ธ Installation

Clone the repository

git clone https://github.com/JayRawal316/CodeAlpha-Car-Price-Prediction.git

Install dependencies

pip install -r requirements.txt

๐Ÿš€ Usage

Train the model

python src/train_model.py

Predict selling price

python src/predict.py

๐Ÿ”ฎ Future Improvements

  • Hyperparameter Optimization using GridSearchCV
  • K-Fold Cross Validation
  • Deployment using Streamlit or Flask
  • Cloud Deployment (AWS / Azure)
  • Larger Dataset for Better Generalization

๐Ÿ‘จโ€๐Ÿ’ป Author

Rawal JayKumar NarendraKumar

Data Science & Machine Learning Enthusiast

CodeAlpha Data Science Internship

github - https://github.com/JayRawal316

๐Ÿ“œ License

This project is licensed under the MIT License.

About

Machine Learning project for predicting used car selling prices using regression algorithms. Developed during the CodeAlpha Data Science Internship.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Contributors