code: def log_pdf(self, y, mu, weights=None):
          
          if weights is None:
              weights = np.ones_like(mu)
          # in Poisson regression weights are proportional to the exposure
          # so we want to pump up all our predictions
          # NOTE: we assume the targets are counts, not rate.
          # ie if observations were scaled to account for exposure, they have
          # been rescaled before calling this function.
          # since some samples have higher exposure,
          # they also need to have higher variance,
          # we do this by multiplying mu by the weight=exposure
          mu = mu * weights
          return sp.stats.poisson.logpmf(y, mu=mu)
docs: computes the log of the pdf or pmf of the values under the current distribution
  
          Parameters
          ----------
          y : array-like of length n
              target values
          mu : array-like of length n
              expected values
          weights : array-like shape (n,) or None, default: None
              containing sample weights
              if None, defaults to array of ones
  
          Returns
          -------
          pdf/pmf : np.array of length n