code: def plot_cost(scores=np.random.rand(100), thresh=0.5, noise=0):
      
      c = pd.DataFrame(index=np.arange(0, 1, 0.01))
      if isinstance(thresh, (int, float)):
          thresh = [thresh]
      elif not isinstance(thresh, (pd.Series, np.ndarray, list, tuple)):
          thresh = np.arange(0, 1, .2)
      cost_fun.fun = spec_from_thresh
      for t in thresh:
          labels = (scores / t / scores.max() / 1.00001).astype(int)
          cost_fun.target = t
          c['target=0.{}'.format(int(t * 10))] = np.array([cost_fun(x, labels, scores, verbose=True) for x in c.index])
      c.plot()
      plt.show(block=False)
docs: Plot the cost function topology (contours for each of several targets)