Completed Neural Network prediction function. End of ex4.