Skip to content
Snippets Groups Projects
Verified Commit 61677b84 authored by Frank Sauerburger's avatar Frank Sauerburger
Browse files

Add ROC example

parent 866bb9cb
No related branches found
No related tags found
No related merge requests found
%% Cell type:code id: tags:
``` python
from nnfwtbn import Variable, Process, Cut, roc
```
%% Cell type:code id: tags:
``` python
import pandas as pd
import seaborn as sns
#df = pd.read_hdf("test.h5")
df = pd.read_hdf("demo/mva.h5")
```
%% Cell type:code id: tags:
``` python
p_sig = Process(r"Signal", range=(1, 1000))
p_bkg = Process(r"Background", range=(-999, -1))
```
%% Cell type:code id: tags:
``` python
c_vbf = Cut(lambda d: d.dijet_p4__M > 400) & \
Cut(lambda d: d.jet_1_p4__Pt >= 30) & \
Cut(lambda d: d.is_dijet_centrality == 1) & \
Cut(lambda d: d.jet_0_p4__Eta * df.jet_1_p4__Eta < 0) & \
Cut(lambda d: (d.jet_0_p4__Eta - df.jet_1_p4__Eta).abs() > 3)
c_vbf_150 = c_vbf & Cut(lambda d: d.ditau_mmc_mlm_m < 140)
```
%% Cell type:code id: tags:
``` python
import warnings
warnings.filterwarnings("error")
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
v_mmc = Variable(r"$m_\mathrm{MMC}$", "ditau_mmc_mlm_m", "GeV")
roc(df, p_sig, p_bkg, v_mmc, selection=c_vbf_150, axes=ax, steps=400)
roc(df, p_sig, p_bkg, Variable("Particle ID", "fpid"), selection=c_vbf_150, axes=ax)
None
```
%% Output
%% Cell type:code id: tags:
``` python
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment