26 TString outfileName(
"TMVA.root");
30 "!V:!Silent:Color:DrawProgressBar:Transformations=I;D;P;G,D:AnalysisType=Classification");
33 factory->
AddVariable(
"myvar2 := var1-var2",
"Expression 2",
"",
'F');
34 factory->
AddVariable(
"var3",
"Variable 3",
"units",
'F');
35 factory->
AddVariable(
"var4",
"Variable 4",
"units",
'F');
36 factory->
AddSpectator(
"spec1 := var1*2",
"Spectator 1",
"units",
'F');
37 factory->
AddSpectator(
"spec2 := var1*3",
"Spectator 2",
"units",
'F');
39 TString fname =
"./tmva_class_example.root";
42 gSystem->
Exec(
"curl -O http://root.cern.ch/files/tmva_class_example.root");
46 std::cout <<
"--- TMVAClassification : Using input file: " << input->
GetName() << std::endl;
72 "nTrain_Signal=0:nTrain_Background=0:nTest_Signal=0:nTest_Background=0:SplitMode=Random:NormMode=NumEvents:!V");
76 "!H:NTrials=10:Rules=kFALSE:ControlSubSet=kFALSE:ControlBands=0:ControlWinnow=kFALSE:ControlNoGlobalPruning=kTRUE:ControlCF=0.25:ControlMinCases=2:ControlFuzzyThreshold=kTRUE:ControlSample=0:ControlEarlyStopping=kTRUE:!V");
80 factory->
BookMethod(
TMVA::Types::kRSNNS,
"RMLP",
"!H:VarTransform=N:Size=c(5):Maxit=200:InitFunc=Randomize_Weights:LearnFunc=Std_Backpropagation:LearnFuncParams=c(0.2,0):!V");
82 factory->
BookMethod(
TMVA::Types::kRSVM,
"RSVM",
"!H:Kernel=linear:Type=C-classification:VarTransform=Norm:Probability=kTRUE:Tolerance=0.1:!V");
98 std::cout <<
"==> Wrote root file: " << outputFile->
GetName() << std::endl;
99 std::cout <<
"==> TMVAClassification is done!" << std::endl;
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
virtual TObject * Get(const char *namecycle)
Return pointer to object identified by namecycle.
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 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
void TrainAllMethods()
iterates through all booked methods and calls training
void AddBackgroundTree(TTree *background, Double_t weight=1.0, Types::ETreeType treetype=Types::kMaxTreeType)
number of signal events (used to compute significance)
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=1, Int_t netopt=0)
Create / open a file.
A specialized string object used for TTree selections.
R__EXTERN TSystem * gSystem
MethodBase * BookMethod(TString theMethodName, TString methodTitle, TString theOption="")
Book a classifier or regression method.
void EvaluateAllMethods(void)
iterates over all MVAs that have been booked, and calls their evaluation methods
virtual const char * GetName() const
Returns name of object.
void SetBackgroundWeightExpression(const TString &variable)
virtual Int_t Exec(const char *shellcmd)
Execute a command.
void SetVerbose(Bool_t status)
Method to set verbose mode, that produce extra output.
static TRInterface & Instance()
static method to get an TRInterface instance reference
void AddSignalTree(TTree *signal, Double_t weight=1.0, Types::ETreeType treetype=Types::kMaxTreeType)
number of signal events (used to compute significance)
A TTree object has a header with a name and a title.
void PrepareTrainingAndTestTree(const TCut &cut, const TString &splitOpt)
prepare the training and test trees -> same cuts for signal and background
virtual void Close(Option_t *option="")
Close a file.