Skip to content

About

deep learning from scratch

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

18 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deep Learning Architectures from Scratch: A PyTorch Implementation Repository

🚧 STATUS: Active Portfolio Project. This repository is continuously updated with new architectures

🧠 About the Developer

I am Jose Aries E. De Los Santos, a Data Science Ph.D. student and a University Lecturer at the Institute of Mathematics, College of Science, University of the Philippines Diliman, holding a Master of Science in Applied Mathematics degree. Driven by a passion for bridging theoretical mathematics with computational implementation, I built this repository as an open academic and pedagogical resource.

By constructing these complex architectures from scratch, I aim to explore and share a deep, mechanistic understanding of how state-of-the-art models function beneath the abstractions of standard frameworks, serving both advanced research and educational purposes.

🔬 Project Overview

This repository serves as an academic collection of modern and foundational Deep Learning architectures. Rather than simply calling high-level APIs, the models here—ranging from foundational Artificial Neural Networks (ANNs) to advanced Vision Transformers (ViTs) and Kolmogorov-Arnold Networks (KANs)—are meticulously implemented using PyTorch's torch.nn module and raw mathematical operations (including extensive use of einsum).

The primary objective is to provide transparent, readable, and mathematically rigorous codebases for each architecture type. This facilitates better theoretical understanding, rigorous academic study, and in-depth exploration of the mechanics driving modern deep learning.

The goal is to provide transparent, readable, and mathematically sound codebases for each architecture type, facilitating better understanding, debugging, and customization for advanced AI applications.

🗂️ Repository Structure

├── ann_from_scratch/                  # Core neural networks built without high-level frameworks
│   ├── ANN_from_scratch.ipynb
│   ├── Optimizers Comparison Test.ipynb
│   ├── train/test datasets (.csv, .xlsx)
│   └── README.md
├── PyTorch/                           # PyTorch-specific implementations
│   ├── CNN/
│   │   ├── CNN Architectures.ipynb
│   │   └── CNN_Arch_Part2.ipynb
│   ├── KAN/
│   │   └── CNN_KAN (version 2).ipynb  # Kolmogorov-Arnold Network integrations
│   ├── RNN/
│   │   ├── CNN-LSTM.ipynb
│   │   ├── NaiveRNN.ipynb
│   │   ├── RNN.ipynb
│   │   └── data.csv
│   ├── Transformers/
│   │   ├── NanoGPT.ipynb
│   │   ├── Transformers.ipynb
│   │   ├── ViT.ipynb
│   │   └── input.txt
│   └── Using einsum.ipynb             # Advanced tensor operations and Einstein summations
├── .gitignore
└── README.md

🚀 Getting Started

To explore the notebooks and run the implementations locally, ensure you have Python 3.8+ installed, then clone the repository and install the primary dependencies:

git clone https://github.com/Ariestootl/Deep_Learning.git
cd Deep_Learning
pip install torch torchvision numpy pandas matplotlib

📐 Implemented Architectures

1. Artificial Neural Networks (ANN)

  • ANN from Scratch: Complete forward and backward pass implementations without autograd, demonstrating the foundational calculus of backpropagation.
  • Optimizer Comparisons: Custom implementations and performance benchmarking of standard optimizers (SGD, Adam, RMSprop).

2. Convolutional Neural Networks (CNN)

  • Various CNN architectures constructed using torch.nn.Conv2d.
  • Detailed walkthroughs of feature extraction, pooling, and flattened fully connected layers.

3. Recurrent Neural Networks (RNN & LSTM)

  • Naive RNN: A raw implementation of recurrent structures for sequential data processing.
  • CNN-LSTM: A hybrid model designed to capture both spatial hierarchies (CNN) and temporal dependencies (LSTM).

4. Transformers & Attention Mechanisms

  • Transformers: Standard encoder-decoder architectures built module-by-module.
  • ViT (Vision Transformer): Applying self-attention mechanisms to image patches for computer vision tasks.
  • NanoGPT: A scaled-down, functional implementation of generative pre-trained transformers for causal language modeling.

