code: def dirichlet_log_evidence(q_dir, p_dir, r_dir):
      """
      Bayesian model reduction and log evidence calculations for Dirichlet hyperparameters
      This is a NumPY translation of the MATLAB function `spm_MDP_log_evidence.m` from the
      DEM package of spm.
  
      Description (adapted from MATLAB docstring)
      This function computes the negative log evidence of a reduced model of a
      Categorical distribution parameterised in terms of Dirichlet hyperparameters
      (i.e., concentration parameters encoding probabilities). It uses Bayesian model reduction
      to evaluate the evidence for models with and without a particular parameter.
      Arguments:
      ===========
      `q_dir` [1D np.ndarray]: sufficient statistics of posterior of full model
      `p_dir` [1D np.ndarray]: sufficient statistics of prior of full model
      `r_dir` [1D np.ndarray]: sufficient statistics of prior of reduced model
      Returns:
      ==========
      `F` [float]: free energy or (negative) log evidence of reduced model
      `s_dir` [1D np.ndarray]: sufficient statistics of reduced posterior
      """
  
      # change in free energy or log model evidence
      s_dir = q_dir + r_dir - p_dir
      F = (
          spm_betaln(q_dir)
          + spm_betaln(r_dir)
          - spm_betaln(p_dir)
          - spm_betaln(s_dir)
      )
  
      return F, s_dir
  
imports: import numpy
  from scipy import special
  from pymdp import utils
  from itertools import chain
label_desc: Use image node_id 13 for calling a global function with example usage: dirichlet_log_evidence(q_dir, p_dir, r_dir) and returns: F,  s_dir