added training alg to neural network