comp_preds_bkg.extend(output.T) comp_true_bkg.extend(batchY) # plot the comparison to the truth scatter(comp_preds, comp_true, [0.0, 1.00], [0.0, 1.00], "Prediction", "Truth", "Approximation comparison", "plots/approx_vs_truth_deep_fromLoad.pdf") comp_preds = [d.item(0) for d in comp_preds] difflist = [(p - t) for p, t in zip(comp_preds, comp_true) if (math.fabs(p - t) < 0.0001)] comp_preds_bkg = [d.item(0) for d in comp_preds_bkg] difflist_bkg = [(p - t) for p, t in zip(comp_preds_bkg, comp_true_bkg) if (math.fabs(p - t) < 0.0001)] hd_hist([difflist, difflist_bkg], 'plots/approx_vs_truth_diff.pdf', [-0.00005, 0.00005], [0.0, 1100.0], "Approx. difference", "Events", np.arange(-0.00005, 0.00005, 0.0001 / 350), ['signal', 'background']) # Training analysis f_in = open('training.pkl', 'rb') training = pickle.load(f_in) count = [n for n in range(len(training[0]))] # Plot loss history fig = plt.figure() plt.plot(count, training[0], '-') fig.suptitle("") plt.xlabel("Epoch") plt.ylabel("Loss") plt.savefig("plots/loss_history.pdf") plt.clf()
etabins = np.linspace(-4.0, 4.0, num=100) mbins = np.linspace(0.0, 200.0, num=100) ktbins = np.linspace(0.0, 100000.0, num=100) sig_data = joblib.load('../data/signal_data_gpd.p') bkg_data = joblib.load('../data/background_data_gpd.p') sig_data = sig_data[:2000] bkg_data = bkg_data[:2000] sig_eta = [e[0] for e in sig_data] sig_et = [e[1] for e in sig_data] sig_m = [e[2] for e in sig_data] sig_kt = [e[3] for e in sig_data] bkg_eta = [e[0] for e in bkg_data] bkg_et = [e[1] for e in bkg_data] bkg_m = [e[2] for e in bkg_data] bkg_kt = [e[3] for e in bkg_data] hd_hist([sig_et, bkg_et], 'plots_gpd/et_comp_gpd.pdf', [20.0, 400.0], [0.0, 600.0], "$E_{T}$ GeV", "Events", etbins, ['signal', 'background']) hd_hist([sig_eta, bkg_eta], 'plots_gpd/eta_comp_gpd.pdf', [-4.0, 4.0], [0.0, 100.0], "$\eta$", "Events", etabins, ['signal', 'background']) hd_hist([sig_m, bkg_m], 'plots_gpd/m_comp_gpd.pdf', [0.0, 100.0], [0.0, 600.0], "Mass [GeV]", "Events", mbins, ['signal', 'background']) hd_hist([sig_kt, bkg_kt], 'plots_gpd/kt_comp_gpd.pdf', [0.0, 100000.0], [0.0, 1000.0], "$K_{T}$", "Events", ktbins, ['signal', 'background'])
es, rb, nSig, nBKG = scanPoint(s, comp_true, comp_true_bkg) xvals_orig.append(rb) yvals_orig.append(es) xvals_drone.append(xvals_drone_inner) yvals_drone.append(yvals_drone_inner) # Plot fig = plt.figure() for p, q in zip(xvals_drone, yvals_drone): plt.plot(p, q, '-b') plt.plot(xvals_orig, yvals_orig, '-r') fig.suptitle("") plt.ylabel("Signal efficiency") plt.xlabel("Background rejection") plt.savefig("plots_gpd/rocs.pdf") plt.clf() ''' comp_preds = [d.item(0) for d in comp_preds] difflist = [(p-t) for p, t in zip(comp_preds, comp_true) if (math.fabs(p-t) < 0.0001)] comp_preds_bkg = [d.item(0) for d in comp_preds_bkg] difflist_bkg = [(p-t) for p, t in zip(comp_preds_bkg, comp_true_bkg) if (math.fabs(p-t) < 0.0001)] print len(difflist) print len(difflist_bkg) hd_hist([difflist, difflist_bkg], 'plots_gpd/approx_vs_truth_diff.pdf' , [-0.00005, 0.00005], [0.0, 1100.0] , "Approx. difference", "Events", np.arange(-0.00005, 0.00005, 0.0001/350) , ['signal', 'background']) # Training analysis ************************************************************** f_in = open('training_gpd.pkl', 'rb') training = pickle.load(f_in) count = [n for n in range(len(training[0]))]
sig_pt = [e[0] for e in sig_data] sig_eta = [e[1] for e in sig_data] sig_minPT = [e[2] for e in sig_data] sig_maxPT = [e[3] for e in sig_data] sig_minETA = [e[4] for e in sig_data] sig_maxETA = [e[5] for e in sig_data] bkg_pt = [e[0] for e in bkg_data] bkg_eta = [e[1] for e in bkg_data] bkg_minPT = [e[2] for e in bkg_data] bkg_maxPT = [e[3] for e in bkg_data] bkg_minETA = [e[4] for e in bkg_data] bkg_maxETA = [e[5] for e in bkg_data] hd_hist([sig_pt, bkg_pt], 'plots/pt_comp.pdf' , [0.0, 10.0], [0.0, 1000.0] , "Mother $p_{T}$ GeV", "Events", ptbins , ['signal', 'background']) hd_hist([sig_eta, bkg_eta], 'plots/eta_comp.pdf' , [1.0, 6.0], [0.0, 400.0] , "Mother $\eta$", "Events", etabins , ['signal', 'background']) hd_hist([sig_minPT, bkg_minPT], 'plots/minpt_comp.pdf' , [0.0, 10.0], [0.0, 5000.0] , "min. $p_{T}$ GeV", "Events", ptbins , ['signal', 'background']) hd_hist([sig_minETA, bkg_minETA], 'plots/mineta_comp.pdf' , [1.0, 6.0], [0.0, 400.0] , "min. $\eta$", "Events", etabins