86 data->Branch(
"x", &
x,
"x/F");
87 data->Branch(
"y", &
y,
"y/F");
88 data->Branch(
"eventID", &eventID,
"eventID/I");
90 for (
Int_t n = 0;
n < nPoints; ++
n) {
91 x = rng.Gaus(offset, scale);
92 y = rng.Gaus(offset, scale);
102 data->ResetBranchAddresses();
106int TMVACrossValidation()
120 TTree *sigTree = genTree(1000, 1.0, 1.0, 100);
121 TTree *bkgTree = genTree(1000, -1.0, 1.0, 101);
124 TString outfileName(
"TMVA.root");
147 dataloader->PrepareTrainingAndTestTree(
"",
"",
149 ":nTest_Background=1"
151 ":NormMode=NumEvents"
167 TString analysisType =
"Classification";
196 analysisType.
Data(), splitType.
Data(), numFolds,
207 "!H:!V:NTrees=100:MinNodeSize=2.5%:BoostType=Grad"
208 ":NegWeightTreatment=Pray:Shrinkage=0.10:nCuts=20"
212 "!H:!V:Fisher:VarTransform=None");
230 for (
auto && result : cv.GetResults()) {
231 std::cout <<
"Summary for method " << cv.GetMethods()[iMethod++].GetValue<
TString>(
"MethodName")
233 for (
UInt_t iFold = 0; iFold<cv.GetNumFolds(); ++iFold) {
234 std::cout <<
"\tFold " << iFold <<
": "
235 <<
"ROC int: " << result.GetROCValues()[iFold]
237 <<
"BkgEff@SigEff=0.3: " << result.GetEff30Values()[iFold]
249 std::cout <<
"==> Wrote root file: " << outputFile->
GetName() << std::endl;
250 std::cout <<
"==> TMVACrossValidation is done!" << std::endl;
257 if (!
gROOT->IsBatch()) {
259 cv.GetResults()[0].DrawAvgROCCurve(
kTRUE,
"Avg ROC for BDTG");
260 cv.GetResults()[0].DrawAvgROCCurve(
kTRUE,
"Avg ROC for Fisher");
273int main(
int argc,
char **argv)
275 TMVACrossValidation();
char * Form(const char *fmt,...)
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
virtual void Close(Option_t *option="")
Close a file.
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseGeneralPurpose, Int_t netopt=0)
Create / open a file.
Class to perform cross validation, splitting the dataloader into folds.
virtual const char * GetName() const
Returns name of object.
Random number generator class based on M.
const char * Data() const
A TTree object has a header with a name and a title.
int main(int argc, char **argv)
void TMVAGui(const char *fName="TMVA.root", TString dataset="")