plt.ylabel('TPR', fontsize=14) plt.title('AUC = ' + str(auc), fontsize=14) plt.savefig('ROC_curve.png') plt.close() # Plot TPR and FPR vs decision threshold (dt) plt.plot(dt[1:], fpr[1:], label='FPR') plt.plot(dt[1:], tpr[1:], label='TPR') plt.xlabel('decision thresh.', fontsize=14) plt.ylabel('metric', fontsize=14) plt.legend(loc='best') plt.savefig('TPR_FPR_vs_dt.png') plt.close() # Create TPR/FPR vs. pt pt, eff, faker, err_eff, err_faker = get_eff_faker_vs_feat( 'pt', pt_test, X_test_bin, y_test, clf_GBDT) plt.errorbar(pt, eff, yerr=err_eff, linestyle='None', fmt='.') plt.xlabel('p$_{T}$ (GeV/c)', fontsize=14) plt.ylabel('TPR', fontsize=14) plt.savefig('TPR_vs_pt.png') plt.close() plt.errorbar(pt, faker, yerr=err_faker, linestyle='None', fmt='.') plt.xlabel('p$_{T}$ (GeV/c)', fontsize=14) plt.ylabel('FPR', fontsize=14) plt.savefig('FPR_vs_pt.png') plt.close() # Create TPR/FPR vs. eta pt, eff, faker, err_eff, err_faker = get_eff_faker_vs_feat(
plt.plot(fpr, tpr) plt.xlabel('FPR', fontsize=14) plt.ylabel('TPR', fontsize=14) plt.title('AUC = ' + str(auc), fontsize=14) plt.savefig('ROC_curve.png') # Plot TPR and FPR vs decision threshold (dt) plt.plot(dt[1:], fpr[1:], label='FPR') plt.plot(dt[1:], tpr[1:], label='TPR') plt.xlabel('decision thresh.', fontsize=14) plt.ylabel('metric', fontsize=14) plt.legend(loc='best') plt.savefig('TPR_FPR_vs_dt.png') # Create TPR/FPR vs. pt pt, eff, faker, err_eff, err_faker = get_eff_faker_vs_feat( 'pt', features, X_test, y_test, clf_GBDT) plt.errorbar(pt, eff, yerr=err_eff, linestyle='None', fmt='.') plt.xlabel('p$_{T}$ (GeV/c)', fontsize=14) plt.ylabel('TPR', fontsize=14) plt.savefig('TPR_vs_pt.png') plt.errorbar(pt, faker, yerr=err_faker, linestyle='None', fmt='.') plt.xlabel('p$_{T}$ (GeV/c)', fontsize=14) plt.ylabel('FPR', fontsize=14) plt.savefig('FPR_vs_pt.png') # Create TPR/FPR vs. eta pt, eff, faker, err_eff, err_faker = get_eff_faker_vs_feat( 'eta', features, X_test, y_test, clf_GBDT)