Training the neural network