Added prediction for Newton CG. Fixed cost and gradient. Added scipy import.