code: def dlogpdf_dlink(self, inv_link_f, y, Y_metadata=None):
          
          #grad = (y/inv_link_f) - (1.-y)/(1-inv_link_f)
          #grad = np.where(y, 1./inv_link_f, -1./(1-inv_link_f))
          ff = np.clip(inv_link_f, 1e-9, 1-1e-9)
          denom = np.where(y==1, ff, -(1-ff))
          return 1./denom
docs: Gradient of the pdf at y, given inverse link of f w.r.t inverse link of f.
  
          .. math::
              \\frac{d\\ln p(y_{i}|\\lambda(f_{i}))}{d\\lambda(f)} = \\frac{y_{i}}{\\lambda(f_{i})} - \\frac{(1 - y_{i})}{(1 - \\lambda(f_{i}))}
  
          :param inv_link_f: latent variables inverse link of f.
          :type inv_link_f: Nx1 array
          :param y: data
          :type y: Nx1 array
          :param Y_metadata: Y_metadata not used in bernoulli
          :returns: gradient of log likelihood evaluated at points inverse link of f.
          :rtype: Nx1 array