51#define MinNoTrainingEvents 10
81 auto roc = GetROC(iClass,
type);
82 auto inte = roc->GetROCIntegral();
99 fROCCurve =
new ROCCurve(fMvaTest[iClass]);
101 fROCCurve =
new ROCCurve(fMvaTrain[iClass]);
128 TString hLine =
"--------------------------------------------------- :";
130 fLogger << kINFO << hLine <<
Endl;
131 fLogger << kINFO <<
"DataSet MVA :" <<
Endl;
132 fLogger << kINFO <<
"Name: Method/Title: ROC-integ :" <<
Endl;
133 fLogger << kINFO << hLine <<
Endl;
134 fLogger << kINFO <<
Form(
"%-20s %-15s %#1.3f :", fDataLoaderName.Data(),
139 fLogger << kINFO << hLine <<
Endl;
153 TGraph *roc = GetROC(iClass,
type)->GetROCCurve();
170 return fMethod.GetValue<
TString>(
"MethodName") == methodname &&
171 fMethod.GetValue<
TString>(
"MethodTitle") == methodtitle
184 :
TMVA::
Envelope(
"Classification", dataloader,
file, options), fAnalysisType(
Types::kClassification),
203 :
TMVA::
Envelope(
"Classification", dataloader, NULL, options), fAnalysisType(
Types::kClassification),
223 for (
auto m : fIMethods) {
238 for (
auto &meth : fMethods) {
239 if (meth.GetValue<
TString>(
"MethodName") == methodname && meth.GetValue<
TString>(
"MethodTitle") == methodtitle)
240 return meth.GetValue<
TString>(
"MethodOptions");
261 for (
auto &meth : fMethods) {
264 fWorkers.SetNWorkers(fJobs);
270 auto methodname = fMethods[workerID].GetValue<
TString>(
"MethodName");
271 auto methodtitle = fMethods[workerID].GetValue<
TString>(
"MethodTitle");
272 auto meth =
GetMethod(methodname, methodtitle);
273 if (!IsSilentFile()) {
274 auto fname =
Form(
".%s%s%s.root", fDataLoader->GetName(), methodname.Data(), methodtitle.
Data());
275 auto f =
new TFile(fname,
"RECREATE");
276 f->mkdir(fDataLoader->GetName());
280 TrainMethod(methodname, methodtitle);
281 TestMethod(methodname, methodtitle);
282 if (!IsSilentFile()) {
285 return GetResults(methodname, methodtitle);
288 fResults = fWorkers.Map(executor,
ROOT::TSeqI(fMethods.size()));
296 TString hLine =
"--------------------------------------------------- :";
297 Log() << kINFO << hLine <<
Endl;
298 Log() << kINFO <<
"DataSet MVA :" <<
Endl;
299 Log() << kINFO <<
"Name: Method/Title: ROC-integ :" <<
Endl;
300 Log() << kINFO << hLine <<
Endl;
301 for (
auto &
r : fResults) {
303 Log() << kINFO <<
Form(
"%-20s %-15s %#1.3f :",
r.GetDataLoaderName().Data(),
304 Form(
"%s/%s",
r.GetMethodName().Data(),
r.GetMethodTitle().Data()),
r.GetROCIntegral())
307 Log() << kINFO << hLine <<
Endl;
309 Log() << kINFO <<
"-----------------------------------------------------" <<
Endl;
310 Log() << kHEADER <<
"Evaluation done." <<
Endl <<
Endl;
311 Log() << kINFO <<
Form(
"Jobs = %d Real Time = %lf ", fJobs, fTimer.RealTime()) <<
Endl;
312 Log() << kINFO <<
"-----------------------------------------------------" <<
Endl;
313 Log() << kINFO <<
"Evaluation done." <<
Endl;
323 for (
auto &meth : fMethods) {
324 TrainMethod(meth.GetValue<
TString>(
"MethodName"), meth.GetValue<
TString>(
"MethodTitle"));
336 auto method =
GetMethod(methodname, methodtitle);
339 <<
Form(
"Trying to train method %s %s that maybe is not booked.", methodname.
Data(), methodtitle.
Data())
347 method->DataInfo().GetNClasses() < 2)
348 Log() << kFATAL <<
"You want to do classification training, but specified less than two classes." <<
Endl;
354 Log() << kWARNING <<
"Method " << method->GetMethodName() <<
" not trained (training tree has less entries ["
359 Log() << kHEADER <<
"Train method: " << method->GetMethodName() <<
" for Classification" <<
Endl <<
Endl;
360 method->TrainMethod();
361 Log() << kHEADER <<
"Training finished" <<
Endl <<
Endl;
386 if (!HasMethod(methodname, methodtitle)) {
387 std::cout << methodname <<
" " << methodtitle << std::endl;
388 Log() << kERROR <<
"Trying to get method not booked." <<
Endl;
392 if (HasMethodObject(methodname, methodtitle, index)) {
393 return dynamic_cast<MethodBase *
>(fIMethods[index]);
396 if (GetDataLoaderDataInput().GetEntries() <=
398 Log() << kFATAL <<
"No input data for the training provided!" <<
Endl;
400 Log() << kHEADER <<
"Loading booked method: " <<
gTools().
Color(
"bold") << methodname <<
" " << methodtitle
403 TString moptions = GetMethodOptions(methodname, methodtitle);
408 conf->DeclareOptionRef(boostNum = 0,
"Boost_num",
"Number of times the classifier will be boosted");
409 conf->ParseOptions();
413 if (fModelPersistence) {
414 fFileDir = fDataLoader->GetName();
423 GetDataLoaderDataSetInfo(), moptions);
426 Log() << kDEBUG <<
"Boost Number is " << boostNum <<
" > 0: train boosted classifier" <<
Endl;
431 Log() << kFATAL <<
"Method with type kBoost cannot be casted to MethodCategory. /Classification" <<
Endl;
433 if (fModelPersistence)
438 methBoost->
SetFile(fFile.get());
450 Log() << kFATAL <<
"Method with type kCategory cannot be casted to MethodCategory. /Classification" <<
Endl;
452 if (fModelPersistence)
460 if (!method->
HasAnalysisType(fAnalysisType, GetDataLoaderDataSetInfo().GetNClasses(),
461 GetDataLoaderDataSetInfo().GetNTargets())) {
462 Log() << kWARNING <<
"Method " << method->
GetMethodTypeName() <<
" is not capable of handling ";
463 Log() <<
"classification with " << GetDataLoaderDataSetInfo().GetNClasses() <<
" classes." <<
Endl;
467 if (fModelPersistence)
479 fIMethods.push_back(method);
493 if (fIMethods.empty())
495 for (
UInt_t i = 0; i < fIMethods.size(); i++) {
497 auto methbase =
dynamic_cast<MethodBase *
>(fIMethods[i]);
498 if (methbase->GetMethodTypeName() == methodname && methbase->GetMethodName() == methodtitle) {
512 for (
auto &meth : fMethods) {
513 TestMethod(meth.GetValue<
TString>(
"MethodName"), meth.GetValue<
TString>(
"MethodTitle"));
525 auto method =
GetMethod(methodname, methodtitle);
528 <<
Form(
"Trying to train method %s %s that maybe is not booked.", methodname.
Data(), methodtitle.
Data())
536 Log() << kHEADER <<
"Test method: " << method->GetMethodName() <<
" for Classification"
548 Int_t nmeth_used[2] = {0, 0};
550 std::vector<std::vector<TString>> mname(2);
551 std::vector<std::vector<Double_t>> sig(2),
sep(2), roc(2);
552 std::vector<std::vector<Double_t>> eff01(2), eff10(2), eff30(2), effArea(2);
553 std::vector<std::vector<Double_t>> eff01err(2), eff10err(2), eff30err(2);
554 std::vector<std::vector<Double_t>> trainEff01(2), trainEff10(2), trainEff30(2);
556 method->SetFile(fFile.get());
557 method->SetSilentFile(IsSilentFile());
560 if (!IsCutsMethod(method))
561 methodNoCuts = method;
563 Log() << kHEADER <<
"Evaluate classifier: " << method->GetMethodName() <<
Endl <<
Endl;
564 isel = (method->GetMethodTypeName().Contains(
"Variable")) ? 1 : 0;
567 method->TestClassification();
570 mname[isel].push_back(method->GetMethodName());
571 sig[isel].push_back(method->GetSignificance());
572 sep[isel].push_back(method->GetSeparation());
573 roc[isel].push_back(method->GetROCIntegral());
576 eff01[isel].push_back(method->GetEfficiency(
"Efficiency:0.01",
Types::kTesting, err));
577 eff01err[isel].push_back(err);
578 eff10[isel].push_back(method->GetEfficiency(
"Efficiency:0.10",
Types::kTesting, err));
579 eff10err[isel].push_back(err);
580 eff30[isel].push_back(method->GetEfficiency(
"Efficiency:0.30",
Types::kTesting, err));
581 eff30err[isel].push_back(err);
582 effArea[isel].push_back(method->GetEfficiency(
"",
Types::kTesting, err));
584 trainEff01[isel].push_back(method->GetTrainingEfficiency(
"Efficiency:0.01"));
585 trainEff10[isel].push_back(method->GetTrainingEfficiency(
"Efficiency:0.10"));
586 trainEff30[isel].push_back(method->GetTrainingEfficiency(
"Efficiency:0.30"));
590 if (!IsSilentFile()) {
591 Log() << kDEBUG <<
"\tWrite evaluation histograms to file" <<
Endl;
597 for (
Int_t k = 0; k < 2; k++) {
598 std::vector<std::vector<Double_t>> vtemp;
599 vtemp.push_back(effArea[k]);
600 vtemp.push_back(eff10[k]);
601 vtemp.push_back(eff01[k]);
602 vtemp.push_back(eff30[k]);
603 vtemp.push_back(eff10err[k]);
604 vtemp.push_back(eff01err[k]);
605 vtemp.push_back(eff30err[k]);
606 vtemp.push_back(trainEff10[k]);
607 vtemp.push_back(trainEff01[k]);
608 vtemp.push_back(trainEff30[k]);
609 vtemp.push_back(sig[k]);
610 vtemp.push_back(
sep[k]);
611 vtemp.push_back(roc[k]);
612 std::vector<TString> vtemps = mname[k];
614 effArea[k] = vtemp[0];
618 eff10err[k] = vtemp[4];
619 eff01err[k] = vtemp[5];
620 eff30err[k] = vtemp[6];
621 trainEff10[k] = vtemp[7];
622 trainEff01[k] = vtemp[8];
623 trainEff30[k] = vtemp[9];
637 const Int_t nmeth = methodNoCuts == NULL ? 0 : 1;
643 std::vector<Double_t> rvec;
650 std::vector<TString> *theVars =
new std::vector<TString>;
651 std::vector<ResultsClassification *> mvaRes;
654 theVars->back().ReplaceAll(
"MVA_",
"");
665 DataSet *defDs = method->fDataSetInfo.GetDataSet();
672 for (
Int_t im = 0; im < nmeth; im++) {
676 Log() << kWARNING <<
"Found NaN return value in event: " << ievt <<
" for method \""
682 for (
Int_t iv = 0; iv < nvar; iv++)
684 if (method->fDataSetInfo.IsSignal(ev)) {
693 for (
Int_t im = 0; im < nmeth; im++) {
694 for (
Int_t jm = im; jm < nmeth; jm++) {
695 if ((dvec[im] - rvec[im]) * (dvec[jm] - rvec[jm]) > 0) {
718 if (corrMatS != 0 && corrMatB != 0) {
723 for (
Int_t im = 0; im < nmeth; im++) {
724 for (
Int_t jm = 0; jm < nmeth; jm++) {
725 mvaMatS(im, jm) = (*corrMatS)(im, jm);
726 mvaMatB(im, jm) = (*corrMatB)(im, jm);
731 std::vector<TString> theInputVars;
734 for (
Int_t iv = 0; iv < nvar; iv++) {
735 theInputVars.push_back(method->fDataSetInfo.GetVariableInfo(iv).GetLabel());
736 for (
Int_t jm = 0; jm < nmeth; jm++) {
737 varmvaMatS(iv, jm) = (*corrMatS)(nmeth + iv, jm);
738 varmvaMatB(iv, jm) = (*corrMatB)(nmeth + iv, jm);
744 Log() << kINFO <<
Form(
"Dataset[%s] : ", method->fDataSetInfo.GetName())
745 <<
"Inter-MVA correlation matrix (signal):" <<
Endl;
749 Log() << kINFO <<
Form(
"Dataset[%s] : ", method->fDataSetInfo.GetName())
750 <<
"Inter-MVA correlation matrix (background):" <<
Endl;
755 Log() << kINFO <<
Form(
"Dataset[%s] : ", method->fDataSetInfo.GetName())
756 <<
"Correlations between input variables and MVA response (signal):" <<
Endl;
760 Log() << kINFO <<
Form(
"Dataset[%s] : ", method->fDataSetInfo.GetName())
761 <<
"Correlations between input variables and MVA response (background):" <<
Endl;
765 Log() << kWARNING <<
Form(
"Dataset[%s] : ", method->fDataSetInfo.GetName())
766 <<
"<TestAllMethods> cannot compute correlation matrices" <<
Endl;
769 Log() << kINFO <<
Form(
"Dataset[%s] : ", method->fDataSetInfo.GetName())
770 <<
"The following \"overlap\" matrices contain the fraction of events for which " <<
Endl;
771 Log() << kINFO <<
Form(
"Dataset[%s] : ", method->fDataSetInfo.GetName())
772 <<
"the MVAs 'i' and 'j' have returned conform answers about \"signal-likeness\"" <<
Endl;
773 Log() << kINFO <<
Form(
"Dataset[%s] : ", method->fDataSetInfo.GetName())
774 <<
"An event is signal-like, if its MVA output exceeds the following value:" <<
Endl;
776 Log() << kINFO <<
Form(
"Dataset[%s] : ", method->fDataSetInfo.GetName())
777 <<
"which correspond to the working point: eff(signal) = 1 - eff(background)" <<
Endl;
781 Log() << kINFO <<
Form(
"Dataset[%s] : ", method->fDataSetInfo.GetName())
782 <<
"Note: no correlations and overlap with cut method are provided at present" <<
Endl;
786 Log() << kINFO <<
Form(
"Dataset[%s] : ", method->fDataSetInfo.GetName())
787 <<
"Inter-MVA overlap matrix (signal):" <<
Endl;
791 Log() << kINFO <<
Form(
"Dataset[%s] : ", method->fDataSetInfo.GetName())
792 <<
"Inter-MVA overlap matrix (background):" <<
Endl;
813 auto &fResult = GetResults(methodname, methodtitle);
817 Log().EnableOutput();
820 TString hLine =
"------------------------------------------------------------------------------------------"
821 "-------------------------";
822 Log() << kINFO <<
"Evaluation results ranked by best signal efficiency and purity (area)" <<
Endl;
823 Log() << kINFO << hLine <<
Endl;
824 Log() << kINFO <<
"DataSet MVA " <<
Endl;
825 Log() << kINFO <<
"Name: Method: ROC-integ" <<
Endl;
827 Log() << kDEBUG << hLine <<
Endl;
828 for (
Int_t k = 0; k < 2; k++) {
829 if (k == 1 && nmeth_used[k] > 0) {
830 Log() << kINFO << hLine <<
Endl;
831 Log() << kINFO <<
"Input Variables: " <<
Endl << hLine <<
Endl;
833 for (
Int_t i = 0; i < nmeth_used[k]; i++) {
834 TString datasetName = fDataLoader->GetName();
835 TString methodName = mname[k][i];
843 std::vector<Bool_t> *mvaResType =
dynamic_cast<ResultsClassification *
>(results)->GetValueVectorTypes();
846 if (mvaResType->size() != 0) {
847 rocIntegral = GetROCIntegral(methodname, methodtitle);
850 if (
sep[k][i] < 0 || sig[k][i] < 0) {
852 fResult.fROCIntegral = effArea[k][i];
854 <<
Form(
"%-13s %-15s: %#1.3f", fDataLoader->GetName(), methodName.
Data(), fResult.fROCIntegral)
857 fResult.fROCIntegral = rocIntegral;
858 Log() << kINFO <<
Form(
"%-13s %-15s: %#1.3f", datasetName.
Data(), methodName.
Data(), rocIntegral)
863 Log() << kINFO << hLine <<
Endl;
865 Log() << kINFO <<
"Testing efficiency compared to training efficiency (overtraining check)" <<
Endl;
866 Log() << kINFO << hLine <<
Endl;
868 <<
"DataSet MVA Signal efficiency: from test sample (from training sample) "
870 Log() << kINFO <<
"Name: Method: @B=0.01 @B=0.10 @B=0.30 "
872 Log() << kINFO << hLine <<
Endl;
873 for (
Int_t k = 0; k < 2; k++) {
874 if (k == 1 && nmeth_used[k] > 0) {
875 Log() << kINFO << hLine <<
Endl;
876 Log() << kINFO <<
"Input Variables: " <<
Endl << hLine <<
Endl;
878 for (
Int_t i = 0; i < nmeth_used[k]; i++) {
880 mname[k][i].ReplaceAll(
"Variable_",
"");
882 Log() << kINFO <<
Form(
"%-20s %-15s: %#1.3f (%#1.3f) %#1.3f (%#1.3f) %#1.3f (%#1.3f)",
883 method->fDataSetInfo.GetName(), (
const char *)mname[k][i], eff01[k][i],
884 trainEff01[k][i], eff10[k][i], trainEff10[k][i], eff30[k][i], trainEff30[k][i])
888 Log() << kINFO << hLine <<
Endl;
891 if (
gTools().CheckForSilentOption(GetOptions()))
892 Log().InhibitOutput();
893 }
else if (IsCutsMethod(method)) {
894 for (
Int_t k = 0; k < 2; k++) {
895 for (
Int_t i = 0; i < nmeth_used[k]; i++) {
897 if (
sep[k][i] < 0 || sig[k][i] < 0) {
899 fResult.fROCIntegral = effArea[k][i];
908 if (IsCutsMethod(method)) {
909 fResult.fIsCuts =
kTRUE;
911 auto rocCurveTest = GetROC(methodname, methodtitle, 0,
Types::kTesting);
912 fResult.fMvaTest[0] = rocCurveTest->GetMvas();
913 fResult.fROCIntegral = GetROCIntegral(methodname, methodtitle);
915 TString className = method->DataInfo().GetClassInfo(0)->GetName();
916 fResult.fClassNames.push_back(className);
918 if (!IsSilentFile()) {
920 RootBaseDir()->cd(method->fDataSetInfo.GetName());
944 if (fResults.size() == 0)
945 Log() << kFATAL <<
"No Classification results available" <<
Endl;
969 for (
auto &result : fResults) {
970 if (result.IsMethod(methodname, methodtitle))
974 result.
fMethod[
"MethodName"] = methodname;
975 result.
fMethod[
"MethodTitle"] = methodtitle;
977 fResults.push_back(result);
978 return fResults.back();
998 Log() << kERROR <<
Form(
"Given class number (iClass = %i) does not exist. There are %i classes in dataset.",
1008 std::vector<Bool_t> *mvaResTypes =
dynamic_cast<ResultsClassification *
>(results)->GetValueVectorTypes();
1009 std::vector<Float_t> mvaResWeights;
1012 mvaResWeights.reserve(eventCollection.size());
1013 for (
auto ev : eventCollection) {
1014 mvaResWeights.push_back(ev->GetWeight());
1017 rocCurve =
new TMVA::ROCCurve(*mvaRes, *mvaResTypes, mvaResWeights);
1020 std::vector<Float_t> mvaRes;
1021 std::vector<Bool_t> mvaResTypes;
1022 std::vector<Float_t> mvaResWeights;
1024 std::vector<std::vector<Float_t>> *rawMvaRes =
dynamic_cast<ResultsMulticlass *
>(results)->GetValueVector();
1029 mvaRes.reserve(rawMvaRes->size());
1030 for (
auto item : *rawMvaRes) {
1031 mvaRes.push_back(item[iClass]);
1035 mvaResTypes.reserve(eventCollection.size());
1036 mvaResWeights.reserve(eventCollection.size());
1037 for (
auto ev : eventCollection) {
1038 mvaResTypes.push_back(ev->GetClass() == iClass);
1039 mvaResWeights.push_back(ev->GetWeight());
1042 rocCurve =
new TMVA::ROCCurve(mvaRes, mvaResTypes, mvaResWeights);
1060 return GetROC(
GetMethod(methodname, methodtitle), iClass,
type);
1073 TMVA::ROCCurve *rocCurve = GetROC(methodname, methodtitle, iClass);
1076 <<
Form(
"ROCCurve object was not created in MethodName = %s MethodTitle = %s not found with Dataset = %s ",
1077 methodname.
Data(), methodtitle.
Data(), fDataLoader->GetName())
1098 while ((key = (
TKey *)nextkey())) {
1107 CopyFrom(subdir,
file);
1112 TTree *newT =
T->CloneTree(-1,
"fast");
1130 auto dsdir = fFile->mkdir(fDataLoader->GetName());
1131 TTree *TrainTree = 0;
1132 TTree *TestTree = 0;
1135 for (
UInt_t i = 0; i < fMethods.size(); i++) {
1136 auto methodname = fMethods[i].GetValue<
TString>(
"MethodName");
1137 auto methodtitle = fMethods[i].GetValue<
TString>(
"MethodTitle");
1138 auto fname =
Form(
".%s%s%s.root", fDataLoader->GetName(), methodname.Data(), methodtitle.
Data());
1141 ifile =
new TFile(fname);
1144 ofile =
new TFile(fname);
1147 auto tmptrain = (
TTree *)ds->
Get(
"TrainTree");
1148 auto tmptest = (
TTree *)ds->
Get(
"TestTree");
1150 fFile->cd(fDataLoader->GetName());
1152 auto methdirname =
Form(
"Method_%s", methodtitle.
Data());
1153 auto methdir = dsdir->mkdir(methdirname, methdirname);
1154 auto methdirbase = methdir->mkdir(methodtitle.
Data(), methodtitle.
Data());
1158 CopyFrom(mfdirbase, (
TFile *)methdirbase);
1161 TrainTree = tmptrain->
CopyTree(
"");
1165 auto trainbranch = TrainTree->
Branch(methodtitle.
Data(), &mva);
1166 tmptrain->SetBranchAddress(methodtitle.
Data(), &mva);
1167 auto entries = tmptrain->GetEntries();
1168 for (
UInt_t ev = 0; ev < entries; ev++) {
1169 tmptrain->GetEntry(ev);
1170 trainbranch->Fill();
1172 auto testbranch = TestTree->
Branch(methodtitle.
Data(), &mva);
1173 tmptest->SetBranchAddress(methodtitle.
Data(), &mva);
1174 entries = tmptest->GetEntries();
1175 for (
UInt_t ev = 0; ev < entries; ev++) {
1176 tmptest->GetEntry(ev);
1186 for (
UInt_t i = 0; i < fMethods.size(); i++) {
1187 auto methodname = fMethods[i].GetValue<
TString>(
"MethodName");
1188 auto methodtitle = fMethods[i].GetValue<
TString>(
"MethodTitle");
1189 auto fname =
Form(
".%s%s%s.root", fDataLoader->GetName(), methodname.Data(), methodtitle.
Data());
#define MinNoTrainingEvents
TMatrixT< Double_t > TMatrixD
char * Form(const char *fmt,...)
R__EXTERN TSystem * gSystem
A pseudo container class which is a generator of indices.
TClass instances represent classes, structs and namespaces in the ROOT type system.
Bool_t InheritsFrom(const char *cl) const
Return kTRUE if this class inherits from a class with name "classname".
A ROOT file is structured in Directories (like a file system).
virtual TObject * Get(const char *namecycle)
Return pointer to object identified by namecycle.
virtual Bool_t cd(const char *path=0)
Change current directory to "this" directory.
Describe directory structure in memory.
virtual TObject * Get(const char *namecycle)
Return pointer to object identified by namecycle.
virtual Bool_t cd(const char *path=0)
Change current directory to "this" directory.
virtual void SaveSelf(Bool_t=kFALSE)
virtual TList * GetListOfKeys() const
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.
A Graph is a graphics object made of two arrays X and Y with npoints each.
virtual void SetName(const char *name="")
Set graph name.
virtual void SetTitle(const char *title="")
Change (i.e.
TAxis * GetXaxis() const
Get x axis of the graph.
TAxis * GetYaxis() const
Get y axis of the graph.
Book space in a file, create I/O buffers, to fill them, (un)compress them.
virtual const char * GetClassName() const
virtual TObject * ReadObj()
To read a TObject* from the file.
IMethod * Create(const std::string &name, const TString &job, const TString &title, DataSetInfo &dsi, const TString &option)
creates the method if needed based on the method name using the creator function the factory has stor...
static ClassifierFactory & Instance()
access to the ClassifierFactory singleton creates the instance if needed
void SetDrawProgressBar(Bool_t d)
void SetUseColor(Bool_t uc)
class TMVA::Config::VariablePlotting fVariablePlotting
void SetConfigDescription(const char *d)
OptionBase * DeclareOptionRef(T &ref, const TString &name, const TString &desc="")
void SetConfigName(const char *n)
virtual void ParseOptions()
options parser
void CheckForUnusedOptions() const
checks for unused options in option string
UInt_t GetNVariables() const
UInt_t GetNClasses() const
Class that contains all the data information.
Long64_t GetNEvtSigTest()
return number of signal test events in dataset
const Event * GetEvent() const
Long64_t GetNEvents(Types::ETreeType type=Types::kMaxTreeType) const
Results * GetResults(const TString &, Types::ETreeType type, Types::EAnalysisType analysistype)
void SetCurrentType(Types::ETreeType type) const
const std::vector< Event * > & GetEventCollection(Types::ETreeType type=Types::kMaxTreeType) const
Long64_t GetNEvtBkgdTest()
return number of background test events in dataset
Abstract base class for all high level ml algorithms, you can book ml methods like BDT,...
Bool_t fModelPersistence
file to save the results
std::shared_ptr< DataLoader > fDataLoader
Booked method information.
virtual void ParseOptions()
Method to parse the internal option string.
Float_t GetValue(UInt_t ivar) const
return value of i'th variable
static void SetIsTraining(Bool_t)
when this static function is called, it sets the flag whether events with negative event weight shoul...
Double_t GetROCIntegral(UInt_t iClass=0, TMVA::Types::ETreeType type=TMVA::Types::kTesting)
Method to get ROC-Integral value from mvas.
TGraph * GetROCGraph(UInt_t iClass=0, TMVA::Types::ETreeType type=TMVA::Types::kTesting)
Method to get TGraph object with the ROC curve.
void Show()
Method to print the results in stdout.
Bool_t IsMethod(TString methodname, TString methodtitle)
Method to check if method was booked.
std::map< UInt_t, std::vector< std::tuple< Float_t, Float_t, Bool_t > > > fMvaTest
ROCCurve * GetROC(UInt_t iClass=0, TMVA::Types::ETreeType type=TMVA::Types::kTesting)
Method to get TMVA::ROCCurve Object.
ClassificationResult & operator=(const ClassificationResult &r)
std::map< UInt_t, std::vector< std::tuple< Float_t, Float_t, Bool_t > > > fMvaTrain
Classification(DataLoader *loader, TFile *file, TString options)
Contructor to create a two class classifier.
Double_t GetROCIntegral(TString methodname, TString methodtitle, UInt_t iClass=0)
Method to get ROC-Integral value from mvas.
virtual void Test()
Perform test evaluation in all booked methods.
TString GetMethodOptions(TString methodname, TString methodtitle)
return the options for the booked method.
MethodBase * GetMethod(TString methodname, TString methodtitle)
Return a TMVA::MethodBase object.
virtual void TrainMethod(TString methodname, TString methodtitle)
Lets train an specific ml method.
Bool_t HasMethodObject(TString methodname, TString methodtitle, Int_t &index)
Allows to check if the TMVA::MethodBase was created and return the index in the vector.
std::vector< ClassificationResult > & GetResults()
return the the vector of TMVA::Experimental::ClassificationResult objects.
virtual void Train()
Method to train all booked ml methods.
virtual void Evaluate()
Method to perform Train/Test over all ml method booked.
Types::EAnalysisType fAnalysisType
vector of objects with booked methods
TMVA::ROCCurve * GetROC(TMVA::MethodBase *method, UInt_t iClass=0, TMVA::Types::ETreeType type=TMVA::Types::kTesting)
Method to get TMVA::ROCCurve Object.
Bool_t IsCutsMethod(TMVA::MethodBase *method)
Allows to check if the ml method is a Cuts method.
void CopyFrom(TDirectory *src, TFile *file)
virtual void TestMethod(TString methodname, TString methodtitle)
Lets perform test an specific ml method.
Interface for all concrete MVA method implementations.
virtual Bool_t HasAnalysisType(Types::EAnalysisType type, UInt_t numberClasses, UInt_t numberTargets)=0
Virtual base Class for all MVA method.
void SetSilentFile(Bool_t status)
void SetWeightFileDir(TString fileDir)
set directory of weight file
TString GetMethodTypeName() const
const char * GetName() const
const TString & GetTestvarName() const
void SetupMethod()
setup of methods
virtual void SetAnalysisType(Types::EAnalysisType type)
const TString & GetMethodName() const
void ProcessSetup()
process all options the "CheckForUnusedOptions" is done in an independent call, since it may be overr...
DataSetInfo & DataInfo() const
DataSetInfo & fDataSetInfo
Types::EMVA GetMethodType() const
void SetFile(TFile *file)
void SetModelPersistence(Bool_t status)
Double_t GetSignalReferenceCut() const
virtual void CheckSetup()
check may be overridden by derived class (sometimes, eg, fitters are used which can only be implement...
Class for boosting a TMVA method.
void SetBoostedMethodName(TString methodName)
DataSetManager * fDataSetManager
Class for categorizing the phase space.
DataSetManager * fDataSetManager
ostringstream derivative to redirect and format output
static void InhibitOutput()
static void EnableOutput()
Double_t GetROCIntegral(const UInt_t points=41)
Calculates the ROC integral (AUC)
Class that is the base-class for a vector of result.
Class which takes the results of a multiclass classification.
Class that is the base-class for a vector of result.
Singleton class for Global types used by TMVA.
static Types & Instance()
the the single instance of "Types" if existing already, or create it (Singleton)
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
virtual const char * GetName() const
Returns name of object.
Mother of all ROOT objects.
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
@ kOverwrite
overwrite existing object with same name
Principal Components Analysis (PCA)
virtual void AddRow(const Double_t *x)
Add a data point and update the covariance matrix.
const TMatrixD * GetCovarianceMatrix() const
virtual void MakePrincipals()
Perform the principal components analysis.
const char * Data() const
TString & ReplaceAll(const TString &s1, const TString &s2)
virtual int MakeDirectory(const char *name)
Make a directory.
virtual int Unlink(const char *name)
Unlink, i.e.
A TTree represents a columnar dataset.
virtual TTree * CopyTree(const char *selection, Option_t *option="", Long64_t nentries=kMaxEntries, Long64_t firstentry=0)
Copy a tree with selection.
virtual Int_t Branch(TCollection *list, Int_t bufsize=32000, Int_t splitlevel=99, const char *name="")
Create one branch for each element in the collection.
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
std::string GetMethodName(TCppMethod_t)
std::string GetName(const std::string &scope_name)
TCppMethod_t GetMethod(TCppScope_t scope, TCppIndex_t imeth)
void GetMethodTitle(TString &name, TKey *ikey)
create variable transformations
MsgLogger & Endl(MsgLogger &ml)