docstr: ...Test that ModelHawkesExpKernLeastSq gradient is consistent
  with loss
docstr_tok: ["...","Test","that","ModelHawkesExpKernLeastSq","gradient","is","consistent","with","loss"]
code: def test_model_hawkes_varying_baseline_least_sq_grad(self):
      """...Test that ModelHawkesExpKernLeastSq gradient is consistent
      with loss
      """
      for model in [self.model, self.model_list]:
          model.period_length = 1.0
          model.n_baselines = 3
          coeffs = np.random.rand(model.n_coeffs)
  
          self.assertLess(
              check_grad(model.loss, model.grad, coeffs), 1e-5
          )
  
          coeffs_min = fmin_bfgs(
              model.loss, coeffs, fprime=model.grad, disp=False
          )
  
          self.assertAlmostEqual(
              norm(model.grad(coeffs_min)), 0.0, delta=1e-4
          )
  
imports: import pickle
  import unittest
  import numpy
  from numpy.linalg import norm
  from scipy.optimize import check_grad, fmin_bfgs
  from tick.base.inference import InferenceTest
  from tick.hawkes.model import ModelHawkesSumExpKernLeastSq
  from tick.hawkes.model.tests.model_hawkes_test_utils import hawkes_sumexp_kernel_intensities, hawkes_sumexp_kernel_varying_intensities, hawkes_least_square_error
label_desc: Use image node_id 11 for calling the Test obj's underlying member method code with example usage: obj.test_model_hawkes_varying_baseline_least_sq_grad() without return types