85 input =
TFile::Open(
"http://root.cern.ch/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 =
"";
134 dataloader->PrepareTrainingAndTestTree(selectionCut,
"nTest_Regression=1"
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();
char * Form(const char *fmt,...)
R__EXTERN TSystem * gSystem
A specialized string object used for TTree selections.
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.
Class to perform cross validation, splitting the dataloader into folds.
virtual const char * GetName() const
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 object has a header with a name and a title.
int main(int argc, char **argv)
void TMVAGui(const char *fName="TMVA.root", TString dataset="")