code: def kl_gamma_distribution(b_q, c_q, b_p, c_p):
      """
      KL Divergence between two gamma distributions
  
      q(x) = Gamma(x; b_q, c_q)
      p(x) = Gamma(x; b_p, c_p)
      """
      result = (
          (b_q - b_p) * digamma(b_q)
          - gammaln(b_q)
          + gammaln(b_p)
          + b_p * (np.log(c_q) - np.log(c_p))
          + b_q * (c_p - c_q) / c_q
      )
      assert result >= 0, result
      return result
  
file_path: hmmlearn/lib/hmmlearn/_kl_divergence.py
imports: import numpy
  from scipy.special import gammaln, digamma
  from .None import _utils
label_desc: Use image node_id 4 for calling a global function with example usage: kl_gamma_distribution(b_q, c_q, b_p, c_p) and returns: result