Skip to content

Repository files navigation

Car Price Prediction

A machine learning web application that predicts the selling price of used cars based on various features like age, mileage, fuel type, and more.

Features

  • 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

Demo

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

Installation

  1. Clone the repository:
git clone https://github.com/RoshaniPawar16/Car-Price-Prediction.git
cd Car-Price-Prediction
  1. Create a virtual environment (recommended):
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Run the application:
python app.py
  1. Open your browser and go to http://127.0.0.1:5000

Project Structure

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

Model Details

  • 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

Model Performance

Metric Value
MAE 0.88 Lakhs
MSE 3.95
RMSE 1.99 Lakhs

Feature Importance

The most influential features for price prediction:

  1. Present Price (37.6%)
  2. Fuel Type - Diesel (22.8%)
  3. Seller Type - Individual (13.4%)
  4. Transmission - Manual (13.4%)
  5. Car Age (8.1%)

Dataset

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

Technologies Used

  • Backend: Python, Flask
  • ML: scikit-learn, pandas, numpy
  • Frontend: HTML, CSS
  • Deployment: Heroku (Gunicorn)

License

This project is open source and available under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages