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);
106 int 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");
149 ":nTest_Background=1" 151 ":NormMode=NumEvents" 161 TString analysisType =
"Classification";
188 analysisType.
Data(), numFolds, splitExpr.
Data());
198 "!H:!V:NTrees=100:MinNodeSize=2.5%:BoostType=Grad" 199 ":NegWeightTreatment=Pray:Shrinkage=0.10:nCuts=20" 203 "!H:!V:Fisher:VarTransform=None");
221 for (
auto && result : cv.GetResults()) {
222 std::cout <<
"Summary for method " << cv.GetMethods()[iMethod++].GetValue<
TString>(
"MethodName")
224 for (
UInt_t iFold = 0; iFold<cv.GetNumFolds(); ++iFold) {
225 std::cout <<
"\tFold " << iFold <<
": " 226 <<
"ROC int: " << result.GetROCValues()[iFold]
228 <<
"BkgEff@SigEff=0.3: " << result.GetEff30Values()[iFold]
240 std::cout <<
"==> Wrote root file: " << outputFile->
GetName() << std::endl;
241 std::cout <<
"==> TMVACrossValidation is done!" << std::endl;
248 if (!
gROOT->IsBatch()) {
259 int main(
int argc,
char **argv)
261 TMVACrossValidation();
void AddBackgroundTree(TTree *background, Double_t weight=1.0, Types::ETreeType treetype=Types::kMaxTreeType)
number of signal events (used to compute significance)
virtual const char * GetName() const
Returns name of object.
Random number generator class based on M.
virtual Int_t Fill()
Fill all branches.
void TMVAGui(const char *fName="TMVA.root", TString dataset="")
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
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
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=1, Int_t netopt=0)
Create / open a file.
int main(int argc, char **argv)
char * Form(const char *fmt,...)
void PrepareTrainingAndTestTree(const TCut &cut, const TString &splitOpt)
prepare the training and test trees -> same cuts for signal and background
Class to perform cross validation, splitting the dataloader into folds.
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.
A TTree object has a header with a name and a title.
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
virtual void Close(Option_t *option="")
Close a file.
const char * Data() const