Machine Learning model to predict car selling prices using Random Forest Regressor with feature engineering and data visualization.
Machine Learning model to predict used car selling prices using Random Forest Regression with feature engineering, exploratory data analysis, visualization, and model comparison.
- Total Records: 303
- Source: Kaggle — Car Price Dataset
- Car_Name
- Year
- Selling_Price (Target Variable)
- Present_Price
- Driven_kms
- Fuel_Type
- Selling_type
- Transmission
- Owner
- Python
- Pandas
- NumPy
- Matplotlib
- Seaborn
- Scikit-Learn
- Data Loading
- Data Exploration
- Data Visualization
- Feature Engineering
- Data Preprocessing
- Train-Test Split
- Model Training
- Model Evaluation
- Feature Importance Analysis
- New Car Price Prediction
- Selling Price Distribution
- Cars by Fuel Type
- Selling Price by Fuel Type
- Correlation Heatmap
- Year vs Selling Price Scatter Plot
- Actual vs Predicted Price Plot
- Feature Importance Bar Chart
A new feature was created:
- Car_Age = Current Year - Manufacturing Year
This feature improved the model's ability to understand vehicle depreciation over time.
Used as a baseline regression model.
Selected as the final model due to superior predictive performance.
Parameters:
- n_estimators = 100
- random_state = 42
| Metric | Linear Regression | Random Forest |
|---|---|---|
| R² Score | 84.67% | 95.99% |
| RMSE | 1.88 Lakhs | 0.96 Lakhs |
| MAE | 1.22 Lakhs | 0.64 Lakhs |
Random Forest significantly outperformed Linear Regression and was selected as the final model.
| Metric | Result |
|---|---|
| Final Model | Random Forest Regressor |
| R² Score | 95.99% |
| RMSE | 0.96 Lakhs |
| MAE | 0.64 Lakhs |
- Present Price is the most influential feature in predicting car value.
- Diesel vehicles generally have higher resale values than Petrol vehicles.
- Car age significantly affects resale price.
- Vehicles with lower mileage tend to have higher market value.
- First-owner vehicles generally command better resale prices.
- Random Forest delivered highly accurate predictions with strong generalization performance.
- Data Cleaning
- Exploratory Data Analysis (EDA)
- Data Visualization
- Feature Engineering
- Regression Modeling
- Model Evaluation
- Feature Importance Analysis
- Predictive Analytics
- Machine Learning with Scikit-Learn
- Hyperparameter Tuning
- Cross Validation
- Deployment using Streamlit or Flask
- Integration with Real-Time Car Market Data
- Clone this repository
git clone <repository-url>- Install required libraries
pip install pandas numpy matplotlib seaborn scikit-learn- Open the notebook
jupyter notebook car_price_prediction.ipynb- Run all cells sequentially
Shreyansh Gupta B.Tech (CSDS) Galgotias College of Engineering & Technology