Skip to content

implementation of linear regression in python with the Gradient Descent Method

Notifications You must be signed in to change notification settings

oph-design/ft_linear_regression

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FT Linear Regression

GitHub code size in bytes Code language count GitHub top language GitHub last commit

Table of Contents
  1. About The Project
  2. Getting Started
  3. Contact

About The Project

Screen Shot 2024-04-04 at 7 09 39 PM

The project is about training a linear model able to predict the price of a car based on the driven mileage.
So the formular to achieve is: $price = mileage * m + c$
with m and c having to be found by the training alogrithm.
For finding the coeficciants the project is using the Gradient Descent algorithm, which uses the mean squared error as loss function:
$$E = \sum_{i=1}^n (y_i * (m * x_i + c))^2$$ During each the program calculates the loss for each coefficient using the partial derivatives of the loss function. The coefficiants than get adjusted by their multiplied by the Learningrate L (0.1): $Coef_x = Coef_x - L * D_x $

Getting Started

The following contains a description of how to use the program.

Prerequisites

To run the programs you have to have python3 and pip3 installed. See an installation guide here After, you have to clone the repository and install the libraries used in this project.

 git clone https://github.com/oph-design/ft_linear_regression
 pip3 install -r requirements.txt

Usage

The project consists of three seperate programs predict.py, train.py and evaluate.py Each of the programs can be started by typing:

python3 <programname>.py
  • predict.py asks for any mileage and ourt puts the pice prediction
  • train.py train the model on the current data and shows the training process
  • evaluate.py calculates the R squared value of the current model

Contact

Ole-Paul Heinzelmann
[email protected]

linkedin shield

(back to top)

About

implementation of linear regression in python with the Gradient Descent Method

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages