class_docstr: This class is used for performing non parametric estimation of
  multi-dimensional Hawkes processes based on expectation
  maximization algorithm.
  
  Hawkes processes are point processes defined by the intensity:
  
  .. math::
      \forall i \in [1 \dots D], \quad
      \lambda_i = \mu_i + \sum_{j=1}^D \int \phi_{ij} dN_j
  
  where
  
  * :math:`D` is the number of nodes
  * :math:`\mu_i` are the baseline intensities
  * :math:`\phi_{ij}` are the kernels
  
  Parameters
  ----------
  kernel_support : `float`, default=`None`
      The support size common to all the kernels. Might be `None` if
      `kernel_discretization` is set
  
  kernel_size : `int`, default=10
      Number of discretizations of the kernel
  
  kernel_discretization : `np.ndarray`, default=None
      Explicit discretization of the kernel. If set, it will override
      `kernel_support` and `kernel_size` values.
  
  tol : `float`, default=1e-5
      The tolerance of the solver (iterations stop when the stopping
      criterion is below it). If not reached the solver does ``max_iter``
      iterations
  
  max_iter : `int`, default=100
      Maximum number of iterations of the solver
  
  verbose : `bool`, default=False
      If `True`, we verbose things, otherwise the solver does not
      print anything (but records information in history anyway)
  
  print_every : `int`, default=10
      Print history information when ``n_iter`` (iteration number) is
      a multiple of ``print_every``
  
  record_every : `int`, default=10
      Record history information when ``n_iter`` (iteration number) is
      a multiple of ``record_every``
  
  n_threads : `int`, default=1
      Number of threads used for parallel computation.
  
      * if `int <= 0`: the number of physical cores available on the CPU
      * otherwise the desired number of threads
  
  Attributes
  ----------
  n_nodes : `int`
      Number of nodes of the estimated Hawkes process
  
  n_realizations : `int`
      Number of given realizations
  
  kernel : `np.array` shape=(n_nodes, n_nodes, kernel_size)
      The estimated kernels
  
  baseline : `np.array` shape=(n_nodes)
      The estimated baseline
  
  References
  ----------
  Lewis, E., & Mohler, G. (2011).
  A nonparametric EM algorithm for multiscale Hawkes processes.
  `preprint, 1-16`_.
  
  The n-dimensional extension of this algorithm can be found in the latex
  documentation.
  
  .. _preprint, 1-16: http://paleo.sscnet.ucla.edu/Lewis-Molher-EM_Preprint.pdf
class_docstr_tok: ["This","class","is","used","for","performing","non","parametric","estimation","of","multi-dimensional","Hawkes","processes","based","on","expectation","maximization","algorithm",".","Hawkes","processes","are","point","processes","defined","by","the","intensity",":","..","math",":",":","\\forall","i","\\in","[","1","\\dots","D","]",",","\\quad","\\lambda_i","=","\\mu_i","+","\\sum_","{","j=1","}","^D","\\int","\\phi_","{","ij","}","dN_j","where","*",":","math",":","`","D","`","is","the","number","of","nodes","*",":","math",":","`","\\mu_i","`","are","the","baseline","intensities","*",":","math",":","`","\\phi_","{","ij","}","`","are","the","kernels","Parameters","--","--","--","--","--","kernel_support",":","`","float","`",",","default=","`","None","`","The","support","size","common","to","all","the","kernels",".","Might","be","`","None","`","if","`","kernel_discretization","`","is","set","kernel_size",":","`","int","`",",","default=10","Number","of","discretizations","of","the","kernel","kernel_discretization",":","`","np.ndarray","`",",","default=None","Explicit","discretization","of","the","kernel",".","If","set",",","it","will","override","`","kernel_support","`","and","`","kernel_size","`","values",".","tol",":","`","float","`",",","default=1e-5","The","tolerance","of","the","solver","(","iterations","stop","when","the","stopping","criterion","is","below","it",")",".","If","not","reached","the","solver","does","``","max_iter","``","iterations","max_iter",":","`","int","`",",","default=100","Maximum","number","of","iterations","of","the","solver","verbose",":","`","bool","`",",","default=False","If","`","True","`",",","we","verbose","things",",","otherwise","the","solver","does","not","print","anything","(","but","records","information","in","history","anyway",")","print_every",":","`","int","`",",","default=10","Print","history","information","when","``","n_iter","``","(","iteration","number",")","is","a","multiple","of","``","print_every","``","record_every",":","`","int","`",",","default=10","Record","history","information","when","``","n_iter","``","(","iteration","number",")","is","a","multiple","of","``","record_every","``","n_threads",":","`","int","`",",","default=1","Number","of","threads","used","for","parallel","computation",".","*","if","`","int","<","=","0","`",":","the","number","of","physical","cores","available","on","the","CPU","*","otherwise","the","desired","number","of","threads","Attributes","--","--","--","--","--","n_nodes",":","`","int","`","Number","of","nodes","of","the","estimated","Hawkes","process","n_realizations",":","`","int","`","Number","of","given","realizations","kernel",":","`","np.array","`","shape=","(","n_nodes",",","n_nodes",",","kernel_size",")","The","estimated","kernels","baseline",":","`","np.array","`","shape=","(","n_nodes",")","The","estimated","baseline","References","--","--","--","--","--","Lewis",",","E.",",","&","Mohler",",","G.","(","2011",")",".","A","nonparametric","EM","algorithm","for","multiscale","Hawkes","processes",".","`","preprint",",","1-16","`","_",".","The","n-dimensional","extension","of","this","algorithm","can","be","found","in","the","latex","documentation",".","..","_preprint",",","1-16",":","http",":","\/\/paleo.sscnet.ucla.edu\/Lewis-Molher-EM_Preprint.pdf"]
docstr: Compute score metric
  Score metric is log likelihood (the higher the better)
  
  Parameters
  ----------
  events : `list` of `list` of `np.ndarray`, default = None
      List of Hawkes processes realizations used to measure score.
      Each realization of the Hawkes process is a list of n_node for
      each component of the Hawkes. Namely `events[i][j]` contains a
      one-dimensional `numpy.array` of the events' timestamps of
      component j of realization i.
      If only one realization is given, it will be wrapped into a list
      If None, events given while fitting model will be used
  
  end_times : `np.ndarray` or `float`, default = None
      List of end time of all hawkes processes used to measure score.
      If None, it will be set to each realization's latest time.
      If only one realization is provided, then a float can be given.
  
  baseline : `np.ndarray`, shape=(n_nodes, ), default = None
      Baseline vector for which the score is measured
      If `None` baseline obtained during fitting is used
  
  kernel : `None` or `np.ndarray`, shape=(n_nodes, n_nodes, kernel_size), default=None
      Used to force start values for kernel parameter
      If `None` kernel obtained during fitting is used
  
  Returns
  -------
  likelihood : `double`
      Computed log likelihood value
