Example #1
0
plotter.fill_colours = (ROOT.kAzure,   ROOT.kRed,   ROOT.kAzure,   ROOT.kRed)
plotter.line_colours = (ROOT.kAzure-6, ROOT.kRed+2, ROOT.kAzure-6, ROOT.kRed+2)
plotter.markers = (ROOT.kPlus, ROOT.kPlus, ROOT.kPlus, ROOT.kPlus)
canvas = plotter.prep_canvas()
if doprint: canvas.Print('overtraining.pdf[')

ROOT.gStyle.SetHatchesLineWidth(1)
ROOT.gStyle.SetHatchesSpacing(1)
def _style(l):
    l[0].SetFillStyle(3345)
    l[1].SetFillStyle(3354)

def _plot(plots, opts):
    plotter.draw_hist(plots, opts)
    canvas.Update()
    if doprint: canvas.Print('overtraining.pdf')

for classifier in classifiers:
    # TODO: KS test b/w train & test
    _plot(arrange(distribs[classifier], 4, predicate = _style),
          arrange(['hist', 'hist', 'e1', 'e1'], 4))
    if rarity or probab:
        opts = arrange(['hist', 'hist'], 2)
    if rarity:
        _plot(arrange(rarity[classifier], 2, predicate = _style), opts)
    if probab:
        _plot(arrange(probab[classifier], 2, predicate = _style), opts)

if doprint: canvas.Print('overtraining.pdf]')
del canvas
Example #2
0
def _style(l):
    l[0].SetFillStyle(3345)
    l[1].SetFillStyle(3354)
    try:
        l[2].SetLineWidth(2)
        l[3].SetLineWidth(2)
    except IndexError:          # fails for probab & rarity
        pass


def _plot(plots, opts, plotter=plotter, canvas=canvas):
    plotter.draw_hist(plots, opts)
    canvas.Update()
    if options.doprint:
        canvas.Print('{}_overtraining.pdf'.format(prefix))

for classifier in classifiers:
    # TODO: KS test b/w train & test
    _plot(arrange(distribs[classifier], 4, predicate=_style),
          [['hist', 'hist', 'e1', 'e1']])  # same as arrange(.., 4)
    if rarity or probab:
        opts = [['hist', 'hist']]  # same as arrange(.., 2)
    if rarity:
        _plot(arrange(rarity[classifier], 2, predicate=_style), opts)
    if probab:
        _plot(arrange(probab[classifier], 2, predicate=_style), opts)

if options.doprint:
    canvas.Print('{}_overtraining.pdf]'.format(prefix))
del canvas
Example #3
0
from rplot.rplot import Rplot, arrange, partition

## variable distributions
if options.distribs:
    # histogram order: signal, background (repeat for diff transforms)
    distributions = get_hists(transforms, rfileconf, pathtool, robj_t=ROOT.TH1)

    ROOT.gStyle.SetHatchesLineWidth(1)
    ROOT.gStyle.SetHatchesSpacing(2.5)
    for transform in transforms:
        def _style(l):
            # l.reverse()
            l[0].SetFillStyle(3345)
            l[1].SetFillStyle(3354)
        distributions[transform] = arrange(distributions[transform], 2,
                                           predicate=_style)

    plotter = Rplot(3, 3, 2000, 1200)
    plotter.alpha = 0.2
    canvas = plotter.prep_canvas()
    if options.doprint:
        canvas.Print('{}_transforms.pdf['.format(prefix))

    def _plot_n_print(hlist, plotter=plotter, canvas=canvas):
        plotter.draw_hist(hlist, 'hist')
        canvas.Update()
        if options.doprint:
            canvas.Print('{}_transforms.pdf'.format(prefix))

    for transform in transforms:
        if len(distributions[transform]) > plotter.nplots:
Example #4
0
    l[0].SetFillStyle(3345)
    l[1].SetFillStyle(3354)
    try:
        l[2].SetLineWidth(2)
        l[3].SetLineWidth(2)
    except IndexError:  # fails for probab & rarity
        pass


def _plot(plots, opts, plotter=plotter, canvas=canvas):
    plotter.draw_hist(plots, opts)
    canvas.Update()
    if options.doprint:
        canvas.Print('{}_overtraining.pdf'.format(prefix))


for classifier in classifiers:
    # TODO: KS test b/w train & test
    _plot(arrange(distribs[classifier], 4, predicate=_style),
          [['hist', 'hist', 'e1', 'e1']])  # same as arrange(.., 4)
    if rarity or probab:
        opts = [['hist', 'hist']]  # same as arrange(.., 2)
    if rarity:
        _plot(arrange(rarity[classifier], 2, predicate=_style), opts)
    if probab:
        _plot(arrange(probab[classifier], 2, predicate=_style), opts)

if options.doprint:
    canvas.Print('{}_overtraining.pdf]'.format(prefix))
del canvas