Maji
Maji is a small neural-network framework built from scratch with NumPy. It started as a learning project based on the ideas in Neural Networks from Scratch, and this repository is the new home for growing it into a reusable framework.
The current code can build simple feed-forward models for classification, binary classification, and regression. The long-term direction is to grow the core into a clean, well-tested framework that can support deeper model families such as CNNs and transformers, with special attention to performance on Apple silicon.
Install for development
python -m venv .venv
source .venv/bin/activate
python -m pip install -e .
Install from PyPI
After the first release is published:
python -m pip install maji-nn
The PyPI distribution name is maji-nn, and the Python package import remains
maji:
import maji
Quick example
import numpy as np
from maji import (
Adam,
CategoricalAccuracy,
CategoricalCrossEntropyLoss,
DenseLayer,
Model,
ReLU,
Softmax,
)
x = np.array([[0.0, 0.0], [0.0, 1.0], [1.0, 0.0], [1.0, 1.0]])
y = np.array([0, 1, 1, 0])
model = Model()
model.add(DenseLayer(2, 8))
model.add(ReLU())
model.add(DenseLayer(8, 2))
model.add(Softmax())
model.set(
loss=CategoricalCrossEntropyLoss(),
optimizer=Adam(learning_rate=0.01),
accuracy=CategoricalAccuracy(),
)
model.finalize()
model.train(x, y, epochs=10, print_every=1)
What is included now
- Dense layers
- Dropout
- ReLU, Softmax, Sigmoid, and Linear activations
- Categorical cross entropy, binary cross entropy, mean squared error, and mean absolute error losses
- SGD, AdaGrad, RMSProp, and Adam optimizers
- Classification and regression accuracy helpers
- A sequential
ModelAPI with training, evaluation, and model/parameter persistence
Verify
python -m unittest discover -s tests -v
Release
Releases publish to PyPI through GitHub Actions and PyPI Trusted Publishing.
The PyPI project is maji-nn; the GitHub workflow is
.github/workflows/publish.yml; the GitHub environment is pypi.
To release:
git tag v0.1.0
git push origin v0.1.0
gh release create v0.1.0 --generate-notes
Roadmap
- Split the current single-file core into focused modules
- Improve numerical stability and API consistency
- Add benchmarks for NumPy and Apple silicon acceleration paths
- Add convolutional layers
- Add transformer building blocks
- Add documentation and example notebooks
License
No license has been selected yet. Choose a license before publishing Maji for broad reuse.
Metadata
Release files for maji-nn 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| maji_nn-0.1.0.tar.gz | 11.7 kB | With provenance | Details for maji_nn-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| maji_nn-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for maji_nn-0.1.0-py3-none-any.whl |
Total release size: 21.1 kB
Release files / maji_nn-0.1.0.tar.gz
| Download URL | maji_nn-0.1.0.tar.gz |
|---|---|
| Size | 11.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a0c10bf11c5ef55982333749e3cbdf6a51fc613e56e6f94a3fac514fcc9b1431
|
|
BLAKE2b-256 checksum How to use checksums |
3b0b99168283784a4c2773fd90a288e4f853512b01fe6aa7fe968b72b8a9aa93
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 24, 2026.
Transparency logRelease files / maji_nn-0.1.0-py3-none-any.whl
| Download URL | maji_nn-0.1.0-py3-none-any.whl |
|---|---|
| Size | 9.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1505024b1abef52c23cc96e078119e123939f940eca38b35e387d9c7cf9bc966
|
|
BLAKE2b-256 checksum How to use checksums |
7cba82c18d774f1ba4d6638deb6ea5b4b3d6ffe0024d446b7e606a16beef0346
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 24, 2026.
Transparency logSecurity for maji-nn 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for maji_nn-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 24, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.