code: def test_gam_discrete():
      cur_dir = os.path.dirname(os.path.abspath(__file__))
      file_path = os.path.join(
          cur_dir, "results", "prediction_from_mgcv.csv"
      )
      data_from_r = pd.read_csv(file_path)
      # dataset used to train the R model
      x = data_from_r.x.values
      y = data_from_r.ybin.values
  
      df = [10]
      degree = [5]
      bsplines = BSplines(
          x, degree=degree, df=df, include_intercept=True
      )
  
      # y_mgcv is obtained from R with the following code
      # g = gam(y~s(x, k = 10, bs = "cr"), data = data, scale = 80)
      y_mgcv = data_from_r.ybin_est
  
      alpha = 0.00002
      # gp = UnivariateGamPenalty(alpha=alpha, univariate_smoother=bsplines)
      # lg_gam = LogitGam(y, bsplines.basis, penal=gp)
      #
      lg_gam = LogitGam(y, bsplines, alpha=alpha)
      res_lg_gam = lg_gam.fit(maxiter=10000)
      y_gam = np.dot(bsplines.basis, res_lg_gam.params)
      y_gam = sigmoid(y_gam)
      y_mgcv = sigmoid(y_mgcv)
  
      # plt.plot(x, y_gam, label='gam')
      # plt.plot(x, y_mgcv, label='mgcv')
      # plt.plot(x, y, '.', label='y')
      # plt.ylim(-0.4, 1.4)
      # plt.legend()
      # plt.show()
  
      assert_allclose(y_gam, y_mgcv, rtol=1.0e-10, atol=1.0e-1)
  
imports: import os
  import numpy
  from numpy.testing import assert_allclose
  import pandas
  from scipy.linalg import block_diag
  import pytest
  from statsmodels.tools.linalg import matrix_sqrt
  from statsmodels.gam.smooth_basis import UnivariatePolynomialSmoother, PolynomialSmoother, BSplines, GenericSmoothers, UnivariateCubicSplines, CyclicCubicSplines
  from statsmodels.gam.generalized_additive_model import GLMGam, LogitGam, make_augmented_matrix, penalized_wls
  from statsmodels.gam.gam_cross_validation.gam_cross_validation import MultivariateGAMCV, MultivariateGAMCVPath, _split_train_test_smoothers
  from statsmodels.gam.gam_penalties import UnivariateGamPenalty, MultivariateGamPenalty
  from statsmodels.gam.gam_cross_validation.cross_validators import KFold
  from statsmodels.genmod.generalized_linear_model import GLM
  from statsmodels.genmod.families.family import Gaussian
  from statsmodels.genmod.generalized_linear_model import lm
label_desc: Use image node_id 11 for calling a global function with example usage: test_gam_discrete() without return types