A simple neural network library built from scratch using NumPy
Project description
myneuralnet
A simple, lightweight neural network library built from scratch using NumPy.
This project is designed for educational purposes to help understand how neural networks work under the hood — without relying on high-level frameworks like TensorFlow or PyTorch.
🚀 Features
- Fully connected feedforward neural network
- Supports custom architectures (you define number of layers and neurons)
- Activation functions: ReLU, Sigmoid, Softmax, Linear (more can be added)
- Forward propagation & backpropagation
- MSE loss for regression tasks (you can extend to classification easily)
- Training with gradient descent
- Designed to be minimal and beginner-friendly
📦 Installation
Once you’ve built your package, you can install it locally using:
pip install -e .
🧠 Example Usage
from myneuralnet.network import NeuralNetwork
from myneuralnet.layers import Layer
# Create a network
net = NeuralNetwork()
net.add(Layer(units=4, activation_function="relu", input_dim=2))
net.add(Layer(units=4, activation_function="relu"))
net.add(Layer(units=1)) # No activation = linear for regression
# Train
net.train(X_train, y_train, epochs=1000)
# Predict
predictions = net.predict(X_test)
📁 Project Structure
myneuralnet/
│
├── network.py # NeuralNetwork class: manages training, prediction
├── layers.py # Layer class: handles weights, activation, backprop
├── activations.py # Activation functions and their derivatives
├── utils.py # Utility functions (e.g., loss, metrics)
├── __init__.py # Makes the folder a Python package
🧪 Dependencies
- numpy
📈 Future Improvements
- Add support for classification with softmax & cross-entropy
- Include optimizers like Adam or Momentum
- Add regularization (L2, dropout)
- Save/load trained models
- Add unit tests
📄 License
This project is licensed under the MIT License. See the LICENSE file for details.
Made with ❤️ by Om Asanani
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file myneuralnet-0.1.0.tar.gz.
File metadata
- Download URL: myneuralnet-0.1.0.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
477fc45c7ceaa7f4761c7adc9bcf2bcedb06b34f7b887d99c8a30015962f7c08
|
|
| MD5 |
9e602a3fbd283d4bb437da07b450e9b0
|
|
| BLAKE2b-256 |
bb6deab5e2ad6097451951c7087fe4178e91d03c501c86aa523bfea9adc2e363
|
File details
Details for the file myneuralnet-0.1.0-py3-none-any.whl.
File metadata
- Download URL: myneuralnet-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d4fef2f31c9cd575af985ff3c645aaa143032de4bfe24948d3682652f9a3f4ad
|
|
| MD5 |
d3ca3d62d1ec1e2a77d04b3eda030e79
|
|
| BLAKE2b-256 |
ab3b4cad57e144b2d935c76439227f1a67319336fd610677d3debb7ab043a589
|