Computes the logistic loss and gradient.

after """ on the line above