June 2017
Intermediate to advanced
744 pages
16h 41m
English
Now let's apply these classes and get some results. The following code has a test class, a main method with an object of the NeuralNet class called nn. We are going to define a simple neural network with two inputs, one output, and one hidden layer containing three neurons:
public class NeuralNetConsoleTest { public static void main(String[] args) { RandomNumberGenerator.seed=0; int numberOfInputs=2; int numberOfOutputs=1; int[] numberOfHiddenNeurons= { 3 }; IActivationFunction[] hiddenAcFnc = { new Sigmoid(1.0) } ; Linear outputAcFnc = new Linear(1.0); System.out.println("Creating Neural Network..."); NeuralNet nn = new NeuralNet(numberOfInputs,numberOfOutputs, numberOfHiddenNeurons,hiddenAcFnc,outputAcFnc); System.out.println("Neural ...Read now
Unlock full access