Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
VariableNormalizeTransform.cxx
Go to the documentation of this file.
1// @(#)root/tmva $Id$
2// Author: Andreas Hoecker, Joerg Stelzer, Helge Voss, Peter Speckmayer, Eckhard von Toerne
3
4/**********************************************************************************
5 * Project: TMVA - a Root-integrated toolkit for multivariate data analysis *
6 * Package: TMVA *
7 * Class : VariableNormalizeTransform *
8 * *
9 * *
10 * Description: *
11 * Implementation (see header for description) *
12 * *
13 * Authors (alphabetical): *
14 * Andreas Hoecker <Andreas.Hocker@cern.ch> - CERN, Switzerland *
15 * Joerg Stelzer <Joerg.Stelzer@cern.ch> - CERN, Switzerland *
16 * Peter Speckmayer <Peter.Speckmayer@cern.ch> - CERN, Switzerland *
17 * Helge Voss <Helge.Voss@cern.ch> - MPI-K Heidelberg, Germany *
18 * Eckhard v. Toerne <evt@uni-bonn.de> - U of Bonn, Germany *
19 * *
20 * Copyright (c) 2005-2011: *
21 * CERN, Switzerland *
22 * MPI-K Heidelberg, Germany *
23 * U. of Bonn, Germany *
24 * *
25 * Redistribution and use in source and binary forms, with or without *
26 * modification, are permitted according to the terms listed in LICENSE *
27 * (see tmva/doc/LICENSE) *
28 **********************************************************************************/
29
30/*! \class TMVA::VariableNormalizeTransform
31\ingroup TMVA
32Linear interpolation class
33*/
34
36
37#include "TMVA/DataSet.h"
38#include "TMVA/DataSetInfo.h"
39#include "TMVA/Event.h"
40#include "TMVA/MsgLogger.h"
41#include "TMVA/Tools.h"
42#include "TMVA/Types.h"
43#include "TMVA/VariableInfo.h"
44
45#include "TMatrixD.h"
46#include "TMatrixDBase.h"
47#include "TVectorF.h"
48
49#include <iostream>
50#include <iomanip>
51#include <cfloat>
52
53
54////////////////////////////////////////////////////////////////////////////////
55/// constructor
56
61
62////////////////////////////////////////////////////////////////////////////////
63
66
67////////////////////////////////////////////////////////////////////////////////
68/// initialization of the normalization transformation
69
71{
72 UInt_t inputSize = fGet.size();
73 Int_t numC = GetNClasses()+1;
74 if (GetNClasses() <= 1 ) numC = 1;
75
76 fMin.resize( numC );
77 fMax.resize( numC );
78 for (Int_t i=0; i<numC; i++) {
79 fMin.at(i).resize(inputSize);
80 fMax.at(i).resize(inputSize);
81 fMin.at(i).assign(inputSize, 0);
82 fMax.at(i).assign(inputSize, 0);
83 }
84}
85
86////////////////////////////////////////////////////////////////////////////////
87/// prepare transformation
88
90{
91 if (!IsEnabled() || IsCreated()) return kTRUE;
92
93 Log() << kDEBUG << "\tPreparing the transformation." << Endl;
94
95 Initialize();
96
97 CalcNormalizationParams( events );
98
99 SetCreated( kTRUE );
100
101 return kTRUE;
102}
103
104////////////////////////////////////////////////////////////////////////////////
105/// apply the normalization transformation
106
108{
109 if (!IsCreated()) Log() << kFATAL << "Transformation not yet created" << Endl;
110
111 // if cls (the class chosen by the user) not existing,
112 // assume that he wants to have the matrix for all classes together.
113 // if (cls < 0 || cls > GetNClasses()) {
114 // if (GetNClasses() > 1 ) cls = GetNClasses();
115 // else cls = (fMin.size()==1?0:2);
116 // }
117 // EVT this is a workaround to address the reader problem with transforma and EvaluateMVA(std::vector<float/double> ,...)
118 if (cls < 0 || cls >= (int) fMin.size()) cls = fMin.size()-1;
119 // EVT workaround end
120
121 FloatVector input; // will be filled with the selected variables, targets, (spectators)
122 FloatVector output; // will be filled with the selected variables, targets, (spectators)
123 std::vector<Char_t> mask; // entries with kTRUE must not be transformed
124 GetInput( ev, input, mask );
125
126 if (fTransformedEvent==0) fTransformedEvent = new Event();
127
128 Float_t min,max;
129 const FloatVector& minVector = fMin.at(cls);
130 const FloatVector& maxVector = fMax.at(cls);
131
132 UInt_t iidx = 0;
133 std::vector<Char_t>::iterator itMask = mask.begin();
134 for ( std::vector<Float_t>::iterator itInp = input.begin(), itInpEnd = input.end(); itInp != itInpEnd; ++itInp) { // loop over input variables
135 if( (*itMask) ){
136 ++iidx;
137 ++itMask;
138 // don't put any value into output if the value is masked
139 continue;
140 }
141
142 Float_t val = (*itInp);
143
144 min = minVector.at(iidx);
145 max = maxVector.at(iidx);
146 Float_t offset = min;
147 Float_t scale = 1.0/(max-min);
148
149 Float_t valnorm = (val-offset)*scale * 2 - 1;
150 output.push_back( valnorm );
151
152 ++iidx;
153 ++itMask;
154 }
155
156 SetOutput( fTransformedEvent, output, mask, ev );
157 return fTransformedEvent;
158}
159
160////////////////////////////////////////////////////////////////////////////////
161/// apply the inverse transformation
162
164{
165 if (!IsCreated()) Log() << kFATAL << "Transformation not yet created" << Endl;
166
167 // if cls (the class chosen by the user) not existing,
168 // assume that user wants to have the transformation for all classes together.
169 if (cls < 0 || cls > GetNClasses()) {
170 if (GetNClasses() > 1 ) cls = GetNClasses();
171 else cls = 0;
172 }
173
174 FloatVector input; // will be filled with the selected variables, targets, (spectators)
175 FloatVector output; // will be filled with the output
176 std::vector<Char_t> mask;
177 GetInput( ev, input, mask, kTRUE );
178
179 if (fBackTransformedEvent==0) fBackTransformedEvent = new Event( *ev );
180
181 Float_t min,max;
182 const FloatVector& minVector = fMin.at(cls);
183 const FloatVector& maxVector = fMax.at(cls);
184
185 UInt_t iidx = 0;
186 for ( std::vector<Float_t>::iterator itInp = input.begin(), itInpEnd = input.end(); itInp != itInpEnd; ++itInp) { // loop over input variables
187 Float_t val = (*itInp);
188
189 min = minVector.at(iidx);
190 max = maxVector.at(iidx);
191 Float_t offset = min;
192 Float_t scale = 1.0/(max-min);
193
194 Float_t valnorm = offset+((val+1)/(scale * 2));
195 output.push_back( valnorm );
196
197 ++iidx;
198 }
199
200 SetOutput( fBackTransformedEvent, output, mask, ev, kTRUE );
201
202 return fBackTransformedEvent;
203}
204
205////////////////////////////////////////////////////////////////////////////////
206/// compute offset and scale from min and max
207
208void TMVA::VariableNormalizeTransform::CalcNormalizationParams( const std::vector< Event*>& events )
209{
210 if (events.size() <= 1)
211 Log() << kFATAL << "Not enough events (found " << events.size() << ") to calculate the normalization" << Endl;
212
213 FloatVector input; // will be filled with the selected variables, targets, (spectators)
214 std::vector<Char_t> mask;
215
216 UInt_t inputSize = fGet.size(); // number of input variables
217
218 const UInt_t nCls = GetNClasses();
219 Int_t numC = nCls+1; // prepare the min and max values for each of the classes and additionally for all classes (if more than one)
220 Int_t all = nCls; // at idx the min and max values for "all" classes are stored
221 if (nCls <= 1 ) {
222 numC = 1;
223 all = 0;
224 }
225
226 for (UInt_t iinp=0; iinp<inputSize; ++iinp) {
227 for (Int_t ic = 0; ic < numC; ic++) {
228 fMin.at(ic).at(iinp) = FLT_MAX;
229 fMax.at(ic).at(iinp) = -FLT_MAX;
230 }
231 }
232
233 std::vector<Event*>::const_iterator evIt = events.begin();
234 for (;evIt!=events.end();++evIt) { // loop over all events
235 const TMVA::Event* event = (*evIt); // get the event
236
237 UInt_t cls = (*evIt)->GetClass(); // get the class of this event
238
239 FloatVector& minVector = fMin.at(cls);
240 FloatVector& maxVector = fMax.at(cls);
241
242 FloatVector& minVectorAll = fMin.at(all);
243 FloatVector& maxVectorAll = fMax.at(all);
244
245 GetInput(event,input,mask); // select the input variables for the transformation and get them from the event
246 UInt_t iidx = 0;
247 for ( std::vector<Float_t>::iterator itInp = input.begin(), itInpEnd = input.end(); itInp != itInpEnd; ++itInp) { // loop over input variables
248 Float_t val = (*itInp);
249
250 if( minVector.at(iidx) > val ) minVector.at(iidx) = val;
251 if( maxVector.at(iidx) < val ) maxVector.at(iidx) = val;
252
253 if (nCls != 1) { // in case more than one class exists, compute min and max as well for all classes together
254 if (minVectorAll.at(iidx) > val) minVectorAll.at(iidx) = val;
255 if (maxVectorAll.at(iidx) < val) maxVectorAll.at(iidx) = val;
256 }
257
258 ++iidx;
259 }
260 }
261
262 return;
263}
264
265////////////////////////////////////////////////////////////////////////////////
266/// creates string with variable transformations applied
267
269{
270 // if cls (the class chosen by the user) not existing, assume that user wants to
271 // have the matrix for all classes together.
272 if (cls < 0 || cls > GetNClasses()) cls = GetNClasses();
273
274 Float_t min, max;
275 const UInt_t size = fGet.size();
276 std::vector<TString>* strVec = new std::vector<TString>(size);
277
278 UInt_t iinp = 0;
279 for( ItVarTypeIdxConst itGet = fGet.begin(), itGetEnd = fGet.end(); itGet != itGetEnd; ++itGet ) {
280 min = fMin.at(cls).at(iinp);
281 max = fMax.at(cls).at(iinp);
282
283 Char_t type = (*itGet).first;
284 UInt_t idx = (*itGet).second;
285 Float_t offset = min;
286 Float_t scale = 1.0/(max-min);
287 TString str("");
288 VariableInfo& varInfo = (type=='v'?fDsi.GetVariableInfo(idx):(type=='t'?fDsi.GetTargetInfo(idx):fDsi.GetSpectatorInfo(idx)));
289
290 if (offset < 0) str = TString::Format( "2*%g*([%s] + %g) - 1", scale, varInfo.GetLabel().Data(), -offset );
291 else str = TString::Format( "2*%g*([%s] - %g) - 1", scale, varInfo.GetLabel().Data(), offset );
292 (*strVec)[iinp] = str;
293
294 ++iinp;
295 }
296
297 return strVec;
298}
299
300////////////////////////////////////////////////////////////////////////////////
301/// write the transformation to the stream
302
304{
305 o << "# min max for all variables for all classes one after the other and as a last entry for all classes together" << std::endl;
306
307 Int_t numC = GetNClasses()+1;
308 if (GetNClasses() <= 1 ) numC = 1;
309
310 UInt_t nvars = GetNVariables();
311 UInt_t ntgts = GetNTargets();
312
313 for (Int_t icls = 0; icls < numC; icls++ ) {
314 o << icls << std::endl;
315 for (UInt_t ivar=0; ivar<nvars; ivar++)
316 o << std::setprecision(12) << std::setw(20) << fMin.at(icls).at(ivar) << " "
317 << std::setprecision(12) << std::setw(20) << fMax.at(icls).at(ivar) << std::endl;
318 for (UInt_t itgt=0; itgt<ntgts; itgt++)
319 o << std::setprecision(12) << std::setw(20) << fMin.at(icls).at(nvars+itgt) << " "
320 << std::setprecision(12) << std::setw(20) << fMax.at(icls).at(nvars+itgt) << std::endl;
321 }
322 o << "##" << std::endl;
323}
324
325////////////////////////////////////////////////////////////////////////////////
326/// create XML description of Normalize transformation
327
329{
330 void* trfxml = gTools().AddChild(parent, "Transform");
331 gTools().AddAttr(trfxml, "Name", "Normalize");
333
334 Int_t numC = (GetNClasses()<= 1)?1:GetNClasses()+1;
335
336 for( Int_t icls=0; icls<numC; icls++ ) {
337 void* clsxml = gTools().AddChild(trfxml, "Class");
338 gTools().AddAttr(clsxml, "ClassIndex", icls);
339 void* inpxml = gTools().AddChild(clsxml, "Ranges");
340 UInt_t iinp = 0;
341 for( ItVarTypeIdx itGet = fGet.begin(), itGetEnd = fGet.end(); itGet != itGetEnd; ++itGet ) {
342 void* mmxml = gTools().AddChild(inpxml, "Range");
343 gTools().AddAttr(mmxml, "Index", iinp);
344 gTools().AddAttr(mmxml, "Min", fMin.at(icls).at(iinp) );
345 gTools().AddAttr(mmxml, "Max", fMax.at(icls).at(iinp) );
346 ++iinp;
347 }
348 }
349}
350
351////////////////////////////////////////////////////////////////////////////////
352/// Read the transformation matrices from the xml node
353
355{
357
358 void* inpnode = NULL;
359
360 inpnode = gTools().GetChild(trfnode, "Selection"); // new xml format
361 if( inpnode != NULL )
363
364 if( newFormat ){
365 // ------------- new format --------------------
366 // read input
368
369 // read transformation information
370
371 UInt_t size = fGet.size();
372 UInt_t classindex, idx;
373
374 void* ch = gTools().GetChild( trfnode, "Class" );
375 while(ch) {
376 Int_t ci = 0;
377 gTools().ReadAttr(ch, "ClassIndex", ci);
379
380 fMin.resize(classindex+1);
381 fMax.resize(classindex+1);
382
383 fMin[classindex].resize(size,Float_t(0));
384 fMax[classindex].resize(size,Float_t(0));
385
386 void* clch = gTools().GetChild( ch );
387 while(clch) {
388 TString nodeName(gTools().GetName(clch));
389 if(nodeName=="Ranges") {
390 void* varch = gTools().GetChild( clch );
391 while(varch) {
392 gTools().ReadAttr(varch, "Index", idx);
393 gTools().ReadAttr(varch, "Min", fMin[classindex][idx]);
394 gTools().ReadAttr(varch, "Max", fMax[classindex][idx]);
396 }
397 }
399 }
400 ch = gTools().GetNextChild( ch );
401 }
402 SetCreated();
403 return;
404 }
405
406 // ------------- old format --------------------
408 // coverity[tainted_data_argument]
409 gTools().ReadAttr(trfnode, "NVariables", nvars);
410 // coverity[tainted_data_argument]
411 gTools().ReadAttr(trfnode, "NTargets", ntgts);
412 // coverity[tainted_data_argument]
413
414 for( UInt_t ivar = 0; ivar < nvars; ++ivar ){
415 fGet.push_back(std::pair<Char_t,UInt_t>('v',ivar));
416 }
417 for( UInt_t itgt = 0; itgt < ntgts; ++itgt ){
418 fGet.push_back(std::pair<Char_t,UInt_t>('t',itgt));
419 }
420 void* ch = gTools().GetChild( trfnode );
421 while(ch) {
422 gTools().ReadAttr(ch, "ClassIndex", classindex);
423
424 fMin.resize(classindex+1);
425 fMax.resize(classindex+1);
426 fMin[classindex].resize(nvars+ntgts,Float_t(0));
427 fMax[classindex].resize(nvars+ntgts,Float_t(0));
428
429 void* clch = gTools().GetChild( ch );
430 while(clch) {
431 TString nodeName(gTools().GetName(clch));
432 if(nodeName=="Variables") {
433 void* varch = gTools().GetChild( clch );
434 while(varch) {
435 gTools().ReadAttr(varch, "VarIndex", varindex);
436 gTools().ReadAttr(varch, "Min", fMin[classindex][varindex]);
437 gTools().ReadAttr(varch, "Max", fMax[classindex][varindex]);
439 }
440 } else if (nodeName=="Targets") {
441 void* tgtch = gTools().GetChild( clch );
442 while(tgtch) {
443 gTools().ReadAttr(tgtch, "TargetIndex", tgtindex);
444 gTools().ReadAttr(tgtch, "Min", fMin[classindex][nvars+tgtindex]);
445 gTools().ReadAttr(tgtch, "Max", fMax[classindex][nvars+tgtindex]);
447 }
448 }
450 }
451 ch = gTools().GetNextChild( ch );
452 }
453 SetCreated();
454}
455
456////////////////////////////////////////////////////////////////////////////////
457/// this method is only used when building a normalization transformation
458/// from old text files
459/// in this case regression didn't exist and there were no targets
460
461void TMVA::VariableNormalizeTransform::BuildTransformationFromVarInfo( const std::vector<TMVA::VariableInfo>& var )
462{
463 UInt_t nvars = GetNVariables();
464
465 if(var.size() != nvars)
466 Log() << kFATAL << "<BuildTransformationFromVarInfo> can't build transformation,"
467 << " since the number of variables disagree" << Endl;
468
469 UInt_t numC = (GetNClasses()<=1)?1:GetNClasses()+1;
470 fMin.clear();fMin.resize( numC );
471 fMax.clear();fMax.resize( numC );
472
473
474 for(UInt_t cls=0; cls<numC; ++cls) {
475 fMin[cls].resize(nvars+GetNTargets(),0);
476 fMax[cls].resize(nvars+GetNTargets(),0);
477 UInt_t vidx(0);
478 for(std::vector<TMVA::VariableInfo>::const_iterator v = var.begin(); v!=var.end(); ++v, ++vidx) {
479 fMin[cls][vidx] = v->GetMin();
480 fMax[cls][vidx] = v->GetMax();
481 fGet.push_back(std::pair<Char_t,UInt_t>('v',vidx));
482 }
483 }
484 SetCreated();
485}
486
487////////////////////////////////////////////////////////////////////////////////
488/// Read the variable ranges from an input stream
489
491{
492 UInt_t nvars = GetNVariables();
493 UInt_t ntgts = GetNTargets();
494 for( UInt_t ivar = 0; ivar < nvars; ++ivar ){
495 fGet.push_back(std::pair<Char_t,UInt_t>('v',ivar));
496 }
497 for( UInt_t itgt = 0; itgt < ntgts; ++itgt ){
498 fGet.push_back(std::pair<Char_t,UInt_t>('t',itgt));
499 }
500 char buf[512];
501 char buf2[512];
502 istr.getline(buf,512);
503 TString strvar, dummy;
504 Int_t icls;
506 while (!(buf[0]=='#'&& buf[1]=='#')) { // if line starts with ## return
507 char* p = buf;
508 while (*p==' ' || *p=='\t') p++; // 'remove' leading whitespace
509 if (*p=='#' || *p=='\0') {
510 istr.getline(buf,512);
511 continue; // if comment or empty line, read the next line
512 }
513 std::stringstream sstr(buf);
514 sstr >> icls;
515 for (UInt_t ivar=0;ivar<nvars;ivar++) {
516 istr.getline(buf2,512); // reading the next line
517 std::stringstream sstr2(buf2);
518 sstr2 >> fMin[icls][ivar] >> fMax[icls][ivar];
519 }
520 for (UInt_t itgt=0;itgt<ntgts;itgt++) {
521 istr.getline(buf2,512); // reading the next line
522 std::stringstream sstr2(buf2);
523 sstr2 >> fMin[icls][nvars+itgt] >> fMax[icls][nvars+itgt];
524 }
525 istr.getline(buf,512); // reading the next line
526 }
527 SetCreated();
528}
529
530////////////////////////////////////////////////////////////////////////////////
531/// prints the transformation ranges
532
534{
535 Int_t nCls = GetNClasses();
536 Int_t numC = nCls+1;
537 if (nCls <= 1 ) numC = 1;
538 for (Int_t icls = 0; icls < numC; icls++ ) {
539 if( icls == nCls )
540 Log() << kINFO << "Transformation for all classes based on these ranges:" << Endl;
541 else
542 Log() << kINFO << "Transformation for class " << icls << " based on these ranges:" << Endl;
543 for( ItVarTypeIdxConst itGet = fGet.begin(), itGetEnd = fGet.end(); itGet != itGetEnd; ++itGet ){
544 Char_t type = (*itGet).first;
545 UInt_t idx = (*itGet).second;
546
547 TString typeString = (type=='v'?"Variable: ": (type=='t'?"Target : ":"Spectator : ") );
548 Log() << typeString.Data() << std::setw(20) << fMin[icls][idx] << std::setw(20) << fMax[icls][idx] << Endl;
549
550 }
551 }
552}
553
554////////////////////////////////////////////////////////////////////////////////
555/// creates a normalizing function
556/// TODO include target-transformation into makefunction
557
560{
561 UInt_t nVar = fGet.size();
562 UInt_t numC = fMin.size();
563 if (part == 1) {
564 fout << std::endl;
565 fout << " double fOff_" << trCounter << "[" << numC << "][" << nVar << "];" << std::endl;
566 fout << " double fScal_" << trCounter << "[" << numC << "][" << nVar << "];" << std::endl;
567 }
568
569 if (part == 2) {
570 fout << std::endl;
571 fout << "//_______________________________________________________________________" << std::endl;
572 fout << "inline void " << fcncName << "::InitTransform_" << trCounter << "()" << std::endl;
573 fout << "{" << std::endl;
574 fout << " double fMin_" << trCounter << "[" << numC << "][" << nVar << "];" << std::endl;
575 fout << " double fMax_" << trCounter << "[" << numC << "][" << nVar << "];" << std::endl;
576 fout << " // Normalization transformation, initialisation" << std::endl;
577 for (UInt_t ivar = 0; ivar < nVar; ivar++) {
578 for (UInt_t icls = 0; icls < numC; icls++) {
579 Double_t min = TMath::Min(FLT_MAX, fMin.at(icls).at(ivar));
580 Double_t max = TMath::Max(-FLT_MAX, fMax.at(icls).at(ivar));
581 fout << " fMin_" << trCounter << "[" << icls << "][" << ivar << "] = " << std::setprecision(12) << min
582 << ";" << std::endl;
583 fout << " fMax_" << trCounter << "[" << icls << "][" << ivar << "] = " << std::setprecision(12) << max
584 << ";" << std::endl;
585 fout << " fScal_" << trCounter << "[" << icls << "][" << ivar << "] = 2.0/(fMax_" << trCounter << "["
586 << icls << "][" << ivar << "]-fMin_" << trCounter << "[" << icls << "][" << ivar << "]);" << std::endl;
587 fout << " fOff_" << trCounter << "[" << icls << "][" << ivar << "] = fMin_" << trCounter << "[" << icls
588 << "][" << ivar << "]*fScal_" << trCounter << "[" << icls << "][" << ivar << "]+1.;" << std::endl;
589 }
590 }
591 fout << "}" << std::endl;
592 fout << std::endl;
593 fout << "//_______________________________________________________________________" << std::endl;
594 fout << "inline void " << fcncName << "::Transform_" << trCounter << "( std::vector<double>& iv, int cls) const"
595 << std::endl;
596 fout << "{" << std::endl;
597 fout << " // Normalization transformation" << std::endl;
598 fout << " if (cls < 0 || cls > " << GetNClasses() << ") {" << std::endl;
599 fout << " if (" << GetNClasses() << " > 1 ) cls = " << GetNClasses() << ";" << std::endl;
600 fout << " else cls = " << (fMin.size() == 1 ? 0 : 2) << ";" << std::endl;
601 fout << " }" << std::endl;
602 fout << " const int nVar = " << nVar << ";" << std::endl << std::endl;
603 fout << " // get indices of used variables" << std::endl;
605 fout << " static std::vector<double> dv;"
606 << std::endl; // simply made it static so it doesn't need to be re-booked every time
607 fout << " dv.resize(nVar);" << std::endl;
608 fout << " for (int ivar=0; ivar<nVar; ivar++) dv[ivar] = iv[indicesGet.at(ivar)];" << std::endl;
609
610 fout << " for (int ivar=0;ivar<" << nVar << ";ivar++) {" << std::endl;
611 fout << " double offset = fOff_" << trCounter << "[cls][ivar];" << std::endl;
612 fout << " double scale = fScal_" << trCounter << "[cls][ivar];" << std::endl;
613 fout << " iv[indicesPut.at(ivar)] = scale*dv[ivar]-offset;" << std::endl;
614 fout << " }" << std::endl;
615 fout << "}" << std::endl;
616 }
617}
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
char Char_t
Character 1 byte (char)
Definition RtypesCore.h:51
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int)
Definition RtypesCore.h:60
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:71
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void input
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 mask
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 offset
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
const_iterator begin() const
const_iterator end() const
Class that contains all the data information.
Definition DataSetInfo.h:62
void ReadAttr(void *node, const char *, T &value)
read attribute from xml
Definition Tools.h:329
void * GetChild(void *parent, const char *childname=nullptr)
get child node
Definition Tools.cxx:1150
void AddAttr(void *node, const char *, const T &value, Int_t precision=16)
add attribute to xml
Definition Tools.h:347
void * AddChild(void *parent, const char *childname, const char *content=nullptr, bool isRootNode=false)
add child node
Definition Tools.cxx:1124
void * GetNextChild(void *prevchild, const char *childname=nullptr)
XML helpers.
Definition Tools.cxx:1162
Singleton class for Global types used by TMVA.
Definition Types.h:71
Class for type info of MVA input variable.
void Initialize() override
initialization of the normalization transformation
void ReadTransformationFromStream(std::istream &, const TString &) override
Read the variable ranges from an input stream.
void MakeFunction(std::ostream &fout, const TString &fncName, Int_t part, UInt_t trCounter, Int_t cls) override
creates a normalizing function TODO include target-transformation into makefunction
const Event * Transform(const Event *const, Int_t cls) const override
apply the normalization transformation
void CalcNormalizationParams(const std::vector< Event * > &events)
compute offset and scale from min and max
std::vector< TString > * GetTransformationStrings(Int_t cls) const override
creates string with variable transformations applied
void PrintTransformation(std::ostream &o) override
prints the transformation ranges
void WriteTransformationToStream(std::ostream &) const override
write the transformation to the stream
void AttachXMLTo(void *parent) override
create XML description of Normalize transformation
void ReadFromXML(void *trfnode) override
Read the transformation matrices from the xml node.
VariableNormalizeTransform(DataSetInfo &dsi)
constructor
Bool_t PrepareTransformation(const std::vector< Event * > &) override
prepare transformation
void BuildTransformationFromVarInfo(const std::vector< TMVA::VariableInfo > &var)
this method is only used when building a normalization transformation from old text files in this cas...
const Event * InverseTransform(const Event *const, Int_t cls) const override
apply the inverse transformation
Linear interpolation class.
virtual void MakeFunction(std::ostream &fout, const TString &fncName, Int_t part, UInt_t trCounter, Int_t cls)=0
getinput and setoutput equivalent
virtual void ReadFromXML(void *trfnode)=0
Read the input variables from the XML node.
virtual void AttachXMLTo(void *parent)=0
create XML description the transformation (write out info of selected variables)
VectorOfCharAndInt::iterator ItVarTypeIdx
VectorOfCharAndInt::const_iterator ItVarTypeIdxConst
Basic string class.
Definition TString.h:138
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition TString.cxx:2384
Tools & gTools()
MsgLogger & Endl(MsgLogger &ml)
Definition MsgLogger.h:148
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Definition TMathBase.h:251
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Definition TMathBase.h:199
static void output()