11 TString fname =
"./tmva_class_example.root";
16 input =
TFile::Open(
"http://root.cern.ch/files/tmva_class_example.root",
"CACHEREAD");
19 std::cout <<
"ERROR: could not open data file" << std::endl;
38 dataloader->AddVariable(
"myvar1 := var1+var2",
'F');
39 dataloader->AddVariable(
"myvar2 := var1-var2",
"Expression 2",
"",
'F');
40 dataloader->AddVariable(
"var3",
"Variable 3",
"units",
'F');
41 dataloader->AddVariable(
"var4",
"Variable 4",
"units",
'F');
47 dataloader->AddSpectator(
"spec1 := var1*2",
"Spectator 1",
"units",
'F');
48 dataloader->AddSpectator(
"spec2 := var1*3",
"Spectator 2",
"units",
'F');
55 dataloader->AddSignalTree(signalTree, signalWeight);
61 dataloader->SetBackgroundWeightExpression(
"weight");
63 "",
"",
"nTrain_Signal=1000:nTrain_Background=1000:SplitMode=Random:NormMode=NumEvents:!V");
70 "UseBaggedBoost:BaggedSampleFraction=0.5:nCuts=20:MaxDepth=2");
82 c->SetTitle(
"ROC-Integral Curve");
85 for (
UInt_t i = 0; i < results.size(); i++) {
86 if (!results[i].IsCutsMethod()) {
87 auto roc = results[i].GetROCGraph();
88 roc->SetLineColorAlpha(i + 1, 0.1);
93 mg->GetXaxis()->SetTitle(
" Signal Efficiency ");
94 mg->GetYaxis()->SetTitle(
" Background Rejection ");
95 c->BuildLegend(0.15, 0.15, 0.3, 0.3);
char * Form(const char *fmt,...)
R__EXTERN TSystem * gSystem
virtual TObject * Get(const char *namecycle)
Return pointer to object identified by namecycle.
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 Bool_t SetCacheFileDir(ROOT::Internal::TStringView cacheDir, Bool_t operateDisconnected=kTRUE, Bool_t forceCacheread=kFALSE)
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.
virtual void BookMethod(TString methodname, TString methodtitle, TString options="")
Method to book the machine learning method to perform the algorithm.
std::vector< ClassificationResult > & GetResults()
return the the vector of TMVA::Experimental::ClassificationResult objects.
virtual void Evaluate()
Method to perform Train/Test over all ml method booked.
A TMultiGraph is a collection of TGraph (or derived) objects.
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
A TTree object has a header with a name and a title.
void classification(UInt_t jobs=4)
static constexpr double mg