49#define MinNoTrainingEvents 10
79 auto roc = GetROC(iClass,
type);
80 auto inte = roc->GetROCIntegral();
97 fROCCurve =
new ROCCurve(fMvaTest[iClass]);
99 fROCCurve =
new ROCCurve(fMvaTrain[iClass]);
126 TString hLine =
"--------------------------------------------------- :";
128 fLogger << kINFO << hLine <<
Endl;
129 fLogger << kINFO <<
"DataSet MVA :" <<
Endl;
130 fLogger << kINFO <<
"Name: Method/Title: ROC-integ :" <<
Endl;
131 fLogger << kINFO << hLine <<
Endl;
132 fLogger << kINFO <<
TString::Format(
"%-20s %-15s %#1.3f :", fDataLoaderName.Data(),
137 fLogger << kINFO << hLine <<
Endl;
151 TGraph *roc = GetROC(iClass,
type)->GetROCCurve();
168 return fMethod.GetValue<
TString>(
"MethodName") == methodname &&
169 fMethod.GetValue<
TString>(
"MethodTitle") == methodtitle
182 :
TMVA::
Envelope(
"Classification", dataloader, file, options), fAnalysisType(
Types::kClassification),
201 :
TMVA::
Envelope(
"Classification", dataloader, NULL, options), fAnalysisType(
Types::kClassification),
221 for (
auto m : fIMethods) {
236 for (
auto &meth : fMethods) {
237 if (meth.GetValue<
TString>(
"MethodName") == methodname && meth.GetValue<
TString>(
"MethodTitle") == methodtitle)
238 return meth.GetValue<
TString>(
"MethodOptions");
259 for (
auto &meth : fMethods) {
260 GetMethod(meth.GetValue<
TString>(
"MethodName"), meth.GetValue<
TString>(
"MethodTitle"));
263 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 =
TString::Format(
".%s%s%s.root", fDataLoader->GetName(), methodname.Data(), methodtitle.
Data());
275 auto f =
new TFile(fname.Data(),
"RECREATE");
276 f->mkdir(fDataLoader->GetName());
280 TrainMethod(methodname, methodtitle);
281 TestMethod(methodname, methodtitle);
282 if (!IsSilentFile()) {
285 return GetResults(methodname, methodtitle);
289 fResults = fWorkers.Map(executor,
ROOT::TSeqI(fMethods.size()));
298 TString hLine =
"--------------------------------------------------- :";
299 Log() << kINFO << hLine <<
Endl;
300 Log() << kINFO <<
"DataSet MVA :" <<
Endl;
301 Log() << kINFO <<
"Name: Method/Title: ROC-integ :" <<
Endl;
302 Log() << kINFO << hLine <<
Endl;
303 for (
auto &
r : fResults) {
305 Log() << kINFO <<
TString::Format(
"%-20s %-15s %#1.3f :",
r.GetDataLoaderName().Data(),
310 Log() << kINFO << hLine <<
Endl;
312 Log() << kINFO <<
"-----------------------------------------------------" <<
Endl;
313 Log() << kHEADER <<
"Evaluation done." <<
Endl <<
Endl;
314 Log() << kINFO <<
TString::Format(
"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 <<
TString::Format(
"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)) {
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 <<
TString::Format(
"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);
746 Log() << kINFO <<
Endl;
747 Log() << kINFO <<
TString::Format(
"Dataset[%s] : ", method->fDataSetInfo.GetName())
748 <<
"Inter-MVA correlation matrix (signal):" <<
Endl;
750 Log() << kINFO <<
Endl;
752 Log() << kINFO <<
TString::Format(
"Dataset[%s] : ", method->fDataSetInfo.GetName())
753 <<
"Inter-MVA correlation matrix (background):" <<
Endl;
755 Log() << kINFO <<
Endl;
758 Log() << kINFO <<
TString::Format(
"Dataset[%s] : ", method->fDataSetInfo.GetName())
759 <<
"Correlations between input variables and MVA response (signal):" <<
Endl;
761 Log() << kINFO <<
Endl;
763 Log() << kINFO <<
TString::Format(
"Dataset[%s] : ", method->fDataSetInfo.GetName())
764 <<
"Correlations between input variables and MVA response (background):" <<
Endl;
766 Log() << kINFO <<
Endl;
768 Log() << kWARNING <<
TString::Format(
"Dataset[%s] : ", method->fDataSetInfo.GetName())
769 <<
"<TestAllMethods> cannot compute correlation matrices" <<
Endl;
772 Log() << kINFO <<
TString::Format(
"Dataset[%s] : ", method->fDataSetInfo.GetName())
773 <<
"The following \"overlap\" matrices contain the fraction of events for which " <<
Endl;
774 Log() << kINFO <<
TString::Format(
"Dataset[%s] : ", method->fDataSetInfo.GetName())
775 <<
"the MVAs 'i' and 'j' have returned conform answers about \"signal-likeness\"" <<
Endl;
776 Log() << kINFO <<
TString::Format(
"Dataset[%s] : ", method->fDataSetInfo.GetName())
777 <<
"An event is signal-like, if its MVA output exceeds the following value:" <<
Endl;
779 Log() << kINFO <<
TString::Format(
"Dataset[%s] : ", method->fDataSetInfo.GetName())
780 <<
"which correspond to the working point: eff(signal) = 1 - eff(background)" <<
Endl;
784 Log() << kINFO <<
TString::Format(
"Dataset[%s] : ", method->fDataSetInfo.GetName())
785 <<
"Note: no correlations and overlap with cut method are provided at present" <<
Endl;
788 Log() << kINFO <<
Endl;
789 Log() << kINFO <<
TString::Format(
"Dataset[%s] : ", method->fDataSetInfo.GetName())
790 <<
"Inter-MVA overlap matrix (signal):" <<
Endl;
792 Log() << kINFO <<
Endl;
794 Log() << kINFO <<
TString::Format(
"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 <<
TString::Format(
"%-13s %-15s: %#1.3f", fDataLoader->GetName(), methodName.
Data(), fResult.fROCIntegral)
860 fResult.fROCIntegral = rocIntegral;
866 Log() << kINFO << hLine <<
Endl;
867 Log() << kINFO <<
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++) {
885 Log() << kINFO <<
TString::Format(
"%-20s %-15s: %#1.3f (%#1.3f) %#1.3f (%#1.3f) %#1.3f (%#1.3f)",
886 method->fDataSetInfo.GetName(), mname[k][i].Data(), eff01[k][i],
887 trainEff01[k][i], eff10[k][i], trainEff10[k][i], eff30[k][i], trainEff30[k][i])
891 Log() << kINFO << hLine <<
Endl;
892 Log() << kINFO <<
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;
979 result.fDataLoaderName = fDataLoader->GetName();
980 fResults.push_back(
result);
981 return fResults.back();
996 dataset->SetCurrentType(
type);
1001 Log() << kERROR <<
TString::Format(
"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;
1014 auto eventCollection = dataset->GetEventCollection(
type);
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]);
1037 auto eventCollection = dataset->GetEventCollection(
type);
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 <<
TString::Format(
"ROCCurve object was not created in MethodName = %s MethodTitle = %s not found with Dataset = %s ",
1080 methodname.
Data(), methodtitle.
Data(), fDataLoader->GetName())
1095 TFile *savdir = file;
1100 TIter nextkey(
src->GetListOfKeys());
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 =
nullptr;
1135 TTree *TestTree =
nullptr;
1136 TFile *ifile =
nullptr;
1137 TFile *ofile =
nullptr;
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 =
TString::Format(
".%s%s%s.root", fDataLoader->GetName(), methodname.Data(), methodtitle.
Data());
1150 auto tmptrain = (
TTree *)ds->
Get(
"TrainTree");
1151 auto tmptest = (
TTree *)ds->
Get(
"TestTree");
1153 fFile->cd(fDataLoader->GetName());
1156 auto methdir = dsdir->mkdir(methdirname.Data(), methdirname.Data());
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 =
TString::Format(
".%s%s%s.root", fDataLoader->GetName(), methodname.Data(), methodtitle.
Data());
#define MinNoTrainingEvents
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 r
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
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t src
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 Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
TMatrixT< Double_t > TMatrixD
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 override
Return kTRUE if this class inherits from a class with name "classname".
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
A ROOT file is structured in Directories (like a file system).
Bool_t cd() 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 Bool_t cd()
Change current directory to "this" directory.
virtual void SaveSelf(Bool_t=kFALSE)
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
void Close(Option_t *option="") override
Close a file.
A TGraph is an object made of two arrays X and Y with npoints each.
void SetName(const char *name="") override
Set graph name.
TAxis * GetXaxis() const
Get x axis of the graph.
TAxis * GetYaxis() const
Get y axis of the graph.
void SetTitle(const char *title="") override
Change (i.e.
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
returns event without transformations
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
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
! flag to save the trained model
std::shared_ptr< DataLoader > fDataLoader
! data
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
Mvas for two-class and multiclass classification.
ROCCurve * GetROC(UInt_t iClass=0, TMVA::Types::ETreeType type=TMVA::Types::kTesting)
Method to get TMVA::ROCCurve Object.
Bool_t fIsCuts
if it is a method cuts need special output
ClassificationResult & operator=(const ClassificationResult &r)
std::map< UInt_t, std::vector< std::tuple< Float_t, Float_t, Bool_t > > > fMvaTrain
Mvas for two-class classification.
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 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
!
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
DSMTEST.
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 single instance of "Types" if existing already, or create it (Singleton)
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
const char * GetName() const override
Returns name of object.
Mother of all ROOT objects.
@ kOverwrite
overwrite existing object with same name
virtual Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
Principal Components Analysis (PCA)
virtual void AddRow(const Double_t *x)
Add a data point and update the covariance matrix.
const TMatrixD * GetCovarianceMatrix() const
Return the covariance matrix.
virtual void MakePrincipals()
Perform the principal components analysis.
const char * Data() const
TString & ReplaceAll(const TString &s1, const TString &s2)
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
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.
Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0) override
Write this object to the current directory.
create variable transformations
MsgLogger & Endl(MsgLogger &ml)