code: def _test_glm_intercept_vs_hardcoded_intercept(self, model):
      # If the model has an intercept (ModelCoxReg does not for instance)
      if hasattr(model, "fit_intercept"):
          # For the model with intercept only, test that
          if model.fit_intercept:
              X = model.features
              y = model.labels
              coeffs = np.random.randn(model.n_coeffs).astype(
                  self.dtype
              )
              grad1 = model.grad(coeffs)
  
              X_with_ones = np.hstack(
                  (X, np.ones((model.n_samples, 1)))
              ).astype(self.dtype)
              model.fit_intercept = False
              model.fit(X_with_ones, y)
              grad2 = model.grad(coeffs)
  
              np.testing.assert_almost_equal(
                  grad1, grad2, decimal=self.decimal_places
              )
  
              # Put back model to its previous status
              model.fit_intercept = True
              model.fit(X, y)
  
file_path: tick/tick/base_model/tests/generalized_linear_model.py
imports: import warnings
  import numpy
  from numpy.linalg import norm
  from scipy.optimize import check_grad, fmin_bfgs
  import unittest
label_desc: Use image node_id 4 for calling the TestGLM obj's underlying member method code with example usage: obj._test_glm_intercept_vs_hardcoded_intercept(model) without return types