print computeMutualInfo(hist)


exit()

"""
c1 = ROOT.TCanvas()
for key in TwoDdic:
    TwoDdic[key].GetTH2F().Draw("colz")
    c1.Update()
    raw_input("press ret")
raw_input("press ret")
"""

outputfile = ROOT.TFile(sys.argv[2]+".root","RECREATE")
pdfout = PDFPrinting(sys.argv[2])
c1 = ROOT.TCanvas()

for key in TwoDdic:
    TwoDdic[key].WriteTwoDPlot(c1,pdfout)

pdfout.closePDF()


milist = []
for key in TwoDdic:
    milist.append([key ,computeMutualInfo(TwoDdic[key].GetTH2F())])

milist_sorted = sorted(milist, key = lambda x : float(x[1]))

for elem in milist_sorted[::-1]:
        rV.append(arraydict["BDTG"][0])
        wV.append(1)

    mutinfoH = TwoDplot("BDTG Output", "Jet_PartonPt", [150, xmin, xmax],
                        [100, xmin, xmax])
    #hist  = ROOT.TH2F( "hist for mutinf",  "hist for mutinf",  150, xmin, xmax, 100, xmin, xmax )
    #histT = ROOT.TH2F( "histT", "histT", 150, xmin, xmax, 100, xmin, xmax );

    for iev in range(nEntries):
        if iev == maxevts:
            break
        #d = rV[iev]-tV[iev]
        #hist.Fill(rV[iev],tV[iev],wV[iev])
        mutinfoH.FillTwoDplot(rV[iev], tV[iev])

    pdfout = PDFPrinting(outputfolder + sys.argv[1] + names[ifile])
    outputfile = ROOT.TFile(
        outputfolder + sys.argv[1] + names[ifile] + ".root", "RECREATE")
    outputfile.cd()
    c1 = ROOT.TCanvas()

    #hist.Draw("colz")
    #c1.Update()
    #c1.Write()

    #print xmin, xmax

    #pdfout.addCanvastoPDF(c1)

    #-----------------------------------------------------------------------------------------------------------------------------------#
    # Remove for other files
示例#3
0
                             "1: nTrees, 2: Shrinkage, 3: MaxDepth, 4:nCuts",
                             90, 0.03)
avquaddevplot_train_best90.addLabel(
    0.92, 0.325, "1: nTrees, 2: Shrinkage, 3: MaxDepth, 4:nCuts", 90, 0.03)

deviations_test_best90 = normPlots("Quadratic Deviation", True, len(names),
                                   legendtext, [200, 0, 700])
deviations_test = normPlots("Quadratic Deviation", True, len(names),
                            legendtext, [300, 0, 500])
deviations_train_best90 = normPlots("Quadratic Deviation", True, len(names),
                                    legendtext, [200, 0, 700])

del ifile

c1 = ROOT.TCanvas()
pdfout = PDFPrinting(outputname)

c1.cd(1)

quaddev_quatile100_test = normPlots("Quadratic Deviation", True,
                                    len(legendtext), legendtext,
                                    [300, 0, 50000])
quaddev_quatile95_test = normPlots("Quadratic Deviation (best 95 %)", True,
                                   len(legendtext), legendtext, [300, 0, 1500])
quaddev_quatile90_test = normPlots("Quadratic Deviation (best 90 %)", True,
                                   len(legendtext), legendtext, [300, 0, 800])
quaddev_quatile85_test = normPlots("Quadratic Deviation (best 85 %)", True,
                                   len(legendtext), legendtext, [200, 0, 600])
quaddev_quatile80_test = normPlots("Quadratic Deviation (best 80 %)", True,
                                   len(legendtext), legendtext, [200, 0, 600])



#exit()


c1 = ROOT.TCanvas()
"""
for key in TwoDdic:
    TwoDdic[key].GetTH2F().Draw("colz")
    c1.Update()
    raw_input("press ret")
"""
outputfile = ROOT.TFile(sys.argv[2]+".root","RECREATE")
pdfout = PDFPrinting(sys.argv[2])
#c1 = ROOT.TCanvas()



hist.Draw("colz")
c1.Update()
c1.Write()

print xmin, xmax

pdfout.addCanvastoPDF(c1)

for key in keylist:
    normHdic[key].WriteHisto(c1,None,False,False, pdfout)