85 input =
TFile::Open(
"http://root.cern/files/tmva_reg_example.root",
"CACHEREAD");
89 std::cout <<
"ERROR: could not open data file " << fname << std::endl;
96int TMVACrossValidationRegression()
104 TString outfileName(
"TMVARegCv.root");
107 TString infileName(
"./files/tmva_reg_example.root");
108 TFile * inputFile = getDataFile(infileName);
112 dataloader->
AddVariable(
"var1",
"Variable 1",
"units",
'F');
113 dataloader->
AddVariable(
"var2",
"Variable 2",
"units",
'F');
124 std::cout <<
"--- TMVACrossValidationRegression: Using input file: " << inputFile->
GetName() << std::endl;
133 TCut selectionCut =
"";
136 ":NormMode=NumEvents"
150 TString analysisType =
"Regression";
160 analysisType.
Data(), numFolds, splitExpr.
Data());
170 "!H:!V:NTrees=500:BoostType=Grad:Shrinkage=0.1:"
171 "UseBaggedBoost:BaggedSampleFraction=0.5:nCuts=20:MaxDepth=3");
189 std::cout <<
"==> Wrote root file: " << outputFile->
GetName() << std::endl;
190 std::cout <<
"==> TMVACrossValidationRegression is done!" << std::endl;
197 if (!
gROOT->IsBatch()) {
208int main(
int argc,
char **argv)
210 TMVACrossValidationRegression();
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void input
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
R__EXTERN TSystem * gSystem
A specialized string object used for TTree selections.
TObject * Get(const char *namecycle) override
Return pointer to object identified by namecycle.
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
static Bool_t SetCacheFileDir(std::string_view cacheDir, Bool_t operateDisconnected=kTRUE, Bool_t forceCacheread=kFALSE)
Sets the directory where to locally stage/cache remote files.
void Close(Option_t *option="") override
Close a file.
Class to perform cross validation, splitting the dataloader into folds.
void AddRegressionTree(TTree *tree, Double_t weight=1.0, Types::ETreeType treetype=Types::kMaxTreeType)
void PrepareTrainingAndTestTree(const TCut &cut, const TString &splitOpt)
prepare the training and test trees -> same cuts for signal and background
void AddTarget(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
const char * GetName() const override
Returns name of object.
const char * Data() const
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 represents a columnar dataset.
void TMVAGui(const char *fName="TMVA.root", TString dataset="")