Skip to content

tsannie/linear_regression

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

linear_regression

screen

Description

This project provides a simple implementation of linear regression using the gradient descent algorithm in Python.

  • train_model.py takes a CSV file as input and trains the model using the gradient descent algorithm. After that the model is saved.
  • predict.py retrieves the trained model and makes predictions based on the given features.

After running train_model.py, performance metrics such as R-squared, Mean Absolute Error (MAE), Mean Absolute Percentage Error (MAPE), and Mean Squared Error (MSE) will be calculated.

Installation

git clone git@github.com:tsannie/linear_regression.git && cd linear_regression
pip install -r requirements.txt

Usage

python train_model.py [-h] [-f 'file_name'.csv] [-t 'column_name']
                      [-n N_ITERS] [-r LEARNING_RATE] [-g]

optional arguments:
  -h, --help            show this help message and exit
  -f 'file_name'.csv, --file 'file_name'.csv
                        File name csv (default: data.csv)
  -t 'column_name', --target 'column_name'
                        Target column (default: price)
  -n N_ITERS, --n_iters N_ITERS
                        Number of iterations (default: 100)
  -r LEARNING_RATE, --learning_rate LEARNING_RATE
                        Learning rate (alpha) (default: 1)
  -g, --graph           Show graph
python predict.py

Author

forthebadge

About

Linear regression AI model for predicting numerical values.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages