Implements the neural network cost function for a two layer
neural network which performs classification