141 #pragma warning ( disable : 4355 ) 177 std::cerr << kERROR <<
"IPythonInteractive::Init: already initialized..." << std::endl;
181 for(
auto& title : graphTitles){
183 fGraphs.back()->SetTitle(title);
184 fGraphs.back()->SetName(title);
185 fGraphs.back()->SetFillColor(color);
186 fGraphs.back()->SetLineColor(color);
187 fGraphs.back()->SetMarkerColor(color);
252 fAnalysisType (
Types::kNoAnalysisType ),
253 fRegressionReturnVal ( 0 ),
254 fMulticlassReturnVal ( 0 ),
255 fDataSetInfo ( dsi ),
256 fSignalReferenceCut ( 0.5 ),
257 fSignalReferenceCutOrientation( 1. ),
258 fVariableTransformType (
Types::kSignal ),
259 fJobName ( jobName ),
260 fMethodName ( methodTitle ),
261 fMethodType ( methodType ),
265 fConstructedFromWeightFile (
kFALSE ),
267 fMethodBaseDir ( 0 ),
270 fModelPersistence (
kTRUE),
281 fSplTrainEffBvsS ( 0 ),
282 fVarTransformString (
"None" ),
283 fTransformationPointer ( 0 ),
284 fTransformation ( dsi, methodTitle ),
286 fVerbosityLevelString (
"Default" ),
289 fIgnoreNegWeightsInTraining(
kFALSE ),
291 fBackgroundClass ( 0 ),
393 for (
Int_t i = 0; i < 2; i++ ) {
485 if (
DataInfo().GetClassInfo(
"Signal") != 0) {
488 if (
DataInfo().GetClassInfo(
"Background") != 0) {
516 DeclareOptionRef(
fVerbose,
"V",
"Verbose output (short form of \"VerbosityLevel\" below - overrides the latter one)" );
532 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)\"" );
539 "Events with negative weights are ignored in the training (but are included for testing and performance evaluation)" );
590 Log() << kFATAL <<
"<ProcessOptions> Verbosity level type '" 606 "Use signal or background events to derive for variable transformation (the transformation is applied on both types of, course)" );
634 Log() << kWARNING <<
Form(
"Dataset[%s] : ",
DataInfo().
GetName())<<
"Parameter optimization is not yet implemented for method " 636 Log() << kWARNING <<
Form(
"Dataset[%s] : ",
DataInfo().
GetName())<<
"Currently we need to set hardcoded which parameter is tuned in which ranges"<<
Endl;
638 std::map<TString,Double_t> tunedParameters;
639 tunedParameters.size();
640 return tunedParameters;
672 <<
"Begin training" <<
Endl;
677 <<
"\tEnd of training " <<
Endl;
680 <<
"Elapsed time for training with " << nEvents <<
" events: " 684 <<
"\tCreate MVA output for ";
734 bool truncate =
false;
735 TH1F*
h1 = regRes->QuadraticDeviation( tgtNum , truncate, 1.);
740 TH1F* h2 = regRes->QuadraticDeviation( tgtNum , truncate, yq[0]);
764 regRes->Resize( nEvents );
769 Int_t totalProgressDraws = 100;
770 Int_t drawProgressEvery = 1;
771 if(nEvents >= totalProgressDraws) drawProgressEvery = nEvents/totalProgressDraws;
773 for (
Int_t ievt=0; ievt<nEvents; ievt++) {
777 regRes->SetValue( vals, ievt );
780 if(ievt % drawProgressEvery == 0 || ievt==nEvents-1) timer.
DrawProgressBar( ievt );
784 <<
"Elapsed time for evaluation of " << nEvents <<
" events: " 793 regRes->CreateDeviationHistograms( histNamePrefix );
806 if (!resMulticlass)
Log() << kFATAL<<
Form(
"Dataset[%s] : ",
DataInfo().
GetName())<<
"unable to create pointer in AddMulticlassOutput, exiting."<<
Endl;
816 resMulticlass->
Resize( nEvents );
817 for (
Int_t ievt=0; ievt<nEvents; ievt++) {
820 resMulticlass->SetValue( vals, ievt );
825 <<
"Elapsed time for evaluation of " << nEvents <<
" events: " 836 resMulticlass->CreateMulticlassPerformanceHistos(histNamePrefix);
843 if (errUpper) *errUpper=-1;
885 std::vector<Double_t> mvaValues =
GetMvaValues(0, nEvents,
true);
892 for (
Int_t ievt=0; ievt<nEvents; ievt++) {
893 clRes->
SetValue( mvaValues[ievt], ievt );
903 if (firstEvt > lastEvt || lastEvt > nEvents) lastEvt = nEvents;
904 if (firstEvt < 0) firstEvt = 0;
905 std::vector<Double_t> values(lastEvt-firstEvt);
907 nEvents = values.size();
916 <<
" sample (" << nEvents <<
" events)" <<
Endl;
918 for (
Int_t ievt=firstEvt; ievt<lastEvt; ievt++) {
925 if (modulo <= 0 ) modulo = 1;
931 <<
"Elapsed time for evaluation of " << nEvents <<
" events: " 956 mvaProb->
Resize( nEvents );
957 for (
Int_t ievt=0; ievt<nEvents; ievt++) {
961 if (proba < 0)
break;
966 if (modulo <= 0 ) modulo = 1;
971 <<
"Elapsed time for evaluation of " << nEvents <<
" events: " 992 bias = 0; biasT = 0; dev = 0; devT = 0; rms = 0; rmsT = 0;
1000 Log() << kINFO <<
"Calculate regression for all events" <<
Endl;
1002 for (
Long64_t ievt=0; ievt<nevt; ievt++) {
1026 m1 += t*w;
s1 += t*t*w;
1027 m2 += r*w; s2 += r*r*w;
1032 Log() << kINFO <<
"Elapsed time for evaluation of " << nevt <<
" events: " 1044 corr = s12/sumw - m1*
m2;
1045 corr /=
TMath::Sqrt( (
s1/sumw - m1*m1) * (s2/sumw - m2*m2) );
1048 TH2F* hist =
new TH2F(
"hist",
"hist", 150, xmin, xmax, 100, xmin, xmax );
1049 TH2F* histT =
new TH2F(
"histT",
"histT", 150, xmin, xmax, 100, xmin, xmax );
1056 for (
Long64_t ievt=0; ievt<nevt; ievt++) {
1058 hist->
Fill( rV[ievt], tV[ievt], wV[ievt] );
1059 if (d >= devMin && d <= devMax) {
1061 biasT += wV[ievt] *
d;
1063 rmsT += wV[ievt] * d *
d;
1064 histT->
Fill( rV[ievt], tV[ievt], wV[ievt] );
1092 if (!resMulticlass)
Log() << kFATAL<<
Form(
"Dataset[%s] : ",
DataInfo().
GetName())<<
"unable to create pointer in TestMulticlass, exiting."<<
Endl;
1102 TString histNamePrefixTest{histNamePrefix +
"_Test"};
1103 TString histNamePrefixTrain{histNamePrefix +
"_Train"};
1128 <<
" not found in tree" <<
Endl;
1160 mvaRes->
Store(mva_s,
"MVA_S");
1161 mvaRes->
Store(mva_b,
"MVA_B");
1171 proba_s =
new TH1D( TestvarName +
"_Proba_S", TestvarName +
"_Proba_S",
fNbinsMVAoutput, 0.0, 1.0 );
1172 proba_b =
new TH1D( TestvarName +
"_Proba_B", TestvarName +
"_Proba_B",
fNbinsMVAoutput, 0.0, 1.0 );
1173 mvaRes->
Store(proba_s,
"Prob_S");
1174 mvaRes->
Store(proba_b,
"Prob_B");
1179 rarity_s =
new TH1D( TestvarName +
"_Rarity_S", TestvarName +
"_Rarity_S",
fNbinsMVAoutput, 0.0, 1.0 );
1180 rarity_b =
new TH1D( TestvarName +
"_Rarity_B", TestvarName +
"_Rarity_B",
fNbinsMVAoutput, 0.0, 1.0 );
1181 mvaRes->
Store(rarity_s,
"Rar_S");
1182 mvaRes->
Store(rarity_b,
"Rar_B");
1188 TH1* mva_eff_s =
new TH1D( TestvarName +
"_S_high", TestvarName +
"_S_high",
fNbinsH, fXmin, sxmax );
1189 TH1* mva_eff_b =
new TH1D( TestvarName +
"_B_high", TestvarName +
"_B_high",
fNbinsH, fXmin, sxmax );
1190 mvaRes->
Store(mva_eff_s,
"MVA_HIGHBIN_S");
1191 mvaRes->
Store(mva_eff_b,
"MVA_HIGHBIN_B");
1200 Log() << kHEADER <<
Form(
"[%s] : ",
DataInfo().
GetName())<<
"Loop over test events and fill histograms with classifier response..." <<
Endl <<
Endl;
1201 if (mvaProb)
Log() << kINFO <<
"Also filling probability and rarity histograms (on request)..." <<
Endl;
1217 mvaResTypes->push_back(
kTRUE);
1218 mva_s ->
Fill( v, w );
1220 proba_s->
Fill( (*mvaProb)[ievt][0], w );
1224 mva_eff_s ->
Fill( v, w );
1227 mvaResTypes->push_back(
kFALSE);
1228 mva_b ->
Fill( v, w );
1230 proba_b->
Fill( (*mvaProb)[ievt][0], w );
1233 mva_eff_b ->
Fill( v, w );
1263 tf << prefix <<
"#GEN -*-*-*-*-*-*-*-*-*-*-*- general info -*-*-*-*-*-*-*-*-*-*-*-" << std::endl << prefix << std::endl;
1265 tf.setf(std::ios::left);
1270 tf << prefix <<
"Creator : " << userInfo->
fUser << std::endl;
1279 tf << prefix << std::endl;
1284 tf << prefix << std::endl << prefix <<
"#OPT -*-*-*-*-*-*-*-*-*-*-*-*- options -*-*-*-*-*-*-*-*-*-*-*-*-" << std::endl << prefix << std::endl;
1286 tf << prefix << std::endl;
1289 tf << prefix << std::endl << prefix <<
"#VAR -*-*-*-*-*-*-*-*-*-*-*-* variables *-*-*-*-*-*-*-*-*-*-*-*-" << std::endl << prefix << std::endl;
1291 tf << prefix << std::endl;
1324 if (!parent)
return;
1403 <<
"Creating xml weight file: " 1424 <<
"Reading weight file: " 1428 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,29,0) 1434 Log() << kFATAL <<
"Error parsing XML file " << tfname <<
Endl;
1442 fb.open(tfname.
Data(),std::ios::in);
1443 if (!fb.is_open()) {
1445 <<
"Unable to open input weight file: " << tfname <<
Endl;
1447 std::istream fin(&fb);
1465 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,26,00) 1471 Log() << kFATAL<<
Form(
"Dataset[%s] : ",
DataInfo().
GetName()) <<
"Method MethodBase::ReadStateFromXMLString( const char* xmlstr = " 1472 << xmlstr <<
" ) is not available for ROOT versions prior to 5.26/00." <<
Endl;
1501 if (nodeName==
"GeneralInfo") {
1506 while (antypeNode) {
1509 if (
name ==
"TrainingTime")
1512 if (
name ==
"AnalysisType") {
1521 if (
name ==
"TMVA Release" ||
name ==
"TMVA") {
1528 if (
name ==
"ROOT Release" ||
name ==
"ROOT") {
1538 else if (nodeName==
"Options") {
1543 else if (nodeName==
"Variables") {
1546 else if (nodeName==
"Spectators") {
1549 else if (nodeName==
"Classes") {
1552 else if (nodeName==
"Targets") {
1555 else if (nodeName==
"Transformations") {
1558 else if (nodeName==
"MVAPdfs") {
1573 else if (nodeName==
"Weights") {
1604 methodType = methodType(methodType.Last(
' '),methodType.Length());
1609 if (methodName ==
"") methodName = methodType;
1634 fin.getline(buf,512);
1635 while (!
TString(buf).BeginsWith(
"#VAR")) fin.getline(buf,512);
1667 fin.getline(buf,512);
1668 while (!
TString(buf).BeginsWith(
"#MAT")) fin.getline(buf,512);
1671 varTrafo->ReadTransformationFromStream(fin, trafo );
1682 fin.getline(buf,512);
1683 while (!
TString(buf).BeginsWith(
"#MVAPDFS")) fin.getline(buf,512);
1696 fin.getline(buf,512);
1697 while (!
TString(buf).BeginsWith(
"#WGT")) fin.getline(buf,512);
1698 fin.getline(buf,512);
1729 istr >> dummy >> readNVar;
1733 <<
" while there are " << readNVar <<
" variables declared in the file" 1749 Log() << kINFO <<
"The definition (or the order) of the variables found in the input file is" <<
Endl;
1750 Log() << kINFO <<
"is not the same as the one declared in the Reader (which is necessary for" <<
Endl;
1751 Log() << kINFO <<
"the correct working of the method):" <<
Endl;
1752 Log() << kINFO <<
" var #" << varIdx <<
" declared in Reader: " << varIt->GetExpression() <<
Endl;
1753 Log() << kINFO <<
" var #" << varIdx <<
" declared in file : " << varInfo.
GetExpression() <<
Endl;
1754 Log() << kFATAL <<
"The expression declared to the Reader needs to be checked (name or order are wrong)" <<
Endl;
1808 for (
UInt_t iCls=0; iCls<nClasses; ++iCls) {
1844 <<
" while there are " << readNVar <<
" variables declared in the file" 1859 existingVarInfo = readVarInfo;
1863 Log() << kINFO <<
"The definition (or the order) of the variables found in the input file is" <<
Endl;
1864 Log() << kINFO <<
"not the same as the one declared in the Reader (which is necessary for the" <<
Endl;
1865 Log() << kINFO <<
"correct working of the method):" <<
Endl;
1866 Log() << kINFO <<
" var #" << varIdx <<
" declared in Reader: " << existingVarInfo.
GetExpression() <<
Endl;
1867 Log() << kINFO <<
" var #" << varIdx <<
" declared in file : " << readVarInfo.
GetExpression() <<
Endl;
1868 Log() << kFATAL <<
"The expression declared to the Reader needs to be checked (name or order are wrong)" <<
Endl;
1884 <<
" while there are " << readNSpec <<
" spectators declared in the file" 1899 existingSpecInfo = readSpecInfo;
1903 Log() << kINFO <<
"The definition (or the order) of the spectators found in the input file is" <<
Endl;
1904 Log() << kINFO <<
"not the same as the one declared in the Reader (which is necessary for the" <<
Endl;
1905 Log() << kINFO <<
"correct working of the method):" <<
Endl;
1906 Log() << kINFO <<
" spec #" << specIdx <<
" declared in Reader: " << existingSpecInfo.
GetExpression() <<
Endl;
1907 Log() << kINFO <<
" spec #" << specIdx <<
" declared in file : " << readSpecInfo.
GetExpression() <<
Endl;
1908 Log() << kFATAL <<
"The expression declared to the Reader needs to be checked (name or order are wrong)" <<
Endl;
1927 for (
UInt_t icls = 0; icls<readNCls;++icls) {
1944 if (
DataInfo().GetClassInfo(
"Signal") != 0) {
1949 if (
DataInfo().GetClassInfo(
"Background") != 0) {
1987 Log() << kFATAL <<
Form(
"Dataset[%s] : ",
DataInfo().
GetName())<<
"MethodBase::BaseDir() - MethodBaseDir() return a NULL pointer!" <<
Endl;
1994 sdir = methodDir->
mkdir(defaultDir);
2000 wfilePath.Write(
"TrainingPath" );
2001 wfileName.Write(
"WeightFileName" );
2036 Log()<<kDEBUG<<
Form(
"Dataset[%s] : ",
DataInfo().
GetName())<<
"Return from MethodBaseDir() after creating base directory "<<
Endl;
2070 if (wFileDir.
IsNull() )
return wFileName;
2072 return ( wFileDir + (wFileDir[wFileDir.
Length()-1]==
'/' ?
"" :
"/")
2098 Log() << kFATAL <<
Form(
"Dataset[%s] : ",
DataInfo().
GetName())<<
"<WriteEvaluationHistosToFile> Unknown result: " 2100 <<
"/kMaxAnalysisType" <<
Endl;
2122 fin.getline(buf,512);
2128 std::stringstream
s(code.
Data());
2136 std::stringstream
s(code.
Data());
2144 std::stringstream
s(code.
Data());
2145 std::string analysisType;
2150 else Log() << kFATAL <<
"Analysis type " << analysisType <<
" from weight-file not known!" << std::endl;
2172 if (mvaRes==0 || mvaRes->
GetSize()==0) {
2173 Log() << kERROR<<
Form(
"Dataset[%s] : ",
DataInfo().
GetName())<<
"<CreateMVAPdfs> No result of classifier testing available" <<
Endl;
2187 histMVAPdfS->Sumw2();
2188 histMVAPdfB->
Sumw2();
2196 else histMVAPdfB->
Fill( theVal, theWeight );
2205 histMVAPdfS->Write();
2206 histMVAPdfB->
Write();
2214 if (
DataInfo().GetNClasses() == 2) {
2216 <<
Form(
"<CreateMVAPdfs> Separation from histogram (PDF): %1.3f (%1.3f)",
2230 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;
2236 return GetProba(mvaVal,sigFraction);
2245 Log() << kWARNING <<
Form(
"Dataset[%s] : ",
DataInfo().
GetName())<<
"<GetProba> MVA PDFs for Signal and Background don't exist" <<
Endl;
2251 Double_t denom = p_s*ap_sig + p_b*(1 - ap_sig);
2253 return (denom > 0) ? (p_s*ap_sig) / denom : -1;
2266 Log() << kWARNING <<
Form(
"Dataset[%s] : ",
DataInfo().
GetName())<<
"<GetRarity> Required MVA PDF for Signal or Background does not exist: " 2267 <<
"select option \"CreateMVAPdfs\"" <<
Endl;
2292 else if (list->
GetSize() > 2) {
2293 Log() << kFATAL <<
Form(
"Dataset[%s] : ",
DataInfo().
GetName())<<
"<GetEfficiency> Wrong number of arguments" 2294 <<
" in string: " << theString
2295 <<
" | required format, e.g., Efficiency:0.05, or empty string" <<
Endl;
2303 Log() << kFATAL <<
Form(
"Dataset[%s] : ",
DataInfo().
GetName())<<
"<GetEfficiency> Binning mismatch between signal and background histos" <<
Endl;
2311 TH1 * effhist = results->
GetHist(
"MVA_HIGHBIN_S");
2318 if (results->
DoesExist(
"MVA_EFF_S")==0) {
2323 results->
Store(eff_s,
"MVA_EFF_S");
2324 results->
Store(eff_b,
"MVA_EFF_B");
2336 Float_t theVal = (*mvaRes)[ievt];
2339 TH1* theHist = isSignal ? eff_s : eff_b;
2342 if (isSignal) nevtS+=theWeight;
2346 if (sign > 0 && maxbin >
fNbinsH)
continue;
2347 if (sign < 0 && maxbin < 1 )
continue;
2348 if (sign > 0 && maxbin < 1 ) maxbin = 1;
2368 results->
Store(eff_BvsS,
"MVA_EFF_BvsS");
2374 results->
Store(rej_BvsS);
2376 rej_BvsS->
SetYTitle(
"Backgr rejection (1-eff)" );
2381 results->
Store(inveff_BvsS);
2383 inveff_BvsS->
SetYTitle(
"Inverse backgr. eff (1/eff)" );
2426 Double_t effS = 0., rejB, effS_ = 0., rejB_ = 0.;
2427 Int_t nbins_ = 5000;
2428 for (
Int_t bini=1; bini<=nbins_; bini++) {
2431 effS = (bini - 0.5)/
Float_t(nbins_);
2435 if ((effS - rejB)*(effS_ - rejB_) < 0)
break;
2453 Double_t effS = 0, effB = 0, effS_ = 0, effB_ = 0;
2454 Int_t nbins_ = 1000;
2460 for (
Int_t bini=1; bini<=nbins_; bini++) {
2463 effS = (bini - 0.5)/
Float_t(nbins_);
2465 integral += (1.0 - effB);
2479 for (
Int_t bini=1; bini<=nbins_; bini++) {
2482 effS = (bini - 0.5)/
Float_t(nbins_);
2486 if ((effB - effBref)*(effB_ - effBref) <= 0)
break;
2492 effS = 0.5*(effS + effS_);
2495 if (nevtS > 0) effSerr =
TMath::Sqrt( effS*(1.0 - effS)/nevtS );
2520 Log() << kFATAL <<
Form(
"Dataset[%s] : ",
DataInfo().
GetName())<<
"<GetTrainingEfficiency> Wrong number of arguments" 2521 <<
" in string: " << theString
2522 <<
" | required format, e.g., Efficiency:0.05" <<
Endl;
2535 Log() << kFATAL <<
Form(
"Dataset[%s] : ",
DataInfo().
GetName())<<
"<GetTrainingEfficiency> Binning mismatch between signal and background histos" 2543 TH1 * effhist = results->
GetHist(
"MVA_HIGHBIN_S");
2548 if (results->
DoesExist(
"MVA_TRAIN_S")==0) {
2556 results->
Store(mva_s_tr,
"MVA_TRAIN_S");
2557 results->
Store(mva_b_tr,
"MVA_TRAIN_B");
2566 results->
Store(mva_eff_tr_s,
"MVA_TRAINEFF_S");
2567 results->
Store(mva_eff_tr_b,
"MVA_TRAINEFF_B");
2587 theClsHist->
Fill( theVal, theWeight );
2591 if (sign > 0 && maxbin >
fNbinsH)
continue;
2592 if (sign < 0 && maxbin < 1 )
continue;
2593 if (sign > 0 && maxbin < 1 ) maxbin = 1;
2596 if (sign > 0)
for (
Int_t ibin=1; ibin<=maxbin; ibin++) theEffHist->
AddBinContent( ibin , theWeight );
2613 results->
Store(eff_bvss,
"EFF_BVSS_TR");
2614 results->
Store(rej_bvss,
"REJ_BVSS_TR");
2662 Double_t effS = 0., effB, effS_ = 0., effB_ = 0.;
2663 Int_t nbins_ = 1000;
2664 for (
Int_t bini=1; bini<=nbins_; bini++) {
2667 effS = (bini - 0.5)/
Float_t(nbins_);
2671 if ((effB - effBref)*(effB_ - effBref) <= 0)
break;
2676 return 0.5*(effS + effS_);
2685 if (!resMulticlass)
Log() << kFATAL<<
Form(
"Dataset[%s] : ",
DataInfo().
GetName())<<
"unable to create pointer in GetMulticlassEfficiency, exiting."<<
Endl;
2697 if (!resMulticlass)
Log() << kFATAL<<
"unable to create pointer in GetMulticlassTrainingEfficiency, exiting."<<
Endl;
2699 Log() << kINFO <<
Form(
"Dataset[%s] : ",
DataInfo().
GetName())<<
"Determine optimal multiclass cuts for training data..." <<
Endl;
2731 Log() << kFATAL <<
"Cannot get confusion matrix for non-multiclass analysis." << std::endl;
2739 if (resMulticlass ==
nullptr) {
2741 <<
"unable to create pointer in GetMulticlassEfficiency, exiting." <<
Endl;
2782 if ((!pdfS && pdfB) || (pdfS && !pdfB))
2784 if (!pdfS) pdfS =
fSplS;
2785 if (!pdfB) pdfB =
fSplB;
2788 Log()<<kDEBUG<<
Form(
"[%s] : ",
DataInfo().
GetName())<<
"could not calculate the separation, distributions" 2789 <<
" fSplS or fSplB are not yet filled" <<
Endl;
2804 if ((!histS && histB) || (histS && !histB))
2807 if (histS==0 || histB==0)
return 0.;
2820 for (
UInt_t i=0; i<nsteps; i++) {
2826 return integral*step;
2838 if ((!pdfS && pdfB) || (pdfS && !pdfB))
2840 if (!pdfS) pdfS =
fSplS;
2841 if (!pdfB) pdfB =
fSplB;
2843 if (pdfS==0 || pdfB==0)
return 0.;
2852 for (
UInt_t i=0; i<nsteps; i++) {
2856 return integral*step;
2866 Double_t& max_significance_value )
const 2871 Double_t effS(0),effB(0),significance(0);
2874 if (SignalEvents <= 0 || BackgroundEvents <= 0) {
2876 <<
"Number of signal or background events is <= 0 ==> abort" 2880 Log() << kINFO <<
Form(
"Dataset[%s] : ",
DataInfo().
GetName())<<
"Using ratio SignalEvents/BackgroundEvents = " 2881 << SignalEvents/BackgroundEvents <<
Endl;
2886 if ( (eff_s==0) || (eff_b==0) ) {
2897 significance =
sqrt(SignalEvents)*( effS )/
sqrt( effS + ( BackgroundEvents / SignalEvents) * effB );
2907 delete temp_histogram;
2912 return max_significance;
2932 Log() << kFATAL <<
Form(
"Dataset[%s] : ",
DataInfo().
GetName())<<
"<CalculateEstimator> Wrong tree type: " << treeType <<
Endl;
2951 for (
Int_t ievt = 0; ievt < entries; ievt++) {
2960 meanS += weight*theVar;
2961 rmsS += weight*theVar*theVar;
2965 meanB += weight*theVar;
2966 rmsB += weight*theVar*theVar;
2974 meanS = meanS/sumwS;
2975 meanB = meanB/sumwB;
2989 if (theClassFileName ==
"")
2992 classFileName = theClassFileName;
2996 TString tfname( classFileName );
2998 <<
"Creating standalone class: " 3001 std::ofstream fout( classFileName );
3003 Log() << kFATAL <<
"<MakeClass> Unable to open file: " << classFileName <<
Endl;
3008 fout <<
"// Class: " << className << std::endl;
3009 fout <<
"// Automatically generated by MethodBase::MakeClass" << std::endl <<
"//" << std::endl;
3013 fout <<
"/* configuration options =====================================================" << std::endl << std::endl;
3016 fout <<
"============================================================================ */" << std::endl;
3019 fout <<
"" << std::endl;
3020 fout <<
"#include <array>" << std::endl;
3021 fout <<
"#include <vector>" << std::endl;
3022 fout <<
"#include <cmath>" << std::endl;
3023 fout <<
"#include <string>" << std::endl;
3024 fout <<
"#include <iostream>" << std::endl;
3025 fout <<
"" << std::endl;
3030 fout <<
"#ifndef IClassifierReader__def" << std::endl;
3031 fout <<
"#define IClassifierReader__def" << std::endl;
3033 fout <<
"class IClassifierReader {" << std::endl;
3035 fout <<
" public:" << std::endl;
3037 fout <<
" // constructor" << std::endl;
3038 fout <<
" IClassifierReader() : fStatusIsClean( true ) {}" << std::endl;
3039 fout <<
" virtual ~IClassifierReader() {}" << std::endl;
3041 fout <<
" // return classifier response" << std::endl;
3042 fout <<
" virtual double GetMvaValue( const std::vector<double>& inputValues ) const = 0;" << std::endl;
3044 fout <<
" // returns classifier status" << std::endl;
3045 fout <<
" bool IsStatusClean() const { return fStatusIsClean; }" << std::endl;
3047 fout <<
" protected:" << std::endl;
3049 fout <<
" bool fStatusIsClean;" << std::endl;
3050 fout <<
"};" << std::endl;
3052 fout <<
"#endif" << std::endl;
3054 fout <<
"class " << className <<
" : public IClassifierReader {" << std::endl;
3056 fout <<
" public:" << std::endl;
3058 fout <<
" // constructor" << std::endl;
3059 fout <<
" " << className <<
"( std::vector<std::string>& theInputVars )" << std::endl;
3060 fout <<
" : IClassifierReader()," << std::endl;
3061 fout <<
" fClassName( \"" << className <<
"\" )," << std::endl;
3062 fout <<
" fNvars( " <<
GetNvar() <<
" )," << std::endl;
3063 fout <<
" fIsNormalised( " << (
IsNormalised() ?
"true" :
"false") <<
" )" << std::endl;
3064 fout <<
" {" << std::endl;
3065 fout <<
" // the training input variables" << std::endl;
3066 fout <<
" const char* inputVars[] = { ";
3069 if (ivar<
GetNvar()-1) fout <<
", ";
3071 fout <<
" };" << std::endl;
3073 fout <<
" // sanity checks" << std::endl;
3074 fout <<
" if (theInputVars.size() <= 0) {" << std::endl;
3075 fout <<
" std::cout << \"Problem in class \\\"\" << fClassName << \"\\\": empty input vector\" << std::endl;" << std::endl;
3076 fout <<
" fStatusIsClean = false;" << std::endl;
3077 fout <<
" }" << std::endl;
3079 fout <<
" if (theInputVars.size() != fNvars) {" << std::endl;
3080 fout <<
" std::cout << \"Problem in class \\\"\" << fClassName << \"\\\": mismatch in number of input values: \"" << std::endl;
3081 fout <<
" << theInputVars.size() << \" != \" << fNvars << std::endl;" << std::endl;
3082 fout <<
" fStatusIsClean = false;" << std::endl;
3083 fout <<
" }" << std::endl;
3085 fout <<
" // validate input variables" << std::endl;
3086 fout <<
" for (size_t ivar = 0; ivar < theInputVars.size(); ivar++) {" << std::endl;
3087 fout <<
" if (theInputVars[ivar] != inputVars[ivar]) {" << std::endl;
3088 fout <<
" std::cout << \"Problem in class \\\"\" << fClassName << \"\\\": mismatch in input variable names\" << std::endl" << std::endl;
3089 fout <<
" << \" for variable [\" << ivar << \"]: \" << theInputVars[ivar].c_str() << \" != \" << inputVars[ivar] << std::endl;" << std::endl;
3090 fout <<
" fStatusIsClean = false;" << std::endl;
3091 fout <<
" }" << std::endl;
3092 fout <<
" }" << std::endl;
3094 fout <<
" // initialize min and max vectors (for normalisation)" << std::endl;
3096 fout <<
" fVmin[" << ivar <<
"] = " << std::setprecision(15) <<
GetXmin( ivar ) <<
";" << std::endl;
3097 fout <<
" fVmax[" << ivar <<
"] = " << std::setprecision(15) <<
GetXmax( ivar ) <<
";" << std::endl;
3100 fout <<
" // initialize input variable types" << std::endl;
3105 fout <<
" // initialize constants" << std::endl;
3106 fout <<
" Initialize();" << std::endl;
3109 fout <<
" // initialize transformation" << std::endl;
3110 fout <<
" InitTransform();" << std::endl;
3112 fout <<
" }" << std::endl;
3114 fout <<
" // destructor" << std::endl;
3115 fout <<
" virtual ~" << className <<
"() {" << std::endl;
3116 fout <<
" Clear(); // method-specific" << std::endl;
3117 fout <<
" }" << std::endl;
3119 fout <<
" // the classifier response" << std::endl;
3120 fout <<
" // \"inputValues\" is a vector of input values in the same order as the" << std::endl;
3121 fout <<
" // variables given to the constructor" << std::endl;
3122 fout <<
" double GetMvaValue( const std::vector<double>& inputValues ) const override;" << std::endl;
3124 fout <<
" private:" << std::endl;
3126 fout <<
" // method-specific destructor" << std::endl;
3127 fout <<
" void Clear();" << std::endl;
3130 fout <<
" // input variable transformation" << std::endl;
3132 fout <<
" void InitTransform();" << std::endl;
3133 fout <<
" void Transform( std::vector<double> & iv, int sigOrBgd ) const;" << std::endl;
3136 fout <<
" // common member variables" << std::endl;
3137 fout <<
" const char* fClassName;" << std::endl;
3139 fout <<
" const size_t fNvars;" << std::endl;
3140 fout <<
" size_t GetNvar() const { return fNvars; }" << std::endl;
3141 fout <<
" char GetType( int ivar ) const { return fType[ivar]; }" << std::endl;
3143 fout <<
" // normalisation of input variables" << std::endl;
3144 fout <<
" const bool fIsNormalised;" << std::endl;
3145 fout <<
" bool IsNormalised() const { return fIsNormalised; }" << 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;
3158 fout <<
" double GetMvaValue__( const std::vector<double>& inputValues ) const;" << std::endl;
3159 fout <<
"" << std::endl;
3160 fout <<
" // private members (method specific)" << std::endl;
3165 fout <<
" inline double " << className <<
"::GetMvaValue( const std::vector<double>& inputValues ) const" << std::endl;
3166 fout <<
" {" << std::endl;
3167 fout <<
" // classifier response value" << std::endl;
3168 fout <<
" double retval = 0;" << std::endl;
3170 fout <<
" // classifier response, sanity check first" << std::endl;
3171 fout <<
" if (!IsStatusClean()) {" << std::endl;
3172 fout <<
" std::cout << \"Problem in class \\\"\" << fClassName << \"\\\": cannot return classifier response\"" << std::endl;
3173 fout <<
" << \" because status is dirty\" << std::endl;" << std::endl;
3174 fout <<
" retval = 0;" << std::endl;
3175 fout <<
" }" << std::endl;
3176 fout <<
" else {" << std::endl;
3177 fout <<
" if (IsNormalised()) {" << std::endl;
3178 fout <<
" // normalise variables" << std::endl;
3179 fout <<
" std::vector<double> iV;" << std::endl;
3180 fout <<
" iV.reserve(inputValues.size());" << std::endl;
3181 fout <<
" int ivar = 0;" << std::endl;
3182 fout <<
" for (std::vector<double>::const_iterator varIt = inputValues.begin();" << std::endl;
3183 fout <<
" varIt != inputValues.end(); varIt++, ivar++) {" << std::endl;
3184 fout <<
" iV.push_back(NormVariable( *varIt, fVmin[ivar], fVmax[ivar] ));" << std::endl;
3185 fout <<
" }" << std::endl;
3189 fout <<
" Transform( iV, -1 );" << std::endl;
3191 fout <<
" retval = GetMvaValue__( iV );" << std::endl;
3192 fout <<
" }" << std::endl;
3193 fout <<
" else {" << std::endl;
3197 fout <<
" std::vector<double> iV;" << std::endl;
3198 fout <<
" int ivar = 0;" << std::endl;
3199 fout <<
" for (std::vector<double>::const_iterator varIt = inputValues.begin();" << std::endl;
3200 fout <<
" varIt != inputValues.end(); varIt++, ivar++) {" << std::endl;
3201 fout <<
" iV.push_back(*varIt);" << std::endl;
3202 fout <<
" }" << std::endl;
3203 fout <<
" Transform( iV, -1 );" << std::endl;
3204 fout <<
" retval = GetMvaValue__( iV );" << std::endl;
3207 fout <<
" retval = GetMvaValue__( inputValues );" << std::endl;
3209 fout <<
" }" << std::endl;
3210 fout <<
" }" << std::endl;
3212 fout <<
" return retval;" << std::endl;
3213 fout <<
" }" << std::endl;
3229 std::streambuf* cout_sbuf = std::cout.rdbuf();
3230 std::ofstream* o = 0;
3231 if (
gConfig().WriteOptionsReference()) {
3237 std::cout.rdbuf( o->rdbuf() );
3244 <<
"================================================================" 3248 <<
"H e l p f o r M V A m e t h o d [ " <<
GetName() <<
" ] :" 3253 Log() <<
"Help for MVA method [ " <<
GetName() <<
" ] :" <<
Endl;
3261 Log() <<
"<Suppress this message by specifying \"!H\" in the booking option>" <<
Endl;
3263 <<
"================================================================" 3270 Log() <<
"# End of Message___" <<
Endl;
3273 std::cout.rdbuf( cout_sbuf );
3358 if (mvaRes != NULL) {
3361 TH1D *mva_s_tr =
dynamic_cast<TH1D*
> (mvaRes->
GetHist(
"MVA_TRAIN_S"));
3362 TH1D *mva_b_tr =
dynamic_cast<TH1D*
> (mvaRes->
GetHist(
"MVA_TRAIN_B"));
3364 if ( !mva_s || !mva_b || !mva_s_tr || !mva_b_tr)
return -1;
3366 if (SorB ==
's' || SorB ==
'S')
virtual void DeclareOptions()=0
Bool_t HasMVAPdfs() const
Types::EAnalysisType fAnalysisType
virtual const char * GetName() const
Returns name of object.
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
virtual void AddClassifierOutputProb(Types::ETreeType type)
prepare tree branch with the method's discriminating variable
virtual Int_t FindBin(Double_t x, Double_t y=0, Double_t z=0)
Return Global bin number corresponding to x,y,z.
virtual void Scale(Double_t c1=1, Option_t *option="")
Multiply this histogram by a constant c1.
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
void WriteStateToXML(void *parent) const
general method used in writing the header of the weight files where the used variables, variable transformation type etc.
virtual void SetTuneParameters(std::map< TString, Double_t > tuneParameters)
set the tuning parameters according to the argument This is just a dummy .
virtual void MakeClass(const TString &classFileName=TString("")) const
create reader class for method (classification only at present)
virtual Double_t GetMaximum(Double_t maxval=FLT_MAX) const
Return maximum value smaller than maxval of bins in the range, unless the value has been overridden b...
UInt_t GetNVariables() const
virtual Double_t GetBinCenter(Int_t bin) const
Return bin center for 1D histogram.
virtual const std::vector< Float_t > & GetMulticlassValues()
#define TMVA_VERSION_CODE
void SetCurrentEvent(Long64_t ievt) const
MsgLogger & Endl(MsgLogger &ml)
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 ReadOptionsFromXML(void *node)
void ReadXML(void *pdfnode)
XML file reading.
Singleton class for Global types used by TMVA.
void AddOutput(Types::ETreeType type, Types::EAnalysisType analysisType)
VariableInfo & AddTarget(const TString &expression, const TString &title, const TString &unit, Double_t min, Double_t max, Bool_t normalized=kTRUE, void *external=0)
add a variable (can be a complex expression) to the set of variables used in the MV analysis ...
Class that is the base-class for a vector of result.
void AddPoint(Double_t x, Double_t y1, Double_t y2)
This function is used only in 2 TGraph case, and it will add new data points to graphs.
Bool_t fIgnoreNegWeightsInTraining
virtual const char * WorkingDirectory()
Return working directory.
void ReadStateFromXML(void *parent)
std::vector< VariableInfo > & GetSpectatorInfos()
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 ...
virtual Double_t GetMvaValue(Double_t *errLower=0, Double_t *errUpper=0)=0
virtual void MakeClassSpecificHeader(std::ostream &, const TString &="") const
Collectable string class.
virtual Double_t GetValueForRoot(Double_t)
returns efficiency as function of cut
std::vector< TGraph * > fGraphs
void ReadOptionsFromStream(std::istream &istr)
read option back from the weight file
TString & ReplaceAll(const TString &s1, const TString &s2)
TH1 * GetSmoothedHist() const
virtual const char * GetBuildNode() const
Return the build node name.
void BuildPDF(const TH1 *theHist)
virtual void WriteEvaluationHistosToFile(Types::ETreeType treetype)
writes all MVA evaluation histograms to file
const TString & GetOriginalVarName(Int_t ivar) const
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.
TString fVariableTransformTypeString
XMLDocPointer_t NewDoc(const char *version="1.0")
creates new xml document with provided version
OptionBase * DeclareOptionRef(T &ref, const TString &name, const TString &desc="")
TransformationHandler * fTransformationPointer
Types::ESBType fVariableTransformType
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
virtual Double_t Eval(Double_t x) const
returns linearly interpolated TGraph entry around x
A TMultiGraph is a collection of TGraph (or derived) objects.
virtual Int_t GetQuantiles(Int_t nprobSum, Double_t *q, const Double_t *probSum=0)
Compute Quantiles for this histogram Quantile x_q of a probability distribution Function F is defined...
virtual int MakeDirectory(const char *name)
Make a directory.
Virtual base Class for all MVA method.
virtual TObject * Get(const char *namecycle)
Return pointer to object identified by namecycle.
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.
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
virtual const std::vector< Float_t > & GetRegressionValues()
const TString & GetReferenceFile() const
static Bool_t AddDirectoryStatus()
Static function: cannot be inlined on Windows/NT.
1-D histogram with a float per channel (see TH1 documentation)}
void SetTrainTime(Double_t trainTime)
TMultiGraph * fMultiGraph
TransformationHandler & GetTransformationHandler(Bool_t takeReroutedIfAvailable=true)
Short_t Min(Short_t a, Short_t b)
void ToLower()
Change string to lower-case.
virtual Double_t GetKSTrainingVsTest(Char_t SorB, TString opt="X")
virtual void SetYTitle(const char *title)
virtual TDirectory * mkdir(const char *name, const char *title="")
Create a sub-directory "a" or a hierarchy of sub-directories "a/b/c/...".
virtual void TestMulticlass()
test multiclass classification
TString GetTrainingROOTVersionString() const
calculates the ROOT version string from the training version code on the fly
UInt_t GetNClasses() const
UInt_t GetNTargets() const
TMatrixD GetConfusionMatrix(Double_t effB)
Returns a confusion matrix where each class is pitted against each other.
const std::vector< Event * > & GetEventCollection(Types::ETreeType type=Types::kMaxTreeType) const
std::vector< TString > * fInputVars
virtual void GetRegressionDeviation(UInt_t tgtNum, Types::ETreeType type, Double_t &stddev, Double_t &stddev90Percent) const
#define ROOT_VERSION_CODE
void ReadTargetsFromXML(void *tarnode)
read target info from XML
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 ...
void AddInfoItem(void *gi, const TString &name, const TString &value) const
xml writing
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 ...
TDirectory * MethodBaseDir() const
returns the ROOT directory where all instances of the corresponding MVA method are stored ...
Double_t GetTrainingSumSignalWeights()
void FreeDoc(XMLDocPointer_t xmldoc)
frees allocated document data and deletes document itself
Double_t GetTrainTime() const
virtual Bool_t IsSignalLike()
uses a pre-set cut on the MVA output (SetSignalReferenceCut and SetSignalReferenceCutOrientation) for...
void CreateMVAPdfs()
Create PDFs of the MVA output variables.
static void AddDirectory(Bool_t add=kTRUE)
Sets the flag controlling the automatic add of histograms in memory.
void ReadVariablesFromXML(void *varnode)
read variable info from XML
const TString & GetExpression() const
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=1, Int_t netopt=0)
Create / open a file.
const TString & GetWeightFileDir() const
void WriteStateToFile() const
write options and weights to file note that each one text file for the main configuration information...
static void SetIsTraining(Bool_t)
when this static function is called, it sets the flag whether events with negative event weight shoul...
Class that contains all the information of a class.
TString GetTrainingTMVAVersionString() const
calculates the TMVA version string from the training version code on the fly
DataSetInfo & fDataSetInfo
UInt_t TreeIndex(Types::ETreeType type) const
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
ECutOrientation fCutOrientation
virtual ~MethodBase()
destructor
void DocSetRootElement(XMLDocPointer_t xmldoc, XMLNodePointer_t xmlnode)
set main (root) node for document
UInt_t GetTrainingTMVAVersionCode() const
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
const Event * GetEvent() const
MethodBase(const TString &jobName, Types::EMVA methodType, const TString &methodTitle, DataSetInfo &dsi, const TString &theOption="")
standard constructor
void ClearGraphs()
This function sets the point number to 0 for all graphs.
void ReadStateFromFile()
Function to write options and weights to file.
Types::ETreeType GetCurrentType() const
std::vector< Float_t > * GetValueVector()
~IPythonInteractive()
standard destructor
virtual void AddClassifierOutput(Types::ETreeType type)
prepare tree branch with the method's discriminating variable
virtual Double_t GetRarity(Double_t mvaVal, Types::ESBType reftype=Types::kBackground) const
compute rarity: where PDF(x) is the PDF of the classifier's signal or background distribution ...
void PrintHelpMessage() const
prints out method-specific help method
void ReadClassesFromXML(void *clsnode)
read number of classes from XML
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
virtual void ParseOptions()
options parser
Double_t GetXmin(Int_t ivar) const
void SetupMethod()
setup of methods
void Init(std::vector< TString > &graphTitles)
This function gets some title and it creates a TGraph for every title.
DataSetInfo & DataInfo() const
void SetOptions(const TString &s)
virtual UserGroup_t * GetUserInfo(Int_t uid)
Returns all user info in the UserGroup_t structure.
Bool_t DoRegression() const
XMLDocPointer_t ParseString(const char *xmlstring)
parses content of string and tries to produce xml structures
void SetMinType(EMsgType minType)
Ssiz_t First(char c) const
Find first occurrence of a character c.
Bool_t DoesExist(const TString &alias) const
Returns true if there is an object stored in the result for a given alias, false otherwise.
Class that contains all the data information.
virtual void ProcessOptions()=0
virtual Double_t GetProba(const Event *ev)
PDF wrapper for histograms; uses user-defined spline interpolation.
virtual void AddBinContent(Int_t bin)
Increment bin content by 1.
Double_t GetWeight() const
return the event weight - depending on whether the flag IgnoreNegWeightsInTraining is or not...
Long64_t GetNTrainingEvents() const
std::vector< VariableInfo > & GetTargetInfos()
virtual Double_t GetEfficiency(const TString &, Types::ETreeType, Double_t &err)
fill background efficiency (resp.
void CreateVariableTransforms(const TString &trafoDefinition, TMVA::DataSetInfo &dataInfo, TMVA::TransformationHandler &transformationHandler, TMVA::MsgLogger &log)
virtual std::vector< Float_t > GetMulticlassEfficiency(std::vector< std::vector< Float_t > > &purity)
Double_t Root(Double_t refValue)
Root finding using Brents algorithm; taken from CERNLIB function RZERO.
virtual void AddWeightsXMLTo(void *parent) const =0
UInt_t fTMVATrainingVersion
UInt_t GetNEvents() const
temporary event when testing on a different DataSet than the own one
TString GetElapsedTime(Bool_t Scientific=kTRUE)
returns pretty string with elapsed time
Double_t GetXmax(Int_t ivar) const
TransformationHandler fTransformation
TMatrixT< Double_t > TMatrixD
void ReadStateFromXMLString(const char *xmlstr)
for reading from memory
Bool_t DoMulticlass() const
virtual Double_t KolmogorovTest(const TH1 *h2, Option_t *option="") const
Statistical test of compatibility in shape between this histogram and h2, using Kolmogorov test...
virtual void MakeClassSpecific(std::ostream &, const TString &="") const
virtual void ReadWeightsFromXML(void *wghtnode)=0
Int_t GetHistNBins(Int_t evtNum=0)
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...
TString fWeightFileExtension
void * GetExternalLink() const
Float_t GetTarget(UInt_t itgt) const
void WriteStateToStream(std::ostream &tf) const
general method used in writing the header of the weight files where the used variables, variable transformation type etc.
Results * GetResults(const TString &, Types::ETreeType type, Types::EAnalysisType analysistype)
Class to manage histogram axis.
R__EXTERN TSystem * gSystem
TDirectory * fMethodBaseDir
UInt_t fROOTTrainingVersion
const char * GetName() const
ClassInfo * GetClassInfo(Int_t clNum) const
void ReadVarsFromStream(std::istream &istr)
Read the variables (name, min, max) for a given data transformation method from the stream...
void AddClassesXMLTo(void *parent) const
write class info to XML
const Int_t NBIN_HIST_HIGH
2-D histogram with a float per channel (see TH1 documentation)}
class TMVA::Config::VariablePlotting fVariablePlotting
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 BeginsWith(const char *s, ECaseCompare cmp=kExact) const
virtual void SetBinContent(Int_t bin, Double_t content)
Set bin content see convention for numbering bins in TH1::GetBin In case the bin number is greater th...
Float_t GetAchievablePur(UInt_t cls)
void SetReadingVersion(UInt_t rv)
void SetValue(Float_t value, Int_t ievt)
set MVA response
UInt_t GetTrainingROOTVersionCode() const
Double_t ElapsedSeconds(void)
computes elapsed tim in seconds
char * Form(const char *fmt,...)
void ReadFromXML(void *varnode)
read VariableInfo from stream
void CreateMulticlassPerformanceHistos(TString prefix)
Create performance graphs for this classifier a multiclass setting.
TSubString Strip(EStripType s=kTrailing, char c=' ') const
Return a substring of self stripped at beginning and/or end.
const TString & GetJobName() const
const TString & GetMethodName() const
UInt_t GetNSpectators(bool all=kTRUE) const
virtual Double_t Eval(Double_t x) const =0
TSpline * fSplTrainEffBvsS
static constexpr double m2
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
void DeclareBaseOptions()
define the options (their key words) that can be set in the option string here the options valid for ...
1-D histogram with a double per channel (see TH1 documentation)}
virtual Double_t GetSignificance() const
compute significance of mean difference
TString GetWeightFileName() const
retrieve weight file name
Linear interpolation of TGraph.
Double_t GetSignalReferenceCutOrientation() const
void ProcessBaseOptions()
the option string is decoded, for available options see "DeclareOptions"
Int_t FindVarIndex(const TString &) const
find variable by name
UInt_t GetNVariables() const
std::vector< const std::vector< TMVA::Event * > * > fEventCollections
void AddSpectatorsXMLTo(void *parent) const
write spectator info to XML
Float_t GetValue(UInt_t ivar) const
return value of i'th variable
TString fVerbosityLevelString
void CreateMulticlassHistos(TString prefix, Int_t nbins, Int_t nbins_high)
this function fills the mva response histos for multiclass classification
void DeclareOptions()
define the options (their key words) that can be set in the option string
TList * GetStorage() const
static void SetIgnoreNegWeightsInTraining(Bool_t)
when this static function is called, it sets the flag whether events with negative event weight shoul...
XMLDocPointer_t ParseFile(const char *filename, Int_t maxbuf=100000)
Parses content of file and tries to produce xml structures.
const std::vector< TMVA::Event * > & GetEventCollection(Types::ETreeType type)
returns the event collection (i.e.
virtual void CheckSetup()
check may be overridden by derived class (sometimes, eg, fitters are used which can only be implement...
void SetTestTime(Double_t testTime)
virtual void AddRegressionOutput(Types::ETreeType type)
prepare tree branch with the method's discriminating variable
std::vector< Double_t > GetBestMultiClassCuts(UInt_t targetClass)
calculate the best working point (optimal cut values) for the multiclass classifier ...
void SetWeightFileName(TString)
set the weight file name (depreciated)
virtual Double_t GetSeparation(TH1 *, TH1 *) const
compute "separation" defined as
Describe directory structure in memory.
std::vector< Float_t > * fMulticlassReturnVal
Bool_t IsNormalised() const
Double_t GetTrainingSumBackgrWeights()
TH1 * GetHist(const TString &alias) const
Class which takes the results of a multiclass classification.
static RooMathCoreReg dummy
virtual void GetHelpMessage() const =0
void SetCurrentType(Types::ETreeType type) const
void AddVarsXMLTo(void *parent) const
write variable info to XML
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
const Bool_t Use_Splines_for_Eff_
static constexpr double s
const char * AsString() const
Return the date & time as a string (ctime() format).
VariableInfo & GetVariableInfo(Int_t i)
void AddPreDefVal(const T &)
IPythonInteractive()
standard constructor
virtual void WriteMonitoringHistosToFile() const
write special monitoring histograms to file dummy implementation here --------------— ...
ClassInfo * AddClass(const TString &className)
void AddXMLTo(void *parent)
XML file writing.
Bool_t fConstructedFromWeightFile
virtual const char * GetName() const
Returns name of object.
void ProcessSetup()
process all options the "CheckForUnusedOptions" is done in an independent call, since it may be overr...
TString fVarTransformString
virtual void AddMulticlassOutput(Types::ETreeType type)
prepare tree branch with the method's discriminating variable
const TString & GetOptions() const
void SetConfigName(const char *n)
Interface for all concrete MVA method implementations.
void ValidatePDF(TH1 *original=0) const
comparison of original histogram with reference PDF
Float_t GetAchievableEff(UInt_t cls)
void SetSource(const std::string &source)
Root finding using Brents algorithm (translated from CERNLIB function RZERO)
virtual std::vector< Float_t > GetMulticlassTrainingEfficiency(std::vector< std::vector< Float_t > > &purity)
virtual void SetXTitle(const char *title)
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 Bool_t cd(const char *path=0)
Change current directory to "this" directory.
void ReadFromStream(std::istream &istr)
read VariableInfo from stream
TDirectory * BaseDir() const
returns the ROOT directory where info/histograms etc of the corresponding MVA method instance are sto...
TString GetMethodTypeName() const
virtual void DeclareCompatibilityOptions()
options that are used ONLY for the READER to ensure backward compatibility they are hence without any...
Class that is the base-class for a vector of result.
Short_t Max(Short_t a, Short_t b)
void AddToXML(void *varnode)
write class to XML
Double_t fSignalReferenceCut
the data set information (sometimes needed)
void SetWeightFileDir(TString fileDir)
set directory of weight file
XMLNodePointer_t DocGetRootElement(XMLDocPointer_t xmldoc)
returns root node of document
Double_t GetSignalReferenceCut() const
virtual void Sumw2(Bool_t flag=kTRUE)
Create structure to store sum of squares of weights.
A Graph is a graphics object made of two arrays X and Y with npoints each.
TH1 * GetOriginalHist() const
virtual TDirectory * GetDirectory(const char *namecycle, Bool_t printError=false, const char *funcname="GetDirectory")
Find a directory using apath.
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
THist< 1, double, THistStatContent, THistStatUncertainty > TH1D
Long64_t GetNEvents(Types::ETreeType type=Types::kMaxTreeType) const
virtual Double_t GetTrainingEfficiency(const TString &)
void AddOptionsXMLTo(void *parent) const
write options to XML file
Double_t GetIntegral(Double_t xmin, Double_t xmax)
computes PDF integral within given ranges
void ReadSpectatorsFromXML(void *specnode)
read spectator info from XML
Int_t Atoi() const
Return integer value of string.
Bool_t IsSignal(const Event *ev) const
void DrawProgressBar(Int_t, const TString &comment="")
draws progress bar in color or B&W caution:
std::vector< Bool_t > * GetValueVectorTypes()
ECutOrientation GetCutOrientation() const
void InitBase()
default initialization called by all constructors
std::vector< Float_t > * fRegressionReturnVal
Types::EAnalysisType GetAnalysisType() const
void AddTargetsXMLTo(void *parent) const
write target info to XML
void Store(TObject *obj, const char *alias=0)
virtual Int_t GetNbinsX() const
virtual void Add(TGraph *graph, Option_t *chopt="")
Add a new graph to the list of graphs.
Double_t Sqrt(Double_t x)
Class for type info of MVA input variable.
const TString & GetTestvarName() const
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
virtual void ReadWeightsFromStream(std::istream &)=0
virtual TMatrixD GetMulticlassConfusionMatrix(Double_t effB, Types::ETreeType type)
Construct a confusion matrix for a multiclass classifier.
Int_t Fill(Double_t)
Invalid Fill method.
THist< 2, float, THistStatContent, THistStatUncertainty > TH2F
void SetTestvarName(const TString &v="")
Types::EMVA GetMethodType() const
void CheckForUnusedOptions() const
checks for unused options in option string
virtual Int_t GetMaximumBin() const
Return location of bin with maximum value in the range.
Timing information for training and evaluation of MVA methods.
virtual void TestClassification()
initialization
void ReadStateFromStream(std::istream &tf)
read the header from the weight files of the different MVA methods
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write all objects in this collection.
const Event * GetEvent() const
std::vector< VariableInfo > & GetVariableInfos()
void SetExternalLink(void *p)
virtual void SetAnalysisType(Types::EAnalysisType type)
void Resize(Int_t entries)
Class that is the base-class for a vector of result.
TAxis * GetXaxis()
Get the behaviour adopted by the object about the statoverflows. See EStatOverflows for more informat...
void NoErrorCalc(Double_t *const err, Double_t *const errUpper)
void SetSignalReferenceCut(Double_t cut)
void WriteOptionsToStream(std::ostream &o, const TString &prefix) const
write options to output stream (e.g. in writing the MVA weight files
void Resize(Ssiz_t n)
Resize the string. Truncate or add blanks as necessary.
This class stores the date and time with a precision of one second in an unsigned 32 bit word (950130...
Double_t GetVal(Double_t x) const
returns value PDF(x)
void SetConfigDescription(const char *d)
virtual void Close(Option_t *option="")
Close a file.
const char * Data() const