5. Kolmogorov-Arnold Networks (KAN)

  • CNN-KAN: An innovative integration of standard convolutions with the flexible, spline-based activation functions of Kolmogorov-Arnold Networks, exploring alternatives to traditional Multi-Layer Perceptrons (MLPs).

6. Advanced Tensor Operations

  • Using einsum: A dedicated notebook mastering Einstein summation notation for highly efficient and readable multidimensional tensor operations within PyTorch.

🎯 Impact and Use Case

This repository is designed for AI researchers, applied engineers, and students who want to look inside the "black box" of deep learning. By providing transparent code for complex models like ViTs and KANs, it serves as both an educational resource and a foundation for developing highly customized, mathematically rigorous AI systems.

📝 How to Cite

If you utilize these architectures or educational notebooks in your research, study, or projects, please consider citing this repository alongside the PyTorch framework:

APA Format:

De Los Santos, J. A. E. (2023--Present). Deep Learning Architectures from Scratch in PyTorch. GitHub. https://https://github.com/Ariestootl/Deep_Learning

BibTeX:

@software{delossantos2023dlarchitectures,
  author = {De Los Santos, Jose Aries E.},
  title = {Deep Learning Architectures from Scratch in PyTorch},
  year = {2023--Present},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/Ariestootl/Deep_Learning}
}

Note: The implementations in this repository heavily rely on the PyTorch framework. Please also cite the original PyTorch paper if you are publishing research based on this code:

@inproceedings{conf/nips/PaszkeGMLBCKLGA19,
  added-at = {2021-11-02T00:00:00.000+0100},
  author = {Paszke, Adam and Gross, Sam and Massa, Francisco and Lerer, Adam and Bradbury, James and Chanan, Gregory and Killeen, Trevor and Lin, Zeming and Gimelshein, Natalia and Antiga, Luca and Desmaison, Alban and Köpf, Andreas and Yang, Edward Z. and DeVito, Zachary and Raison, Martin and Tejani, Alykhan and Chilamkurthy, Sasank and Steiner, Benoit and Fang, Lu and Bai, Junjie and Chintala, Soumith},
  biburl = {https://www.bibsonomy.org/bibtex/2124d5bf6a2a0a02b949f14fa05813755/dblp},
  booktitle = {NeurIPS},
  crossref = {conf/nips/2019},
  editor = {Wallach, Hanna M. and Larochelle, Hugo and Beygelzimer, Alina and d'Alché Buc, Florence and Fox, Emily B. and Garnett, Roman},
  ee = {http://papers.nips.cc/paper/9015-pytorch-an-imperative-style-high-performance-deep-learning-library},
  interhash = {a3caca5456f48ad236ed06df5cf0ecca},
  intrahash = {124d5bf6a2a0a02b949f14fa05813755},
  keywords = {dblp},
  pages = {8024-8035},
  timestamp = {2024-04-09T23:13:58.000+0200},
  title = {PyTorch: An Imperative Style, High-Performance Deep Learning Library.},
  url = {http://dblp.uni-trier.de/db/conf/nips/nips2019.html#PaszkeGMLBCKLGA19},
  year = 2019
}

📚 References & Acknowledgments

The implementations, mathematical derivations, and theoretical foundations within this repository are heavily inspired by and built upon the knowledge from the following exceptional resources:

Practical Implementation

  • Learn PyTorch for Deep Learning: https://www.learnpytorch.io/ — An invaluable resource that provided the foundational structural practices for modern PyTorch model building.

Core Textbooks & Theoretical Foundations

  • Pattern Recognition and Machine Learning (PRML) by Christopher M. Bishop.
  • The Elements of Statistical Learning (ESL II) by Trevor Hastie, Robert Tibshirani, and Jerome Friedman.
  • Data-Driven Science and Engineering: Machine Learning, Dynamical Systems, and Control by Steven L. Brunton and J. Nathan Kutz.
  • Neural Networks and Deep Learning: A Textbook by Charu C. Aggarwal.

About

deep learning from scratch

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages