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 NeuralNetworkFromScratch
pip install .

Example Usage

import numpy as np
from keras.datasets import mnist

from NeuralNetworkFromScratch 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.1.tar.gz (11.3 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.1-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: neuralnetworknumpy-0.1.1.tar.gz
  • Upload date:
  • Size: 11.3 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.1.tar.gz
Algorithm Hash digest
SHA256 98527a3d26f9502d19d62d0d146ac7e254ae0fdc70ee39ce4c8f550bf0931a93
MD5 7d58e247cd4a92fd534c4d507c5d9886
BLAKE2b-256 eefc95b3578cc26addc71450f6e856963f402d273bf601c28a3ada91115a00b7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neuralnetworknumpy-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 228e7786f08cb3abd1b6526c3f73c57d4b7fec7f71e2588bd0b3fd9230e7e2aa
MD5 c68d2d7b14abc063dc72f912871c2efc
BLAKE2b-256 04c221da6b54fe50370239515c2ac3b611f912b12336f638f1a7d34348021b5d

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