Fixed IndexOutOfBounds bug in the neural network training method and added accuracy calculation.