72 TString trafoDefinition(trafoDefinitionIn);
73 if (trafoDefinition ==
"None")
return;
77 TString trafoDefinitionCheck(trafoDefinitionIn);
78 int npartial = 0, ntrafo=0;
79 for (
Int_t pos = 0, siz = trafoDefinition.Sizeof(); pos < siz; ++pos) {
80 TString ch = trafoDefinition(pos,1);
81 if ( ch ==
"(" ) npartial++;
82 if ( ch ==
"+" || ch ==
",") ntrafo++;
85 log << kWARNING <<
"The use of multiple partial variable transformations during the application phase can be properly invoked via the \"Reader\", but it is not yet implemented in \"MakeClass\", the creation mechanism for standalone C++ application classes. The standalone C++ class produced by this training job is thus INCOMPLETE AND MUST NOT BE USED! The transformation in question is: " << trafoDefinitionIn <<
Endl;
93 Int_t parenthesisCount = 0;
94 for (
Int_t position = 0, size = trafoDefinition.Sizeof(); position < size; ++position) {
95 TString ch = trafoDefinition(position,1);
96 if (ch ==
"(") ++parenthesisCount;
97 else if (ch ==
")") --parenthesisCount;
98 else if (ch ==
"," && parenthesisCount == 0) trafoDefinition.Replace(position,1,
'+');
104 TString tdef = os->GetString();
110 Ssiz_t parLen = tdef.
Index(
")", parStart )-parStart+1;
112 variables = tdef(parStart,parLen);
113 tdef.
Remove(parStart,parLen);
114 variables.
Remove(parLen-1,1);
120 if (trClsList->
GetSize() < 1) log << kFATAL <<
Form(
"Dataset[%s] : ",dataInfo.
GetName())<<
"Incorrect transformation string provided." <<
Endl;
125 ClassInfo *ci =
NULL;
127 if (trCls !=
"AllClasses") {
130 log << kFATAL <<
Form(
"Dataset[%s] : ",dataInfo.
GetName())<<
"Class " << trCls <<
" not known for variable transformation "
131 << trName <<
", please check." <<
Endl;
133 idxCls = ci->GetNumber();
137 VariableTransformBase* transformation =
NULL;
138 if (trName ==
"I" || trName ==
"Ident" || trName ==
"Identity") {
139 if (variables.
Length() == 0) variables =
"_V_";
140 transformation =
new VariableIdentityTransform( dataInfo);
142 else if (trName ==
"D" || trName ==
"Deco" || trName ==
"Decorrelate") {
143 if (variables.
Length() == 0) variables =
"_V_";
144 transformation =
new VariableDecorrTransform( dataInfo);
146 else if (trName ==
"P" || trName ==
"PCA") {
147 if (variables.
Length() == 0) variables =
"_V_";
148 transformation =
new VariablePCATransform ( dataInfo);
150 else if (trName ==
"U" || trName ==
"Uniform") {
151 if (variables.
Length() == 0) variables =
"_V_,_T_";
152 transformation =
new VariableGaussTransform ( dataInfo,
"Uniform" );
154 else if (trName ==
"G" || trName ==
"Gauss") {
155 if (variables.
Length() == 0) variables =
"_V_";
156 transformation =
new VariableGaussTransform ( dataInfo);
158 else if (trName ==
"N" || trName ==
"Norm" || trName ==
"Normalise" || trName ==
"Normalize") {
159 if (variables.
Length() == 0) variables =
"_V_,_T_";
160 transformation =
new VariableNormalizeTransform( dataInfo);
162 else log << kFATAL <<
Form(
"Dataset[%s] : ",dataInfo.
GetName())<<
"<ProcessOptions> Variable transform '"
163 << trName <<
"' unknown." <<
Endl;
166 if (transformation) {
169 log << kHEADER <<
Form(
"[%s] : ",dataInfo.
GetName())
170 <<
"Create Transformation \"" << trName <<
"\" with reference class "
171 << clsInfo->GetName() <<
"=("<< idxCls <<
")"<<
Endl <<
Endl;
173 log << kHEADER <<
Form(
"[%s] : ",dataInfo.
GetName())
174 <<
"Create Transformation \"" << trName <<
"\" with events from all classes." << Endl << Endl;
176 transformation->SelectInput( variables );
virtual Int_t GetEntries() const
MsgLogger & Endl(MsgLogger &ml)
Collectable string class.
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
virtual const char * GetName() const
Returns name of object.
Class that contains all the data information.
void CreateVariableTransforms(const TString &trafoDefinition, TMVA::DataSetInfo &dataInfo, TMVA::TransformationHandler &transformationHandler, TMVA::MsgLogger &log)
ClassInfo * GetClassInfo(Int_t clNum) const
char * Form(const char *fmt,...)
TString & Remove(Ssiz_t pos)
virtual Int_t GetSize() const
ostringstream derivative to redirect and format output
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
void variables(TString dataset, TString fin="TMVA.root", TString dirName="InputVariables_Id", TString title="TMVA Input Variables", Bool_t isRegression=kFALSE, Bool_t useTMVAStyle=kTRUE)