New neural network cost function