Beispiel #1
0
#multiGPU = True
#if os.environ["CUDA_VISIBLE_DEVICES"] in ["0", "1","2","3"]:
#  multiGPU = False

#directory name
configDir = '../'
weightDir = 'training/' + era + '/reco' + ch
scoreDir = era + '/score' + ch
assignDir = era + '/assign' + ch

#Options for data preparation
input_files = []
input_features = []
signal_label = gen_label(ch)
input_files.extend(train_files(ch, era))
input_features.extend(input_variables(ch))
input_features.append('genMatch')

label_name = 'genMatch'
bkg_drop_rate = 0.0
train_test_rate = 0.8
plot_figures = True
mass_name = "jet12m"
mass_decorr = False
sklearn_based_overtraining_check = False  #If it set to false, directly plot DNN scores

#Check if the model and files already exist
if not os.path.exists(os.path.join(configDir, weightDir + ver)):
    os.makedirs(os.path.join(configDir, weightDir + ver))
if not os.path.exists(os.path.join(configDir, scoreDir + ver)):
    os.makedirs(os.path.join(configDir, scoreDir + ver))
Beispiel #2
0
label_name = 'label'
weight_name = 'EventWeight'
weight_name_modi = 'SampleWeight'
njets_cut = int(jetcat[1:2]) #Must be jXbX
if njets_cut not in [3,4]:
  print("Check jet category")
  sys.exit()
if len(jetcat) > 3:
  nbjets_cut = int(jetcat[3:4])
  if nbjets_cut not in [2,3,4]:
    print("Check b jet category")
    sys.exit()
else: nbjets_cut = 0

input_features = []
if all_features: input_features.extend(input_variables(jetcat))
else:
  try: input_features.extend(input_selected_bdt(ch, jetcat, era))
  except: input_features.extend(input_variables(jetcat))
input_features.append(label_name)

sig_files, bkg_files = train_files(ch, era)
if not input_only:
  scaleST, scaleTT, scaleTTLJ, scaleTTLL, frac_sig, frac_bkg = evalScale(ch, era, sig_files, bkg_files)
else: scaleST=1.0; scaleTT=1.0; scaleTTLJ=1.0; scaleTTLL=1.0; frac_sig=1.0; frac_bkg=1.0
#input_features.remove('STTT')
#input_features.remove('channel')

import tensorflow as tf
from keras.backend.tensorflow_backend import set_session
config = tf.ConfigProto()
Beispiel #3
0
                trainB.Draw('hist same')
                testS.Draw('ep same')
                testB.Draw('ep same')
                label.Draw('same')
                label2.Draw('same')
                l.Draw('same')
                testS.Draw('axis same')
                c1.Print(era + '/bdt_plots/' + i + '/overtrain_' + ch + '_' +
                         jetcat + '_' + method + '.pdf')
                l.Clear()
                label2.Clear()
                c1.Clear()

            #Correlation part
            axislabel = []
            axislabel.extend(input_variables(jetcat))

            corrS.SetTitle('')
            for i in range(0, len(axislabel)):
                corrS.GetXaxis().LabelsOption("v")
            corrS.GetXaxis().SetLabelSize(0.02)
            corrS.GetYaxis().SetLabelSize(0.02)
            corrS.GetZaxis().SetLabelSize(0.02)
            corrS.GetXaxis().SetLabelOffset(0.002)
            corrS.GetYaxis().SetLabelOffset(0.002)
            c1.SetGrid(1, 1)
            corrS.Draw('colz')
            label.Draw('same')
            #c1.Print(era+'bdt_plots/' + i + '/corr_'+ch+'_'+jetcat+'_sig.pdf')
            c1.Clear()