wrote the Neural network function