docstr: ...Test that multiple events list for ModelHawkesExpKernLeastSq
  is consistent with direct integral estimation
docstr_tok: ["...","Test","that","multiple","events","list","for","ModelHawkesExpKernLeastSq","is","consistent","with","direct","integral","estimation"]
code: def test_model_hawkes_least_sq_multiple_events(self):
      """...Test that multiple events list for ModelHawkesExpKernLeastSq
      is consistent with direct integral estimation
      """
      # precision of the integral approximation (and the corresponding
      # tolerance)
      precison = 1
  
      end_times = np.array(
          [max(map(max, e)) for e in self.timestamps_list]
      )
      end_times += 1.0
      self.model_list.fit(self.timestamps_list, end_times=end_times)
  
      intensities_list = [
          hawkes_sumexp_kernel_intensities(
              self.baseline, self.decays, self.adjacency, timestamps
          )
          for timestamps in self.timestamps_list
      ]
  
      integral_approx = sum(
          [
              hawkes_least_square_error(
                  intensities, timestamps, end_time, precision=precison
              )
              for (intensities, timestamps, end_time) in zip(
                  intensities_list,
                  self.timestamps_list,
                  self.model_list.end_times,
              )
          ]
      )
  
      integral_approx /= self.model_list.n_jumps
      self.assertAlmostEqual(
          integral_approx,
          self.model_list.loss(self.coeffs),
          places=precison,
      )
  
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 6 for calling the Test obj's underlying member method code with example usage: obj.test_model_hawkes_least_sq_multiple_events() without return types