TinyNN4J is a Java library for implementing Neural Networks into your projects
Download the jar file and add it to your build path. To use with Processing3, simply drag the jar file into the Processing editor.
//(number of inputs, number of nodes in hidden layer, number of outputs)
NeuralNetwork nn = new NeuralNetwork(3,5,1);
nn.setActivationFunction("RELU"); //default is SIGMOID
nn.setLearningRate(0.01f); //default is 0.1f
//3 inputs and 1 output
float[] trainingInputs = {1.0,2.0,3.0};
float[] trainingOutputs = {0.5};
nn.train(trainingInputs,trainingOutputs);
float[] testData = {1.1,2.1,3.1};
//output will be a float[] with size equal to the number of output nodes
float outputs[] = n.predict(testData);
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Make Your Own Neural Network by Tariq Rashid