docstr_tok: ["Compute","score","metric","Score","metric","is","log","likelihood","(","the","higher","the","better",")","Parameters","--","--","--","--","--","events",":","`","list","`","of","`","list","`","of","`","np.ndarray","`",",","default","=","None","List","of","Hawkes","processes","realizations","used","to","measure","score",".","Each","realization","of","the","Hawkes","process","is","a","list","of","n_node","for","each","component","of","the","Hawkes",".","Namely","`","events","[","i","]","[","j","]","`","contains","a","one-dimensional","`","numpy.array","`","of","the","events","'","timestamps","of","component","j","of","realization","i",".","If","only","one","realization","is","given",",","it","will","be","wrapped","into","a","list","If","None",",","events","given","while","fitting","model","will","be","used","end_times",":","`","np.ndarray","`","or","`","float","`",",","default","=","None","List","of","end","time","of","all","hawkes","processes","used","to","measure","score",".","If","None",",","it","will","be","set","to","each","realization","'s","latest","time",".","If","only","one","realization","is","provided",",","then","a","float","can","be","given",".","baseline",":","`","np.ndarray","`",",","shape=","(","n_nodes",",",")",",","default","=","None","Baseline","vector","for","which","the","score","is","measured","If","`","None","`","baseline","obtained","during","fitting","is","used","kernel",":","`","None","`","or","`","np.ndarray","`",",","shape=","(","n_nodes",",","n_nodes",",","kernel_size",")",",","default=None","Used","to","force","start","values","for","kernel","parameter","If","`","None","`","kernel","obtained","during","fitting","is","used","Returns","--","--","--","-","likelihood",":","`","double","`","Computed","log","likelihood","value"]
code: def score(
      self, events=None, end_times=None, baseline=None, kernel=None
  ):
      """Compute score metric
      Score metric is log likelihood (the higher the better)
  
      Parameters
      ----------
      events : `list` of `list` of `np.ndarray`, default = None
          List of Hawkes processes realizations used to measure score.
          Each realization of the Hawkes process is a list of n_node for
          each component of the Hawkes. Namely `events[i][j]` contains a
          one-dimensional `numpy.array` of the events' timestamps of
          component j of realization i.
          If only one realization is given, it will be wrapped into a list
          If None, events given while fitting model will be used
  
      end_times : `np.ndarray` or `float`, default = None
          List of end time of all hawkes processes used to measure score.
          If None, it will be set to each realization's latest time.
          If only one realization is provided, then a float can be given.
  
      baseline : `np.ndarray`, shape=(n_nodes, ), default = None
          Baseline vector for which the score is measured
          If `None` baseline obtained during fitting is used
  
      kernel : `None` or `np.ndarray`, shape=(n_nodes, n_nodes, kernel_size), default=None
          Used to force start values for kernel parameter
          If `None` kernel obtained during fitting is used
  
      Returns
      -------
      likelihood : `double`
          Computed log likelihood value
      """
      if events is None and not self._fitted:
          raise ValueError(
              "You must either call `fit` before `score` or "
              "provide events"
          )
  
      if events is None and end_times is None:
          learner = self
      else:
          learner = HawkesEM(**self.get_params())
          learner._set("_end_times", end_times)
          learner._set_data(events)
  
      n_nodes = learner.n_nodes
      kernel_size = learner.kernel_size
  
      if baseline is None:
          baseline = self.baseline
  
      if kernel is None:
          kernel = self.kernel
  
      flat_kernels = kernel.reshape((n_nodes, n_nodes * kernel_size))
  
      return learner._learner.loglikelihood(baseline, flat_kernels)
  
imports: from typing import List
  import numpy
  from tick.hawkes.inference.base import LearnerHawkesNoParam
  from tick.hawkes.inference.build.hawkes_inference import HawkesEM
  from tick.solver.base.utils import relative_distance
label_desc: Use image node_id 10 for calling the HawkesEM obj's underlying member method code with example usage: obj.score(events, end_times, baseline, kernel) and returns: learner