import pandas as pd
import seaborn as sns
from nnfwtbn import Variable, Process, Cut, hist, McStack, DataStack, Stack, TmvaBdt
from nnfwtbn import toydata
df = toydata.get()
df = df.compute()
The file tmva_bdt.xml
contains a sample BDT trained on the toy dataset. The input variables are
The BDT was trained with regular TMVA in ROOT. The weights stored in the XML file can be read by nnfwtbn.TmvaBdt
directly.
bdt = TmvaBdt("tmva_bdt.xml")
df['bdt_prediction'] = bdt.predict(df)
p_ztt = Process(r"$Z\rightarrow\tau\tau$", range=(0, 0))
p_sig = Process(r"Signal", range=(1, 1))
colors = ["windows blue", "amber", "greyish", "faded green", "dusty purple"]
colors = sns.xkcd_palette(colors)
s_ztt = McStack(p_ztt, color=colors[0], histtype='step')
s_sig = McStack(p_sig, color=colors[1], histtype='step')
v_bdt = Variable("BDT Score", "bdt_prediction")
hist(df, v_bdt, 22, [s_ztt, s_sig], range=(-1.1, 1.1),
weight="weight", numerator=None)
None