code: public static double deriv(double pred, double y)
      {
          final double x = y * pred;
          if (x >= 30)
              return 0;
          else if (x <= -30)
              return y;
  
          return -y / (1 + exp(y * pred));
      }
docs: Computes the first derivative of the logistic loss
  
  @param pred the predicted value
  @param y the true value
  @return the first derivative of the logistic loss