Home | News | Documentation | Download

Failed to call "kCuts" methods from pyroot using TMVA

when I used TMVA with pyroot, I can not successfully call kCuts in TMVA method. the error message is following:

TFHandler_Factory : Variable Mean RMS [ Min Max ]
: -----------------------------------------------------------
: pt_b1b2: 134.63 90.575 [ 0.18029 1241.2 ]
: -----------------------------------------------------------
: Ranking input variables (method unspecific)…
IdTransformation : Ranking result (top variable is best ranked)
: --------------------------------
: Rank : Variable : Separation
: --------------------------------
: 1 : pt_b1b2 : 3.203e-01
: --------------------------------
Factory : Train method: kCuts for Classification
:
: Dataset[DYBDTTraining] : Base Directory for kCuts not set yet --> check if already there…
: Dataset[DYBDTTraining] : Base Directory for Cuts not set yet --> check if already there…
: Dataset[DYBDTTraining] : Base Directory for kCuts does not exist yet–> created it
: Dataset[DYBDTTraining] : Return from MethodBaseDir() after creating base directory
: Dataset[DYBDTTraining] : Base Directory for Cuts does not exist yet–> created it
: Dataset[DYBDTTraining] : Base Directory for Cuts existed, return it…
: Begin training
: maximum lower than minimum

I could use Macro to book kCuts in TMVA with same setting and dataset, and the results make sense for me.

The following is the pyroot code to call “kCuts” with MVAmethods = [“kCuts”] and options = {“kCuts” : “!H:Debug:FitMethod=MC:EffSel:SampleSize=20000:VarProp=FSmart”}. i tried to use one dimensional input and multiple dimensional inputs, and none of them could work. I even tried to define the cutrange by adding “CutRangeMin[0]=0:CutRangeMax[1]=1200” to book method options and it still did not work.

dataloader.PrepareTrainingAndTestTree(R.TCut(trainCut), traintestOptions)
for MVAmethod in MVAmethods:
     option = ""
     if options is not None:
         option = options[MVAmethod]
     print("method ", MVAmethod, " TMVA type ", getattr(R.TMVA.Types, MVAmethod)," option ",option)
     factory.BookMethod(dataloader, getattr(R.TMVA.Types, MVAmethod), MVAmethod, option)

As for other MVA methods in TMVA, i could use them in pyroot without any issue.

Does anyone have an explanation or see something similar.
Cheers,
Tao

Hi,

@sitong or @moneta might be able to help.