code: def condentropy(px, py, pxpy=None, logbase=2):
      """
      Return the conditional entropy of X given Y.
  
      Parameters
      ----------
      px : array_like
      py : array_like
      pxpy : array_like, optional
          If pxpy is None, the distributions are assumed to be independent
          and conendtropy(px,py) = shannonentropy(px)
      logbase : int or np.e
  
      Returns
      -------
      sum_{kj}log(q_{j}/w_{kj}
  
      where q_{j} = Y[j]
      and w_kj = X[k,j]
      """
      if not _isproperdist(px) or not _isproperdist(py):
          raise ValueError(
              "px or py is not a proper probability distribution"
          )
      if pxpy is not None and not _isproperdist(pxpy):
          raise ValueError("pxpy is not a proper joint distribtion")
      if pxpy is None:
          pxpy = np.outer(py, px)
      condent = np.sum(pxpy * np.nan_to_num(np.log2(py / pxpy)))
      if logbase == 2:
          return condent
      else:
          return logbasechange(2, logbase) * condent
  
file_path: statsmodels/statsmodels/sandbox/infotheo.py
imports: from statsmodels.compat.python import lzip, lmap
  from scipy import stats
  import numpy
  from matplotlib import pyplot
  from scipy.special import logsumexp
label_desc: Use image node_id 9 for calling a global function with example usage: condentropy(px, py, pxpy, logbase) and returns: condent, unknown