136#pragma warning ( disable : 4355 )
152 fAnalysisType (
Types::kNoAnalysisType ),
153 fRegressionReturnVal ( 0 ),
154 fMulticlassReturnVal ( 0 ),
155 fDataSetInfo (
dsi ),
156 fSignalReferenceCut ( 0.5 ),
157 fSignalReferenceCutOrientation( 1. ),
158 fVariableTransformType (
Types::kSignal ),
160 fMethodName ( methodTitle ),
165 fConstructedFromWeightFile (
kFALSE ),
167 fMethodBaseDir ( 0 ),
170 fModelPersistence (
kTRUE),
181 fSplTrainEffBvsS ( 0 ),
182 fVarTransformString (
"None" ),
183 fTransformationPointer ( 0 ),
184 fTransformation (
dsi, methodTitle ),
186 fVerbosityLevelString (
"Default" ),
189 fIgnoreNegWeightsInTraining(
kFALSE ),
191 fBackgroundClass ( 0 ),
199 fLogger->SetSource(GetName());
216 fAnalysisType (
Types::kNoAnalysisType ),
217 fRegressionReturnVal ( 0 ),
218 fMulticlassReturnVal ( 0 ),
219 fDataSetInfo (
dsi ),
220 fSignalReferenceCut ( 0.5 ),
221 fVariableTransformType (
Types::kSignal ),
223 fMethodName (
"MethodBase" ),
226 fTMVATrainingVersion ( 0 ),
227 fROOTTrainingVersion ( 0 ),
228 fConstructedFromWeightFile (
kTRUE ),
230 fMethodBaseDir ( 0 ),
233 fModelPersistence (
kTRUE),
244 fSplTrainEffBvsS ( 0 ),
245 fVarTransformString (
"None" ),
246 fTransformationPointer ( 0 ),
247 fTransformation (
dsi,
"" ),
249 fVerbosityLevelString (
"Default" ),
252 fIgnoreNegWeightsInTraining(
kFALSE ),
254 fBackgroundClass ( 0 ),
272 if (!fSetupCompleted) Log() << kWARNING <<
Form(
"Dataset[%s] : ",DataInfo().GetName())<<
"Calling destructor of method which got never setup" <<
Endl;
275 if (fInputVars != 0) { fInputVars->clear();
delete fInputVars; }
276 if (fRanking != 0)
delete fRanking;
279 if (fDefaultPDF!= 0) {
delete fDefaultPDF; fDefaultPDF = 0; }
280 if (fMVAPdfS != 0) {
delete fMVAPdfS; fMVAPdfS = 0; }
281 if (fMVAPdfB != 0) {
delete fMVAPdfB; fMVAPdfB = 0; }
284 if (fSplS) {
delete fSplS; fSplS = 0; }
285 if (fSplB) {
delete fSplB; fSplB = 0; }
286 if (fSpleffBvsS) {
delete fSpleffBvsS; fSpleffBvsS = 0; }
287 if (fSplRefS) {
delete fSplRefS; fSplRefS = 0; }
288 if (fSplRefB) {
delete fSplRefB; fSplRefB = 0; }
289 if (fSplTrainRefS) {
delete fSplTrainRefS; fSplTrainRefS = 0; }
290 if (fSplTrainRefB) {
delete fSplTrainRefB; fSplTrainRefB = 0; }
291 if (fSplTrainEffBvsS) {
delete fSplTrainEffBvsS; fSplTrainEffBvsS = 0; }
293 for (
size_t i = 0; i < fEventCollections.size(); i++ ) {
294 if (fEventCollections.at(i)) {
295 for (std::vector<Event*>::const_iterator it = fEventCollections.at(i)->begin();
296 it != fEventCollections.at(i)->end(); ++it) {
299 delete fEventCollections.at(i);
300 fEventCollections.at(i) =
nullptr;
304 if (fRegressionReturnVal)
delete fRegressionReturnVal;
305 if (fMulticlassReturnVal)
delete fMulticlassReturnVal;
315 if (fSetupCompleted) Log() << kFATAL <<
Form(
"Dataset[%s] : ",DataInfo().GetName())<<
"Calling SetupMethod for the second time" <<
Endl;
317 DeclareBaseOptions();
320 fSetupCompleted =
kTRUE;
330 ProcessBaseOptions();
340 CheckForUnusedOptions();
348 SetConfigDescription(
"Configuration options for classifier architecture and tuning" );
356 fSplTrainEffBvsS = 0;
363 fTxtWeightsOnly =
kTRUE;
373 fInputVars =
new std::vector<TString>;
375 fInputVars->push_back(DataInfo().GetVariableInfo(
ivar).GetLabel());
377 fRegressionReturnVal = 0;
378 fMulticlassReturnVal = 0;
380 fEventCollections.resize( 2 );
381 fEventCollections.at(0) = 0;
382 fEventCollections.at(1) = 0;
385 if (DataInfo().GetClassInfo(
"Signal") != 0) {
386 fSignalClass = DataInfo().GetClassInfo(
"Signal")->GetNumber();
388 if (DataInfo().GetClassInfo(
"Background") != 0) {
389 fBackgroundClass = DataInfo().GetClassInfo(
"Background")->GetNumber();
392 SetConfigDescription(
"Configuration options for MVA method" );
393 SetConfigName(
TString(
"Method") + GetMethodTypeName() );
416 DeclareOptionRef( fVerbose,
"V",
"Verbose output (short form of \"VerbosityLevel\" below - overrides the latter one)" );
418 DeclareOptionRef( fVerbosityLevelString=
"Default",
"VerbosityLevel",
"Verbosity level" );
419 AddPreDefVal(
TString(
"Default") );
420 AddPreDefVal(
TString(
"Debug") );
421 AddPreDefVal(
TString(
"Verbose") );
422 AddPreDefVal(
TString(
"Info") );
423 AddPreDefVal(
TString(
"Warning") );
424 AddPreDefVal(
TString(
"Error") );
425 AddPreDefVal(
TString(
"Fatal") );
429 fTxtWeightsOnly =
kTRUE;
432 DeclareOptionRef( fVarTransformString,
"VarTransform",
"List of variable transformations performed before training, e.g., \"D_Background,P_Signal,G,N_AllClasses\" for: \"Decorrelation, PCA-transformation, Gaussianisation, Normalisation, each for the given class of events ('AllClasses' denotes all events of all classes, if no class indication is given, 'All' is assumed)\"" );
434 DeclareOptionRef( fHelp,
"H",
"Print method-specific help message" );
436 DeclareOptionRef( fHasMVAPdfs,
"CreateMVAPdfs",
"Create PDFs for classifier outputs (signal and background)" );
438 DeclareOptionRef( fIgnoreNegWeightsInTraining,
"IgnoreNegWeightsInTraining",
439 "Events with negative weights are ignored in the training (but are included for testing and performance evaluation)" );
451 fDefaultPDF =
new PDF(
TString(GetName())+
"_PDF", GetOptions(),
"MVAPdf" );
452 fDefaultPDF->DeclareOptions();
453 fDefaultPDF->ParseOptions();
454 fDefaultPDF->ProcessOptions();
455 fMVAPdfB =
new PDF(
TString(GetName())+
"_PDFBkg", fDefaultPDF->GetOptions(),
"MVAPdfBkg", fDefaultPDF );
456 fMVAPdfB->DeclareOptions();
457 fMVAPdfB->ParseOptions();
458 fMVAPdfB->ProcessOptions();
459 fMVAPdfS =
new PDF(
TString(GetName())+
"_PDFSig", fMVAPdfB->GetOptions(),
"MVAPdfSig", fDefaultPDF );
460 fMVAPdfS->DeclareOptions();
461 fMVAPdfS->ParseOptions();
462 fMVAPdfS->ProcessOptions();
465 SetOptions( fMVAPdfS->GetOptions() );
470 GetTransformationHandler(),
474 if (fDefaultPDF!= 0) {
delete fDefaultPDF; fDefaultPDF = 0; }
475 if (fMVAPdfS != 0) {
delete fMVAPdfS; fMVAPdfS = 0; }
476 if (fMVAPdfB != 0) {
delete fMVAPdfB; fMVAPdfB = 0; }
480 fVerbosityLevelString =
TString(
"Verbose");
481 Log().SetMinType( kVERBOSE );
483 else if (fVerbosityLevelString ==
"Debug" ) Log().SetMinType( kDEBUG );
484 else if (fVerbosityLevelString ==
"Verbose" ) Log().SetMinType( kVERBOSE );
485 else if (fVerbosityLevelString ==
"Info" ) Log().SetMinType( kINFO );
486 else if (fVerbosityLevelString ==
"Warning" ) Log().SetMinType( kWARNING );
487 else if (fVerbosityLevelString ==
"Error" ) Log().SetMinType( kERROR );
488 else if (fVerbosityLevelString ==
"Fatal" ) Log().SetMinType( kFATAL );
489 else if (fVerbosityLevelString !=
"Default" ) {
490 Log() << kFATAL <<
"<ProcessOptions> Verbosity level type '"
491 << fVerbosityLevelString <<
"' unknown." <<
Endl;
503 DeclareOptionRef( fNormalise=
kFALSE,
"Normalise",
"Normalise input variables" );
504 DeclareOptionRef( fUseDecorr=
kFALSE,
"D",
"Use-decorrelated-variables flag" );
505 DeclareOptionRef( fVariableTransformTypeString=
"Signal",
"VarTransformType",
506 "Use signal or background events to derive for variable transformation (the transformation is applied on both types of, course)" );
507 AddPreDefVal(
TString(
"Signal") );
508 AddPreDefVal(
TString(
"Background") );
509 DeclareOptionRef( fTxtWeightsOnly=
kTRUE,
"TxtWeightFilesOnly",
"If True: write all training results (weights) as text files (False: some are written in ROOT format)" );
519 DeclareOptionRef( fNbinsMVAPdf = 60,
"NbinsMVAPdf",
"Number of bins used for the PDFs of classifier outputs" );
520 DeclareOptionRef( fNsmoothMVAPdf = 2,
"NsmoothMVAPdf",
"Number of smoothing iterations for classifier PDFs" );
534 Log() << kWARNING <<
Form(
"Dataset[%s] : ",DataInfo().GetName())<<
"Parameter optimization is not yet implemented for method "
535 << GetName() <<
Endl;
536 Log() << kWARNING <<
Form(
"Dataset[%s] : ",DataInfo().GetName())<<
"Currently we need to set hardcoded which parameter is tuned in which ranges"<<
Endl;
538 return std::map<TString,Double_t>();
558 if (Help()) PrintHelpMessage();
561 if(!IsSilentFile()) BaseDir()->cd();
565 GetTransformationHandler().CalcTransformations(Data()->GetEventCollection());
569 <<
"Begin training" <<
Endl;
570 Long64_t nEvents = Data()->GetNEvents();
574 <<
"\tEnd of training " <<
Endl;
577 <<
"Elapsed time for training with " << nEvents <<
" events: "
581 <<
"\tCreate MVA output for ";
584 if (DoMulticlass()) {
585 Log() <<
Form(
"[%s] : ",DataInfo().GetName())<<
"Multiclass classification on training sample" <<
Endl;
588 else if (!DoRegression()) {
590 Log() <<
Form(
"[%s] : ",DataInfo().GetName())<<
"classification on training sample" <<
Endl;
599 Log() <<
Form(
"Dataset[%s] : ",DataInfo().GetName())<<
"regression on training sample" <<
Endl;
603 Log() <<
Form(
"Dataset[%s] : ",DataInfo().GetName())<<
"Create PDFs" <<
Endl;
610 if (fModelPersistence ) WriteStateToFile();
613 if ((!DoRegression()) && (fModelPersistence)) MakeClass();
620 WriteMonitoringHistosToFile();
628 if (!DoRegression()) Log() << kFATAL <<
Form(
"Dataset[%s] : ",DataInfo().GetName())<<
"Trying to use GetRegressionDeviation() with a classification job" <<
Endl;
629 Log() << kINFO <<
Form(
"Dataset[%s] : ",DataInfo().GetName())<<
"Create results for " << (
type==
Types::kTraining?
"training":
"testing") <<
Endl;
647 Long64_t nEvents = Data()->GetNEvents();
658 size_t ntargets = Data()->GetEvent(0)->GetNTargets();
659 std::vector<float> output(nEvents*
ntargets);
660 auto itr = output.begin();
663 Data()->SetCurrentEvent(
ievt);
664 std::vector< Float_t > vals = GetRegressionValues();
666 Log() << kFATAL <<
"Output regression vector with size " << vals.size() <<
" is not consistent with target size of "
669 std::copy(vals.begin(), vals.end(),
itr);
684 Data()->SetCurrentType(
type);
686 Log() << kINFO <<
Form(
"Dataset[%s] : ",DataInfo().GetName())<<
"Create results for " << (
type==
Types::kTraining?
"training":
"testing") <<
Endl;
690 Long64_t nEvents = Data()->GetNEvents();
695 Log() << kINFO <<
Form(
"Dataset[%s] : ",DataInfo().GetName()) <<
"Evaluation of " << GetMethodName() <<
" on "
698 regRes->Resize( nEvents );
700 std::vector<float> output = GetAllRegressionValues();
702 Data()->SetCurrentEvent(0);
703 size_t nTargets = GetEvent()->GetNTargets();
707 if (output.size() !=
nTargets *
size_t(nEvents))
708 Log() << kFATAL <<
"Output regression vector with size " << output.size() <<
" is not consistent with target size of "
709 <<
nTargets <<
" and number of events " << nEvents << std::endl;
721 Log() << kINFO <<
Form(
"Dataset[%s] : ",DataInfo().GetName())
722 <<
"Elapsed time for evaluation of " << nEvents <<
" events: "
723 <<
timer.GetElapsedTime() <<
" " <<
Endl;
727 SetTestTime(
timer.ElapsedSeconds());
739 Long64_t nEvents = Data()->GetNEvents();
744 Data()->SetCurrentEvent(0);
745 std::vector< Float_t > vals = GetMulticlassValues();
746 std::vector<float> output(nEvents * vals.size());
747 auto itr = output.begin();
748 std::copy(vals.begin(), vals.end(),
itr);
751 Data()->SetCurrentEvent(
ievt);
752 vals = GetMulticlassValues();
754 std::copy(vals.begin(), vals.end(),
itr);
765 Data()->SetCurrentType(
type);
767 Log() << kINFO <<
Form(
"Dataset[%s] : ",DataInfo().GetName())<<
"Create results for " << (
type==
Types::kTraining?
"training":
"testing") <<
Endl;
770 if (!
resMulticlass) Log() << kFATAL<<
Form(
"Dataset[%s] : ",DataInfo().GetName())<<
"unable to create pointer in AddMulticlassOutput, exiting."<<
Endl;
772 Long64_t nEvents = Data()->GetNEvents();
777 Log() << kINFO <<
Form(
"Dataset[%s] : ",DataInfo().GetName())<<
"Multiclass evaluation of " << GetMethodName() <<
" on "
781 std::vector<Float_t> output = GetAllMulticlassValues();
782 size_t nClasses = output.size()/nEvents;
789 Log() << kINFO <<
Form(
"Dataset[%s] : ",DataInfo().GetName())
790 <<
"Elapsed time for evaluation of " << nEvents <<
" events: "
791 <<
timer.GetElapsedTime() <<
" " <<
Endl;
795 SetTestTime(
timer.ElapsedSeconds());
825 return GetMvaValue()*GetSignalReferenceCutOrientation() > GetSignalReferenceCut()*GetSignalReferenceCutOrientation() ?
kTRUE :
kFALSE;
832 return mvaVal*GetSignalReferenceCutOrientation() > GetSignalReferenceCut()*GetSignalReferenceCutOrientation() ?
kTRUE :
kFALSE;
840 Data()->SetCurrentType(
type);
845 Long64_t nEvents = Data()->GetNEvents();
846 clRes->Resize( nEvents );
851 Log() << kHEADER <<
Form(
"[%s] : ",DataInfo().GetName())
852 <<
"Evaluation of " << GetMethodName() <<
" on "
854 <<
" sample (" << nEvents <<
" events)" <<
Endl;
856 std::vector<Double_t> mvaValues = GetMvaValues(0, nEvents,
true);
859 <<
"Elapsed time for evaluation of " << nEvents <<
" events: "
860 <<
timer.GetElapsedTime() <<
" " <<
Endl;
864 SetTestTime(
timer.ElapsedSeconds());
870 auto ev = Data()->GetEvent(
ievt);
880 Long64_t nEvents = Data()->GetNEvents();
885 nEvents = values.size();
891 Log() << kHEADER <<
Form(
"[%s] : ",DataInfo().GetName())
892 <<
"Evaluation of " << GetMethodName() <<
" on "
894 <<
" sample (" << nEvents <<
" events)" <<
Endl;
897 Data()->SetCurrentEvent(
ievt);
898 values[
ievt] = GetMvaValue();
909 <<
"Elapsed time for evaluation of " << nEvents <<
" events: "
910 <<
timer.GetElapsedTime() <<
" " <<
Endl;
932 Data()->SetCurrentType(
type);
937 Long64_t nEvents = Data()->GetNEvents();
942 Log() << kINFO <<
Form(
"Dataset[%s] : ",DataInfo().GetName()) <<
"Evaluation of " << GetMethodName() <<
" on "
950 Data()->SetCurrentEvent(
ievt);
952 if (
proba < 0)
break;
959 Log() << kDEBUG <<
Form(
"Dataset[%s] : ",DataInfo().GetName())
960 <<
"Elapsed time for evaluation of " << nEvents <<
" events: "
961 <<
timer.GetElapsedTime() <<
" " <<
Endl;
979 Data()->SetCurrentType(
type);
984 const Int_t nevt = GetNEvents();
989 Log() << kINFO <<
"Calculate regression for all events" <<
Endl;
992 auto output = GetAllRegressionValues();
993 int ntargets = Data()->GetEvent(0)->GetNTargets();
1017 m1 += t*
w;
s1 += t*t*
w;
1024 timer.DrawProgressBar(nevt - 1);
1025 Log() << kINFO <<
"Elapsed time for evaluation of " << nevt <<
" events: "
1026 <<
timer.GetElapsedTime() <<
" " <<
Endl;
1083 if (!
resMulticlass) Log() << kFATAL<<
Form(
"Dataset[%s] : ",DataInfo().GetName())<<
"unable to create pointer in TestMulticlass, exiting."<<
Endl;
1115 if (0==
mvaRes && !(GetMethodTypeName().Contains(
"Cuts"))) {
1116 Log()<<
Form(
"Dataset[%s] : ",DataInfo().GetName()) <<
"mvaRes " <<
mvaRes <<
" GetMethodTypeName " << GetMethodTypeName()
1117 <<
" contains " << !(GetMethodTypeName().Contains(
"Cuts")) <<
Endl;
1118 Log() << kFATAL<<
Form(
"Dataset[%s] : ",DataInfo().GetName()) <<
"<TestInit> Test variable " << GetTestvarName()
1119 <<
" not found in tree" <<
Endl;
1124 fMeanS, fMeanB, fRmsS, fRmsB, fXmin, fXmax, fSignalClass );
1132 fCutOrientation = (fMeanS > fMeanB) ? kPositive : kNegative;
1142 if(IsSilentFile()) {
1189 Log() << kHEADER <<
Form(
"[%s] : ",DataInfo().GetName())<<
"Loop over test events and fill histograms with classifier response..." <<
Endl <<
Endl;
1190 if (
mvaProb) Log() << kINFO <<
"Also filling probability and rarity histograms (on request)..." <<
Endl;
1194 if (
mvaRes->GetSize() != GetNEvents() ) {
1195 Log() << kFATAL <<
TString::Format(
"Inconsistent result size %lld with number of events %u ",
mvaRes->GetSize() , GetNEvents() ) <<
Endl;
1205 if (DataInfo().IsSignal(
ev)) {
1237 if (fSplS) {
delete fSplS; fSplS = 0; }
1238 if (fSplB) {
delete fSplB; fSplB = 0; }
1252 tf << prefix <<
"#GEN -*-*-*-*-*-*-*-*-*-*-*- general info -*-*-*-*-*-*-*-*-*-*-*-" << std::endl << prefix << std::endl;
1253 tf << prefix <<
"Method : " << GetMethodTypeName() <<
"::" << GetMethodName() << std::endl;
1254 tf.setf(std::ios::left);
1255 tf << prefix <<
"TMVA Release : " << std::setw(10) << GetTrainingTMVAVersionString() <<
" ["
1256 << GetTrainingTMVAVersionCode() <<
"]" << std::endl;
1257 tf << prefix <<
"ROOT Release : " << std::setw(10) << GetTrainingROOTVersionString() <<
" ["
1258 << GetTrainingROOTVersionCode() <<
"]" << std::endl;
1259 tf << prefix <<
"Creator : " <<
userInfo->fUser << std::endl;
1263 tf << prefix <<
"Training events: " << Data()->GetNTrainingEvents() << std::endl;
1267 tf << prefix <<
"Analysis type : " <<
"[" << ((GetAnalysisType()==
Types::kRegression) ?
"Regression" :
"Classification") <<
"]" << std::endl;
1268 tf << prefix << std::endl;
1273 tf << prefix << std::endl << prefix <<
"#OPT -*-*-*-*-*-*-*-*-*-*-*-*- options -*-*-*-*-*-*-*-*-*-*-*-*-" << std::endl << prefix << std::endl;
1274 WriteOptionsToStream(
tf, prefix );
1275 tf << prefix << std::endl;
1278 tf << prefix << std::endl << prefix <<
"#VAR -*-*-*-*-*-*-*-*-*-*-*-* variables *-*-*-*-*-*-*-*-*-*-*-*-" << std::endl << prefix << std::endl;
1279 WriteVarsToStream(
tf, prefix );
1280 tf << prefix << std::endl;
1297 AddRegressionOutput(
type );
1299 AddMulticlassOutput(
type );
1301 AddClassifierOutput(
type );
1303 AddClassifierOutputProb(
type );
1313 if (!parent)
return;
1318 AddInfoItem(
gi,
"TMVA Release", GetTrainingTMVAVersionString() +
" [" +
gTools().StringFromInt(GetTrainingTMVAVersionCode()) +
"]" );
1319 AddInfoItem(
gi,
"ROOT Release", GetTrainingROOTVersionString() +
" [" +
gTools().StringFromInt(GetTrainingROOTVersionCode()) +
"]");
1320 AddInfoItem(
gi,
"Creator",
userInfo->fUser);
1324 AddInfoItem(
gi,
"Training events",
gTools().StringFromInt(Data()->GetNTrainingEvents()));
1330 AddInfoItem(
gi,
"AnalysisType", analysisType );
1334 AddOptionsXMLTo( parent );
1337 AddVarsXMLTo( parent );
1340 if (fModelPersistence)
1341 AddSpectatorsXMLTo( parent );
1344 AddClassesXMLTo(parent);
1347 if (DoRegression()) AddTargetsXMLTo(parent);
1350 GetTransformationHandler(
false).AddXMLTo( parent );
1354 if (fMVAPdfS) fMVAPdfS->AddXMLTo(
pdfs);
1355 if (fMVAPdfB) fMVAPdfB->AddXMLTo(
pdfs);
1358 AddWeightsXMLTo( parent );
1368 fMVAPdfS = (
TMVA::PDF*)
rf.Get(
"MVA_PDF_Signal" );
1369 fMVAPdfB = (
TMVA::PDF*)
rf.Get(
"MVA_PDF_Background" );
1371 ReadWeightsFromStream(
rf );
1389 <<
"Creating xml weight file: "
1394 gTools().
AddAttr(rootnode,
"Method", GetMethodTypeName() +
"::" + GetMethodName());
1395 WriteStateToXML(rootnode);
1410 <<
"Reading weight file: "
1413 if (
tfname.EndsWith(
".xml") ) {
1416 Log() << kFATAL <<
"Error parsing XML file " <<
tfname <<
Endl;
1419 ReadStateFromXML(rootnode);
1424 fb.open(
tfname.Data(),std::ios::in);
1425 if (!fb.is_open()) {
1426 Log() << kFATAL <<
Form(
"Dataset[%s] : ",DataInfo().GetName())<<
"<ReadStateFromFile> "
1427 <<
"Unable to open input weight file: " <<
tfname <<
Endl;
1429 std::istream
fin(&fb);
1430 ReadStateFromStream(
fin);
1433 if (!fTxtWeightsOnly) {
1436 Log() << kINFO <<
Form(
"Dataset[%s] : ",DataInfo().GetName())<<
"Reading root weight file: "
1439 ReadStateFromStream( *
rfile );
1449 ReadStateFromXML(rootnode);
1466 Log().SetSource( GetName() );
1468 <<
"Read method \"" << GetMethodName() <<
"\" of type \"" << GetMethodTypeName() <<
"\"" <<
Endl;
1486 if (
name ==
"TrainingTime")
1489 if (
name ==
"AnalysisType") {
1495 else Log() << kFATAL <<
Form(
"Dataset[%s] : ",DataInfo().GetName())<<
"Analysis type " << val <<
" is not known." <<
Endl;
1498 if (
name ==
"TMVA Release" ||
name ==
"TMVA") {
1502 Log() << kDEBUG <<
Form(
"[%s] : ",DataInfo().GetName()) <<
"MVA method was trained with TMVA Version: " << GetTrainingTMVAVersionString() <<
Endl;
1505 if (
name ==
"ROOT Release" ||
name ==
"ROOT") {
1510 <<
"MVA method was trained with ROOT Version: " << GetTrainingROOTVersionString() <<
Endl;
1516 ReadOptionsFromXML(ch);
1521 ReadVariablesFromXML(ch);
1524 ReadSpectatorsFromXML(ch);
1527 if (DataInfo().GetNClasses()==0) ReadClassesFromXML(ch);
1530 if (DataInfo().GetNTargets()==0 && DoRegression()) ReadTargetsFromXML(ch);
1532 else if (
nodeName==
"Transformations") {
1533 GetTransformationHandler().ReadFromXML(ch);
1537 if (fMVAPdfS) {
delete fMVAPdfS; fMVAPdfS=0; }
1538 if (fMVAPdfB) {
delete fMVAPdfB; fMVAPdfB=0; }
1551 ReadWeightsFromXML(ch);
1554 Log() << kWARNING <<
Form(
"Dataset[%s] : ",DataInfo().GetName())<<
"Unparsed XML node: '" <<
nodeName <<
"'" <<
Endl;
1561 if (GetTransformationHandler().GetCallerName() ==
"") GetTransformationHandler().SetCallerName( GetName() );
1577 while (!
TString(buf).BeginsWith(
"Method")) GetLine(
fin,buf);
1586 if (methodName ==
"") methodName =
methodType;
1587 fMethodName = methodName;
1589 Log() << kINFO <<
Form(
"Dataset[%s] : ",DataInfo().GetName())<<
"Read method \"" << GetMethodName() <<
"\" of type \"" << GetMethodTypeName() <<
"\"" <<
Endl;
1592 Log().SetSource( GetName() );
1606 while (!
TString(buf).BeginsWith(
"#OPT")) GetLine(
fin,buf);
1607 ReadOptionsFromStream(
fin);
1611 fin.getline(buf,512);
1612 while (!
TString(buf).BeginsWith(
"#VAR"))
fin.getline(buf,512);
1613 ReadVarsFromStream(
fin);
1618 if (IsNormalised()) {
1621 norm->BuildTransformationFromVarInfo( DataInfo().GetVariableInfos() );
1624 if ( fVarTransformString ==
"None") {
1627 }
else if ( fVarTransformString ==
"Decorrelate" ) {
1629 }
else if ( fVarTransformString ==
"PCA" ) {
1631 }
else if ( fVarTransformString ==
"Uniform" ) {
1633 }
else if ( fVarTransformString ==
"Gauss" ) {
1635 }
else if ( fVarTransformString ==
"GaussDecorr" ) {
1639 Log() << kFATAL <<
Form(
"Dataset[%s] : ",DataInfo().GetName())<<
"<ProcessOptions> Variable transform '"
1640 << fVarTransformString <<
"' unknown." <<
Endl;
1643 if (GetTransformationHandler().GetTransformationList().GetSize() > 0) {
1644 fin.getline(buf,512);
1645 while (!
TString(buf).BeginsWith(
"#MAT"))
fin.getline(buf,512);
1659 fin.getline(buf,512);
1660 while (!
TString(buf).BeginsWith(
"#MVAPDFS"))
fin.getline(buf,512);
1661 if (fMVAPdfS != 0) {
delete fMVAPdfS; fMVAPdfS = 0; }
1662 if (fMVAPdfB != 0) {
delete fMVAPdfB; fMVAPdfB = 0; }
1663 fMVAPdfS =
new PDF(
TString(GetName()) +
" MVA PDF Sig");
1664 fMVAPdfB =
new PDF(
TString(GetName()) +
" MVA PDF Bkg");
1665 fMVAPdfS->SetReadingVersion( GetTrainingTMVAVersionCode() );
1666 fMVAPdfB->SetReadingVersion( GetTrainingTMVAVersionCode() );
1673 fin.getline(buf,512);
1674 while (!
TString(buf).BeginsWith(
"#WGT"))
fin.getline(buf,512);
1675 fin.getline(buf,512);
1676 ReadWeightsFromStream(
fin );
1679 if (GetTransformationHandler().GetCallerName() ==
"") GetTransformationHandler().SetCallerName( GetName() );
1689 o << prefix <<
"NVar " << DataInfo().GetNVariables() << std::endl;
1690 std::vector<VariableInfo>::const_iterator
varIt = DataInfo().GetVariableInfos().
begin();
1691 for (;
varIt!=DataInfo().GetVariableInfos().
end(); ++
varIt) { o << prefix;
varIt->WriteToStream(o); }
1692 o << prefix <<
"NSpec " << DataInfo().GetNSpectators() << std::endl;
1693 varIt = DataInfo().GetSpectatorInfos().
begin();
1694 for (;
varIt!=DataInfo().GetSpectatorInfos().
end(); ++
varIt) { o << prefix;
varIt->WriteToStream(o); }
1708 if (
readNVar!=DataInfo().GetNVariables()) {
1709 Log() << kFATAL <<
Form(
"Dataset[%s] : ",DataInfo().GetName())<<
"You declared "<< DataInfo().GetNVariables() <<
" variables in the Reader"
1710 <<
" while there are " <<
readNVar <<
" variables declared in the file"
1716 std::vector<VariableInfo>::iterator
varIt = DataInfo().GetVariableInfos().
begin();
1720 if (
varIt->GetExpression() ==
varInfo.GetExpression()) {
1721 varInfo.SetExternalLink((*varIt).GetExternalLink());
1725 Log() << kINFO <<
Form(
"Dataset[%s] : ",DataInfo().GetName())<<
"ERROR in <ReadVarsFromStream>" <<
Endl;
1726 Log() << kINFO <<
"The definition (or the order) of the variables found in the input file is" <<
Endl;
1727 Log() << kINFO <<
"is not the same as the one declared in the Reader (which is necessary for" <<
Endl;
1728 Log() << kINFO <<
"the correct working of the method):" <<
Endl;
1729 Log() << kINFO <<
" var #" <<
varIdx <<
" declared in Reader: " <<
varIt->GetExpression() <<
Endl;
1730 Log() << kINFO <<
" var #" <<
varIdx <<
" declared in file : " <<
varInfo.GetExpression() <<
Endl;
1731 Log() << kFATAL <<
"The expression declared to the Reader needs to be checked (name or order are wrong)" <<
Endl;
1744 for (
UInt_t idx=0; idx<DataInfo().GetVariableInfos().size(); idx++) {
1760 for (
UInt_t idx=0; idx<DataInfo().GetSpectatorInfos().size(); idx++) {
1766 if (
vi.GetVarType()==
'C')
continue;
1803 for (
UInt_t idx=0; idx<DataInfo().GetTargetInfos().size(); idx++) {
1819 if (
readNVar!=DataInfo().GetNVariables()) {
1820 Log() << kFATAL <<
Form(
"Dataset[%s] : ",DataInfo().GetName())<<
"You declared "<< DataInfo().GetNVariables() <<
" variables in the Reader"
1821 <<
" while there are " <<
readNVar <<
" variables declared in the file"
1839 Log() << kINFO <<
Form(
"Dataset[%s] : ",DataInfo().GetName())<<
"ERROR in <ReadVariablesFromXML>" <<
Endl;
1840 Log() << kINFO <<
"The definition (or the order) of the variables found in the input file is" <<
Endl;
1841 Log() << kINFO <<
"not the same as the one declared in the Reader (which is necessary for the" <<
Endl;
1842 Log() << kINFO <<
"correct working of the method):" <<
Endl;
1844 Log() << kINFO <<
" var #" <<
varIdx <<
" declared in file : " <<
readVarInfo.GetExpression() <<
Endl;
1845 Log() << kFATAL <<
"The expression declared to the Reader needs to be checked (name or order are wrong)" <<
Endl;
1860 Log() << kFATAL<<
Form(
"Dataset[%s] : ",DataInfo().GetName()) <<
"You declared "<< DataInfo().GetNSpectators(
kFALSE) <<
" spectators in the Reader"
1861 <<
" while there are " <<
readNSpec <<
" spectators declared in the file"
1879 Log() << kINFO <<
Form(
"Dataset[%s] : ",DataInfo().GetName())<<
"ERROR in <ReadSpectatorsFromXML>" <<
Endl;
1880 Log() << kINFO <<
"The definition (or the order) of the spectators found in the input file is" <<
Endl;
1881 Log() << kINFO <<
"not the same as the one declared in the Reader (which is necessary for the" <<
Endl;
1882 Log() << kINFO <<
"correct working of the method):" <<
Endl;
1885 Log() << kFATAL <<
"The expression declared to the Reader needs to be checked (name or order are wrong)" <<
Endl;
1906 DataInfo().AddClass(classname);
1914 DataInfo().AddClass(className);
1921 if (DataInfo().GetClassInfo(
"Signal") != 0) {
1922 fSignalClass = DataInfo().GetClassInfo(
"Signal")->GetNumber();
1926 if (DataInfo().GetClassInfo(
"Background") != 0) {
1927 fBackgroundClass = DataInfo().GetClassInfo(
"Background")->GetNumber();
1947 DataInfo().AddTarget(expression,
"",
"",0,0);
1959 if (fBaseDir != 0)
return fBaseDir;
1960 Log()<<kDEBUG<<
Form(
"Dataset[%s] : ",DataInfo().GetName())<<
" Base Directory for " << GetMethodName() <<
" not set yet --> check if already there.." <<
Endl;
1962 if (IsSilentFile()) {
1963 Log() << kFATAL <<
Form(
"Dataset[%s] : ", DataInfo().GetName())
1964 <<
"MethodBase::BaseDir() - No directory exists when running a Method without output file. Enable the "
1965 "output when creating the factory"
1971 Log() << kFATAL <<
Form(
"Dataset[%s] : ",DataInfo().GetName())<<
"MethodBase::BaseDir() - MethodBaseDir() return a NULL pointer!" <<
Endl;
1977 Log()<<kDEBUG<<
Form(
"Dataset[%s] : ",DataInfo().GetName())<<
" Base Directory for " << GetMethodTypeName() <<
" does not exist yet--> created it" <<
Endl;
1981 if (fModelPersistence) {
1989 Log()<<kDEBUG<<
Form(
"Dataset[%s] : ",DataInfo().GetName())<<
" Base Directory for " << GetMethodTypeName() <<
" existed, return it.." <<
Endl;
1999 if (fMethodBaseDir != 0) {
2000 return fMethodBaseDir;
2005 Log() << kDEBUG <<
Form(
"Dataset[%s] : ",
datasetName) <<
" Base Directory for " << GetMethodTypeName()
2006 <<
" not set yet --> check if already there.." <<
Endl;
2011 if (!fMethodBaseDir) {
2013 if (!fMethodBaseDir) {
2014 Log() << kFATAL <<
"Can not create dir " <<
datasetName;
2018 fMethodBaseDir = fMethodBaseDir->GetDirectory(
methodTypeDir.Data());
2020 if (!fMethodBaseDir) {
2024 Log() << kDEBUG <<
Form(
"Dataset[%s] : ",
datasetName) <<
" Base Directory for " << GetMethodName()
2025 <<
" does not exist yet--> created it" <<
Endl;
2029 <<
"Return from MethodBaseDir() after creating base directory " <<
Endl;
2030 return fMethodBaseDir;
2055 if (fWeightFile!=
"")
return fWeightFile;
2077 if (0 != fMVAPdfS) {
2078 fMVAPdfS->GetOriginalHist()->Write();
2079 fMVAPdfS->GetSmoothedHist()->Write();
2080 fMVAPdfS->GetPDFHist()->Write();
2082 if (0 != fMVAPdfB) {
2083 fMVAPdfB->GetOriginalHist()->Write();
2084 fMVAPdfB->GetSmoothedHist()->Write();
2085 fMVAPdfB->GetPDFHist()->Write();
2091 Log() << kFATAL <<
Form(
"Dataset[%s] : ",DataInfo().GetName())<<
"<WriteEvaluationHistosToFile> Unknown result: "
2093 <<
"/kMaxAnalysisType" <<
Endl;
2094 results->GetStorage()->Write();
2098 GetTransformationHandler().PlotVariables (GetEventCollection(
Types::kTesting ), BaseDir() );
2100 Log() << kINFO <<
TString::Format(
"Dataset[%s] : ",DataInfo().GetName())
2101 <<
" variable plots are not produces ! The number of variables is " << DataInfo().GetNVariables()
2121 fin.getline(buf,512);
2123 if (
line.BeginsWith(
"TMVA Release")) {
2127 std::stringstream s(code.
Data());
2128 s >> fTMVATrainingVersion;
2129 Log() << kINFO <<
Form(
"Dataset[%s] : ",DataInfo().GetName())<<
"MVA method was trained with TMVA Version: " << GetTrainingTMVAVersionString() <<
Endl;
2131 if (
line.BeginsWith(
"ROOT Release")) {
2135 std::stringstream s(code.
Data());
2136 s >> fROOTTrainingVersion;
2137 Log() << kINFO <<
Form(
"Dataset[%s] : ",DataInfo().GetName())<<
"MVA method was trained with ROOT Version: " << GetTrainingROOTVersionString() <<
Endl;
2139 if (
line.BeginsWith(
"Analysis type")) {
2143 std::stringstream s(code.
Data());
2144 std::string analysisType;
2146 if (analysisType ==
"regression" || analysisType ==
"Regression") SetAnalysisType(
Types::kRegression );
2147 else if (analysisType ==
"classification" || analysisType ==
"Classification") SetAnalysisType(
Types::kClassification );
2148 else if (analysisType ==
"multiclass" || analysisType ==
"Multiclass") SetAnalysisType(
Types::kMulticlass );
2149 else Log() << kFATAL <<
"Analysis type " << analysisType <<
" from weight-file not known!" << std::endl;
2151 Log() << kINFO <<
Form(
"Dataset[%s] : ",DataInfo().GetName())<<
"Method was trained for "
2172 Log() << kERROR<<
Form(
"Dataset[%s] : ",DataInfo().GetName())<<
"<CreateMVAPdfs> No result of classifier testing available" <<
Endl;
2179 TH1*
histMVAPdfS =
new TH1D( GetMethodTypeName() +
"_tr_S", GetMethodTypeName() +
"_tr_S",
2180 fMVAPdfS->GetHistNBins(
mvaRes->GetSize() ), minVal, maxVal );
2181 TH1*
histMVAPdfB =
new TH1D( GetMethodTypeName() +
"_tr_B", GetMethodTypeName() +
"_tr_B",
2182 fMVAPdfB->GetHistNBins(
mvaRes->GetSize() ), minVal, maxVal );
2213 if (DataInfo().GetNClasses() == 2) {
2214 Log() << kINFO<<
Form(
"Dataset[%s] : ",DataInfo().GetName())
2215 <<
TString::Format(
"<CreateMVAPdfs> Separation from histogram (PDF): %1.3f (%1.3f)",
2228 if (!fMVAPdfS || !fMVAPdfB) {
2229 Log() << kINFO<<
Form(
"Dataset[%s] : ",DataInfo().GetName()) <<
"<GetProba> MVA PDFs for Signal and Background don't exist yet, we'll create them on demand" <<
Endl;
2232 Double_t sigFraction = DataInfo().GetTrainingSumSignalWeights() / (DataInfo().GetTrainingSumSignalWeights() + DataInfo().GetTrainingSumBackgrWeights() );
2243 if (!fMVAPdfS || !fMVAPdfB) {
2244 Log() << kWARNING <<
Form(
"Dataset[%s] : ",DataInfo().GetName())<<
"<GetProba> MVA PDFs for Signal and Background don't exist" <<
Endl;
2265 Log() << kWARNING <<
Form(
"Dataset[%s] : ",DataInfo().GetName())<<
"<GetRarity> Required MVA PDF for Signal or Background does not exist: "
2266 <<
"select option \"CreateMVAPdfs\"" <<
Endl;
2281 Data()->SetCurrentType(
type);
2291 else if (list->GetSize() > 2) {
2292 Log() << kFATAL <<
Form(
"Dataset[%s] : ",DataInfo().GetName())<<
"<GetEfficiency> Wrong number of arguments"
2294 <<
" | required format, e.g., Efficiency:0.05, or empty string" <<
Endl;
2300 if (
results->GetHist(
"MVA_S")->GetNbinsX() !=
results->GetHist(
"MVA_B")->GetNbinsX() ||
2301 results->GetHist(
"MVA_HIGHBIN_S")->GetNbinsX() !=
results->GetHist(
"MVA_HIGHBIN_B")->GetNbinsX() ) {
2302 Log() << kFATAL <<
Form(
"Dataset[%s] : ",DataInfo().GetName())<<
"<GetEfficiency> Binning mismatch between signal and background histos" <<
Endl;
2317 if (
results->DoesExist(
"MVA_EFF_S")==0) {
2320 TH1*
eff_s =
new TH1D( GetTestvarName() +
"_effS", GetTestvarName() +
" (signal)", fNbinsH,
xmin,
xmax );
2321 TH1*
eff_b =
new TH1D( GetTestvarName() +
"_effB", GetTestvarName() +
" (background)", fNbinsH,
xmin,
xmax );
2326 Int_t sign = (fCutOrientation == kPositive) ? +1 : -1;
2355 Log() << kFATAL <<
Form(
"Dataset[%s] : ",DataInfo().GetName())<<
"<GetEfficiency> Mismatch in sign" <<
Endl;
2366 TH1*
eff_BvsS =
new TH1D( GetTestvarName() +
"_effBvsS", GetTestvarName() +
"", fNbins, 0, 1 );
2368 eff_BvsS->SetXTitle(
"Signal eff" );
2369 eff_BvsS->SetYTitle(
"Backgr eff" );
2372 TH1*
rej_BvsS =
new TH1D( GetTestvarName() +
"_rejBvsS", GetTestvarName() +
"", fNbins, 0, 1 );
2374 rej_BvsS->SetXTitle(
"Signal eff" );
2375 rej_BvsS->SetYTitle(
"Backgr rejection (1-eff)" );
2379 GetTestvarName(), fNbins, 0, 1 );
2382 inveff_BvsS->SetYTitle(
"Inverse backgr. eff (1/eff)" );
2416 if (
effB>std::numeric_limits<double>::epsilon())
2431 rejB = 1.0 - fSpleffBvsS->Eval(
effS );
2441 SetSignalReferenceCut( cut );
2446 if (0 == fSpleffBvsS) {
2464 integral += (1.0 -
effB);
2518 if (list->GetSize() != 2) {
2519 Log() << kFATAL <<
Form(
"Dataset[%s] : ",DataInfo().GetName())<<
"<GetTrainingEfficiency> Wrong number of arguments"
2521 <<
" | required format, e.g., Efficiency:0.05" <<
Endl;
2532 if (
results->GetHist(
"MVA_S")->GetNbinsX() !=
results->GetHist(
"MVA_B")->GetNbinsX() ||
2533 results->GetHist(
"MVA_HIGHBIN_S")->GetNbinsX() !=
results->GetHist(
"MVA_HIGHBIN_B")->GetNbinsX() ) {
2534 Log() << kFATAL <<
Form(
"Dataset[%s] : ",DataInfo().GetName())<<
"<GetTrainingEfficiency> Binning mismatch between signal and background histos"
2547 if (
results->DoesExist(
"MVA_TRAIN_S")==0) {
2553 TH1*
mva_s_tr =
new TH1D( GetTestvarName() +
"_Train_S",GetTestvarName() +
"_Train_S", fNbinsMVAoutput, fXmin,
sxmax );
2554 TH1*
mva_b_tr =
new TH1D( GetTestvarName() +
"_Train_B",GetTestvarName() +
"_Train_B", fNbinsMVAoutput, fXmin,
sxmax );
2561 TH1*
mva_eff_tr_s =
new TH1D( GetTestvarName() +
"_trainingEffS", GetTestvarName() +
" (signal)",
2563 TH1*
mva_eff_tr_b =
new TH1D( GetTestvarName() +
"_trainingEffB", GetTestvarName() +
" (background)",
2569 Int_t sign = (fCutOrientation == kPositive) ? +1 : -1;
2571 std::vector<Double_t> mvaValues = GetMvaValues(0,Data()->GetNEvents());
2577 Data()->SetCurrentEvent(
ievt);
2609 TH1*
eff_bvss =
new TH1D( GetTestvarName() +
"_trainingEffBvsS", GetTestvarName() +
"", fNbins, 0, 1 );
2611 TH1*
rej_bvss =
new TH1D( GetTestvarName() +
"_trainingRejBvsS", GetTestvarName() +
"", fNbins, 0, 1 );
2619 if (fSplTrainRefS)
delete fSplTrainRefS;
2620 if (fSplTrainRefB)
delete fSplTrainRefB;
2635 fEffS =
results->GetHist(
"MVA_TRAINEFF_S");
2658 if (0 == fSplTrainEffBvsS)
return 0.0;
2667 effB = fSplTrainEffBvsS->Eval(
effS );
2684 if (!
resMulticlass) Log() << kFATAL<<
Form(
"Dataset[%s] : ",DataInfo().GetName())<<
"unable to create pointer in GetMulticlassEfficiency, exiting."<<
Endl;
2696 if (!
resMulticlass) Log() << kFATAL<<
"unable to create pointer in GetMulticlassTrainingEfficiency, exiting."<<
Endl;
2698 Log() << kINFO <<
Form(
"Dataset[%s] : ",DataInfo().GetName())<<
"Determine optimal multiclass cuts for training data..." <<
Endl;
2730 Log() << kFATAL <<
"Cannot get confusion matrix for non-multiclass analysis." << std::endl;
2734 Data()->SetCurrentType(
type);
2739 Log() << kFATAL <<
Form(
"Dataset[%s] : ", DataInfo().GetName())
2740 <<
"unable to create pointer in GetMulticlassEfficiency, exiting." <<
Endl;
2782 Log() << kFATAL <<
Form(
"Dataset[%s] : ",DataInfo().GetName())<<
"<GetSeparation> Mismatch in pdfs" <<
Endl;
2786 if (!fSplS || !fSplB) {
2787 Log()<<kDEBUG<<
Form(
"[%s] : ",DataInfo().GetName())<<
"could not calculate the separation, distributions"
2788 <<
" fSplS or fSplB are not yet filled" <<
Endl;
2804 Log() << kFATAL <<
Form(
"Dataset[%s] : ",DataInfo().GetName())<<
"<GetROCIntegral(TH1D*, TH1D*)> Mismatch in hists" <<
Endl;
2820 integral += (1-
pdfB->GetIntegral(cut,
xmax)) *
pdfS->GetVal(cut);
2825 return integral*step;
2838 Log() << kFATAL <<
Form(
"Dataset[%s] : ",DataInfo().GetName())<<
"<GetSeparation> Mismatch in pdfs" <<
Endl;
2852 integral += (1-
pdfB->GetIntegral(cut,
xmax)) *
pdfS->GetVal(cut);
2855 return integral*step;
2874 Log() << kFATAL <<
Form(
"Dataset[%s] : ",DataInfo().GetName())<<
"<GetMaximumSignificance> "
2875 <<
"Number of signal or background events is <= 0 ==> abort"
2879 Log() << kINFO <<
Form(
"Dataset[%s] : ",DataInfo().GetName())<<
"Using ratio SignalEvents/BackgroundEvents = "
2886 Log() << kWARNING <<
Form(
"Dataset[%s] : ",DataInfo().GetName())<<
"Efficiency histograms empty !" <<
Endl;
2887 Log() << kWARNING <<
Form(
"Dataset[%s] : ",DataInfo().GetName())<<
"no maximum cut found, return 0" <<
Endl;
2927 Long64_t entries = Data()->GetNEvents();
2931 Log() << kFATAL <<
Form(
"Dataset[%s] : ",DataInfo().GetName())<<
"<CalculateEstimator> Wrong tree type: " <<
treeType <<
Endl;
2955 if (DataInfo().IsSignal(
ev)) {
2985 classFileName = GetWeightFileDir() +
"/" + GetJobName() +
"_" + GetMethodName() +
".class.C";
2993 <<
"Creating standalone class: "
2998 Log() << kFATAL <<
"<MakeClass> Unable to open file: " <<
classFileName <<
Endl;
3003 fout <<
"// Class: " << className << std::endl;
3004 fout <<
"// Automatically generated by MethodBase::MakeClass" << std::endl <<
"//" << std::endl;
3008 fout <<
"/* configuration options =====================================================" << std::endl << std::endl;
3009 WriteStateToStream(
fout );
3011 fout <<
"============================================================================ */" << std::endl;
3014 fout <<
"" << std::endl;
3015 fout <<
"#include <array>" << std::endl;
3016 fout <<
"#include <vector>" << std::endl;
3017 fout <<
"#include <cmath>" << std::endl;
3018 fout <<
"#include <string>" << std::endl;
3019 fout <<
"#include <iostream>" << std::endl;
3020 fout <<
"" << std::endl;
3023 this->MakeClassSpecificHeader(
fout, className );
3025 fout <<
"#ifndef IClassifierReader__def" << std::endl;
3026 fout <<
"#define IClassifierReader__def" << std::endl;
3028 fout <<
"class IClassifierReader {" << std::endl;
3030 fout <<
" public:" << std::endl;
3032 fout <<
" // constructor" << std::endl;
3033 fout <<
" IClassifierReader() : fStatusIsClean( true ) {}" << std::endl;
3034 fout <<
" virtual ~IClassifierReader() {}" << std::endl;
3036 fout <<
" // return classifier response" << std::endl;
3038 fout <<
" virtual std::vector<double> GetMulticlassValues( const std::vector<double>& inputValues ) const = 0;" << std::endl;
3040 fout <<
" virtual double GetMvaValue( const std::vector<double>& inputValues ) const = 0;" << std::endl;
3043 fout <<
" // returns classifier status" << std::endl;
3044 fout <<
" bool IsStatusClean() const { return fStatusIsClean; }" << std::endl;
3046 fout <<
" protected:" << std::endl;
3048 fout <<
" bool fStatusIsClean;" << std::endl;
3049 fout <<
"};" << std::endl;
3051 fout <<
"#endif" << std::endl;
3053 fout <<
"class " << className <<
" : public IClassifierReader {" << std::endl;
3055 fout <<
" public:" << std::endl;
3057 fout <<
" // constructor" << std::endl;
3058 fout <<
" " << className <<
"( std::vector<std::string>& theInputVars )" << std::endl;
3059 fout <<
" : IClassifierReader()," << std::endl;
3060 fout <<
" fClassName( \"" << className <<
"\" )," << std::endl;
3061 fout <<
" fNvars( " << GetNvar() <<
" )" << std::endl;
3062 fout <<
" {" << std::endl;
3063 fout <<
" // the training input variables" << std::endl;
3064 fout <<
" const char* inputVars[] = { ";
3066 fout <<
"\"" << GetOriginalVarName(
ivar) <<
"\"";
3067 if (
ivar<GetNvar()-1)
fout <<
", ";
3069 fout <<
" };" << std::endl;
3071 fout <<
" // sanity checks" << std::endl;
3072 fout <<
" if (theInputVars.size() <= 0) {" << std::endl;
3073 fout <<
" std::cout << \"Problem in class \\\"\" << fClassName << \"\\\": empty input vector\" << std::endl;" << std::endl;
3074 fout <<
" fStatusIsClean = false;" << std::endl;
3075 fout <<
" }" << std::endl;
3077 fout <<
" if (theInputVars.size() != fNvars) {" << std::endl;
3078 fout <<
" std::cout << \"Problem in class \\\"\" << fClassName << \"\\\": mismatch in number of input values: \"" << std::endl;
3079 fout <<
" << theInputVars.size() << \" != \" << fNvars << std::endl;" << std::endl;
3080 fout <<
" fStatusIsClean = false;" << std::endl;
3081 fout <<
" }" << std::endl;
3083 fout <<
" // validate input variables" << std::endl;
3084 fout <<
" for (size_t ivar = 0; ivar < theInputVars.size(); ivar++) {" << std::endl;
3085 fout <<
" if (theInputVars[ivar] != inputVars[ivar]) {" << std::endl;
3086 fout <<
" std::cout << \"Problem in class \\\"\" << fClassName << \"\\\": mismatch in input variable names\" << std::endl" << std::endl;
3087 fout <<
" << \" for variable [\" << ivar << \"]: \" << theInputVars[ivar].c_str() << \" != \" << inputVars[ivar] << std::endl;" << std::endl;
3088 fout <<
" fStatusIsClean = false;" << std::endl;
3089 fout <<
" }" << std::endl;
3090 fout <<
" }" << std::endl;
3092 fout <<
" // initialize min and max vectors (for normalisation)" << std::endl;
3094 fout <<
" fVmin[" <<
ivar <<
"] = " << std::setprecision(15) << GetXmin(
ivar ) <<
";" << std::endl;
3095 fout <<
" fVmax[" <<
ivar <<
"] = " << std::setprecision(15) << GetXmax(
ivar ) <<
";" << std::endl;
3098 fout <<
" // initialize input variable types" << std::endl;
3100 fout <<
" fType[" <<
ivar <<
"] = \'" << DataInfo().GetVariableInfo(
ivar).GetVarType() <<
"\';" << std::endl;
3103 fout <<
" // initialize constants" << std::endl;
3104 fout <<
" Initialize();" << std::endl;
3106 if (GetTransformationHandler().GetTransformationList().GetSize() != 0) {
3107 fout <<
" // initialize transformation" << std::endl;
3108 fout <<
" InitTransform();" << std::endl;
3110 fout <<
" }" << std::endl;
3112 fout <<
" // destructor" << std::endl;
3113 fout <<
" virtual ~" << className <<
"() {" << std::endl;
3114 fout <<
" Clear(); // method-specific" << std::endl;
3115 fout <<
" }" << std::endl;
3117 fout <<
" // the classifier response" << std::endl;
3118 fout <<
" // \"inputValues\" is a vector of input values in the same order as the" << std::endl;
3119 fout <<
" // variables given to the constructor" << std::endl;
3121 fout <<
" std::vector<double> GetMulticlassValues( const std::vector<double>& inputValues ) const override;" << std::endl;
3123 fout <<
" double GetMvaValue( const std::vector<double>& inputValues ) const override;" << std::endl;
3126 fout <<
" private:" << std::endl;
3128 fout <<
" // method-specific destructor" << std::endl;
3129 fout <<
" void Clear();" << std::endl;
3131 if (GetTransformationHandler().GetTransformationList().GetSize()!=0) {
3132 fout <<
" // input variable transformation" << std::endl;
3133 GetTransformationHandler().MakeFunction(
fout, className,1);
3134 fout <<
" void InitTransform();" << std::endl;
3135 fout <<
" void Transform( std::vector<double> & iv, int sigOrBgd ) const;" << std::endl;
3138 fout <<
" // common member variables" << std::endl;
3139 fout <<
" const char* fClassName;" << std::endl;
3141 fout <<
" const size_t fNvars;" << std::endl;
3142 fout <<
" size_t GetNvar() const { return fNvars; }" << std::endl;
3143 fout <<
" char GetType( int ivar ) const { return fType[ivar]; }" << std::endl;
3145 fout <<
" // normalisation of input variables" << std::endl;
3146 fout <<
" double fVmin[" << GetNvar() <<
"];" << std::endl;
3147 fout <<
" double fVmax[" << GetNvar() <<
"];" << std::endl;
3148 fout <<
" double NormVariable( double x, double xmin, double xmax ) const {" << std::endl;
3149 fout <<
" // normalise to output range: [-1, 1]" << std::endl;
3150 fout <<
" return 2*(x - xmin)/(xmax - xmin) - 1.0;" << std::endl;
3151 fout <<
" }" << std::endl;
3153 fout <<
" // type of input variable: 'F' or 'I'" << std::endl;
3154 fout <<
" char fType[" << GetNvar() <<
"];" << std::endl;
3156 fout <<
" // initialize internal variables" << std::endl;
3157 fout <<
" void Initialize();" << std::endl;
3159 fout <<
" std::vector<double> GetMulticlassValues__( const std::vector<double>& inputValues ) const;" << std::endl;
3161 fout <<
" double GetMvaValue__( const std::vector<double>& inputValues ) const;" << std::endl;
3163 fout <<
"" << std::endl;
3164 fout <<
" // private members (method specific)" << std::endl;
3167 MakeClassSpecific(
fout, className );
3170 fout <<
"inline std::vector<double> " << className <<
"::GetMulticlassValues( const std::vector<double>& inputValues ) const" << std::endl;
3172 fout <<
"inline double " << className <<
"::GetMvaValue( const std::vector<double>& inputValues ) const" << std::endl;
3174 fout <<
"{" << std::endl;
3175 fout <<
" // classifier response value" << std::endl;
3177 fout <<
" std::vector<double> retval;" << std::endl;
3179 fout <<
" double retval = 0;" << std::endl;
3182 fout <<
" // classifier response, sanity check first" << std::endl;
3183 fout <<
" if (!IsStatusClean()) {" << std::endl;
3184 fout <<
" std::cout << \"Problem in class \\\"\" << fClassName << \"\\\": cannot return classifier response\"" << std::endl;
3185 fout <<
" << \" because status is dirty\" << std::endl;" << std::endl;
3186 fout <<
" }" << std::endl;
3187 fout <<
" else {" << std::endl;
3188 if (IsNormalised()) {
3189 fout <<
" // normalise variables" << std::endl;
3190 fout <<
" std::vector<double> iV;" << std::endl;
3191 fout <<
" iV.reserve(inputValues.size());" << std::endl;
3192 fout <<
" int ivar = 0;" << std::endl;
3193 fout <<
" for (std::vector<double>::const_iterator varIt = inputValues.begin();" << std::endl;
3194 fout <<
" varIt != inputValues.end(); varIt++, ivar++) {" << std::endl;
3195 fout <<
" iV.push_back(NormVariable( *varIt, fVmin[ivar], fVmax[ivar] ));" << std::endl;
3196 fout <<
" }" << std::endl;
3197 if (GetTransformationHandler().GetTransformationList().GetSize() != 0 && GetMethodType() !=
Types::kLikelihood &&
3199 fout <<
" Transform( iV, -1 );" << std::endl;
3203 fout <<
" retval = GetMulticlassValues__( iV );" << std::endl;
3205 fout <<
" retval = GetMvaValue__( iV );" << std::endl;
3208 if (GetTransformationHandler().GetTransformationList().GetSize() != 0 && GetMethodType() !=
Types::kLikelihood &&
3210 fout <<
" std::vector<double> iV(inputValues);" << std::endl;
3211 fout <<
" Transform( iV, -1 );" << std::endl;
3213 fout <<
" retval = GetMulticlassValues__( iV );" << std::endl;
3215 fout <<
" retval = GetMvaValue__( iV );" << std::endl;
3219 fout <<
" retval = GetMulticlassValues__( inputValues );" << std::endl;
3221 fout <<
" retval = GetMvaValue__( inputValues );" << std::endl;
3225 fout <<
" }" << std::endl;
3227 fout <<
" return retval;" << std::endl;
3228 fout <<
"}" << std::endl;
3231 if (GetTransformationHandler().GetTransformationList().GetSize()!=0)
3232 GetTransformationHandler().MakeFunction(
fout, className,2);
3244 std::streambuf*
cout_sbuf = std::cout.rdbuf();
3245 std::ofstream* o = 0;
3246 if (
gConfig().WriteOptionsReference()) {
3247 Log() << kINFO <<
"Print Help message for class " << GetName() <<
" into file: " << GetReferenceFile() <<
Endl;
3248 o =
new std::ofstream( GetReferenceFile(), std::ios::app );
3250 Log() << kFATAL <<
"<PrintHelpMessage> Unable to append to output file: " << GetReferenceFile() <<
Endl;
3252 std::cout.rdbuf( o->rdbuf() );
3257 Log() << kINFO <<
Endl;
3259 <<
"================================================================"
3263 <<
"H e l p f o r M V A m e t h o d [ " << GetName() <<
" ] :"
3268 Log() <<
"Help for MVA method [ " << GetName() <<
" ] :" <<
Endl;
3276 Log() <<
"<Suppress this message by specifying \"!H\" in the booking option>" <<
Endl;
3278 <<
"================================================================"
3285 Log() <<
"# End of Message___" <<
Endl;
3305 else retval = fEffS->GetBinContent( fEffS->FindBin(
theCut ) );
3314 if (
theCut-fXmin < eps)
retval = (GetCutOrientation() == kPositive) ? 1.0 : 0.0;
3315 else if (fXmax-
theCut < eps)
retval = (GetCutOrientation() == kPositive) ? 0.0 : 1.0;
3328 if (GetTransformationHandler().GetTransformationList().GetEntries() <= 0) {
3329 return (Data()->GetEventCollection(
type));
3336 if (fEventCollections.at(idx) == 0) {
3337 fEventCollections.at(idx) = &(Data()->GetEventCollection(
type));
3338 fEventCollections.at(idx) = GetTransformationHandler().CalcTransformations(*(fEventCollections.at(idx)),
kTRUE);
3340 return *(fEventCollections.at(idx));
3348 UInt_t a = GetTrainingTMVAVersionCode() & 0xff0000;
a>>=16;
3349 UInt_t b = GetTrainingTMVAVersionCode() & 0x00ff00;
b>>=8;
3350 UInt_t c = GetTrainingTMVAVersionCode() & 0x0000ff;
3360 UInt_t a = GetTrainingROOTVersionCode() & 0xff0000;
a>>=16;
3361 UInt_t b = GetTrainingROOTVersionCode() & 0x00ff00;
b>>=8;
3362 UInt_t c = GetTrainingROOTVersionCode() & 0x0000ff;
const Bool_t Use_Splines_for_Eff_
const Int_t NBIN_HIST_HIGH
#define ROOT_VERSION_CODE
bool Bool_t
Boolean (0=false, 1=true) (bool)
int Int_t
Signed integer 4 bytes (int)
char Char_t
Character 1 byte (char)
float Float_t
Float 4 bytes (float)
double Double_t
Double 8 bytes.
long long Long64_t
Portable signed long integer 8 bytes.
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t 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 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 length
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
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
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
R__EXTERN TSystem * gSystem
#define TMVA_VERSION_CODE
const_iterator begin() const
const_iterator end() const
Class to manage histogram axis.
This class stores the date and time with a precision of one second in an unsigned 32 bit word (950130...
TDirectory::TContext keeps track and restore the current directory.
Describe directory structure in memory.
A file, usually with extension .root, that stores data and code in the form of serialized objects in ...
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
A TGraph is an object made of two arrays X and Y with npoints each.
1-D histogram with a double per channel (see TH1 documentation)
1-D histogram with a float per channel (see TH1 documentation)
TH1 is the base class of all histogram classes in ROOT.
virtual Double_t GetMean(Int_t axis=1) const
For axis = 1,2 or 3 returns the mean value of the histogram along X,Y or Z axis.
virtual Int_t GetQuantiles(Int_t n, Double_t *xp, const Double_t *p=nullptr)
Compute Quantiles for this histogram.
2-D histogram with a float per channel (see TH1 documentation)
Int_t Fill(Double_t) override
Invalid Fill method.
Class that contains all the information of a class.
TString fWeightFileExtension
Int_t fMaxNumOfAllowedVariables
VariablePlotting & GetVariablePlotting()
class TMVA::Config::VariablePlotting fVariablePlotting
MsgLogger * fLogger
! message logger
Class that contains all the data information.
Class that contains all the data information.
static void SetIsTraining(Bool_t)
when this static function is called, it sets the flag whether events with negative event weight shoul...
static void SetIgnoreNegWeightsInTraining(Bool_t)
when this static function is called, it sets the flag whether events with negative event weight shoul...
Interface for all concrete MVA method implementations.
Virtual base Class for all MVA method.
TDirectory * MethodBaseDir() const
returns the ROOT directory where all instances of the corresponding MVA method are stored
virtual Double_t GetKSTrainingVsTest(Char_t SorB, TString opt="X")
MethodBase(const TString &jobName, Types::EMVA methodType, const TString &methodTitle, DataSetInfo &dsi, const TString &theOption="")
standard constructor
void PrintHelpMessage() const override
prints out method-specific help method
virtual std::vector< Float_t > GetAllMulticlassValues()
Get all multi-class values.
virtual Double_t GetSeparation(TH1 *, TH1 *) const
compute "separation" defined as
const char * GetName() const override
void ReadClassesFromXML(void *clsnode)
read number of classes from XML
void SetWeightFileDir(TString fileDir)
set directory of weight file
void WriteStateToXML(void *parent) const
general method used in writing the header of the weight files where the used variables,...
void DeclareBaseOptions()
define the options (their key words) that can be set in the option string here the options valid for ...
virtual void TestRegression(Double_t &bias, Double_t &biasT, Double_t &dev, Double_t &devT, Double_t &rms, Double_t &rmsT, Double_t &mInf, Double_t &mInfT, Double_t &corr, Types::ETreeType type)
calculate <sum-of-deviation-squared> of regression output versus "true" value from test sample
virtual void DeclareCompatibilityOptions()
options that are used ONLY for the READER to ensure backward compatibility they are hence without any...
virtual Double_t GetSignificance() const
compute significance of mean difference
virtual Double_t GetProba(const Event *ev)
virtual TMatrixD GetMulticlassConfusionMatrix(Double_t effB, Types::ETreeType type)
Construct a confusion matrix for a multiclass classifier.
virtual void WriteEvaluationHistosToFile(Types::ETreeType treetype)
writes all MVA evaluation histograms to file
virtual void TestMulticlass()
test multiclass classification
const std::vector< TMVA::Event * > & GetEventCollection(Types::ETreeType type)
returns the event collection (i.e.
virtual std::vector< Double_t > GetDataMvaValues(DataSet *data=nullptr, Long64_t firstEvt=0, Long64_t lastEvt=-1, Bool_t logProgress=false)
get all the MVA values for the events of the given Data type
void SetupMethod()
setup of methods
TDirectory * BaseDir() const
returns the ROOT directory where info/histograms etc of the corresponding MVA method instance are sto...
virtual std::vector< Float_t > GetMulticlassEfficiency(std::vector< std::vector< Float_t > > &purity)
void AddInfoItem(void *gi, const TString &name, const TString &value) const
xml writing
virtual void AddClassifierOutputProb(Types::ETreeType type)
prepare tree branch with the method's discriminating variable
virtual Double_t GetEfficiency(const TString &, Types::ETreeType, Double_t &err)
fill background efficiency (resp.
TString GetTrainingTMVAVersionString() const
calculates the TMVA version string from the training version code on the fly
void Statistics(Types::ETreeType treeType, const TString &theVarName, Double_t &, Double_t &, Double_t &, Double_t &, Double_t &, Double_t &)
calculates rms,mean, xmin, xmax of the event variable this can be either done for the variables as th...
Bool_t GetLine(std::istream &fin, char *buf)
reads one line from the input stream checks for certain keywords and interprets the line if keywords ...
void ProcessSetup()
process all options the "CheckForUnusedOptions" is done in an independent call, since it may be overr...
virtual std::vector< Double_t > GetMvaValues(Long64_t firstEvt=0, Long64_t lastEvt=-1, Bool_t logProgress=false)
get all the MVA values for the events of the current Data type
virtual Bool_t IsSignalLike()
uses a pre-set cut on the MVA output (SetSignalReferenceCut and SetSignalReferenceCutOrientation) for...
virtual ~MethodBase()
destructor
void WriteMonitoringHistosToFile() const override
write special monitoring histograms to file dummy implementation here --------------—
virtual Double_t GetMaximumSignificance(Double_t SignalEvents, Double_t BackgroundEvents, Double_t &optimal_significance_value) const
plot significance, , curve for given number of signal and background events; returns cut for maximum ...
virtual Double_t GetTrainingEfficiency(const TString &)
void SetWeightFileName(TString)
set the weight file name (depreciated)
TString GetWeightFileName() const
retrieve weight file name
virtual void TestClassification()
initialization
void AddOutput(Types::ETreeType type, Types::EAnalysisType analysisType)
virtual void AddRegressionOutput(Types::ETreeType type)
prepare tree branch with the method's discriminating variable
void InitBase()
default initialization called by all constructors
virtual void GetRegressionDeviation(UInt_t tgtNum, Types::ETreeType type, Double_t &stddev, Double_t &stddev90Percent) const
void ReadStateFromXMLString(const char *xmlstr)
for reading from memory
void MakeClass(const TString &classFileName=TString("")) const override
create reader class for method (classification only at present)
void CreateMVAPdfs()
Create PDFs of the MVA output variables.
TString GetTrainingROOTVersionString() const
calculates the ROOT version string from the training version code on the fly
virtual Double_t GetValueForRoot(Double_t)
returns efficiency as function of cut
void ReadStateFromFile()
Function to write options and weights to file.
void WriteVarsToStream(std::ostream &tf, const TString &prefix="") const
write the list of variables (name, min, max) for a given data transformation method to the stream
void ReadVarsFromStream(std::istream &istr)
Read the variables (name, min, max) for a given data transformation method from the stream.
void ReadSpectatorsFromXML(void *specnode)
read spectator info from XML
void ReadVariablesFromXML(void *varnode)
read variable info from XML
virtual std::map< TString, Double_t > OptimizeTuningParameters(TString fomType="ROCIntegral", TString fitType="FitGA")
call the Optimizer with the set of parameters and ranges that are meant to be tuned.
virtual std::vector< Float_t > GetMulticlassTrainingEfficiency(std::vector< std::vector< Float_t > > &purity)
void WriteStateToStream(std::ostream &tf) const
general method used in writing the header of the weight files where the used variables,...
virtual Double_t GetRarity(Double_t mvaVal, Types::ESBType reftype=Types::kBackground) const
compute rarity:
virtual void SetTuneParameters(std::map< TString, Double_t > tuneParameters)
set the tuning parameters according to the argument This is just a dummy .
void ReadStateFromStream(std::istream &tf)
read the header from the weight files of the different MVA methods
void AddVarsXMLTo(void *parent) const
write variable info to XML
Double_t GetMvaValue(Double_t *errLower=nullptr, Double_t *errUpper=nullptr) override=0
void AddTargetsXMLTo(void *parent) const
write target info to XML
void ReadTargetsFromXML(void *tarnode)
read target info from XML
void ProcessBaseOptions()
the option string is decoded, for available options see "DeclareOptions"
void ReadStateFromXML(void *parent)
virtual std::vector< Float_t > GetAllRegressionValues()
Get al regression values in one call.
void NoErrorCalc(Double_t *const err, Double_t *const errUpper)
void WriteStateToFile() const
write options and weights to file note that each one text file for the main configuration information...
void AddClassesXMLTo(void *parent) const
write class info to XML
virtual void AddClassifierOutput(Types::ETreeType type)
prepare tree branch with the method's discriminating variable
void AddSpectatorsXMLTo(void *parent) const
write spectator info to XML
virtual Double_t GetROCIntegral(TH1D *histS, TH1D *histB) const
calculate the area (integral) under the ROC curve as a overall quality measure of the classification
virtual void AddMulticlassOutput(Types::ETreeType type)
prepare tree branch with the method's discriminating variable
virtual void CheckSetup()
check may be overridden by derived class (sometimes, eg, fitters are used which can only be implement...
void SetSource(const std::string &source)
PDF wrapper for histograms; uses user-defined spline interpolation.
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.
Class that is the base-class for a vector of result.
Root finding using Brents algorithm (translated from CERNLIB function RZERO)
Linear interpolation of TGraph.
Timing information for training and evaluation of MVA methods.
Singleton class for Global types used by TMVA.
@ kSignal
Never change this number - it is elsewhere assumed to be zero !
Class for type info of MVA input variable.
Collectable string class.
void ToLower()
Change string to lower-case.
Int_t Atoi() const
Return integer value of string.
TSubString Strip(EStripType s=kTrailing, char c=' ') const
Return a substring of self stripped at beginning and/or end.
const char * Data() const
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
virtual const char * GetBuildNode() const
Return the build node name.
virtual int mkdir(const char *name, Bool_t recursive=kFALSE)
Make a file system directory.
virtual const char * WorkingDirectory()
Return working directory.
virtual UserGroup_t * GetUserInfo(Int_t uid)
Returns all user info in the UserGroup_t structure.
void SaveDoc(XMLDocPointer_t xmldoc, const char *filename, Int_t layout=1)
store document content to file if layout<=0, no any spaces or newlines will be placed between xmlnode...
void FreeDoc(XMLDocPointer_t xmldoc)
frees allocated document data and deletes document itself
XMLNodePointer_t DocGetRootElement(XMLDocPointer_t xmldoc)
returns root node of document
XMLDocPointer_t NewDoc(const char *version="1.0")
creates new xml document with provided version
XMLDocPointer_t ParseFile(const char *filename, Int_t maxbuf=100000)
Parses content of file and tries to produce xml structures.
XMLDocPointer_t ParseString(const char *xmlstring)
parses content of string and tries to produce xml structures
void DocSetRootElement(XMLDocPointer_t xmldoc, XMLNodePointer_t xmlnode)
set main (root) node for document
void CreateVariableTransforms(const TString &trafoDefinition, TMVA::DataSetInfo &dataInfo, TMVA::TransformationHandler &transformationHandler, TMVA::MsgLogger &log)
MsgLogger & Endl(MsgLogger &ml)
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Double_t Sqrt(Double_t x)
Returns the square root of x.
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.