#fpr,tpr = plotting.plot_roc_curve(X_total_test,y_total_test,clf) #plotting.print_roc_report(fpr,tpr) #plt.show() #plt.bar(range(len(clf.feature_importances_)), clf.feature_importances_) #plt.savefig(utils.IO.plotFolder+outTag+"importance1.eps") #plt.show() # xgb.plot_importance(clf) plt.savefig(utils.IO.plotFolder + outTag + "importance2.eps") #plt.show() fpr_dipho_2ndtest_2, tpr_dipho_2ndtest_2 = plotting.plot_roc_curve_multiclass_singleBkg( X_total_test, y_total_test, clf, -1, 1, outTag + "test_xgbr_diphotons", weights=w_total_test) plotting.print_roc_report(fpr_dipho_2ndtest_2, tpr_dipho_2ndtest_2, outString=outTag + "test_xgbr_diphotons") plt.savefig(utils.IO.plotFolder + outTag + "test_xgbr_diphotons.eps") #plt.show() fpr_gJets_2ndtest_2, tpr_gJets_2ndtest_2 = plotting.plot_roc_curve_multiclass_singleBkg( X_total_test, y_total_test, clf, -2, 1, outTag + "test_xgbr_gJets",
import matplotlib as mpl #if os.environ.get('DISPLAY','') == '': # print('no display found. Using non-interactive Agg backend') mpl.use('Agg') import plotting_utils as plotting reload(plotting) import numpy as np import matplotlib.pyplot as plt reload(plt) #test #fpr_gJ,tpr_gJ = plotting.plot_roc_curve_multiclass_singleBkg(X_total_test,y_total_test,loaded_model,-1,outString="test_xgb_diphotons",weights=w_total_test) #plt.savefig(utils.IO.plotFolder+"test_xgb_diphotons.eps") ##plt.show() fpr_dipho,tpr_dipho = plotting.plot_roc_curve_multiclass_singleBkg(X_total_test,y_total_test,loaded_model,-2,outString="test_xgb_gJets",weights=w_total_test) plt.savefig(utils.IO.plotFolder+"test_xgb_gJets.eps") curve_roc = np.array([fpr_dipho, tpr_dipho]) np.savetxt('roc_test_dipho.txt', curve_roc) #plt.show() #train #fpr_gJ_train,tpr_gJ_train = plotting.plot_roc_curve_multiclass_singleBkg(X_total_train,y_total_train,loaded_model,-1,outString="train_xgb_diphotons",weights=w_total_test) #plt.savefig(utils.IO.plotFolder+"train_xgb_diphotons.eps") ##plt.show() #fpr_dipho_train,tpr_dipho_train = plotting.plot_roc_curve_multiclass_singleBkg(X_total_train,y_total_train,loaded_model,-2,outString="train_xgb_gJets",weights=w_total_test) #plt.savefig(utils.IO.plotFolder+"train_xgb_gJets.eps") #plt.show() print utils.IO.plotFolder print "Finish"