neural network regularized cost function