Exemple #1
0
    batch_size=4096,
    n_epochs=n_epochs,
    x=x,
    y=y,
    x0=x0,
    x1=x1,
    scale_inputs=True,
    #early_stopping = True,
    #early_stopping_patience = 10
)

loss_out_path = model_out_path + "/loss"
directory = os.path.dirname(loss_out_path)
if not os.path.exists(loss_out_path):
    os.makedirs(loss_out_path)

np.savetxt(loss_out_path + "/train_loss.csv", train_loss, delimiter=",")
np.savetxt(loss_out_path + "/val_loss.csv", val_loss, delimiter=",")

#
model_out_path = model_out_path + '/carl/'
print('all done, saving model to:', model_out_path)
estimator.save(model_out_path, x=x, export_model=True)

# also store patch, if it was provided:
if (args.patch != ""):
    patch_out_path = model_out_path + "/patch/"
    if not os.path.exists(patch_out_path):
        os.makedirs(patch_out_path)
    copy2(args.patch, patch_out_path)
Exemple #2
0
        TreeName=treename,
        randomize=False,
        save=True,
        correlation=True,
        preprocessing=True,
        nentries=n,
        pathA=p + nominal + ".root",
        pathB=p + variation + ".root",
    )
    logger.info(" Loaded new datasets ")
#######################################

#######################################
# Estimate the likelihood ratio
estimator = RatioEstimator(n_hidden=(10, 10, 10), activation="relu")
estimator.train(
    method='carl',
    batch_size=1024,
    n_epochs=100,
    x=x,
    y=y,
    x0=x0,
    x1=x1,
    scale_inputs=True,
)
estimator.save('models/' + global_name + '_carl_' + str(n),
               x,
               metaData,
               export_model=True)
########################################
Exemple #3
0
else:
    x, y, x0, x1, metaData = loading.loading(
        folder='./data/',
        plot=True,
        var=var,
        do=sample,
        randomize=False,
        save=True,
        correlation=True,
        preprocessing=True,
        nentries=n,
        path=p,
    )
    logger.info(" Loaded new datasets ")

estimator = RatioEstimator(n_hidden=(10, 10, 10), activation="relu")
estimator.train(
    method='carl',
    batch_size=1024,
    n_epochs=100,
    x=x,
    y=y,
    x0=x0,
    x1=x1,
    scale_inputs=True,
)
estimator.save('models/' + sample + '/' + var + '_carl_' + str(n),
               x,
               metaData,
               export_model=True)