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) {
265 fWorkers.SetNWorkers(fJobs);
272 auto methodname = fMethods[workerID].GetValue<
TString>(
"MethodName");
273 auto methodtitle = fMethods[workerID].GetValue<
TString>(
"MethodTitle");
274 auto meth =
GetMethod(methodname, methodtitle);
275 if (!IsSilentFile()) {
276 auto fname =
Form(
".%s%s%s.root", fDataLoader->GetName(), methodname.Data(), methodtitle.
Data());
277 auto f =
new TFile(fname,
"RECREATE");
278 f->mkdir(fDataLoader->GetName());
282 TrainMethod(methodname, methodtitle);
283 TestMethod(methodname, methodtitle);
284 if (!IsSilentFile()) {
287 return GetResults(methodname, methodtitle);
291 fResults = fWorkers.Map(executor,
ROOT::TSeqI(fMethods.size()));
300 TString hLine =
"--------------------------------------------------- :";
301 Log() << kINFO << hLine <<
Endl;
302 Log() << kINFO <<
"DataSet MVA :" <<
Endl;
303 Log() << kINFO <<
"Name: Method/Title: ROC-integ :" <<
Endl;
304 Log() << kINFO << hLine <<
Endl;
305 for (
auto &
r : fResults) {
307 Log() << kINFO <<
Form(
"%-20s %-15s %#1.3f :",
r.GetDataLoaderName().Data(),
308 Form(
"%s/%s",
r.GetMethodName().Data(),
r.GetMethodTitle().Data()),
r.GetROCIntegral())
311 Log() << kINFO << hLine <<
Endl;
313 Log() << kINFO <<
"-----------------------------------------------------" <<
Endl;
314 Log() << kHEADER <<
"Evaluation done." <<
Endl <<
Endl;
315 Log() << kINFO <<
Form(
"Jobs = %d Real Time = %lf ", fJobs, fTimer.RealTime()) <<
Endl;
316 Log() << kINFO <<
"-----------------------------------------------------" <<
Endl;
317 Log() << kINFO <<
"Evaluation done." <<
Endl;
327 for (
auto &meth : fMethods) {
328 TrainMethod(meth.GetValue<
TString>(
"MethodName"), meth.GetValue<
TString>(
"MethodTitle"));
340 auto method =
GetMethod(methodname, methodtitle);
343 <<
Form(
"Trying to train method %s %s that maybe is not booked.", methodname.
Data(), methodtitle.
Data())
351 method->DataInfo().GetNClasses() < 2)
352 Log() << kFATAL <<
"You want to do classification training, but specified less than two classes." <<
Endl;
358 Log() << kWARNING <<
"Method " << method->GetMethodName() <<
" not trained (training tree has less entries ["
363 Log() << kHEADER <<
"Train method: " << method->GetMethodName() <<
" for Classification" <<
Endl <<
Endl;
364 method->TrainMethod();
365 Log() << kHEADER <<
"Training finished" <<
Endl <<
Endl;
390 if (!HasMethod(methodname, methodtitle)) {
391 std::cout << methodname <<
" " << methodtitle << std::endl;
392 Log() << kERROR <<
"Trying to get method not booked." <<
Endl;
396 if (HasMethodObject(methodname, methodtitle, index)) {
397 return dynamic_cast<MethodBase *
>(fIMethods[index]);
400 if (GetDataLoaderDataInput().GetEntries() <=
402 Log() << kFATAL <<
"No input data for the training provided!" <<
Endl;
404 Log() << kHEADER <<
"Loading booked method: " <<
gTools().
Color(
"bold") << methodname <<
" " << methodtitle
407 TString moptions = GetMethodOptions(methodname, methodtitle);
412 conf->DeclareOptionRef(boostNum = 0,
"Boost_num",
"Number of times the classifier will be boosted");
413 conf->ParseOptions();
417 if (fModelPersistence) {
418 fFileDir = fDataLoader->GetName();
427 GetDataLoaderDataSetInfo(), moptions);
430 Log() << kDEBUG <<
"Boost Number is " << boostNum <<
" > 0: train boosted classifier" <<
Endl;
435 Log() << kFATAL <<
"Method with type kBoost cannot be casted to MethodCategory. /Classification" <<
Endl;
437 if (fModelPersistence)
442 methBoost->
SetFile(fFile.get());
454 Log() << kFATAL <<
"Method with type kCategory cannot be casted to MethodCategory. /Classification" <<
Endl;
456 if (fModelPersistence)
464 if (!method->
HasAnalysisType(fAnalysisType, GetDataLoaderDataSetInfo().GetNClasses(),
465 GetDataLoaderDataSetInfo().GetNTargets())) {
466 Log() << kWARNING <<
"Method " << method->
GetMethodTypeName() <<
" is not capable of handling ";
467 Log() <<
"classification with " << GetDataLoaderDataSetInfo().GetNClasses() <<
" classes." <<
Endl;
471 if (fModelPersistence)
483 fIMethods.push_back(method);
497 if (fIMethods.empty())
499 for (
UInt_t i = 0; i < fIMethods.size(); i++) {
501 auto methbase =
dynamic_cast<MethodBase *
>(fIMethods[i]);
502 if (methbase->GetMethodTypeName() == methodname && methbase->GetMethodName() == methodtitle) {
516 for (
auto &meth : fMethods) {
517 TestMethod(meth.GetValue<
TString>(
"MethodName"), meth.GetValue<
TString>(
"MethodTitle"));
529 auto method =
GetMethod(methodname, methodtitle);
532 <<
Form(
"Trying to train method %s %s that maybe is not booked.", methodname.
Data(), methodtitle.
Data())
540 Log() << kHEADER <<
"Test method: " << method->GetMethodName() <<
" for Classification"
552 Int_t nmeth_used[2] = {0, 0};
554 std::vector<std::vector<TString>> mname(2);
555 std::vector<std::vector<Double_t>> sig(2),
sep(2), roc(2);
556 std::vector<std::vector<Double_t>> eff01(2), eff10(2), eff30(2), effArea(2);
557 std::vector<std::vector<Double_t>> eff01err(2), eff10err(2), eff30err(2);
558 std::vector<std::vector<Double_t>> trainEff01(2), trainEff10(2), trainEff30(2);
560 method->SetFile(fFile.get());
561 method->SetSilentFile(IsSilentFile());
564 if (!IsCutsMethod(method))
565 methodNoCuts = method;
567 Log() << kHEADER <<
"Evaluate classifier: " << method->GetMethodName() <<
Endl <<
Endl;
568 isel = (method->GetMethodTypeName().Contains(
"Variable")) ? 1 : 0;
571 method->TestClassification();
574 mname[isel].push_back(method->GetMethodName());
575 sig[isel].push_back(method->GetSignificance());
576 sep[isel].push_back(method->GetSeparation());
577 roc[isel].push_back(method->GetROCIntegral());
580 eff01[isel].push_back(method->GetEfficiency(
"Efficiency:0.01",
Types::kTesting, err));
581 eff01err[isel].push_back(err);
582 eff10[isel].push_back(method->GetEfficiency(
"Efficiency:0.10",
Types::kTesting, err));
583 eff10err[isel].push_back(err);
584 eff30[isel].push_back(method->GetEfficiency(
"Efficiency:0.30",
Types::kTesting, err));
585 eff30err[isel].push_back(err);
586 effArea[isel].push_back(method->GetEfficiency(
"",
Types::kTesting, err));
588 trainEff01[isel].push_back(method->GetTrainingEfficiency(
"Efficiency:0.01"));
589 trainEff10[isel].push_back(method->GetTrainingEfficiency(
"Efficiency:0.10"));
590 trainEff30[isel].push_back(method->GetTrainingEfficiency(
"Efficiency:0.30"));
594 if (!IsSilentFile()) {
595 Log() << kDEBUG <<
"\tWrite evaluation histograms to file" <<
Endl;
601 for (
Int_t k = 0; k < 2; k++) {
602 std::vector<std::vector<Double_t>> vtemp;
603 vtemp.push_back(effArea[k]);
604 vtemp.push_back(eff10[k]);
605 vtemp.push_back(eff01[k]);
606 vtemp.push_back(eff30[k]);
607 vtemp.push_back(eff10err[k]);
608 vtemp.push_back(eff01err[k]);
609 vtemp.push_back(eff30err[k]);
610 vtemp.push_back(trainEff10[k]);
611 vtemp.push_back(trainEff01[k]);
612 vtemp.push_back(trainEff30[k]);
613 vtemp.push_back(sig[k]);
614 vtemp.push_back(
sep[k]);
615 vtemp.push_back(roc[k]);
616 std::vector<TString> vtemps = mname[k];
618 effArea[k] = vtemp[0];
622 eff10err[k] = vtemp[4];
623 eff01err[k] = vtemp[5];
624 eff30err[k] = vtemp[6];
625 trainEff10[k] = vtemp[7];
626 trainEff01[k] = vtemp[8];
627 trainEff30[k] = vtemp[9];
641 const Int_t nmeth = methodNoCuts == NULL ? 0 : 1;
647 std::vector<Double_t> rvec;
654 std::vector<TString> *theVars =
new std::vector<TString>;
655 std::vector<ResultsClassification *> mvaRes;
658 theVars->back().ReplaceAll(
"MVA_",
"");
669 DataSet *defDs = method->fDataSetInfo.GetDataSet();
676 for (
Int_t im = 0; im < nmeth; im++) {
680 Log() << kWARNING <<
"Found NaN return value in event: " << ievt <<
" for method \""
686 for (
Int_t iv = 0; iv < nvar; iv++)
688 if (method->fDataSetInfo.IsSignal(ev)) {
697 for (
Int_t im = 0; im < nmeth; im++) {
698 for (
Int_t jm = im; jm < nmeth; jm++) {
699 if ((dvec[im] - rvec[im]) * (dvec[jm] - rvec[jm]) > 0) {
722 if (corrMatS != 0 && corrMatB != 0) {
727 for (
Int_t im = 0; im < nmeth; im++) {
728 for (
Int_t jm = 0; jm < nmeth; jm++) {
729 mvaMatS(im, jm) = (*corrMatS)(im, jm);
730 mvaMatB(im, jm) = (*corrMatB)(im, jm);
735 std::vector<TString> theInputVars;
738 for (
Int_t iv = 0; iv < nvar; iv++) {
739 theInputVars.push_back(method->fDataSetInfo.GetVariableInfo(iv).GetLabel());
740 for (
Int_t jm = 0; jm < nmeth; jm++) {
741 varmvaMatS(iv, jm) = (*corrMatS)(nmeth + iv, jm);
742 varmvaMatB(iv, jm) = (*corrMatB)(nmeth + iv, jm);
748 Log() << kINFO <<
Form(
"Dataset[%s] : ", method->fDataSetInfo.GetName())
749 <<
"Inter-MVA correlation matrix (signal):" <<
Endl;
753 Log() << kINFO <<
Form(
"Dataset[%s] : ", method->fDataSetInfo.GetName())
754 <<
"Inter-MVA correlation matrix (background):" <<
Endl;
759 Log() << kINFO <<
Form(
"Dataset[%s] : ", method->fDataSetInfo.GetName())
760 <<
"Correlations between input variables and MVA response (signal):" <<
Endl;
764 Log() << kINFO <<
Form(
"Dataset[%s] : ", method->fDataSetInfo.GetName())
765 <<
"Correlations between input variables and MVA response (background):" <<
Endl;
769 Log() << kWARNING <<
Form(
"Dataset[%s] : ", method->fDataSetInfo.GetName())
770 <<
"<TestAllMethods> cannot compute correlation matrices" <<
Endl;
773 Log() << kINFO <<
Form(
"Dataset[%s] : ", method->fDataSetInfo.GetName())
774 <<
"The following \"overlap\" matrices contain the fraction of events for which " <<
Endl;
775 Log() << kINFO <<
Form(
"Dataset[%s] : ", method->fDataSetInfo.GetName())
776 <<
"the MVAs 'i' and 'j' have returned conform answers about \"signal-likeness\"" <<
Endl;
777 Log() << kINFO <<
Form(
"Dataset[%s] : ", method->fDataSetInfo.GetName())
778 <<
"An event is signal-like, if its MVA output exceeds the following value:" <<
Endl;
780 Log() << kINFO <<
Form(
"Dataset[%s] : ", method->fDataSetInfo.GetName())
781 <<
"which correspond to the working point: eff(signal) = 1 - eff(background)" <<
Endl;
785 Log() << kINFO <<
Form(
"Dataset[%s] : ", method->fDataSetInfo.GetName())
786 <<
"Note: no correlations and overlap with cut method are provided at present" <<
Endl;
790 Log() << kINFO <<
Form(
"Dataset[%s] : ", method->fDataSetInfo.GetName())
791 <<
"Inter-MVA overlap matrix (signal):" <<
Endl;
795 Log() << kINFO <<
Form(
"Dataset[%s] : ", method->fDataSetInfo.GetName())
796 <<
"Inter-MVA overlap matrix (background):" <<
Endl;
817 auto &fResult = GetResults(methodname, methodtitle);
821 Log().EnableOutput();
824 TString hLine =
"------------------------------------------------------------------------------------------"
825 "-------------------------";
826 Log() << kINFO <<
"Evaluation results ranked by best signal efficiency and purity (area)" <<
Endl;
827 Log() << kINFO << hLine <<
Endl;
828 Log() << kINFO <<
"DataSet MVA " <<
Endl;
829 Log() << kINFO <<
"Name: Method: ROC-integ" <<
Endl;
831 Log() << kDEBUG << hLine <<
Endl;
832 for (
Int_t k = 0; k < 2; k++) {
833 if (k == 1 && nmeth_used[k] > 0) {
834 Log() << kINFO << hLine <<
Endl;
835 Log() << kINFO <<
"Input Variables: " <<
Endl << hLine <<
Endl;
837 for (
Int_t i = 0; i < nmeth_used[k]; i++) {
838 TString datasetName = fDataLoader->GetName();
839 TString methodName = mname[k][i];
847 std::vector<Bool_t> *mvaResType =
dynamic_cast<ResultsClassification *
>(results)->GetValueVectorTypes();
850 if (mvaResType->size() != 0) {
851 rocIntegral = GetROCIntegral(methodname, methodtitle);
854 if (
sep[k][i] < 0 || sig[k][i] < 0) {
856 fResult.fROCIntegral = effArea[k][i];
858 <<
Form(
"%-13s %-15s: %#1.3f", fDataLoader->GetName(), methodName.
Data(), fResult.fROCIntegral)
861 fResult.fROCIntegral = rocIntegral;
862 Log() << kINFO <<
Form(
"%-13s %-15s: %#1.3f", datasetName.
Data(), methodName.
Data(), rocIntegral)
867 Log() << kINFO << hLine <<
Endl;
869 Log() << kINFO <<
"Testing efficiency compared to training efficiency (overtraining check)" <<
Endl;
870 Log() << kINFO << hLine <<
Endl;
872 <<
"DataSet MVA Signal efficiency: from test sample (from training sample) "
874 Log() << kINFO <<
"Name: Method: @B=0.01 @B=0.10 @B=0.30 "
876 Log() << kINFO << hLine <<
Endl;
877 for (
Int_t k = 0; k < 2; k++) {
878 if (k == 1 && nmeth_used[k] > 0) {
879 Log() << kINFO << hLine <<
Endl;
880 Log() << kINFO <<
"Input Variables: " <<
Endl << hLine <<
Endl;
882 for (
Int_t i = 0; i < nmeth_used[k]; i++) {
884 mname[k][i].ReplaceAll(
"Variable_",
"");
886 Log() << kINFO <<
Form(
"%-20s %-15s: %#1.3f (%#1.3f) %#1.3f (%#1.3f) %#1.3f (%#1.3f)",
887 method->fDataSetInfo.GetName(), (
const char *)mname[k][i], eff01[k][i],
888 trainEff01[k][i], eff10[k][i], trainEff10[k][i], eff30[k][i], trainEff30[k][i])
892 Log() << kINFO << hLine <<
Endl;
895 if (
gTools().CheckForSilentOption(GetOptions()))
896 Log().InhibitOutput();
897 }
else if (IsCutsMethod(method)) {
898 for (
Int_t k = 0; k < 2; k++) {
899 for (
Int_t i = 0; i < nmeth_used[k]; i++) {
901 if (
sep[k][i] < 0 || sig[k][i] < 0) {
903 fResult.fROCIntegral = effArea[k][i];
912 if (IsCutsMethod(method)) {
913 fResult.fIsCuts =
kTRUE;
915 auto rocCurveTest = GetROC(methodname, methodtitle, 0,
Types::kTesting);
916 fResult.fMvaTest[0] = rocCurveTest->GetMvas();
917 fResult.fROCIntegral = GetROCIntegral(methodname, methodtitle);
919 TString className = method->DataInfo().GetClassInfo(0)->GetName();
920 fResult.fClassNames.push_back(className);
922 if (!IsSilentFile()) {
924 RootBaseDir()->cd(method->fDataSetInfo.GetName());
948 if (fResults.size() == 0)
949 Log() << kFATAL <<
"No Classification results available" <<
Endl;
973 for (
auto &result : fResults) {
974 if (result.IsMethod(methodname, methodtitle))
978 result.
fMethod[
"MethodName"] = methodname;
979 result.
fMethod[
"MethodTitle"] = methodtitle;
981 fResults.push_back(result);
982 return fResults.back();
1002 Log() << kERROR <<
Form(
"Given class number (iClass = %i) does not exist. There are %i classes in dataset.",
1012 std::vector<Bool_t> *mvaResTypes =
dynamic_cast<ResultsClassification *
>(results)->GetValueVectorTypes();
1013 std::vector<Float_t> mvaResWeights;
1016 mvaResWeights.reserve(eventCollection.size());
1017 for (
auto ev : eventCollection) {
1018 mvaResWeights.push_back(ev->GetWeight());
1021 rocCurve =
new TMVA::ROCCurve(*mvaRes, *mvaResTypes, mvaResWeights);
1024 std::vector<Float_t> mvaRes;
1025 std::vector<Bool_t> mvaResTypes;
1026 std::vector<Float_t> mvaResWeights;
1028 std::vector<std::vector<Float_t>> *rawMvaRes =
dynamic_cast<ResultsMulticlass *
>(results)->GetValueVector();
1033 mvaRes.reserve(rawMvaRes->size());
1034 for (
auto item : *rawMvaRes) {
1035 mvaRes.push_back(item[iClass]);
1039 mvaResTypes.reserve(eventCollection.size());
1040 mvaResWeights.reserve(eventCollection.size());
1041 for (
auto ev : eventCollection) {
1042 mvaResTypes.push_back(ev->GetClass() == iClass);
1043 mvaResWeights.push_back(ev->GetWeight());
1046 rocCurve =
new TMVA::ROCCurve(mvaRes, mvaResTypes, mvaResWeights);
1064 return GetROC(
GetMethod(methodname, methodtitle), iClass,
type);
1077 TMVA::ROCCurve *rocCurve = GetROC(methodname, methodtitle, iClass);
1080 <<
Form(
"ROCCurve object was not created in MethodName = %s MethodTitle = %s not found with Dataset = %s ",
1081 methodname.
Data(), methodtitle.
Data(), fDataLoader->GetName())
1102 while ((key = (
TKey *)nextkey())) {
1111 CopyFrom(subdir,
file);
1116 TTree *newT =
T->CloneTree(-1,
"fast");
1134 auto dsdir = fFile->mkdir(fDataLoader->GetName());
1135 TTree *TrainTree = 0;
1136 TTree *TestTree = 0;
1139 for (
UInt_t i = 0; i < fMethods.size(); i++) {
1140 auto methodname = fMethods[i].GetValue<
TString>(
"MethodName");
1141 auto methodtitle = fMethods[i].GetValue<
TString>(
"MethodTitle");
1142 auto fname =
Form(
".%s%s%s.root", fDataLoader->GetName(), methodname.Data(), methodtitle.
Data());
1145 ifile =
new TFile(fname);
1148 ofile =
new TFile(fname);
1151 auto tmptrain = (
TTree *)ds->
Get(
"TrainTree");
1152 auto tmptest = (
TTree *)ds->
Get(
"TestTree");
1154 fFile->cd(fDataLoader->GetName());
1156 auto methdirname =
Form(
"Method_%s", methodtitle.
Data());
1157 auto methdir = dsdir->mkdir(methdirname, methdirname);
1158 auto methdirbase = methdir->mkdir(methodtitle.
Data(), methodtitle.
Data());
1162 CopyFrom(mfdirbase, (
TFile *)methdirbase);
1165 TrainTree = tmptrain->
CopyTree(
"");
1169 auto trainbranch = TrainTree->
Branch(methodtitle.
Data(), &mva);
1170 tmptrain->SetBranchAddress(methodtitle.
Data(), &mva);
1172 for (
UInt_t ev = 0; ev < entries; ev++) {
1173 tmptrain->GetEntry(ev);
1174 trainbranch->Fill();
1176 auto testbranch = TestTree->
Branch(methodtitle.
Data(), &mva);
1177 tmptest->SetBranchAddress(methodtitle.
Data(), &mva);
1179 for (
UInt_t ev = 0; ev < entries; ev++) {
1180 tmptest->GetEntry(ev);
1190 for (
UInt_t i = 0; i < fMethods.size(); i++) {
1191 auto methodname = fMethods[i].GetValue<
TString>(
"MethodName");
1192 auto methodtitle = fMethods[i].GetValue<
TString>(
"MethodTitle");
1193 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.
Long64_t GetEntries() const
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).
Bool_t cd(const char *path=nullptr) override
Change current directory to "this" directory.
TObject * Get(const char *namecycle) override
Return pointer to object identified by namecycle.
Describe directory structure in memory.
virtual TObject * Get(const char *namecycle)
Return pointer to object identified by namecycle.
virtual void SaveSelf(Bool_t=kFALSE)
virtual TList * GetListOfKeys() const
virtual Bool_t cd(const char *path=nullptr)
Change current directory to "this" directory.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
void Close(Option_t *option="") override
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.
TBranch * Branch(const char *name, T *obj, Int_t bufsize=32000, Int_t splitlevel=99)
Add a new branch, and infer the data type from the type of obj being passed.
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)