This project contains a curated collection of machine learning and deep learning algorithm implementations that are written from scratch (i.e., minimal dependencies), intended for learning, experimentation and research. The implementations are designed to work with popular frameworks like PyTorch and TensorFlow, along with GPU‑compatible training scripts and datasets.
Ground-up-implementations-ML-algorithms-/
├── algorithms/ # Core algorithm implementations
│ ├── MLP_cifar_pytorch.py # MLP using PyTorch
│ ├── MLP_mnist_tf.py # MLP using TensorFlow
│ ├── CNN_cifar_pytorch.py # CNN using PyTorch
│ ├── CNN_mnist_tf.py # CNN using TensorFlow
├── dataset/ # Dataset loader
├── notebooks/ # Jupyter notebooks demonstration
│ ├── MLP_cifar_pytorch.ipynb # MLP using PyTorch
│ ├── MLP_mnist_tf.ipynb # MLP using TensorFlow
│ ├── CNN_cifar_pytorch.ipynb # CNN using PyTorch
│ ├── CNN_mnist_tf.ipynb # CNN using TensorFlow
│ ├── RNN_cifar_pytorch.ipynb # RNN using PyTorch
│ ├── RNN_mnist_tf.ipynb # RNN using TensorFlow
└── LLM_scratch.ipynb # LLM using PyTorch
├── LICENSE # MIT License
├── README.md
| # | Algorithm | Framework | Dataset | Code | Train Time | Accuracy |
|---|---|---|---|---|---|---|
| 1 | Multilayer Perceptron | PyTorch | CIFAR10 | Github Colab | 14 min | 0.46 |
| 2 | Multilayer Perceptron | Tensorflow | MNIST | Github Colab | 22 s | 0.96 |
| 3 | Convolutional Neural Network | PyTorch | CIFAR10 | Github Colab | 22 min | 0.63 |
| 4 | Convolutional Neural Network | PyTorch | MNIST | Colab | 2 min | 0.96 |
| 5 | Convolutional Neural Network | Tensorflow | MNIST | Github Colab | 12 s | 0.98 |
| 6 | Recurrent Neural Network | From Scratch | Book by H.G. Wells "The Time Machine" |
Colab | 20 min | Perplexity = 1.2 |
| 7 | Recurrent Neural Network | PyTorch | Book by H.G. Wells "The Time Machine" |
Colab | 3 min | Perplexity = 1.1 |
| 8 | Large Language Model (Using Generative Pre-Trained Transformers) | PyTorch | Edith Wharton's "The Verdict" |
Colab | 28 s | Perplexity = 1.9 |
- Clone the repository:
git clone https://github.com/rastri-dey/Ground-up-implementations-ML-algorithms-.git
cd Ground-up-implementations-ML-algorithms-
- Install dependencies:
pip install -r requirements.txt
- Run a model script or notebook:
python -m algorithms.<algorithm_script>
Note: Some models include Google Colab links to launch with minimal setup.
We welcome contributions that:
- Improve algorithm correctness or efficiency
- Add new models or datasets
- Provide notebooks with visual explanations
- Improve documentation
Just open a Pull Request or Issue and we’ll help you get started!
This project is licensed under the MIT License.