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);
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");
158 ":nTest_Background=1"
160 ":NormMode=NumEvents"
176 TString analysisType =
"Classification";
205 analysisType.
Data(), splitType.
Data(), numFolds,
216 "!H:!V:NTrees=100:MinNodeSize=2.5%:BoostType=Grad"
217 ":NegWeightTreatment=Pray:Shrinkage=0.10:nCuts=20"
221 "!H:!V:Fisher:VarTransform=None");
239 for (
auto && result : cv.GetResults()) {
240 std::cout <<
"Summary for method " << cv.GetMethods()[iMethod++].GetValue<
TString>(
"MethodName")
242 for (
UInt_t iFold = 0; iFold<cv.GetNumFolds(); ++iFold) {
243 std::cout <<
"\tFold " << iFold <<
": "
244 <<
"ROC int: " << result.GetROCValues()[iFold]
246 <<
"BkgEff@SigEff=0.3: " << result.GetEff30Values()[iFold]
258 std::cout <<
"==> Wrote root file: " << outputFile->
GetName() << std::endl;
259 std::cout <<
"==> TMVACrossValidation is done!" << std::endl;
266 if (!
gROOT->IsBatch()) {
268 cv.GetResults()[0].DrawAvgROCCurve(
kTRUE,
"Avg ROC for BDTG");
269 cv.GetResults()[0].DrawAvgROCCurve(
kTRUE,
"Avg ROC for Fisher");
282int main(
int argc,
char **argv)
284 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.
void AddSignalTree(TTree *signal, Double_t weight=1.0, Types::ETreeType treetype=Types::kMaxTreeType)
number of signal events (used to compute significance)
void AddSpectator(const TString &expression, const TString &title="", const TString &unit="", Double_t min=0, Double_t max=0)
user inserts target in data set info
void PrepareTrainingAndTestTree(const TCut &cut, const TString &splitOpt)
prepare the training and test trees -> same cuts for signal and background
void AddBackgroundTree(TTree *background, Double_t weight=1.0, Types::ETreeType treetype=Types::kMaxTreeType)
number of signal events (used to compute significance)
void AddVariable(const TString &expression, const TString &title, const TString &unit, char type='F', Double_t min=0, Double_t max=0)
user inserts discriminating variable in data set info
virtual const char * GetName() const
Returns name of object.
Random number generator class based on M.
const char * Data() const
A TTree represents a columnar dataset.
virtual Int_t Fill()
Fill all branches.
virtual void ResetBranchAddresses()
Tell all of our branches to drop their current objects and allocate new ones.
virtual Int_t Branch(TCollection *list, Int_t bufsize=32000, Int_t splitlevel=99, const char *name="")
Create one branch for each element in the collection.
int main(int argc, char **argv)
void TMVAGui(const char *fName="TMVA.root", TString dataset="")