Skip to content

ChisengaSol/basic-machine-learning-algorithms

Repository files navigation

Overview

This repository contains Python code implementing linear regression and logistic regression models. Please note that this is for educational purposes only(to demonstrate understanding of linear regression)

Files

  1. linear_regression.py: Contains the implementation of the LinearRegression class.
  2. logistic_regression.py: Contains the implementation of the LogisticRegression class.
  3. main.py: The main imports the datasets and runs the linear and logistic models.
  4. utility.py: Contains functions to handle the data(generating and splitting the data) and to run the linear and logistic models.

Dependencies

To run the code, you need to install the following dependencies:

  1. numpy: For matrix computations.
  2. scikit-learn: For the classification dataset in logistic regression.
  3. matplotlib: For visualization.

You can install these dependencies by creating a virtual environment and running the command:

    pip install -r requirements.txt

Usage

  1. Clone the repository to your local machine.
  2. Navigate to the repository folder.
  3. Create a virtual environment and install dependencies using the command mentioned above.
  4. Run the command:
    python main.py

Functionality

  1. Linear Regression: Numpy was used to generate sample data. The code includes options for updating weights with momentum and without momentum.
  2. Logistic Regression: Uses data generated from make_classification function in scikit-learn's datasets module.

You can see the usage of both regression models in the main.py file.

About

Implementation of Linear and Logistic Regression

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages