[{'role': 'system', 'content': "You are an expert in machine learning and your task is to classify code snippets into one of the following categories: ['helper_functions', 'load_data', 'data_exploration', 'data_preprocessing', 'evaluation', 'modelling', 'prediction', 'result_visualization', 'save_results', 'comment_only']."}, {'role': 'user', 'content': 'Identify the single most appropriate category to which the provided code belongs. Provide your response as a single category label without any additional information, commentary, or personal opinions.\\nPython Code:"""\nFunction\n--------\ncalibration_plot\nBuilds a plot like the one above, from a classifier and review data\nInputs\n-------\nclf : Classifier object\nA MultinomialNB classifier\nX : (Nexample, Nfeature) array\nThe bag-of-words data\nY : (Nexample) integer array\n1 if a review is Fresh\n"""\ndef calibration_plot(clf, xtest, ytest):\nprob = clf.predict_proba(xtest)[:, 1]\noutcome = ytest\ndata = pd.DataFrame(dict(prob=prob, outcome=outcome))\nbins = np.linspace(0, 1, 20)\ncuts = pd.cut(prob, bins)\nbinwidth = bins[1] - bins[0]\ncal = data.groupby(cuts).outcome.agg([\'mean\', \'count\'])\ncal[\'pmid\'] = (bins[:-1] + bins[1:]) / 2\ncal[\'sig\'] = np.sqrt(cal.pmid * (1 - cal.pmid) / cal[\'count\'])\nax = plt.subplot2grid((3, 1), (0, 0), rowspan=2)\np = plt.errorbar(cal.pmid, cal[\'mean\'], cal[\'sig\'])\nplt.plot(cal.pmid, cal.pmid, linestyle=\'--\', lw=1, color=\'k\')\nplt.ylabel("Empirical P(Fresh)")\nax = plt.subplot2grid((3, 1), (2, 0), sharex=ax)\nplt.bar(left=cal.pmid - binwidth / 2, height=cal[\'count\'],\nwidth=.95 * (bins[1] - bins[0]),\nfc=p[0].get_color())\nplt.xlabel("Predicted P(Fresh)")\nplt.ylabel("Number")'}, {'role': 'assistant', 'content': 'result_visualization'}]