86 data->Branch(
"x", &
x,
"x/F");
87 data->Branch(
"y", &
y,
"y/F");
88 data->Branch(
"eventID", &eventID,
"eventID/I");
90 for (
Int_t n = 0;
n < nPoints; ++
n) {
102 data->ResetBranchAddresses();
106int TMVACrossValidation(
bool useRandomSplitting =
false)
120 TTree *sigTree = genTree(1000, 1.0, 1.0, 100);
121 TTree *bkgTree = genTree(1000, -1.0, 1.0, 101);
124 TString outfileName(
"TMVACV.root");
158 ":nTest_Background=1"
160 ":NormMode=NumEvents"
176 TString analysisType =
"Classification";
178 TString splitType = (useRandomSplitting) ?
"Random" :
"Deterministic";
197 TString splitExpr = (!useRandomSplitting) ?
"int(fabs([eventID]))%int([NumFolds])" :
"";
206 analysisType.
Data(), splitType.
Data(), numFolds,
217 "!H:!V:NTrees=100:MinNodeSize=2.5%:BoostType=Grad"
218 ":NegWeightTreatment=Pray:Shrinkage=0.10:nCuts=20"
222 "!H:!V:Fisher:VarTransform=None");
240 for (
auto &&
result : cv.GetResults()) {
241 std::cout <<
"Summary for method " << cv.GetMethods()[iMethod++].GetValue<
TString>(
"MethodName")
243 for (
UInt_t iFold = 0; iFold<cv.GetNumFolds(); ++iFold) {
244 std::cout <<
"\tFold " << iFold <<
": "
245 <<
"ROC int: " <<
result.GetROCValues()[iFold]
247 <<
"BkgEff@SigEff=0.3: " <<
result.GetEff30Values()[iFold]
259 std::cout <<
"==> Wrote root file: " << outputFile->
GetName() << std::endl;
260 std::cout <<
"==> TMVACrossValidation is done!" << std::endl;
267 if (!
gROOT->IsBatch()) {
269 cv.GetResults()[0].DrawAvgROCCurve(
kTRUE,
"Avg ROC for BDTG");
270 cv.GetResults()[0].DrawAvgROCCurve(
kTRUE,
"Avg ROC for Fisher");
283int main(
int argc,
char **argv)
285 TMVACrossValidation();
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
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.
void Close(Option_t *option="") override
Close a file.
Class to perform cross validation, splitting the dataloader into folds.
void AddSignalTree(TTree *signal, Double_t weight=1.0, Types::ETreeType treetype=Types::kMaxTreeType)
number of signal events (used to compute significance)
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
void PrepareTrainingAndTestTree(const TCut &cut, const TString &splitOpt)
prepare the training and test trees -> same cuts for signal and background
void AddBackgroundTree(TTree *background, Double_t weight=1.0, Types::ETreeType treetype=Types::kMaxTreeType)
number of signal events (used to compute significance)
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.
Random number generator class based on M.
const char * Data() const
A TTree represents a columnar dataset.
void TMVAGui(const char *fName="TMVA.root", TString dataset="")