Skip to main content

A From Scratch Neural Network Framework with Educational Purposes

Project description

forgeNN## Table of Contents

Installationtch Neural Network Framework with Educational Purposes*

Python 3.8+ NumPy PyPI version Downloads License

� Table of Contents

�📦 Installation

pip install forgeNN

Overview

forgeNN is a modern neural network framework that is developed by a solo developer learning about ML. Features vectorized operations for high-speed training.

Key Features

  • Vectorized Operations: NumPy-powered batch processing (100x+ speedup)
  • Dynamic Computation Graphs: Automatic differentiation with gradient tracking
  • Complete Neural Networks: From simple neurons to complex architectures
  • Production Loss Functions: Cross-entropy, MSE with numerical stability

Quick Start

Installation

pip install forgeNN

High-Performance Training

import forgeNN
from sklearn.datasets import make_classification

# Generate dataset
X, y = make_classification(n_samples=1000, n_features=20, n_classes=3)

# Create vectorized model  
model = forgeNN.VectorizedMLP(20, [64, 32], 3)
optimizer = forgeNN.VectorizedOptimizer(model.parameters(), lr=0.01)

# Fast batch training
for epoch in range(10):
    # Convert to tensors
    x_batch = forgeNN.Tensor(X)
    
    # Forward pass
    logits = model(x_batch)
    loss = forgeNN.cross_entropy_loss(logits, y)
    
    # Backward pass
    optimizer.zero_grad()
    loss.backward()
    optimizer.step()
    
    acc = forgeNN.accuracy(logits, y)
    print(f"Epoch {epoch}: Loss = {loss.data:.4f}, Acc = {acc*100:.1f}%")

Educational Examples

Legacy Examples

# For learning automatic differentiation
from forgeNN.legacy import Value, MLP

x = Value(2.0)
y = x**2 + 3*x + 1
y.backward()
print(f"dy/dx = {x.grad}")  # 7.0

# Simple neural network
model = MLP(2, [4, 1])
output = model([Value(1.0), Value(2.0)])

Architecture

  • Main API: forgeNN.Tensor, forgeNN.VectorizedMLP (production use)
  • Legacy API: forgeNN.legacy.* (educational purposes)
  • Functions: Complete activation and loss function library
  • Examples: example.py - Complete MNIST classification demo

Performance

Implementation Speed MNIST Accuracy
Vectorized 38,000+ samples/sec 93%+ in <2s

Highlights:

  • 100x+ speedup over scalar implementations
  • Production-ready performance with educational clarity
  • Memory efficient vectorized operations

Complete Example

See example.py for a full MNIST classification demo achieving professional results.

Links

Contributing

I am not currently accepting contributions, but I'm always open to suggestions and feedback!

Acknowledgments

  • Inspired by educational automatic differentiation tutorials
  • Built for both learning and production use
  • Optimized with modern NumPy practices
  • Available on PyPI: pip install forgeNN

Made with care for the ML community. Happy learning and building!

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

forgenn-1.0.1.tar.gz (35.4 kB view details)

Uploaded Source

Built Distribution

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

forgenn-1.0.1-py3-none-any.whl (27.6 kB view details)

Uploaded Python 3

File details

Details for the file forgenn-1.0.1.tar.gz.

File metadata

  • Download URL: forgenn-1.0.1.tar.gz
  • Upload date:
  • Size: 35.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for forgenn-1.0.1.tar.gz
Algorithm Hash digest
SHA256 af1cd1588e131889e86c806c1c80ee446c2f4a952487335599379c65393d7fe2
MD5 4739785100eaf54dc9d24767a8476391
BLAKE2b-256 286abd5151f07aa2ea0a1e825d06ca2be59746b232dfd04dcc0d5f92491c1a25

See more details on using hashes here.

File details

Details for the file forgenn-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: forgenn-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 27.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for forgenn-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 089d9ddb88d4d3217caf28295907223317859c0e587c99dd924034497624bf3b
MD5 9c4dd146979c4cca75f9f7f0c5a6ca7a
BLAKE2b-256 3f5ecc605cdb60cb17a140e76fcd865d92e0784c3d8e0d31b7e8e6eaf13436a7

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