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.
- 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: Used Car Price Prediction
Source: Kaggle
Records: 301
Target Variable: Selling_Price
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.
Dataset
โ
โผ
Data Preprocessing
โ
โผ
Exploratory Data Analysis
โ
โผ
Feature Engineering
โ
โผ
Train-Test Split
โ
โผ
Model Training
โ
โผ
Model Evaluation
โ
โผ
Best Model Selection
โ
โผ
Save Model
โ
โผ
Price Prediction
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
- Python
- Pandas
- NumPy
- Matplotlib
- Seaborn
- Scikit-Learn
- Joblib
- Jupyter Notebook
- VS Code
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
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)
The following regression algorithms were trained and compared:
- Linear Regression
- Decision Tree Regressor
- Random Forest Regressor
- Gradient Boosting Regressor
| 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 |
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
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
Clone the repository
git clone https://github.com/JayRawal316/CodeAlpha-Car-Price-Prediction.gitInstall dependencies
pip install -r requirements.txtTrain the model
python src/train_model.pyPredict selling price
python src/predict.py- Hyperparameter Optimization using GridSearchCV
- K-Fold Cross Validation
- Deployment using Streamlit or Flask
- Cloud Deployment (AWS / Azure)
- Larger Dataset for Better Generalization
Rawal JayKumar NarendraKumar
Data Science & Machine Learning Enthusiast
CodeAlpha Data Science Internship
github - https://github.com/JayRawal316
This project is licensed under the MIT License.





