Dear TMVA-creators, please help me to understanding.
I want to use the model BDT for my data in root files, but I can't to understand how it really work (yes, I read userguide, but I have a lot of questions, may be more before reading).
It's part of my code (for reader):
cout <<">>>> Let's start to read this BDT result\n";
TMVA::Reader *reader = new TMVA::Reader("V:Color");
// create a set of variables and declare them to the reader
// - the variable names must corresponds in name and type to
// those given in the weight file(s) that you use
Float_t pEquifaxResponse,pQd6MCount,pSex,pAge,pTopQwCat1;
reader ->AddVariable ("pEquifaxResponse", &pEquifaxResponse);
reader ->AddVariable ("pQd6MCount", &pQd6MCount);
reader ->AddVariable ("pSex", &pSex);
reader ->AddVariable ("pAge", &pAge);
reader ->AddVariable ("pTopQwCat1", &pTopQwCat1);
// book the MVA of your choice (prior training of these methods, ie,
// existence of the weight files is required)
reader->BookMVA( "BDT", "weights/t1_BDT.weights.xml");
TTree *BDTtree = new TTree("BDT_readerTree", "The Tree, which show how works this reader");
for (Long64_t ievt=0; ievt<BDTtree->GetEntries();ievt++) {
Float_t Test_EquifaxResponse,Test_Qd6MCount,Test_Sex,Test_Age,Test_TopQwCat1;
BDTtree->SetBranchAddress ("Test_EquifaxResponse", &Test_EquifaxResponse);
BDTtree->SetBranchAddress ("Test_Qd6MCount", &Test_Qd6MCount);
BDTtree->SetBranchAddress ("Test_Sex", &Test_Sex);
BDTtree->SetBranchAddress ("Test_Age", &Test_Age);
BDTtree->SetBranchAddress ("Test_TopQwCat1", &Test_TopQwCat1);
// fill vector with values of variables computed from those in the tree
pEquifaxResponse = Test_EquifaxResponse;
pQd6MCount = Test_Qd6MCount;
pSex = Test_Sex;
pAge = Test_Age;
pTopQwCat1 = Test_TopQwCat1;
cout <<"Does it really work yet?\n";
// retrieve the corresponding MVA output
double mvaBDT = reader->EvaluateMVA( "BDT" );
// do something with these ...., e.g., fill them into your ntuple
} // end of event loop
delete reader;
}
My output in finish:
....bla-bla-bla...
Let's start to read this BDT result
--- Reader : Parsing option string:
--- Reader : ... "V:Color"
--- Reader : The following options are set:
--- Reader : - By User:
--- Reader : V: "True" [Verbose flag]
--- Reader : Color: "True" [Color flag (default True)]
--- Reader : - Default:
--- Reader : Silent: "False" [Boolean silent flag (default False)]
--- Reader : Error: "False" [Calculates errors (default False)]
--- Reader : Booking "BDT" of type "BDT" from weights/t1_BDT.weights.xml.
--- MethodBase : Reading weight file: weights/t1_BDT.weights.xml
--- BDT : Read method "BDT" of type "BDT"
--- BDT : MVA method was trained with TMVA Version: 4.2.1
--- BDT : MVA method was trained with ROOT Version: 6.04/00
--- DataSetInfo : Added class "Signal" with internal class number 0
--- DataSetInfo : Added class "Background" with internal class number 1
--- Reader : Booked classifier "BDT" of type: "BDT"
I use default version of TMVA. I see, that root has create BDT histograms for test tree and train tree. They are same and have same parameters on "colz" (RMS, mean etc), when I start TBrowser b.
Please, tell me what reader can do? Can I use this xml for creating some root files for using how model for others datasets and other signals and background or it's only a model for one-using?
P.S. Sorry for my english, Thanks for your products!