Skip to content

ekm507/deeplearning_numpy

Repository files navigation

Perfect ✅ Here’s a well-structured README.md that introduces your project, explains why it’s useful, links to docs, and guides users on running examples.


🧠 deeplearn_numpy

A NumPy-only deep learning mini-framework in a single file.


🌟 Introduction

deeplearn_numpy is a minimal deep learning framework written entirely with NumPy. It is designed to be:

  • Educational — understand how neural networks work under the hood (forward pass, backward pass, gradients, optimizers).
  • Lightweight — a single Python file (deeplearn_numpy.py) with zero dependencies beyond NumPy.
  • Practical — despite its simplicity, it supports configurable layers, activations, losses, optimizers, regularization, serialization, and evaluation.

This makes it a great companion for:

  • Students learning the fundamentals of deep learning.
  • Teachers who want to show step-by-step mechanics without hiding them in big libraries.
  • Practitioners who want a lightweight sandbox to prototype and understand internals.

🚀 Features

  • Layers: Dense, Conv2D (im2col), MaxPool2D, AvgPool2D, Flatten, Dropout, BatchNorm.
  • Activations: ReLU, Sigmoid, Tanh, LeakyReLU, Softmax.
  • Losses: MSE, CrossEntropy (stable), BinaryCrossEntropy.
  • Optimizers: SGD (momentum, Nesterov), Adam.
  • Metrics: accuracy, binary accuracy, top-k accuracy.
  • Regularization: L1, L2.
  • Serialization: save & load weights.
  • Config Builder: define models in JSON-like configs.

📖 Documentation

We provide multiple developer resources:

🔎 Start with the moons example if you want a guided walkthrough with visualization.


🛠️ Installation

Clone the repo:

git clone https://github.com/yourusername/deeplearn_numpy.git
cd deeplearn_numpy

No extra dependencies required beyond NumPy and Matplotlib (for examples).


▶️ Running Examples

We recommend running examples from the repo root (so Python can find deeplearn_numpy.py). For example:

python -m examples.moon_boundry_learn.moon_boundry_learn

This runs the moon boundary learning example, where a small MLP learns to separate two crescent-shaped clusters of points.

👉 You’ll see:

  • The dataset plotted.
  • The initial random decision boundary.
  • The trained decision boundary after learning.

📂 Repository Structure

.
├── cheatsheet.md            # Quick syntax reference
├── deeplearn_numpy.py       # Core framework (single file)
├── document.md              # Full developer guide
├── examples/                # Example projects
│   └── moon_boundry_learn/  # Moons dataset classification example
│       ├── document.md
│       └── moon_boundry_learn.py
├── index.html               # Project landing page
└── reference_guide.md       # API reference

🎓 Why Use This Framework?

  • Transparency: Unlike TensorFlow or PyTorch, you can open the file and read every line. No magic.
  • Learning-first: Perfect for teaching neural nets in classrooms or self-study.
  • Extendable: Add your own layers, losses, or optimizers by registering them.
  • Real-world capable: Despite being small, it supports Conv2D, BatchNorm, Adam, etc. — so you can solve real problems on small datasets.

❤️ Contributing

Contributions are welcome! If you want to add examples, new layers, or improve docs, open a pull request.


📜 License

GPLv3


this repo and all files in it are created by AI (chatGPT) thus use it responsibly.

About

a deeplearning framework that uses only numpy

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published