Skip to content

My first attempt at creating a completely vanilla java neural network. Inspiration from nnfs.

License

Notifications You must be signed in to change notification settings

AidenFavish/JavaNeuralNetwork

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contributors Forks Stargazers Issues MIT License


Logo

Java Neural Network

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
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgments

About The Project

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.

(back to top)

Getting Started

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.

Installation

  1. Download the jar files or the classes individually to get started
  2. Import the jar files or classes into your project and start working
  3. Getting started with the model class will be the easiest way to start learning the network syntax.
  4. Use our JavaDoc

(back to top)

Usage

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

(back to top)

Roadmap

  • 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).

(back to top)

Contributing

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!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact

Aiden Favish - Twitter: @AidenFavish

Project Link: https://github.com/AidenFavish/JavaNeuralNetwork

(back to top)

Acknowledgments

(back to top)

About

My first attempt at creating a completely vanilla java neural network. Inspiration from nnfs.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages