code: def init(cls):
      nobs = cls.nobs
      y_true, x, exog = cls.y_true, cls.x, cls.exog
      if not hasattr(cls, "scale"):
          scale = 1
      else:
          scale = cls.scale
  
      f = cls.family
  
      cls.mu_true = mu_true = f.link.inverse(y_true)
  
      np.random.seed(8765993)
      # Discrete distributions do not take `scale`.
      try:
          y_obs = cls.rvs(mu_true, scale=scale, size=nobs)
      except TypeError:
          y_obs = cls.rvs(mu_true, size=nobs)
  
      m = GAM(
          y_obs, x, family=f
      )  # TODO: y_obs is twice __init__ and fit
      m.fit(y_obs, maxiter=100)
      res_gam = m.results
      cls.res_gam = res_gam  # attached for debugging
      cls.mod_gam = m  # attached for debugging
  
      res_glm = GLM(y_obs, exog, family=f).fit()
  
      # Note: there still are some naming inconsistencies
      cls.res1 = res1 = Dummy()  # for gam model
      # res2 = Dummy() #for benchmark
      cls.res2 = (
          res2
      ) = res_glm  # reuse existing glm results, will add additional
  
      # eta in GLM terminology
      res2.y_pred = res_glm.model.predict(
          res_glm.params, exog, which="linear"
      )
      res1.y_pred = res_gam.predict(x)
      res1.y_predshort = res_gam.predict(x[:10])  # , linear=True)
  
      # mu
      res2.mu_pred = res_glm.model.predict(
          res_glm.params, exog, which="mean"
      )
      res1.mu_pred = res_gam.mu
  
      # parameters
      slopes = [i for ss in m.smoothers for i in ss.params[1:]]
      const = res_gam.alpha + sum([ss.params[1] for ss in m.smoothers])
      res1.params = np.array([const] + slopes)
  
imports: from statsmodels.compat.python import lrange
  import numpy
  from numpy.testing import assert_almost_equal, assert_equal
  from scipy import stats
  import pytest
  from statsmodels.sandbox.gam import AdditiveModel
  from statsmodels.sandbox.gam import Model
  from statsmodels.genmod.families import family, links
  from statsmodels.genmod.generalized_linear_model import GLM
  from statsmodels.regression.linear_model import OLS
label_desc: Use image node_id 1 for calling the BaseGAM obj's underlying member method code with example usage: obj.init(cls) without return types