implementation of neural network predict.