code: def completeness_contamination(predicted, true):
      """Compute the completeness and contamination values
  
      Parameters
      ----------
      predicted_value, true_value : array_like
          integer arrays of predicted and true values.  This assumes that
          'false' values are given by 0, and 'true' values are nonzero.
  
      Returns
      -------
      completeness, contamination : float or array_like
          the completeness and contamination of the results.  shape is
          np.broadcast(predicted, true).shape[:-1]
      """
      predicted = np.asarray(predicted)
      true = np.asarray(true)
  
      outshape = np.broadcast(predicted, true).shape[:-1]
  
      predicted = np.atleast_2d(predicted)
      true = np.atleast_2d(true)
  
      matches = predicted == true
  
      tp = np.sum(matches & (true != 0), -1)
      fp = np.sum(~matches & (true == 0), -1)
      fn = np.sum(~matches & (true != 0), -1)
  
      tot = tp + fn
      tot[tot == 0] = 1
      completeness = tp * 1.0 / tot
  
      tot = tp + fp
      tot[tot == 0] = 1
      contamination = fp * 1.0 / tot
  
      completeness[np.isnan(completeness)] = 0
      contamination[np.isnan(contamination)] = 0
  
      return completeness.reshape(outshape), contamination.reshape(
          outshape
      )
  
file_path: astroML/astroML/utils/utils.py
imports: import numpy
  from scipy import linalg
  from sklearn.utils import check_random_state
  from astroML.utils.decorators import deprecated
  from astroML.utils.exceptions import AstroMLDeprecationWarning
label_desc: Use image node_id 5 for calling a global function with example usage: completeness_contamination(predicted, true) and returns: completeness,  contamination