A completely vanilla Java Neural Network inspired by nnfs. Optimized for categorical inference. WORK IN PROGRESS.
Explore the docs »
View Demo
·
Report Bug
·
Request Feature
Table of Contents
import com.aidenfavish.javaNeuralNetwork.ActivationFunctions.ActivationELU;
import com.aidenfavish.javaNeuralNetwork.ActivationFunctions.ActivationReLU;
import com.aidenfavish.javaNeuralNetwork.Layers.LayerDense;
import com.aidenfavish.javaNeuralNetwork.Loss.ActivationSoftMaxCCE;
import com.aidenfavish.javaNeuralNetwork.Models.Model;
import com.aidenfavish.javaNeuralNetwork.Optimizers.AdamOptimizer;
/** All it takes to train and test a model
*
*/
public class Tester {
public static void main(String[] args) {
Model model = new Model("TesterModel", new AdamOptimizer(0.01f, (float) (5 * Math.pow(10, -5)), (float) (1 * Math.pow(10, -7)), 0.9f, 0.999f));
model.addLayer(new LayerDense(2, 8));
model.addLayer(new ActivationReLU());
model.addLayer(new LayerDense(8, 4));
model.addLayer(new ActivationELU());
model.addLayer(new LayerDense(4, 3));
model.addLayer(new ActivationSoftMaxCCE());
model.save("Models/TesterModel.json");
model = new Model("Models/TesterModel.json");
model.train(500, new float[][]{{0.1f, 0.1f}, {0.1f, 0.1f}}, new int[]{1, 1});
System.out.println(model.predict(new float[]{0.1f, 0.11f}));
}
}
The Java Neural Network is a project designed to help use complex machine learning processes that are often written in Python, in Java. This project helps explore the deep parts of neural networks to make very hands on changes. Efficiency is however not priority number 1 (because if it was you wouldn't be using Java), however multithreading and complex fast matrix operations are coming soon; more compatability and learning features are prioritized higher.
This is an example of how you may give instructions on setting up your project locally. To get a local copy up and running follow these simple example steps.
- Download the jar files or the classes individually to get started
- Import the jar files or classes into your project and start working
- Getting started with the model class will be the easiest way to start learning the network syntax.
- Use our JavaDoc
The Java Neural Network is perfect for training using Reinforcement Learning Techniques on your own custom Java environments. It has also been built to perform supervised learning with a wide variety of different options for optimizers and activation functions.
For more examples, please refer to the Documentation
- PPO
- A2C
- Evolution Learning
- More Activation Functions
- Easier inheritance to create custom activation functions
See the open issues for a full list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE.txt
for more information.
Aiden Favish - Twitter: @AidenFavish
Project Link: https://github.com/AidenFavish/JavaNeuralNetwork
- NNFS - https://nnfs.io/