Skip to main content

A neural network framework built completely from scratch using NumPy

Project description

NeuralNetworkFromScratch

A lightweight Python library implementing a fully functional neural network from scratch using NumPy, without relying on machine learning frameworks such as TensorFlow or PyTorch.

The goal of this project is to provide a clear and educational implementation of neural networks, including forward propagation, backpropagation, normalization, and regularization techniques.


Features

  • Fully connected neural network implementation
  • Modular layer system
  • Forward and backward propagation
  • Batch normalization
  • Dropout regularization
  • ReLU and Softmax activation functions
  • Dataset scaling utilities
  • Train / validation split helpers

Installation

Install from PyPI:

pip install neuralnetwork-from-scratch

Or install from source:

git clone https://github.com/Sendy45/NeuralNetworkFromScratch.git
cd neuralnetworknumpy
pip install .

Example Usage

import numpy as np
from keras.datasets import mnist

from neuralnetworknumpy import (
    NeuralNetwork,
    Dense,
    ReLu,
    BatchNorm,
    Dropout,
    Softmax
)

# load dataset
(X_train, y_train), _ = mnist.load_data()

# flatten images
X_train = X_train.reshape(-1, 784) / 255.0

model = NeuralNetwork([
    Dense(64, inputs=784),
    ReLu(),
    BatchNorm(),
    Dropout(0.1),
    Dense(10),
    Softmax()
])

model.compile(
    optimizer="adam",
    loss="categorical_crossentropy"
)

model.fit(X_train, y_train, epochs=10, batch_size=32)

Project Structure

NeuralNetworkFromScratch
│
├── neuralnet
│   ├── __init__.py
│   ├── network.py
│   ├── layers.py
│   ├── activations.py
│   └── utils.py
│
├── tests
├── README.md
└── pyproject.toml

Goals of the Project

This project was designed to:

  • Demonstrate how neural networks work internally
  • Provide a clean NumPy-based implementation
  • Serve as an educational resource for learning deep learning fundamentals

Unlike production ML frameworks, this project prioritizes clarity and learning over performance.


Dependencies

  • numpy
  • tqdm

Optional dependencies used in examples:

  • matplotlib
  • keras (for datasets such as MNIST)

License

This project is licensed under the MIT License.


Author

Created by Itamar Senderovitz.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

neuralnetworknumpy-0.1.3.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

neuralnetworknumpy-0.1.3-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file neuralnetworknumpy-0.1.3.tar.gz.

File metadata

  • Download URL: neuralnetworknumpy-0.1.3.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for neuralnetworknumpy-0.1.3.tar.gz
Algorithm Hash digest
SHA256 33669ba04fbc6fef4ecdb2735f574a1a2ad9898fa1dfdcc224be06cacc9a1bf8
MD5 5aeb93d4502f10d6b38e87577ef70c1d
BLAKE2b-256 619d38e601368fd2b6f2c435026f2f8454f5c761915a1ae1be4696e358ff4f16

See more details on using hashes here.

File details

Details for the file neuralnetworknumpy-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for neuralnetworknumpy-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b015f1dab13c16def5a981044d2d8a11443ef37c1ad1402ad860307bb0ec02b1
MD5 46fd757d5c387a5ee7d3903ed5c2ad60
BLAKE2b-256 2822e3c0558513491e3177da36fe06b8929da790d9509c2b7c1bade6aa739f1b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page