Skip to content

flash6083/PyTorch_ML_models

Repository files navigation

PyTorch Linear Regression and CNN Implementations from Scratch

This repository contains PyTorch implementations of Linear Regression and CNN models from scratch. These models are implemented using PyTorch's tensor operations and do not rely on pre-built neural network modules. This repository is intended to serve as a starting point for beginners to learn about implementing deep learning models from scratch.

Requirements

To use the code in this repository, you will need to have the following dependencies installed:

  • Python 3.x
  • PyTorch
  • NumPy
  • Matplotlib

Usage

The repository contains 3 files:

  • linear_regression_scratch.py: This file contains the implementation of Linear Regression from scratch using PyTorch.
  • LR_with_pytorch.py: This file contains the basic LR implementaion from scratch except for finding the gradient.
  • LR_automated_PyTorch.py: It has the complete implementation of the Linear Regression model using PyTorch Libraries.
  • convnet.py: This file contains the implementation of a CNN model from scratch using PyTorch, trained on the CIFAR10 dataset.

To use these implementations, you can simply download or clone this repository to your local machine and navigate to the desired directory.

Once you are inside the directory, you can run the corresponding Python script. For example, to run the Linear Regression model, navigate to the linear_regression_scratch file and run the following command:

python linear_regression_scratch.py

Similarly, to run the CNN model, navigate to the cnn directory and run the following command:

python convnet.py

Contributing

If you find any bugs or issues with the code in this repository, please open an issue and I will address it as soon as possible. Additionally, I welcome contributions to this repository, so please feel free to submit a pull request if you have any changes or improvements to the code.

About

PyTorch Linear Regression and CNN Implementations from Scratch

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages