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