code: def d3logpdf_dlink3(self, inv_link_f, y, Y_metadata=None):
          
          assert np.atleast_1d(inv_link_f).shape == np.atleast_1d(y).shape
          #d3logpdf_dlink3 = 2*(y/(inv_link_f**3) - (1-y)/((1-inv_link_f)**3))
          state = np.seterr(divide='ignore')
          # TODO check y \in {0, 1} or {-1, 1}
          d3logpdf_dlink3 = np.where(y==1, 2./(inv_link_f**3), -2./((1.-inv_link_f)**3))
          np.seterr(**state)
          return d3logpdf_dlink3
docs: Third order derivative log-likelihood function at y given inverse link of f w.r.t inverse link of f
  
          .. math::
              \\frac{d^{3} \\ln p(y_{i}|\\lambda(f_{i}))}{d^{3}\\lambda(f)} = \\frac{2y_{i}}{\\lambda(f)^{3}} - \\frac{2(1-y_{i}}{(1-\\lambda(f))^{3}}
  
          :param inv_link_f: latent variables passed through 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: third derivative of log likelihood evaluated at points inverse_link(f)
          :rtype: Nx1 array