A really bodged job but now the neural net implementation agrees with
the logistic regression implementation. Of course we don't have
regularization so it's unlikely we will get convergence.