Git Product home page Git Product logo

car-price-prediction's Introduction

Linear Regression for Car Price Prediction

A Linear regression model to predict the price of a car based on its mileage. The model is implemented based on gradient descent algorithm.

Prerequisites

  • Python3
  • Numpy
  • Matplotlib

Getting started

Clone the repository.

Running the programs

Predicting car price

To start the first program, run the following command:

python3 predict.py

If the model is already trained, the program will use the saved theta0 and theta1 values to predict the car's price for a given mileage. If the program hasn't been trained yet, the program will use the default values of theta0 and theta1 to make the prediction(both set to 0).

Training the model

To run the second program, run the following command:

python3 train.py --path=path/to/dataset.csv --display=True

This program will read the specified dataset file (specified using --path argument)and perform a linear regression on the data. After the linear regression is completed, theta0 and theta1 will be saved for use in the first program. If the --display is set to True, the program will display a graph showing the data distribution and the fit line of the model.

visualizing the results

The visualized results below gives a clear illustation of the model's performance:

  • The fit-line graph displays the relationship between the real values and the predicted values, represented by data points and the best fit-line.
  • The loss over iterations graph shows the reduction of the loss function value with each iteration of the training process until it reaches the optimal solution.

fit-line loss-function

Note

The learning rate and number of iterations can be changed in the train.py file.

car-price-prediction's People

Contributors

framdani 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.