64using std::setiosflags, std::ios;
87 fScaleWithPreselEff(0),
100 std::vector<TTreeFormula*>::const_iterator
formIt;
120 if (
ds->GetNEvents() > 1 && fComputeCorrelations ) {
124 for (
UInt_t cl = 0; cl<
dsi.GetNClasses(); cl++) {
125 const TString className =
dsi.GetClassInfo(cl)->GetName();
126 dsi.SetCorrelationMatrix( className, CalcCorrelationMatrix(
ds, cl ) );
128 dsi.PrintCorrelationMatrix(className);
132 Log() << kHEADER <<
Form(
"[%s] : ",
dsi.GetName()) <<
" " <<
Endl <<
Endl;
142 Log() << kDEBUG <<
Form(
"Dataset[%s] : ",
dsi.GetName()) <<
"Build DataSet consisting of one Event with dynamically changing variables" <<
Endl;
147 if(
dsi.GetNClasses()==0){
148 dsi.AddClass(
"data" );
149 dsi.GetClassInfo(
"data" )->SetNumber(0);
152 std::vector<Float_t*>*
evdyn =
new std::vector<Float_t*>(0);
154 std::vector<VariableInfo>&
varinfos =
dsi.GetVariableInfos();
157 Log() << kFATAL <<
Form(
"Dataset[%s] : ",
dsi.GetName()) <<
"Dynamic data set cannot be built, since no variable informations are present. Apparently no variables have been set. This should not happen, please contact the TMVA authors." <<
Endl;
160 for (;it!=
itEnd;++it) {
163 Log() << kDEBUG <<
Form(
"Dataset[%s] : ",
dsi.GetName()) <<
"The link to the external variable is NULL while I am trying to build a dynamic data set. In this case fTmpEvent from MethodBase HAS TO BE USED in the method to get useful values in variables." <<
Endl;
182 ds->SetCurrentEvent( 0 );
196 if (
dataInput.GetEntries()==0)
return BuildDynamicDataSet(
dsi );
203 dsi.AddClass( (*it) );
224 Log() << kINFO <<
Form(
"Dataset[%s] : ",
dsi.GetName()) <<
"Collected:" <<
Endl;
225 for (
UInt_t cl = 0; cl <
dsi.GetNClasses(); cl++) {
226 Log() << kINFO <<
Form(
"Dataset[%s] : ",
dsi.GetName()) <<
" "
227 << setiosflags(ios::left) << std::setw(
maxL) <<
dsi.GetClassInfo(cl)->GetName()
228 <<
" training entries: " <<
ds->GetNClassEvents( 0, cl ) <<
Endl;
229 Log() << kINFO <<
Form(
"Dataset[%s] : ",
dsi.GetName()) <<
" "
230 << setiosflags(ios::left) << std::setw(
maxL) <<
dsi.GetClassInfo(cl)->GetName()
231 <<
" testing entries: " <<
ds->GetNClassEvents( 1, cl ) <<
Endl;
233 Log() << kINFO <<
Form(
"Dataset[%s] : ",
dsi.GetName()) <<
" " <<
Endl;
248 if(
ttf->GetNdim() <= 0 )
249 Log() << kFATAL <<
"Expression " << expression.
Data()
250 <<
" could not be resolved to a valid formula. " <<
Endl;
251 if(
ttf->GetNdata() == 0 ){
252 Log() << kWARNING <<
"Expression: " << expression.
Data()
253 <<
" does not provide data for this event. "
254 <<
"This event is not taken into account. --> please check if you use as a variable "
255 <<
"an entry of an array which is not filled for some events "
256 <<
"(e.g. arr[4] when arr has only 3 elements)." <<
Endl;
257 Log() << kWARNING <<
"If you want to take the event into account you can do something like: "
258 <<
"\"Alt$(arr[4],0)\" where in cases where arr doesn't have a 4th element, "
259 <<
" 0 is taken as an alternative." <<
Endl;
266 for (
int i = 0,
iEnd =
ttf->GetNcodes (); i <
iEnd; ++i)
269 if (!
leaf->IsOnTerminalBranch())
289 tr->ResetBranchAddresses();
294 Log() << kINFO <<
Form(
"Dataset[%s] : ",
dsi.GetName()) <<
" create input formulas for tree " <<
tr->GetName() <<
Endl;
297 fInputFormulas.clear();
299 fInputTableFormulas.clear();
304 for (
UInt_t i = 0; i <
dsi.GetNVariables(); i++) {
307 if (!
dsi.IsVariableFromArray(i) ) {
309 dsi.GetVariableInfo(i).GetExpression().Data(),
tr);
310 CheckTTreeFormula(
ttf,
dsi.GetVariableInfo(i).GetExpression(),
hasDollar);
311 fInputFormulas.emplace_back(
ttf);
312 fInputTableFormulas.emplace_back(std::make_pair(
ttf, (
Int_t) 0));
319 dsi.GetVariableInfo(i).GetExpression().Data(),
tr);
320 CheckTTreeFormula(
ttf,
dsi.GetVariableInfo(i).GetExpression(),
hasDollar);
321 fInputFormulas.push_back(
ttf);
323 arraySize =
dsi.GetVarArraySize(
dsi.GetVariableInfo(i).GetExpression());
327 Log() << kINFO <<
"Using variable " <<
dsi.GetVariableInfo(i).GetInternalName() <<
328 " from array expression " <<
dsi.GetVariableInfo(i).GetExpression() <<
" of size " << arraySize <<
Endl;
335 Log() << kDEBUG <<
"Using Last variable from array : " <<
dsi.GetVariableInfo(i).GetInternalName() <<
Endl;
344 Log() << kDEBUG <<
Form(
"Dataset[%s] : ",
dsi.GetName()) <<
"transform regression targets" <<
Endl;
346 fTargetFormulas.clear();
347 for (
UInt_t i=0; i<
dsi.GetNTargets(); i++) {
349 dsi.GetTargetInfo(i).GetExpression().Data(),
tr );
350 CheckTTreeFormula(
ttf,
dsi.GetTargetInfo(i).GetExpression(),
hasDollar );
351 fTargetFormulas.push_back(
ttf );
357 Log() << kDEBUG <<
Form(
"Dataset[%s] : ",
dsi.GetName()) <<
"transform spectator variables" <<
Endl;
359 fSpectatorFormulas.clear();
360 for (
UInt_t i=0; i<
dsi.GetNSpectators(); i++) {
362 dsi.GetSpectatorInfo(i).GetExpression().Data(),
tr );
363 CheckTTreeFormula(
ttf,
dsi.GetSpectatorInfo(i).GetExpression(),
hasDollar );
364 fSpectatorFormulas.push_back(
ttf );
370 Log() << kDEBUG <<
Form(
"Dataset[%s] : ",
dsi.GetName()) <<
"transform cuts" <<
Endl;
372 fCutFormulas.clear();
381 Log() << kWARNING <<
"Please check class \"" <<
dsi.GetClassInfo(
clIdx)->GetName()
382 <<
"\" cut \"" <<
dsi.GetClassInfo(
clIdx)->GetCut() <<
Endl;
385 fCutFormulas.push_back(
ttf );
391 Log() << kDEBUG <<
Form(
"Dataset[%s] : ",
dsi.GetName()) <<
"transform weights" <<
Endl;
393 fWeightFormula.clear();
397 if (
dsi.GetClassInfo(
clIdx)->GetName() !=
tinfo.GetClassName() ) {
398 fWeightFormula.push_back( 0 );
407 Log() << kWARNING <<
Form(
"Dataset[%s] : ",
dsi.GetName()) <<
"Please check class \"" <<
dsi.GetClassInfo(
clIdx)->GetName()
408 <<
"\" weight \"" <<
dsi.GetClassInfo(
clIdx)->GetWeight() <<
Endl;
414 fWeightFormula.push_back(
ttf );
419 Log() << kDEBUG <<
Form(
"Dataset[%s] : ",
dsi.GetName()) <<
"enable branches" <<
Endl;
423 tr->SetBranchStatus(
"*",0);
424 Log() << kINFO <<
Form(
"Dataset[%s] : ",
dsi.GetName()) <<
"enable branches: input variables" <<
Endl;
429 tr->SetBranchStatus(
ttf->GetLeaf(
bi)->GetBranch()->GetName(), 1 );
433 Log() << kINFO <<
Form(
"Dataset[%s] : ",
dsi.GetName()) <<
"enable branches: targets" <<
Endl;
437 tr->SetBranchStatus(
ttf->GetLeaf(
bi)->GetBranch()->GetName(), 1 );
440 Log() << kDEBUG <<
Form(
"Dataset[%s] : ",
dsi.GetName()) <<
"enable branches: spectators" <<
Endl;
444 tr->SetBranchStatus(
ttf->GetLeaf(
bi)->GetBranch()->GetName(), 1 );
447 Log() << kDEBUG <<
Form(
"Dataset[%s] : ",
dsi.GetName()) <<
"enable branches: cuts" <<
Endl;
452 tr->SetBranchStatus(
ttf->GetLeaf(
bi)->GetBranch()->GetName(), 1 );
455 Log() << kDEBUG <<
Form(
"Dataset[%s] : ",
dsi.GetName()) <<
"enable branches: weights" <<
Endl;
460 tr->SetBranchStatus(
ttf->GetLeaf(
bi)->GetBranch()->GetName(), 1 );
463 Log() << kINFO <<
Form(
"Dataset[%s] : ",
dsi.GetName()) <<
"tree initialized" <<
Endl;
472 const UInt_t nvar =
ds->GetNVariables();
489 for (
Int_t i=0; i<
ds->GetNEvents(); i++) {
512 Log() << kWARNING <<
Form(
"Dataset[%s] : ",
dsi.GetName()) <<
"Variable " <<
dsi.GetVariableInfo(
ivar).GetExpression().Data() <<
" is constant. Please remove the variable." <<
Endl;
518 Log() << kFATAL <<
Form(
"Dataset[%s] : ",
dsi.GetName()) <<
"Target " <<
dsi.GetTargetInfo(
ivar).GetExpression().Data() <<
" is constant. Please remove the variable." <<
Endl;
553 Log() << kWARNING <<
Form(
"Dataset[%s] : ",
DataSetInfo().GetName())<<
"<GetCorrelationMatrix> Zero variances for variables "
554 <<
"(" <<
ivar <<
", " <<
jvar <<
") = " <<
d
587 for (
Int_t i=0; i<
ds->GetNEvents(); i++) {
638 splitSpecs.SetConfigDescription(
"Configuration options given in the \"PrepareForTrainingAndTesting\" call; these options define the creation of the data sets used for training and expert validation by TMVA" );
642 "Method of picking training and testing events (default: random)" );
649 "Method of mixing events of different classes into one dataset (default: SameAsSplitMode)" );
657 "Seed for random event shuffling" );
661 "Overall renormalisation of event-by-event weights used in the training (NumEvents: average weight of 1 per event, independently for signal and background; EqualNumEvents: average weight of 1 per event for signal, and sum of weights for background equal to sum of weights for signal)" );
666 splitSpecs.DeclareOptionRef(fScaleWithPreselEff=
kFALSE,
"ScaleWithPreselEff",
"Scale the number of requested events by the eff. of the preselection cuts (or not)" );
671 for (
UInt_t cl = 0; cl <
dsi.GetNClasses(); cl++) {
682 splitSpecs.DeclareOptionRef( fVerbose,
"V",
"Verbosity (default: true)" );
684 splitSpecs.DeclareOptionRef( fVerboseLevel=
TString(
"Info"),
"VerboseLevel",
"VerboseLevel (Debug/Verbose/Info)" );
689 fCorrelations =
kTRUE;
690 splitSpecs.DeclareOptionRef(fCorrelations,
"Correlations",
"Boolean to show correlation output (Default: true)");
691 fComputeCorrelations =
kTRUE;
692 splitSpecs.DeclareOptionRef(fComputeCorrelations,
"CalcCorrelations",
"Compute correlations and also some variable statistics, e.g. min/max (Default: true )");
698 if (Verbose()) fLogger->SetMinType( kVERBOSE );
699 if (fVerboseLevel.CompareTo(
"Debug") ==0) fLogger->SetMinType( kDEBUG );
700 if (fVerboseLevel.CompareTo(
"Verbose") ==0) fLogger->SetMinType( kVERBOSE );
701 if (fVerboseLevel.CompareTo(
"Info") ==0) fLogger->SetMinType( kINFO );
710 Log() << kINFO <<
Form(
"Dataset[%s] : ",
dsi.GetName()) <<
"DataSet splitmode="<<
splitMode
731 const UInt_t nvars =
dsi.GetNVariables();
761 <<
"\tWeight expression for class \'" <<
dsi.GetClassInfo(cl)->GetName() <<
"\': \""
762 <<
dsi.GetClassInfo(cl)->GetWeight() <<
"\"" <<
Endl;
771 std::vector<Float_t> vars(nvars);
773 std::vector<Float_t> vis(
nvis);
776 Log() << kINFO <<
"Building event vectors for type " <<
currentInfo.GetTreeType() <<
" " <<
currentInfo.GetClassName() <<
Endl;
819 if (
dsi.IsVariableFromArray(
ivar))
continue;
825 if (
ndata == 1)
continue;
834 Log() << kERROR <<
Form(
"Dataset[%s] : ",
dsi.GetName())<<
"ERROR while preparing training and testing trees:" <<
Endl;
835 Log() <<
Form(
"Dataset[%s] : ",
dsi.GetName())<<
" multiple array-type expressions of different length were encountered" <<
Endl;
836 Log() <<
Form(
"Dataset[%s] : ",
dsi.GetName())<<
" location of error: event " <<
evtIdx
838 <<
" of file " <<
currentInfo.GetTree()->GetCurrentFile()->GetName() <<
Endl;
839 Log() <<
Form(
"Dataset[%s] : ",
dsi.GetName())<<
" expression " <<
inputFormula->GetTitle() <<
" has "
840 <<
Form(
"Dataset[%s] : ",
dsi.GetName()) <<
ndata <<
" entries, while" <<
Endl;
841 Log() <<
Form(
"Dataset[%s] : ",
dsi.GetName())<<
" expression " << fInputTableFormulas[
prevArrExpr].first->GetTitle() <<
" has "
842 <<
Form(
"Dataset[%s] : ",
dsi.GetName())<< fInputTableFormulas[
prevArrExpr].first->GetNdata() <<
" entries" <<
Endl;
843 Log() << kFATAL <<
Form(
"Dataset[%s] : ",
dsi.GetName())<<
"Need to abort" <<
Endl;
865 formula = fCutFormulas[cl];
887 Int_t arraySize =
dsi.GetVarArraySize(
dsi.GetVariableInfo(
ivar).GetExpression());
888 if (
ndata < arraySize) {
889 Log() << kFATAL <<
"Size of array " <<
dsi.GetVariableInfo(
ivar).GetExpression()
890 <<
" in the current tree " <<
currentInfo.GetTree()->GetName() <<
" for the event " <<
evtIdx
891 <<
" is " <<
ndata <<
" instead of " << arraySize <<
Endl;
893 Log() << kWARNING <<
"Size of array " <<
dsi.GetVariableInfo(
ivar).GetExpression()
894 <<
" in the current tree " <<
currentInfo.GetTree()->GetName() <<
" for the event "
896 Log() << kWARNING <<
"Some data will then be ignored. This WARNING is printed only once, "
897 <<
" check in case for the other variables and events " <<
Endl;
912 formula = fTargetFormulas[
itrgt];
922 formula = fSpectatorFormulas[
itVis];
933 formula = fWeightFormula[cl];
936 weight *= (
ndata == 1 ?
959 Log() << kWARNING <<
Form(
"Dataset[%s] : ",
dsi.GetName())<<
"NaN or +-inf in Event " <<
evtIdx <<
Endl;
978 Log() << kWARNING <<
"Found events with NaN and/or +-inf values" <<
Endl;
980 auto &log = Log() << kWARNING << warning.first;
981 if (warning.second > 1) log <<
" (" << warning.second <<
" times)";
984 Log() << kWARNING <<
"These NaN and/or +-infs were all removed by the specified cut, continuing." <<
Endl;
989 Log() << kWARNING <<
"Found events with NaN and/or +-inf values (not removed by cut)" <<
Endl;
991 auto &log = Log() << kWARNING << error.first;
992 if (error.second > 1) log <<
" (" << error.second <<
" times)";
995 Log() << kFATAL <<
"How am I supposed to train a NaN or +-inf?!" <<
Endl;
1001 Log() << kHEADER <<
Form(
"[%s] : ",
dsi.GetName()) <<
"Number of events in input trees" <<
Endl;
1002 Log() << kDEBUG <<
"(after possible flattening of arrays):" <<
Endl;
1005 for (
UInt_t cl = 0; cl <
dsi.GetNClasses(); cl++) {
1008 << setiosflags(ios::left) << std::setw(
maxL) <<
dsi.GetClassInfo(cl)->GetName()
1009 <<
" -- number of events : "
1011 <<
" / sum of weights: " << std::setw(5) <<
eventCounts[cl].nWeEvBeforeCut <<
Endl;
1014 for (
UInt_t cl = 0; cl <
dsi.GetNClasses(); cl++) {
1016 <<
" " << std::setw(
maxL) <<
dsi.GetClassInfo(cl)->GetName()
1017 <<
" tree -- total number of entries: "
1018 << std::setw(5) <<
dataInput.GetEntries(
dsi.GetClassInfo(cl)->GetName()) <<
Endl;
1021 if (fScaleWithPreselEff)
1023 <<
"\tPreselection: (will affect number of requested training and testing events)" <<
Endl;
1026 <<
"\tPreselection: (will NOT affect number of requested training and testing events)" <<
Endl;
1028 if (
dsi.HasCuts()) {
1029 for (
UInt_t cl = 0; cl<
dsi.GetNClasses(); cl++) {
1030 Log() << kINFO <<
Form(
"Dataset[%s] : ",
dsi.GetName()) <<
" " << setiosflags(ios::left) << std::setw(
maxL) <<
dsi.GetClassInfo(cl)->GetName()
1031 <<
" requirement: \"" <<
dsi.GetClassInfo(cl)->GetCut() <<
"\"" <<
Endl;
1032 Log() << kINFO <<
Form(
"Dataset[%s] : ",
dsi.GetName()) <<
" "
1033 << setiosflags(ios::left) << std::setw(
maxL) <<
dsi.GetClassInfo(cl)->GetName()
1034 <<
" -- number of events passed: "
1036 <<
" / sum of weights: " << std::setw(5) <<
eventCounts[cl].nWeEvAfterCut <<
Endl;
1037 Log() << kINFO <<
Form(
"Dataset[%s] : ",
dsi.GetName()) <<
" "
1038 << setiosflags(ios::left) << std::setw(
maxL) <<
dsi.GetClassInfo(cl)->GetName()
1039 <<
" -- efficiency : "
1043 else Log() << kDEBUG
1044 <<
" No preselection cuts applied on event classes" <<
Endl;
1072 Log() << kDEBUG <<
"randomly shuffling "
1074 <<
" events of class " <<
cls
1075 <<
" which are not yet associated to testing or training" <<
Endl;
1082 Log() << kDEBUG <<
Form(
"Dataset[%s] : ",
dsi.GetName())<<
"SPLITTING ========" <<
Endl;
1084 Log() << kDEBUG <<
Form(
"Dataset[%s] : ",
dsi.GetName())<<
"---- class " <<
cls <<
Endl;
1085 Log() << kDEBUG <<
Form(
"Dataset[%s] : ",
dsi.GetName())<<
"check number of training/testing events, requested and available number of events and for class " <<
cls <<
Endl;
1097 if (fScaleWithPreselEff) {
1100 Log() << kINFO <<
Form(
"Dataset[%s] : ",
dsi.GetName()) <<
" you have opted for scaling the number of requested training/testing events\n to be scaled by the preselection efficiency"<<
Endl;
1104 Log() << kINFO <<
Form(
"Dataset[%s] : ",
dsi.GetName()) <<
" you have opted for interpreting the requested number of training/testing events\n to be the number of events AFTER your preselection cuts" <<
Endl;
1115 else if(
eventCounts[
cls].TrainTestSplitRequested != 0.0) Log() << kFATAL <<
Form(
"The option TrainTestSplit_<class> has to be in range (0, 1] but is set to %f.",
eventCounts[
cls].TrainTestSplitRequested) <<
Endl;
1210 Log() << kFATAL <<
Form(
"Dataset[%s] : ",
dsi.GetName())<<
"More events requested for training ("
1221 Log() << kFATAL <<
Form(
"Dataset[%s] : ",
dsi.GetName())<<
"More events requested for testing ("
1239 if (NFree <0) NFree = 0;
1244 Log() << kDEBUG <<
Form(
"Dataset[%s] : ",
dsi.GetName())<<
"determined event sample size to select training sample from="<<
useForTraining<<
Endl;
1245 Log() << kDEBUG <<
Form(
"Dataset[%s] : ",
dsi.GetName())<<
"determined event sample size to select test sample from="<<
useForTesting<<
Endl;
1251 Log() << kDEBUG <<
Form(
"Dataset[%s] : ",
dsi.GetName())<<
"split 'ALTERNATE'" <<
Endl;
1265 Log() << kDEBUG <<
Form(
"Dataset[%s] : ",
dsi.GetName())<<
"split '" <<
splitMode <<
"'" <<
Endl;
1277 Log() << kFATAL <<
Form(
"Dataset[%s] : ",
dsi.GetName())<<
"More events requested than available!" <<
Endl;
1331 Log() << kWARNING <<
Form(
"Dataset[%s] : ",
dsi.GetName())<<
"DataSetFactory/requested number of training samples larger than size of eventVectorTraining.\n"
1332 <<
"There is probably an issue. Please contact the TMVA developers." <<
Endl;
1338 Log() << kWARNING <<
Form(
"Dataset[%s] : ",
dsi.GetName())<<
"DataSetFactory/requested number of testing samples larger than size of eventVectorTesting.\n"
1339 <<
"There is probably an issue. Please contact the TMVA developers." <<
Endl;
1371 Log() << kDEBUG <<
" MIXING ============= " <<
Endl;
1378 Log() << kINFO <<
Form(
"Dataset[%s] : ",
dsi.GetName()) <<
"Training sample: You are trying to mix events in alternate mode although the classes have different event numbers. This works but the alternation stops at the last event of the smaller class."<<
Endl;
1381 Log() << kINFO <<
Form(
"Dataset[%s] : ",
dsi.GetName()) <<
"Testing sample: You are trying to mix events in alternate mode although the classes have different event numbers. This works but the alternation stops at the last event of the smaller class."<<
Endl;
1384 typedef EventVector::iterator
EvtVecIt;
1388 Log() << kDEBUG <<
"insert class 0 into training and test vector" <<
Endl;
1395 Log() << kDEBUG <<
Form(
"Dataset[%s] : ",
dsi.GetName())<<
"insert class " <<
cls <<
Endl;
1438 Log() << kDEBUG <<
Form(
"Dataset[%s] : ",
dsi.GetName())<<
"shuffling events"<<
Endl;
1456 if (
ds->GetNTrainingEvents() < 1){
1457 Log() << kFATAL <<
"Dataset " << std::string(
dsi.GetName()) <<
" does not have any training events, I better stop here and let you fix that one first " <<
Endl;
1460 if (
ds->GetNTestEvents() < 1) {
1461 Log() << kERROR <<
"Dataset " << std::string(
dsi.GetName()) <<
" does not have any testing events, guess that will cause problems later..but for now, I continue " <<
Endl;
1527 if (
cls ==
dsi.GetSignalClassIndex()){
1553 Log() << kINFO <<
Form(
"Dataset[%s] : ",
dsi.GetName()) <<
"No weight renormalisation applied: use original global and event weights" <<
Endl;
1559 else if (
normMode ==
"NUMEVENTS") {
1561 <<
"\tWeight renormalisation mode: \"NumEvents\": renormalises all event classes " <<
Endl;
1563 <<
" such that the effective (weighted) number of events in each class equals the respective " <<
Endl;
1565 <<
" number of events (entries) that you demanded in PrepareTrainingAndTestTree(\"\",\"nTrain_Signal=.. )" <<
Endl;
1567 <<
" ... i.e. such that Sum[i=1..N_j]{w_i} = N_j, j=0,1,2..." <<
Endl;
1569 <<
" ... (note that N_j is the sum of TRAINING events (nTrain_j...with j=Signal,Background.." <<
Endl;
1571 <<
" ..... Testing events are not renormalised nor included in the renormalisation factor! )"<<
Endl;
1581 else if (
normMode ==
"EQUALNUMEVENTS") {
1587 Log() << kINFO <<
Form(
"Dataset[%s] : ",
dsi.GetName()) <<
"Weight renormalisation mode: \"EqualNumEvents\": renormalises all event classes ..." <<
Endl;
1588 Log() << kINFO <<
Form(
"Dataset[%s] : ",
dsi.GetName()) <<
" such that the effective (weighted) number of events in each class is the same " <<
Endl;
1589 Log() << kINFO <<
Form(
"Dataset[%s] : ",
dsi.GetName()) <<
" (and equals the number of events (entries) given for class=0 )" <<
Endl;
1590 Log() << kINFO <<
Form(
"Dataset[%s] : ",
dsi.GetName()) <<
"... i.e. such that Sum[i=1..N_j]{w_i} = N_classA, j=classA, classB, ..." <<
Endl;
1591 Log() << kINFO <<
Form(
"Dataset[%s] : ",
dsi.GetName()) <<
"... (note that N_j is the sum of TRAINING events" <<
Endl;
1592 Log() << kINFO <<
Form(
"Dataset[%s] : ",
dsi.GetName()) <<
" ..... Testing events are not renormalised nor included in the renormalisation factor!)" <<
Endl;
1602 Log() << kFATAL <<
Form(
"Dataset[%s] : ",
dsi.GetName())<<
"<PrepareForTrainingAndTesting> Unknown NormMode: " <<
normMode <<
Endl;
1610 <<
"--> Rescale " << setiosflags(ios::left) << std::setw(
maxL)
1625 <<
"Number of training and testing events" <<
Endl;
1626 Log() << kDEBUG <<
"\tafter rescaling:" <<
Endl;
1628 <<
"---------------------------------------------------------------------------" <<
Endl;
1646 if (
cls ==
dsi.GetSignalClassIndex()){
1657 << setiosflags(ios::left) << std::setw(
maxL)
1658 <<
dsi.GetClassInfo(
cls)->GetName() <<
" -- "
1661 <<
" - requested were " <<
eventCounts[
cls].nTrainingEventsRequested <<
" events" <<
Endl;
1663 << setiosflags(ios::left) << std::setw(
maxL)
1664 <<
dsi.GetClassInfo(
cls)->GetName() <<
" -- "
1667 <<
" - requested were " <<
eventCounts[
cls].nTestingEventsRequested <<
" events" <<
Endl;
1669 << setiosflags(ios::left) << std::setw(
maxL)
1670 <<
dsi.GetClassInfo(
cls)->GetName() <<
" -- "
1671 <<
"training and testing events: "
1673 Log() << kDEBUG <<
"\t(sum of weights: "
1676 Log() << kINFO <<
Form(
"Dataset[%s] : ",
dsi.GetName()) << setiosflags(ios::left) << std::setw(
maxL)
1677 <<
dsi.GetClassInfo(
cls)->GetName() <<
" -- "
1678 <<
"due to the preselection a scaling factor has been applied to the numbers of requested events: "
1682 Log() << kINFO <<
Endl;
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
int Int_t
Signed integer 4 bytes (int)
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int)
float Float_t
Float 4 bytes (float)
double Double_t
Double 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 value
TMatrixT< Double_t > TMatrixD
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
const_iterator begin() const
const_iterator end() const
A specialized string object used for TTree selections.
A TLeaf describes individual elements of a TBranch See TBranch structure in TTree.
~DataSetFactory()
destructor
DataSet * BuildInitialDataSet(DataSetInfo &, TMVA::DataInputHandler &)
if no entries, than create a DataSet with one Event which uses dynamic variables (pointers to variabl...
DataSetFactory()
constructor
std::map< Types::ETreeType, EventVectorOfClasses > EventVectorOfClassesOfTreeType
void ChangeToNewTree(TreeInfo &, const DataSetInfo &)
While the data gets copied into the local training and testing trees, the input tree can change (for ...
void BuildEventVector(DataSetInfo &dsi, DataInputHandler &dataInput, EventVectorOfClassesOfTreeType &eventsmap, EvtStatsPerClass &eventCounts)
build empty event vectors distributes events between kTraining/kTesting/kMaxTreeType
DataSet * CreateDataSet(DataSetInfo &, DataInputHandler &)
steering the creation of a new dataset
DataSet * MixEvents(DataSetInfo &dsi, EventVectorOfClassesOfTreeType &eventsmap, EvtStatsPerClass &eventCounts, const TString &splitMode, const TString &mixMode, const TString &normMode, UInt_t splitSeed)
Select and distribute unassigned events to kTraining and kTesting.
std::vector< int > NumberPerClass
std::vector< EventVector > EventVectorOfClasses
void InitOptions(DataSetInfo &dsi, EvtStatsPerClass &eventsmap, TString &normMode, UInt_t &splitSeed, TString &splitMode, TString &mixMode)
the dataset splitting
void CalcMinMax(DataSet *, DataSetInfo &dsi)
compute covariance matrix
std::vector< Double_t > ValuePerClass
DataSet * BuildDynamicDataSet(DataSetInfo &)
std::vector< EventStats > EvtStatsPerClass
Bool_t CheckTTreeFormula(TTreeFormula *ttf, const TString &expression, Bool_t &hasDollar)
checks a TTreeFormula for problems
void RenormEvents(DataSetInfo &dsi, EventVectorOfClassesOfTreeType &eventsmap, const EvtStatsPerClass &eventCounts, const TString &normMode)
renormalisation of the TRAINING event weights
TMatrixD * CalcCorrelationMatrix(DataSet *, const UInt_t classNumber)
computes correlation matrix for variables "theVars" in tree; "theType" defines the required event "ty...
TMatrixD * CalcCovarianceMatrix(DataSet *, const UInt_t classNumber)
compute covariance matrix
std::vector< Event * > EventVector
Class that contains all the data information.
Class that contains all the data information.
ostringstream derivative to redirect and format output
@ kMaxTreeType
also used as temporary storage for trees not yet assigned for testing;training...
const char * GetTitle() const override
Returns title of object.
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.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
A TTree represents a columnar dataset.
create variable transformations
Int_t LargestCommonDivider(Int_t a, Int_t b)
MsgLogger & Endl(MsgLogger &ml)
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Int_t Finite(Double_t x)
Check if it is finite with a mask in order to be consistent in presence of fast math.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.