code: def hawkes_least_square_error(
      intensities, timestamps, end_time, precision=3
  ):
      dim = len(timestamps)
  
      squared_intensity_integral = sum(
          [
              quad(
                  lambda x, i=i: intensities[i](x) ** 2,
                  0,
                  end_time,
                  epsabs=np.power(10.0, -precision),
                  limit=1000,
              )[0]
              for i in range(dim)
          ]
      )
  
      intensity_convolution = sum(
          [
              sum([intensities[i](t) for t in timestamps[i]])
              for i in range(dim)
          ]
      )
  
      return squared_intensity_integral - 2 * intensity_convolution
  
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 5 for calling a global function with example usage: hawkes_least_square_error(intensities, timestamps, end_time, precision) and returns: unknown