Ex 4: new neural network cost function solution