A machine learning web application that predicts the selling price of used cars based on various features like age, mileage, fuel type, and more.
- Predict car selling prices using a trained Random Forest model
- Clean, responsive web interface
- Support for multiple fuel types (Petrol, Diesel, CNG)
- Considers transmission type, seller type, and ownership history
Enter your car details and get an instant price prediction:
| Input | Description |
|---|---|
| Year | Year the car was purchased |
| Showroom Price | Original price in Lakhs |
| Kilometers Driven | Total distance driven |
| Previous Owners | Number of previous owners (0, 1, or 3+) |
| Fuel Type | Petrol, Diesel, or CNG |
| Seller Type | Dealer or Individual |
| Transmission | Manual or Automatic |
- Clone the repository:
git clone https://github.com/RoshaniPawar16/Car-Price-Prediction.git
cd Car-Price-Prediction- Create a virtual environment (recommended):
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Run the application:
python app.py- Open your browser and go to
http://127.0.0.1:5000
Car-Price-Prediction/
├── app.py # Flask web application
├── main.py # Alternative entry point
├── templates/
│ └── index.html # Web interface template
├── random_forest_regression_model.pkl # Trained ML model
├── car data.csv # Training dataset
├── Untitled.ipynb # Model training notebook
├── requirements.txt # Python dependencies
├── Procfile # Heroku deployment config
└── README.md
- Algorithm: Random Forest Regressor
- Hyperparameter Tuning: RandomizedSearchCV with 5-fold cross-validation
- Best Parameters:
- n_estimators: 1000
- max_depth: 25
- max_features: sqrt
- min_samples_split: 2
- min_samples_leaf: 1
| Metric | Value |
|---|---|
| MAE | 0.88 Lakhs |
| MSE | 3.95 |
| RMSE | 1.99 Lakhs |
The most influential features for price prediction:
- Present Price (37.6%)
- Fuel Type - Diesel (22.8%)
- Seller Type - Individual (13.4%)
- Transmission - Manual (13.4%)
- Car Age (8.1%)
The model was trained on a dataset of 301 cars with the following features:
- Car Name, Year, Selling Price, Present Price
- Kilometers Driven, Fuel Type, Seller Type
- Transmission, Owner
- Backend: Python, Flask
- ML: scikit-learn, pandas, numpy
- Frontend: HTML, CSS
- Deployment: Heroku (Gunicorn)
This project is open source and available under the MIT License.