code: public double gammaNum(double w, double y, double z, double f) {
      switch (distribution) {
        case gaussian:
        case bernoulli:
        case quasibinomial:
        case multinomial:
          return w * z;
        case poisson:
          return w * y;
        case gamma:
          return w * (z+1); //z+1 == y*exp(-f)
        case tweedie:
          return w * y * exp(f*(1- tweediePower));
        case modified_huber:
          double yf = (2*y-1)*f;
          if (yf < -1) return w*4*(2*y-1);
          else if (yf > 1) return 0;
          else return w*2*(2*y-1)*(1-yf);
        default:
          throw H2O.unimpl();
      }
    }
docs: Contribution to numerator for GBM's leaf node prediction
  @param w weight
  @param y response
  @param z residual
  @param f predicted value (including offset)
  @return weighted contribution to numerator