code: def _estimate_AIC(self, y, mu, weights=None):
          
          estimated_scale = not(self.distribution._known_scale) # if we estimate the scale, that adds 2 dof
          return -2*self._loglikelihood(y=y, mu=mu, weights=weights) + \
                  2*self.statistics_['edof'] + 2*estimated_scale
docs: estimate the Akaike Information Criterion
  
          Parameters
          ----------
          y : array-like of shape (n_samples,)
              output data vector
          mu : array-like of shape (n_samples,),
              expected value of the targets given the model and inputs
          weights : array-like shape (n_samples,) or None, optional
              containing sample weights
              if None, defaults to array of ones
  
          Returns
          -------
          None