Example #1
0
        canvas.Print('{}_my_ROC_curves.pdf['.format(prefix))

    cols = (ROOT.kAzure, ROOT.kRed, ROOT.kBlack)
    legend = ROOT.TLegend(0.12, 0.15, 0.8, 0.6)
    legend.SetHeader('MVA classifiers')
    legend.SetBorderSize(0)
    legend.SetFillStyle(0)
    ROOT.gStyle.SetOptStat(False)

    from utils import th1integral, distance
    for i, roc in enumerate(rocs):
        coln = 0
        for cl, hist in roc.iteritems():
            # metrics
            print '=> {}:: integral: {}, distance: {}'.format(
                cl, th1integral(hist), distance(hist, (1, 1)))
            hist.SetLineStyle(i + 1)
            hist.SetLineColor(cols[coln])
            hist.GetXaxis().SetRangeUser(axis_range, 1.05)
            hist.GetYaxis().SetRangeUser(axis_range, 1.05)
            try:
                info = sessions[fnames[i]]
            except KeyError:
                info = fnames[i]
            text = '{} ({})'.format(classifiers[cl], info)
            legend.AddEntry(hist, text, 'l')
            if i == 0 and coln == 0:
                hist.SetTitle('MVA classifier ROC curves')
                hist.Draw('e')
            else:
                hist.Draw('e same')
Example #2
0
 def test_th1integral(self):
     from utils import th1integral
     self.assertEqual(th1integral(self.hist1), 1000)
Example #3
0
    cols = (ROOT.kAzure, ROOT.kRed, ROOT.kBlack)
    legend = ROOT.TLegend(0.12, 0.15, 0.8, 0.6)
    legend.SetHeader('MVA classifiers')
    legend.SetBorderSize(0)
    legend.SetFillStyle(0)
    ROOT.gStyle.SetOptStat(False)

    from utils import th1integral, distance
    for i, roc in enumerate(rocs):
        coln = 0
        for cl, hist in roc.iteritems():
            # metrics
            print '=> {}:: integral: {}, distance: {}'.format(
                cl,
                th1integral(hist),
                distance(hist, (1, 1))
            )
            hist.SetLineStyle(i+1)
            hist.SetLineColor(cols[coln])
            hist.GetXaxis().SetRangeUser(axis_range, 1.05)
            hist.GetYaxis().SetRangeUser(axis_range, 1.05)
            try:
                info = sessions[fnames[i]]
            except KeyError:
                info = fnames[i]
            text = '{} ({})'.format(classifiers[cl], info)
            legend.AddEntry(hist, text, 'l')
            if i == 0 and coln == 0:
                hist.SetTitle('MVA classifier ROC curves')
                hist.Draw('e')