This project is licensed under the MIT License – see the LICENSE file for details.
Neuronix is a lightweight machine learning framework built from scratch in Java.
The goal of the project is to understand every part of neural networks by implementing them without external machine learning libraries.
- Matrix operations
- Dense neural networks
- Backpropagation
- MNIST dataset loader (IDX format)
- Model serialization (save/load)
- Mini-batch training with shuffling
- SGD and Momentum optimizers
- Cross-entropy and mean squared error losses
- Accuracy metric and evaluation
- Pure Java
The Main class trains a small network on MNIST and saves the model.
You need the four MNIST files from the official site:
./gradlew run --args="train <train-images> <train-labels> <test-images> <test-labels>"The model is written to neuronix.model.
Load a previously saved model and evaluate it on test data without retraining:
./gradlew run --args="predict <model-file> <test-images> <test-labels>"It prints the achieved test accuracy and a few sample predictions.
Feed one or more image files (PNG/JPG) to a trained model and get a prediction:
./gradlew run --args="predict-image <model-file> <image-file>..."The image is converted to 28×28 grayscale (inverted, centered like MNIST) before classification.
./gradlew checkRuns spotless (formatting), Checkstyle, PMD and the test suite.