code: def ll_dirichlet(data1, data2):
      """The symmetric relative log likelihood of rolling data2 vs data1
      in n trials on a die that rolled data1 in sum(data1) trials.
  
      ..math::
          D(data1, data2) = DirichletMultinomail(data2 | data1)
      """
  
      n1 = np.sum(data1)
      n2 = np.sum(data2)
  
      log_b = 0.0
      self_denom1 = 0.0
      self_denom2 = 0.0
  
      for i in range(data1.shape[0]):
          if data1[i] * data2[i] > 0.9:
              log_b += log_beta(data1[i], data2[i])
              self_denom1 += log_single_beta(data1[i])
              self_denom2 += log_single_beta(data2[i])
  
          else:
              if data1[i] > 0.9:
                  self_denom1 += log_single_beta(data1[i])
  
              if data2[i] > 0.9:
                  self_denom2 += log_single_beta(data2[i])
  
      return np.sqrt(
          1.0
          / n2
          * (
              log_b
              - log_beta(n1, n2)
              - (self_denom2 - log_single_beta(n2))
          )
          + 1.0
          / n1
          * (
              log_b
              - log_beta(n2, n1)
              - (self_denom1 - log_single_beta(n1))
          )
      )
  
imports: import numba
  import numpy
  import scipy.stats
  from sklearn.metrics import pairwise_distances
label_desc: Use image node_id 42 for calling a global function with example usage: ll_dirichlet(data1, data2) and returns: np