code: def hawkes_log_likelihood(
      intensities, timestamps, end_time, precision=3
  ):
      dim = len(timestamps)
  
      compensator = sum(
          [
              quad(
                  lambda x, i=i: intensities[i](x),
                  0,
                  end_time,
                  epsabs=np.power(10.0, -precision),
                  limit=1000,
              )[0]
              for i in range(dim)
          ]
      )
  
      log_intensity = sum(
          [
              sum([np.log(intensities[i](t)) for t in timestamps[i]])
              for i in range(dim)
          ]
      )
  
      return dim * end_time - compensator + log_intensity
  
file_path: tick/tick/hawkes/model/tests/model_hawkes_test_utils.py
imports: import numpy
  from scipy.integrate import quad
label_desc: Use image node_id 6 for calling a global function with example usage: hawkes_log_likelihood(intensities, timestamps, end_time, precision) and returns: unknown