80 if (!
gSystem->AccessPathName(fname)) {
85 std::cout <<
"ERROR: could not open data file " << fname << std::endl;
92int TMVACrossValidationRegression()
100 TString outfileName(
"TMVARegCv.root");
103 TString infileName =
gROOT->GetTutorialDir() +
"/machine_learning/data/tmva_reg_example.root";
104 TFile * inputFile = getDataFile(infileName);
108 dataloader->
AddVariable(
"var1",
"Variable 1",
"units",
'F');
109 dataloader->
AddVariable(
"var2",
"Variable 2",
"units",
'F');
120 std::cout <<
"--- TMVACrossValidationRegression: Using input file: " << inputFile->
GetName() << std::endl;
129 TCut selectionCut =
"";
132 ":NormMode=NumEvents"
146 TString analysisType =
"Regression";
156 analysisType.
Data(), numFolds, splitExpr.
Data());
166 "!H:!V:NTrees=500:BoostType=Grad:Shrinkage=0.1:"
167 "UseBaggedBoost:BaggedSampleFraction=0.5:nCuts=20:MaxDepth=3");
185 std::cout <<
"==> Wrote root file: " << outputFile->
GetName() << std::endl;
186 std::cout <<
"==> TMVACrossValidationRegression is done!" << std::endl;
193 if (!
gROOT->IsBatch()) {
204int main(
int argc,
char **argv)
206 TMVACrossValidationRegression();
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
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.
A specialized string object used for TTree selections.
TObject * Get(const char *namecycle) override
Return pointer to object identified by namecycle.
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
void Close(Option_t *option="") override
Delete all objects from memory and directory structure itself.
Class to perform cross validation, splitting the dataloader into folds.
void Evaluate() override
Does training, test set evaluation and performance evaluation of using cross-evalution.
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
virtual void BookMethod(TString methodname, TString methodtitle, TString options="")
Method to book the machine learning method to perform the algorithm.
const char * GetName() const override
Returns name of object.
const char * Data() const
A TTree represents a columnar dataset.
void TMVAGui(const char *fName="TMVA.root", TString dataset="")