Git Product home page Git Product logo

car-price-recommendation-system's Introduction

Car Price Recommendation System

Repository: Car Price Recommendation System

Original dataset taken from kaggle.com: Dataset

Cleaned dataset suitable for GUI: Dataset

Dataset suitable for model training: Dataset

Project Description

Our project is designed to help users from India predict the approximate price of a used car according to their preferences.

Prerequisites

Name Version
Python 3.11.4
PyQt6 6.6.1
Matplotlib 3.8.2
numpy 1.26.3
pandas 2.1.4
scikit-learn 1.3.2
used_cars_data_cleaned link
cardata_numerized link

Installation

Please download main.py, cardata_numerized.csv and used_cars_data_cleaned.csv files into the same folder. Also the whole project can be downloaded as a zip file.

All libraries from prerequisites section should be also installed for success running of the program.

Virtual Envirnments

If you use an IDE such as PyCharm, a virtual envirnment will be created automatically.
Otherwise, you can create a virtual envirnment using the following commands:

For Windows:

python -m venv /path/to/new/virtual/environment

For Linux + macOS:

(venv) $ python -m pip install <package-name>

Once you have created a virtual envirnment, you must activate it, before installing the packages.

Windows:

PS> venv\Scripts\activate
(venv) PS>

Linux + macOS:

$ source venv/bin/activate
(venv) $

You can then install the packages:

Windows:

(venv) PS> python -m pip install <package-name>

Linux + macOS:

(venv) $ python -m pip install <package-name>

You can find more information here:

Basic Usage

  1. Please run the main.py file.

  2. After the application has started, the data file is read after clicking on the 'Start Analisys' button.

  • Predicted price for default inputs is shown.
  • 'Start Analisys' button is disabled, and its text is set to 'Interactive Analisys Started'.
  1. Custom values can be submitted using various widgets.
  • The plot reacts interactively to the input and gives a prediction.
  1. The modified price is displayed on the plot, and on the text section above the 'Interactive Analisys Started' button.

Note: Price is displayed in Euros and in lakhs on the plot.
1 lakh Indian rupees = ~1000 Euros.

  1. Additionally, the user can view some trends on the data using the buttons on the right of the plot canvas. The text above them explains the plot.

  2. Save button stores the plot in ".png" format at user's specified location.

  • In case of unsaved data, the "quit button" asks for confirmation before closing.

Implementation of the Requests

Graphical User Interface (GUI)

Data Import

We import the data in our code using the "pandas.read_csv" method in the generate_model method.

Data Reading And Analysis

The data is analyzed after clicking on the "Start Analysis" button.

Input Widgets And Statistical Metrics

We use 3 different types of input widgets for 8 statistical metrics:

  • QComboBox:
    • transmission_type: maps the transmission type of the car to our prediction function
    • fuel_type : maps the kind of fuel used to the prediction function
    • brand_class: maps the brand of the car to the prediction function
  • QSpinbox:
    • power: maps the power of the car to our prediction function
    • kmd : maps the number of kilometers the car was used for to the prediction function
    • engine : maps the strength of the ca engine to the prediction function
  • QSlider:
    • age_slider: maps the age of the car to the prediction function
    • seat_no: maps the number of seats in the car to the prediction function

The prediction function is called "show_prediction"

Visualization And Data Overview For User

To implement this part we used Matplotlib 3.8.2 library and integrate it in PyQt6. There are 6 plots available for user:

  • Main plot with Year Vs Price of car
  • Fuel Type Vs Average Mileage,
  • Number Of Seats Vs Average Price
  • Owner Type Vs Average Price
  • Transmission Distribution
  • Seats Number Distribution

Data Analysis With Pandas and Numpy

To implement this part we used pandas 2.1.4, numpy 1.26.3 and scikit-learn 1.3.2 libraries.

Biggest part of this section was done during the dataset cleaning and exploration:

  • data was observed
  • otliers were removed
  • during data exploration the left-skewed pattern of price and kilometer distribution were founded; it is the reason why log price and log km was used for model training and prediction

The part of data analysis which is available for user was done usimg pandas.describe(), pandars.info() libraries and scikit-learn functions m mean_squared_error() and r2_score()

Scikit-Learn

This section was implemented using LinearRegression class form scikit-learn library.

We splitted dataset from "used_cars_dataset_cleaned.csv" file into 4 parts: X, y for training the model and X, y for testing the model.

  • X_train - 70% of rows from all columns except "Price_log"
  • X_test - remaining 30% of rows from all columns except "Price_log"
  • y_train - corresponding 70% of rows from "Price_log" column. Using it as a labels for model
  • y_test - corresponding 30% of rows from "Price_log" column. Using it to measere the accurcy of our model

Mean squared error is equal to 0.1, which could be called a good result

Contributing

We welcome contributions! Please follow these steps to contribute:

  1. Fork the repository
  2. Create a new branch (git checkout -b feature)
  3. Make your changes
  4. Commit your changes (git commit -am 'Add new feature')
  5. Push to the branch (git push origin feature)
  6. Create a new pull request

Please ensure your code follows our coding standards.

License

This project is licensed under the MIT License.

Contact

For questions or support, contact [email protected].

car-price-recommendation-system's People

Contributors

ded0inside avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.