So, now that we've covered ND4J, we want to actually create our neural network. So let's start with the famous XOR example, which actually trains a neural network for learning XOR.
Let's first generate some training data inline:
/* * list off input values, 4 training samples with data for 2 input-neurons each */ var input: INDArray = Nd4j.zeros(4, 2) /* * correspondending list with expected output values, 4 training samples with * data for 2 output-neurons each */ var labels: INDArray = Nd4j.zeros(4, 2); /* * create first dataset when first input=0 and second input=0 */ input.putScalar(Array(0, 0), 0); input.putScalar(Array(0, 1), 0); /* * then the first output fires for false, and the second is 0 (see class comment) */ ...