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)
- linear_regression.py: Contains the implementation of the LinearRegression class.
- logistic_regression.py: Contains the implementation of the LogisticRegression class.
- main.py: The main imports the datasets and runs the linear and logistic models.
- utility.py: Contains functions to handle the data(generating and splitting the data) and to run the linear and logistic models.
To run the code, you need to install the following dependencies:
- numpy: For matrix computations.
- scikit-learn: For the classification dataset in logistic regression.
- matplotlib: For visualization.
You can install these dependencies by creating a virtual environment and running the command:
pip install -r requirements.txt
- Clone the repository to your local machine.
- Navigate to the repository folder.
- Create a virtual environment and install dependencies using the command mentioned above.
- Run the command:
python main.py
- Linear Regression: Numpy was used to generate sample data. The code includes options for updating weights with momentum and without momentum.
- 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.