code: def cross_entropy_calc(TOP, P, POP):
      """
      Calculate Cross entropy.
  
      :param TOP: number of positives in predict vector per class
      :type TOP: dict
      :param P: number of actual positives per class
      :type P: dict
      :param POP: population or total number of samples per class
      :type POP: dict
      :return: cross entropy as float
      """
      try:
          result = 0
          for i in TOP.keys():
              reference_likelihood = P[i] / POP[i]
              response_likelihood = TOP[i] / POP[i]
              if response_likelihood != 0 and reference_likelihood != 0:
                  result += reference_likelihood * math.log(
                      response_likelihood, 2
                  )
          return -result
      except Exception:
          return "None"
  
imports: from __future__ import division
  import math
  import operator
  from functools import reduce
  from .pycm_interpret import *
  from .pycm_ci import kappa_SE_calc, CI_calc, SE_calc
  from .pycm_util import complement
label_desc: Use image node_id 24 for calling a global function with example usage: cross_entropy_calc(TOP, P, POP) and returns: unknown, str