50#define MinNoTrainingEvents 10
80 auto roc = GetROC(iClass,
type);
81 auto inte = roc->GetROCIntegral();
98 fROCCurve =
new ROCCurve(fMvaTest[iClass]);
100 fROCCurve =
new ROCCurve(fMvaTrain[iClass]);
127 TString hLine =
"--------------------------------------------------- :";
129 fLogger << kINFO << hLine <<
Endl;
130 fLogger << kINFO <<
"DataSet MVA :" <<
Endl;
131 fLogger << kINFO <<
"Name: Method/Title: ROC-integ :" <<
Endl;
132 fLogger << kINFO << hLine <<
Endl;
133 fLogger << kINFO <<
Form(
"%-20s %-15s %#1.3f :", fDataLoaderName.Data(),
138 fLogger << kINFO << hLine <<
Endl;
152 TGraph *roc = GetROC(iClass,
type)->GetROCCurve();
169 return fMethod.GetValue<
TString>(
"MethodName") == methodname &&
170 fMethod.GetValue<
TString>(
"MethodTitle") == methodtitle
183 :
TMVA::
Envelope(
"Classification", dataloader,
file, options), fAnalysisType(
Types::kClassification),
202 :
TMVA::
Envelope(
"Classification", dataloader, NULL, options), fAnalysisType(
Types::kClassification),
222 for (
auto m : fIMethods) {
237 for (
auto &meth : fMethods) {
238 if (meth.GetValue<
TString>(
"MethodName") == methodname && meth.GetValue<
TString>(
"MethodTitle") == methodtitle)
239 return meth.GetValue<
TString>(
"MethodOptions");
260 for (
auto &meth : fMethods) {
264 fWorkers.SetNWorkers(fJobs);
271 auto methodname = fMethods[workerID].GetValue<
TString>(
"MethodName");
272 auto methodtitle = fMethods[workerID].GetValue<
TString>(
"MethodTitle");
273 auto meth =
GetMethod(methodname, methodtitle);
274 if (!IsSilentFile()) {
275 auto fname =
Form(
".%s%s%s.root", fDataLoader->GetName(), methodname.Data(), methodtitle.
Data());
276 auto f =
new TFile(fname,
"RECREATE");
277 f->mkdir(fDataLoader->GetName());
281 TrainMethod(methodname, methodtitle);
282 TestMethod(methodname, methodtitle);
283 if (!IsSilentFile()) {
286 return GetResults(methodname, methodtitle);
290 fResults = fWorkers.Map(executor,
ROOT::TSeqI(fMethods.size()));
299 TString hLine =
"--------------------------------------------------- :";
300 Log() << kINFO << hLine <<
Endl;
301 Log() << kINFO <<
"DataSet MVA :" <<
Endl;
302 Log() << kINFO <<
"Name: Method/Title: ROC-integ :" <<
Endl;
303 Log() << kINFO << hLine <<
Endl;
304 for (
auto &
r : fResults) {
306 Log() << kINFO <<
Form(
"%-20s %-15s %#1.3f :",
r.GetDataLoaderName().Data(),
307 Form(
"%s/%s",
r.GetMethodName().Data(),
r.GetMethodTitle().Data()),
r.GetROCIntegral())
310 Log() << kINFO << hLine <<
Endl;
312 Log() << kINFO <<
"-----------------------------------------------------" <<
Endl;
313 Log() << kHEADER <<
"Evaluation done." <<
Endl <<
Endl;
314 Log() << kINFO <<
Form(
"Jobs = %d Real Time = %lf ", fJobs, fTimer.RealTime()) <<
Endl;
315 Log() << kINFO <<
"-----------------------------------------------------" <<
Endl;
316 Log() << kINFO <<
"Evaluation done." <<
Endl;
326 for (
auto &meth : fMethods) {
327 TrainMethod(meth.GetValue<
TString>(
"MethodName"), meth.GetValue<
TString>(
"MethodTitle"));
339 auto method =
GetMethod(methodname, methodtitle);
342 <<
Form(
"Trying to train method %s %s that maybe is not booked.", methodname.
Data(), methodtitle.
Data())
350 method->DataInfo().GetNClasses() < 2)
351 Log() << kFATAL <<
"You want to do classification training, but specified less than two classes." <<
Endl;
357 Log() << kWARNING <<
"Method " << method->GetMethodName() <<
" not trained (training tree has less entries ["
362 Log() << kHEADER <<
"Train method: " << method->GetMethodName() <<
" for Classification" <<
Endl <<
Endl;
363 method->TrainMethod();
364 Log() << kHEADER <<
"Training finished" <<
Endl <<
Endl;
389 if (!HasMethod(methodname, methodtitle)) {
390 std::cout << methodname <<
" " << methodtitle << std::endl;
391 Log() << kERROR <<
"Trying to get method not booked." <<
Endl;
395 if (HasMethodObject(methodname, methodtitle, index)) {
396 return dynamic_cast<MethodBase *
>(fIMethods[index]);
399 if (GetDataLoaderDataInput().GetEntries() <=
401 Log() << kFATAL <<
"No input data for the training provided!" <<
Endl;
403 Log() << kHEADER <<
"Loading booked method: " <<
gTools().
Color(
"bold") << methodname <<
" " << methodtitle
406 TString moptions = GetMethodOptions(methodname, methodtitle);
411 conf->DeclareOptionRef(boostNum = 0,
"Boost_num",
"Number of times the classifier will be boosted");
412 conf->ParseOptions();
416 if (fModelPersistence) {
417 fFileDir = fDataLoader->GetName();
426 GetDataLoaderDataSetInfo(), moptions);
429 Log() << kDEBUG <<
"Boost Number is " << boostNum <<
" > 0: train boosted classifier" <<
Endl;
434 Log() << kFATAL <<
"Method with type kBoost cannot be casted to MethodCategory. /Classification" <<
Endl;
436 if (fModelPersistence)
441 methBoost->
SetFile(fFile.get());
453 Log() << kFATAL <<
"Method with type kCategory cannot be casted to MethodCategory. /Classification" <<
Endl;
455 if (fModelPersistence)
463 if (!method->
HasAnalysisType(fAnalysisType, GetDataLoaderDataSetInfo().GetNClasses(),
464 GetDataLoaderDataSetInfo().GetNTargets())) {
465 Log() << kWARNING <<
"Method " << method->
GetMethodTypeName() <<
" is not capable of handling ";
466 Log() <<
"classification with " << GetDataLoaderDataSetInfo().GetNClasses() <<
" classes." <<
Endl;
470 if (fModelPersistence)
482 fIMethods.push_back(method);
496 if (fIMethods.empty())
498 for (
UInt_t i = 0; i < fIMethods.size(); i++) {
500 auto methbase =
dynamic_cast<MethodBase *
>(fIMethods[i]);
501 if (methbase->GetMethodTypeName() == methodname && methbase->GetMethodName() == methodtitle) {
515 for (
auto &meth : fMethods) {
516 TestMethod(meth.GetValue<
TString>(
"MethodName"), meth.GetValue<
TString>(
"MethodTitle"));
528 auto method =
GetMethod(methodname, methodtitle);
531 <<
Form(
"Trying to train method %s %s that maybe is not booked.", methodname.
Data(), methodtitle.
Data())
539 Log() << kHEADER <<
"Test method: " << method->GetMethodName() <<
" for Classification"
551 Int_t nmeth_used[2] = {0, 0};
553 std::vector<std::vector<TString>> mname(2);
554 std::vector<std::vector<Double_t>> sig(2),
sep(2), roc(2);
555 std::vector<std::vector<Double_t>> eff01(2), eff10(2), eff30(2), effArea(2);
556 std::vector<std::vector<Double_t>> eff01err(2), eff10err(2), eff30err(2);
557 std::vector<std::vector<Double_t>> trainEff01(2), trainEff10(2), trainEff30(2);
559 method->SetFile(fFile.get());
560 method->SetSilentFile(IsSilentFile());
563 if (!IsCutsMethod(method))
564 methodNoCuts = method;
566 Log() << kHEADER <<
"Evaluate classifier: " << method->GetMethodName() <<
Endl <<
Endl;
567 isel = (method->GetMethodTypeName().Contains(
"Variable")) ? 1 : 0;
570 method->TestClassification();
573 mname[isel].push_back(method->GetMethodName());
574 sig[isel].push_back(method->GetSignificance());
575 sep[isel].push_back(method->GetSeparation());
576 roc[isel].push_back(method->GetROCIntegral());
579 eff01[isel].push_back(method->GetEfficiency(
"Efficiency:0.01",
Types::kTesting, err));
580 eff01err[isel].push_back(err);
581 eff10[isel].push_back(method->GetEfficiency(
"Efficiency:0.10",
Types::kTesting, err));
582 eff10err[isel].push_back(err);
583 eff30[isel].push_back(method->GetEfficiency(
"Efficiency:0.30",
Types::kTesting, err));
584 eff30err[isel].push_back(err);
585 effArea[isel].push_back(method->GetEfficiency(
"",
Types::kTesting, err));
587 trainEff01[isel].push_back(method->GetTrainingEfficiency(
"Efficiency:0.01"));
588 trainEff10[isel].push_back(method->GetTrainingEfficiency(
"Efficiency:0.10"));
589 trainEff30[isel].push_back(method->GetTrainingEfficiency(
"Efficiency:0.30"));
593 if (!IsSilentFile()) {
594 Log() << kDEBUG <<
"\tWrite evaluation histograms to file" <<
Endl;
600 for (
Int_t k = 0; k < 2; k++) {
601 std::vector<std::vector<Double_t>> vtemp;
602 vtemp.push_back(effArea[k]);
603 vtemp.push_back(eff10[k]);
604 vtemp.push_back(eff01[k]);
605 vtemp.push_back(eff30[k]);
606 vtemp.push_back(eff10err[k]);
607 vtemp.push_back(eff01err[k]);
608 vtemp.push_back(eff30err[k]);
609 vtemp.push_back(trainEff10[k]);
610 vtemp.push_back(trainEff01[k]);
611 vtemp.push_back(trainEff30[k]);
612 vtemp.push_back(sig[k]);
613 vtemp.push_back(
sep[k]);
614 vtemp.push_back(roc[k]);
615 std::vector<TString> vtemps = mname[k];
617 effArea[k] = vtemp[0];
621 eff10err[k] = vtemp[4];
622 eff01err[k] = vtemp[5];
623 eff30err[k] = vtemp[6];
624 trainEff10[k] = vtemp[7];
625 trainEff01[k] = vtemp[8];
626 trainEff30[k] = vtemp[9];
640 const Int_t nmeth = methodNoCuts == NULL ? 0 : 1;
641 const Int_t nvar = method->fDataSetInfo.GetNVariables();
646 std::vector<Double_t> rvec;
653 std::vector<TString> *theVars =
new std::vector<TString>;
654 std::vector<ResultsClassification *> mvaRes;
657 theVars->back().ReplaceAll(
"MVA_",
"");
668 DataSet *defDs = method->fDataSetInfo.GetDataSet();
675 for (
Int_t im = 0; im < nmeth; im++) {
679 Log() << kWARNING <<
"Found NaN return value in event: " << ievt <<
" for method \""
685 for (
Int_t iv = 0; iv < nvar; iv++)
687 if (method->fDataSetInfo.IsSignal(ev)) {
696 for (
Int_t im = 0; im < nmeth; im++) {
697 for (
Int_t jm = im; jm < nmeth; jm++) {
698 if ((dvec[im] - rvec[im]) * (dvec[jm] - rvec[jm]) > 0) {
721 if (corrMatS != 0 && corrMatB != 0) {
726 for (
Int_t im = 0; im < nmeth; im++) {
727 for (
Int_t jm = 0; jm < nmeth; jm++) {
728 mvaMatS(im, jm) = (*corrMatS)(im, jm);
729 mvaMatB(im, jm) = (*corrMatB)(im, jm);
734 std::vector<TString> theInputVars;
737 for (
Int_t iv = 0; iv < nvar; iv++) {
738 theInputVars.push_back(method->fDataSetInfo.GetVariableInfo(iv).GetLabel());
739 for (
Int_t jm = 0; jm < nmeth; jm++) {
740 varmvaMatS(iv, jm) = (*corrMatS)(nmeth + iv, jm);
741 varmvaMatB(iv, jm) = (*corrMatB)(nmeth + iv, jm);
747 Log() << kINFO <<
Form(
"Dataset[%s] : ", method->fDataSetInfo.GetName())
748 <<
"Inter-MVA correlation matrix (signal):" <<
Endl;
752 Log() << kINFO <<
Form(
"Dataset[%s] : ", method->fDataSetInfo.GetName())
753 <<
"Inter-MVA correlation matrix (background):" <<
Endl;
758 Log() << kINFO <<
Form(
"Dataset[%s] : ", method->fDataSetInfo.GetName())
759 <<
"Correlations between input variables and MVA response (signal):" <<
Endl;
763 Log() << kINFO <<
Form(
"Dataset[%s] : ", method->fDataSetInfo.GetName())
764 <<
"Correlations between input variables and MVA response (background):" <<
Endl;
768 Log() << kWARNING <<
Form(
"Dataset[%s] : ", method->fDataSetInfo.GetName())
769 <<
"<TestAllMethods> cannot compute correlation matrices" <<
Endl;
772 Log() << kINFO <<
Form(
"Dataset[%s] : ", method->fDataSetInfo.GetName())
773 <<
"The following \"overlap\" matrices contain the fraction of events for which " <<
Endl;
774 Log() << kINFO <<
Form(
"Dataset[%s] : ", method->fDataSetInfo.GetName())
775 <<
"the MVAs 'i' and 'j' have returned conform answers about \"signal-likeness\"" <<
Endl;
776 Log() << kINFO <<
Form(
"Dataset[%s] : ", method->fDataSetInfo.GetName())
777 <<
"An event is signal-like, if its MVA output exceeds the following value:" <<
Endl;
779 Log() << kINFO <<
Form(
"Dataset[%s] : ", method->fDataSetInfo.GetName())
780 <<
"which correspond to the working point: eff(signal) = 1 - eff(background)" <<
Endl;
784 Log() << kINFO <<
Form(
"Dataset[%s] : ", method->fDataSetInfo.GetName())
785 <<
"Note: no correlations and overlap with cut method are provided at present" <<
Endl;
789 Log() << kINFO <<
Form(
"Dataset[%s] : ", method->fDataSetInfo.GetName())
790 <<
"Inter-MVA overlap matrix (signal):" <<
Endl;
794 Log() << kINFO <<
Form(
"Dataset[%s] : ", method->fDataSetInfo.GetName())
795 <<
"Inter-MVA overlap matrix (background):" <<
Endl;
816 auto &fResult = GetResults(methodname, methodtitle);
820 Log().EnableOutput();
823 TString hLine =
"------------------------------------------------------------------------------------------"
824 "-------------------------";
825 Log() << kINFO <<
"Evaluation results ranked by best signal efficiency and purity (area)" <<
Endl;
826 Log() << kINFO << hLine <<
Endl;
827 Log() << kINFO <<
"DataSet MVA " <<
Endl;
828 Log() << kINFO <<
"Name: Method: ROC-integ" <<
Endl;
830 Log() << kDEBUG << hLine <<
Endl;
831 for (
Int_t k = 0; k < 2; k++) {
832 if (k == 1 && nmeth_used[k] > 0) {
833 Log() << kINFO << hLine <<
Endl;
834 Log() << kINFO <<
"Input Variables: " <<
Endl << hLine <<
Endl;
836 for (
Int_t i = 0; i < nmeth_used[k]; i++) {
837 TString datasetName = fDataLoader->GetName();
838 TString methodName = mname[k][i];
846 std::vector<Bool_t> *mvaResType =
dynamic_cast<ResultsClassification *
>(results)->GetValueVectorTypes();
849 if (mvaResType->size() != 0) {
850 rocIntegral = GetROCIntegral(methodname, methodtitle);
853 if (
sep[k][i] < 0 || sig[k][i] < 0) {
855 fResult.fROCIntegral = effArea[k][i];
857 <<
Form(
"%-13s %-15s: %#1.3f", fDataLoader->GetName(), methodName.
Data(), fResult.fROCIntegral)
860 fResult.fROCIntegral = rocIntegral;
861 Log() << kINFO <<
Form(
"%-13s %-15s: %#1.3f", datasetName.
Data(), methodName.
Data(), rocIntegral)
866 Log() << kINFO << hLine <<
Endl;
868 Log() << kINFO <<
"Testing efficiency compared to training efficiency (overtraining check)" <<
Endl;
869 Log() << kINFO << hLine <<
Endl;
871 <<
"DataSet MVA Signal efficiency: from test sample (from training sample) "
873 Log() << kINFO <<
"Name: Method: @B=0.01 @B=0.10 @B=0.30 "
875 Log() << kINFO << hLine <<
Endl;
876 for (
Int_t k = 0; k < 2; k++) {
877 if (k == 1 && nmeth_used[k] > 0) {
878 Log() << kINFO << hLine <<
Endl;
879 Log() << kINFO <<
"Input Variables: " <<
Endl << hLine <<
Endl;
881 for (
Int_t i = 0; i < nmeth_used[k]; i++) {
883 mname[k][i].ReplaceAll(
"Variable_",
"");
885 Log() << kINFO <<
Form(
"%-20s %-15s: %#1.3f (%#1.3f) %#1.3f (%#1.3f) %#1.3f (%#1.3f)",
886 method->fDataSetInfo.GetName(), (
const char *)mname[k][i], eff01[k][i],
887 trainEff01[k][i], eff10[k][i], trainEff10[k][i], eff30[k][i], trainEff30[k][i])
891 Log() << kINFO << hLine <<
Endl;
894 if (
gTools().CheckForSilentOption(GetOptions()))
895 Log().InhibitOutput();
896 }
else if (IsCutsMethod(method)) {
897 for (
Int_t k = 0; k < 2; k++) {
898 for (
Int_t i = 0; i < nmeth_used[k]; i++) {
900 if (
sep[k][i] < 0 || sig[k][i] < 0) {
902 fResult.fROCIntegral = effArea[k][i];
911 if (IsCutsMethod(method)) {
912 fResult.fIsCuts =
kTRUE;
914 auto rocCurveTest = GetROC(methodname, methodtitle, 0,
Types::kTesting);
915 fResult.fMvaTest[0] = rocCurveTest->GetMvas();
916 fResult.fROCIntegral = GetROCIntegral(methodname, methodtitle);
918 TString className = method->DataInfo().GetClassInfo(0)->GetName();
919 fResult.fClassNames.push_back(className);
921 if (!IsSilentFile()) {
923 RootBaseDir()->cd(method->fDataSetInfo.GetName());
947 if (fResults.size() == 0)
948 Log() << kFATAL <<
"No Classification results available" <<
Endl;
972 for (
auto &result : fResults) {
973 if (result.IsMethod(methodname, methodtitle))
977 result.
fMethod[
"MethodName"] = methodname;
978 result.
fMethod[
"MethodTitle"] = methodtitle;
980 fResults.push_back(result);
981 return fResults.back();
1001 Log() << kERROR <<
Form(
"Given class number (iClass = %i) does not exist. There are %i classes in dataset.",
1011 std::vector<Bool_t> *mvaResTypes =
dynamic_cast<ResultsClassification *
>(results)->GetValueVectorTypes();
1012 std::vector<Float_t> mvaResWeights;
1015 mvaResWeights.reserve(eventCollection.size());
1016 for (
auto ev : eventCollection) {
1017 mvaResWeights.push_back(ev->GetWeight());
1020 rocCurve =
new TMVA::ROCCurve(*mvaRes, *mvaResTypes, mvaResWeights);
1023 std::vector<Float_t> mvaRes;
1024 std::vector<Bool_t> mvaResTypes;
1025 std::vector<Float_t> mvaResWeights;
1027 std::vector<std::vector<Float_t>> *rawMvaRes =
dynamic_cast<ResultsMulticlass *
>(results)->GetValueVector();
1032 mvaRes.reserve(rawMvaRes->size());
1033 for (
auto item : *rawMvaRes) {
1034 mvaRes.push_back(item[iClass]);
1038 mvaResTypes.reserve(eventCollection.size());
1039 mvaResWeights.reserve(eventCollection.size());
1040 for (
auto ev : eventCollection) {
1041 mvaResTypes.push_back(ev->GetClass() == iClass);
1042 mvaResWeights.push_back(ev->GetWeight());
1045 rocCurve =
new TMVA::ROCCurve(mvaRes, mvaResTypes, mvaResWeights);
1063 return GetROC(
GetMethod(methodname, methodtitle), iClass,
type);
1076 TMVA::ROCCurve *rocCurve = GetROC(methodname, methodtitle, iClass);
1079 <<
Form(
"ROCCurve object was not created in MethodName = %s MethodTitle = %s not found with Dataset = %s ",
1080 methodname.
Data(), methodtitle.
Data(), fDataLoader->GetName())
1101 while ((key = (
TKey *)nextkey())) {
1110 CopyFrom(subdir,
file);
1115 TTree *newT =
T->CloneTree(-1,
"fast");
1133 auto dsdir = fFile->mkdir(fDataLoader->GetName());
1134 TTree *TrainTree = 0;
1135 TTree *TestTree = 0;
1138 for (
UInt_t i = 0; i < fMethods.size(); i++) {
1139 auto methodname = fMethods[i].GetValue<
TString>(
"MethodName");
1140 auto methodtitle = fMethods[i].GetValue<
TString>(
"MethodTitle");
1141 auto fname =
Form(
".%s%s%s.root", fDataLoader->GetName(), methodname.Data(), methodtitle.
Data());
1144 ifile =
new TFile(fname);
1147 ofile =
new TFile(fname);
1150 auto tmptrain = (
TTree *)ds->
Get(
"TrainTree");
1151 auto tmptest = (
TTree *)ds->
Get(
"TestTree");
1153 fFile->cd(fDataLoader->GetName());
1155 auto methdirname =
Form(
"Method_%s", methodtitle.
Data());
1156 auto methdir = dsdir->mkdir(methdirname, methdirname);
1157 auto methdirbase = methdir->mkdir(methodtitle.
Data(), methodtitle.
Data());
1161 CopyFrom(mfdirbase, (
TFile *)methdirbase);
1164 TrainTree = tmptrain->
CopyTree(
"");
1168 auto trainbranch = TrainTree->
Branch(methodtitle.
Data(), &mva);
1169 tmptrain->SetBranchAddress(methodtitle.
Data(), &mva);
1171 for (
UInt_t ev = 0; ev < entries; ev++) {
1172 tmptrain->GetEntry(ev);
1173 trainbranch->Fill();
1175 auto testbranch = TestTree->
Branch(methodtitle.
Data(), &mva);
1176 tmptest->SetBranchAddress(methodtitle.
Data(), &mva);
1178 for (
UInt_t ev = 0; ev < entries; ev++) {
1179 tmptest->GetEntry(ev);
1189 for (
UInt_t i = 0; i < fMethods.size(); i++) {
1190 auto methodname = fMethods[i].GetValue<
TString>(
"MethodName");
1191 auto methodtitle = fMethods[i].GetValue<
TString>(
"MethodTitle");
1192 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 TGraph is an 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 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
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.
RPY_EXPORTED TCppMethod_t GetMethod(TCppScope_t scope, TCppIndex_t imeth)
void GetMethodTitle(TString &name, TKey *ikey)
void GetMethodName(TString &name, TKey *mkey)
create variable transformations
MsgLogger & Endl(MsgLogger &ml)