84 input =
TFile::Open(
"http://root.cern.ch/files/tmva_reg_example.root",
"CACHEREAD");
88 std::cout <<
"ERROR: could not open data file " << fname << std::endl;
95 int TMVACrossValidationRegression()
103 TString outfileName(
"TMVAReg.root");
106 TString infileName(
"./files/tmva_reg_example.root");
107 TFile * inputFile = getDataFile(infileName);
111 dataloader->
AddVariable(
"var1",
"Variable 1",
"units",
'F');
112 dataloader->
AddVariable(
"var2",
"Variable 2",
"units",
'F');
114 dataloader->
AddSpectator(
"spec1 := var1*100 + var2*100",
'F');
123 std::cout <<
"--- TMVACrossValidationRegression: Using input file: " << inputFile->
GetName() << std::endl;
129 ":nTest_Regression=0" 131 ":NormMode=NumEvents" 145 TString analysisType =
"Regression";
155 analysisType.
Data(), numFolds, splitExpr.
Data());
165 "!H:!V:NTrees=2000::BoostType=Grad:Shrinkage=0.1:" 166 "UseBaggedBoost:BaggedSampleFraction=0.5:nCuts=20:MaxDepth=3:" 170 "!H:!V:VarTransform=Norm:NeuronType=tanh:NCycles=200:" 171 "HiddenLayers=N+20:TestRate=6:TrainingMethod=BFGS:" 172 "Sampling=0.3:SamplingEpoch=0.8:ConvergenceImprove=1e-6:" 173 "ConvergenceTests=15:!UseRegulator" );
191 std::cout <<
"==> Wrote root file: " << outputFile->
GetName() << std::endl;
192 std::cout <<
"==> TMVACrossValidationRegression is done!" << std::endl;
199 if (!
gROOT->IsBatch()) {
210 int main(
int argc,
char **argv)
212 TMVACrossValidationRegression();
virtual const char * GetName() const
Returns name of object.
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
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...
static Bool_t SetCacheFileDir(ROOT::Internal::TStringView cacheDir, Bool_t operateDisconnected=kTRUE, Bool_t forceCacheread=kFALSE)
virtual TObject * Get(const char *namecycle)
Return pointer to object identified by namecycle.
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)
R__EXTERN TSystem * gSystem
char * Form(const char *fmt,...)
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
Class to perform cross validation, splitting the dataloader into folds.
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 SetWeightExpression(const TString &variable, const TString &className="")
A TTree object has a header with a name and a title.
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