コード例 #1
0
dotesting = 0
docrossvalidation = 0
doRoCLearning = 0
doBoundary = 0
doBinarySearch = 0
ncores = -1

doRoCLearningGradBoostClass = 1  # mfaggin

##########################################################################################
# var_pt="pt_cand_ML"
# var_signal="signal_ML"
# path = "./plots/%.1f_%.1f_GeV"%(ptmin,ptmax)
# checkdir(path)

classifiers, names = getclassifiers()
mylistvariables = getvariablestraining(optionClassification)
mylistvariablesothers = getvariablesothers(optionClassification)
myvariablesy = getvariableissignal(optionClassification)
mylistvariablesx, mylistvariablesy = getvariablecorrelation(
    optionClassification)
mylistvariablesall = getvariablesall(optionClassification)

train_set = pd.read_pickle("../buildsample/trainsample%s.pkl" % (suffix))
test_set = pd.read_pickle("../buildsample/testsample%s.pkl" % (suffix))

X_train = train_set[mylistvariables]
y_train = train_set[myvariablesy]

X_test = test_set[mylistvariables]
y_test = test_set[myvariablesy]
                plotdir)
    scatterplot(train_set_ptsel_sig, train_set_ptsel_bkg, mylistvariablesx,
                mylistvariablesy, plotdir)
    correlationmatrix(train_set_ptsel_sig, plotdir, "signal")
    correlationmatrix(train_set_ptsel_bkg, plotdir, "background")

if (doStandard == 1):
    X_train = GetDataFrameStandardised(X_train)

if (doPCA == 1):
    n_pca = 5
    X_train, pca = GetPCADataFrameAndPC(X_train, n_pca)
    plotvariancePCA(pca, plotdir)

if (activateScikitModels == 1):
    classifiersScikit, namesScikit = getclassifiers()
    classifiers = classifiers + classifiersScikit
    names = names + namesScikit

if (activateKerasModels == 1):
    classifiersDNN, namesDNN = getclassifiersDNN(len(X_train.columns))
    classifiers = classifiers + classifiersDNN
    names = names + namesDNN

if (dotraining == 1):
    trainedmodels = fit(names, classifiers, X_train, y_train)
    savemodels(names, trainedmodels, output, suffix)

if (dotesting == 1):
    filenametest_set_ML = output + "/testsample%sMLdecision.pkl" % (suffix)
    filenametest_set_ML_root = output + "/testsample%sMLdecision.root" % (