Logo ROOT  
Reference Guide
MethodBase.h
Go to the documentation of this file.
1 // @(#)root/tmva $Id$
2 // Author: Andreas Hoecker, Peter Speckmayer, Joerg Stelzer, Helge Voss, Kai Voss, Eckhard von Toerne, Jan Therhaag
3 
4 /**********************************************************************************
5  * Project: TMVA - a Root-integrated toolkit for multivariate data analysis *
6  * Package: TMVA *
7  * Class : MethodBase *
8  * Web : http://tmva.sourceforge.net *
9  * *
10  * Description: *
11  * Virtual base class for all MVA method *
12  * *
13  * Authors (alphabetical): *
14  * Andreas Hoecker <Andreas.Hocker@cern.ch> - CERN, Switzerland *
15  * Peter Speckmayer <peter.speckmayer@cern.ch> - CERN, Switzerland *
16  * Joerg Stelzer <Joerg.Stelzer@cern.ch> - CERN, Switzerland *
17  * Jan Therhaag <Jan.Therhaag@cern.ch> - U of Bonn, Germany *
18  * Eckhard v. Toerne <evt@uni-bonn.de> - U of Bonn, Germany *
19  * Helge Voss <Helge.Voss@cern.ch> - MPI-K Heidelberg, Germany *
20  * Kai Voss <Kai.Voss@cern.ch> - U. of Victoria, Canada *
21  * *
22  * Copyright (c) 2005-2011: *
23  * CERN, Switzerland *
24  * U. of Victoria, Canada *
25  * MPI-K Heidelberg, Germany *
26  * U. of Bonn, Germany *
27  * *
28  * Redistribution and use in source and binary forms, with or without *
29  * modification, are permitted according to the terms listed in LICENSE *
30  * (http://tmva.sourceforge.net/LICENSE) *
31  **********************************************************************************/
32 
33 #ifndef ROOT_TMVA_MethodBase
34 #define ROOT_TMVA_MethodBase
35 
36 //////////////////////////////////////////////////////////////////////////
37 // //
38 // MethodBase //
39 // //
40 // Virtual base class for all TMVA method //
41 // //
42 //////////////////////////////////////////////////////////////////////////
43 
44 #include <iosfwd>
45 #include <vector>
46 #include <map>
47 #include "assert.h"
48 
49 #include "TString.h"
50 
51 #include "TMVA/IMethod.h"
52 #include "TMVA/Configurable.h"
53 #include "TMVA/Types.h"
54 #include "TMVA/DataSet.h"
55 #include "TMVA/Event.h"
57 #include <TMVA/Results.h>
58 #include "TMVA/TrainingHistory.h"
59 
60 #include <TFile.h>
61 
62 class TGraph;
63 class TTree;
64 class TDirectory;
65 class TSpline;
66 class TH1F;
67 class TH1D;
68 class TMultiGraph;
69 
70 /*! \class TMVA::IPythonInteractive
71 \ingroup TMVA
72 
73 This class is needed by JsMVA, and it's a helper class for tracking errors during
74 the training in Jupyter notebook. It’s only initialized in Jupyter notebook context.
75 In initialization we specify some title, and a TGraph will be created for every title.
76 We can add new data points easily to all TGraphs. These graphs are added to a
77 TMultiGraph, and during an interactive training we get this TMultiGraph object
78 and plot it with JsROOT.
79 */
80 
81 namespace TMVA {
82 
83  class Ranking;
84  class PDF;
85  class TSpline1;
86  class MethodCuts;
87  class MethodBoost;
88  class DataSetInfo;
89  namespace Experimental {
90  class Classification;
91  }
92  class TrainingHistory;
93 
95  public:
98  void Init(std::vector<TString>& graphTitles);
99  void ClearGraphs();
100  void AddPoint(Double_t x, Double_t y1, Double_t y2);
101  void AddPoint(std::vector<Double_t>& dat);
102  inline TMultiGraph* Get() {return fMultiGraph;}
103  inline bool NotInitialized(){ return fNumGraphs==0;};
104  private:
106  std::vector<TGraph*> fGraphs;
109  };
110 
111  class MethodBase : virtual public IMethod, public Configurable {
112 
113  friend class CrossValidation;
114  friend class Factory;
115  friend class RootFinder;
116  friend class MethodBoost;
117  friend class MethodCrossValidation;
119 
120  public:
121 
123 
124  // default constructor
125  MethodBase( const TString& jobName,
126  Types::EMVA methodType,
127  const TString& methodTitle,
128  DataSetInfo& dsi,
129  const TString& theOption = "" );
130 
131  // constructor used for Testing + Application of the MVA, only (no training),
132  // using given weight file
133  MethodBase( Types::EMVA methodType,
134  DataSetInfo& dsi,
135  const TString& weightFile );
136 
137  // default destructor
138  virtual ~MethodBase();
139 
140  // declaration, processing and checking of configuration options
141  void SetupMethod();
142  void ProcessSetup();
143  virtual void CheckSetup(); // may be overwritten by derived classes
144 
145  // ---------- main training and testing methods ------------------------------
146 
147  // prepare tree branch with the method's discriminating variable
148  void AddOutput( Types::ETreeType type, Types::EAnalysisType analysisType );
149 
150  // performs classifier training
151  // calls methods Train() implemented by derived classes
152  void TrainMethod();
153 
154  // optimize tuning parameters
155  virtual std::map<TString,Double_t> OptimizeTuningParameters(TString fomType="ROCIntegral", TString fitType="FitGA");
156  virtual void SetTuneParameters(std::map<TString,Double_t> tuneParameters);
157 
158  virtual void Train() = 0;
159 
160  // store and retrieve time used for training
161  void SetTrainTime( Double_t trainTime ) { fTrainTime = trainTime; }
162  Double_t GetTrainTime() const { return fTrainTime; }
163 
164  // store and retrieve time used for testing
165  void SetTestTime ( Double_t testTime ) { fTestTime = testTime; }
166  Double_t GetTestTime () const { return fTestTime; }
167 
168  // performs classifier testing
169  virtual void TestClassification();
170  virtual Double_t GetKSTrainingVsTest(Char_t SorB, TString opt="X");
171 
172  // performs multiclass classifier testing
173  virtual void TestMulticlass();
174 
175  // performs regression testing
176  virtual void TestRegression( Double_t& bias, Double_t& biasT,
177  Double_t& dev, Double_t& devT,
178  Double_t& rms, Double_t& rmsT,
179  Double_t& mInf, Double_t& mInfT, // mutual information
180  Double_t& corr,
182 
183  // options treatment
184  virtual void Init() = 0;
185  virtual void DeclareOptions() = 0;
186  virtual void ProcessOptions() = 0;
187  virtual void DeclareCompatibilityOptions(); // declaration of past options
188 
189  // reset the Method --> As if it was not yet trained, just instantiated
190  // virtual void Reset() = 0;
191  //for the moment, I provide a dummy (that would not work) default, just to make
192  // compilation/running w/o parameter optimisation still possible
193  virtual void Reset(){return;}
194 
195  // classifier response:
196  // some methods may return a per-event error estimate
197  // error calculation is skipped if err==0
198  virtual Double_t GetMvaValue( Double_t* errLower = 0, Double_t* errUpper = 0) = 0;
199 
200  // signal/background classification response
201  Double_t GetMvaValue( const TMVA::Event* const ev, Double_t* err = 0, Double_t* errUpper = 0 );
202 
203  protected:
204  // helper function to set errors to -1
205  void NoErrorCalc(Double_t* const err, Double_t* const errUpper);
206 
207  // signal/background classification response for all current set of data
208  virtual std::vector<Double_t> GetMvaValues(Long64_t firstEvt = 0, Long64_t lastEvt = -1, Bool_t logProgress = false);
209  // same as above but using a provided data set (used by MethodCategory)
210  virtual std::vector<Double_t> GetDataMvaValues(DataSet *data = nullptr, Long64_t firstEvt = 0, Long64_t lastEvt = -1, Bool_t logProgress = false);
211 
212  public:
213  // regression response
214  const std::vector<Float_t>& GetRegressionValues(const TMVA::Event* const ev){
215  fTmpEvent = ev;
216  const std::vector<Float_t>* ptr = &GetRegressionValues();
217  fTmpEvent = 0;
218  return (*ptr);
219  }
220 
221  virtual const std::vector<Float_t>& GetRegressionValues() {
222  std::vector<Float_t>* ptr = new std::vector<Float_t>(0);
223  return (*ptr);
224  }
225 
226  // multiclass classification response
227  virtual const std::vector<Float_t>& GetMulticlassValues() {
228  std::vector<Float_t>* ptr = new std::vector<Float_t>(0);
229  return (*ptr);
230  }
231 
232  // Training history
233  virtual const std::vector<Float_t>& GetTrainingHistory(const char* /*name*/ ) {
234  std::vector<Float_t>* ptr = new std::vector<Float_t>(0);
235  return (*ptr);
236  }
237 
238  // probability of classifier response (mvaval) to be signal (requires "CreateMvaPdf" option set)
239  virtual Double_t GetProba( const Event *ev); // the simple one, automatically calculates the mvaVal and uses the SAME sig/bkg ratio as given in the training sample (typically 50/50 .. (NormMode=EqualNumEvents) but can be different)
240  virtual Double_t GetProba( Double_t mvaVal, Double_t ap_sig );
241 
242  // Rarity of classifier response (signal or background (default) is uniform in [0,1])
243  virtual Double_t GetRarity( Double_t mvaVal, Types::ESBType reftype = Types::kBackground ) const;
244 
245  // create ranking
246  virtual const Ranking* CreateRanking() = 0;
247 
248  // make ROOT-independent C++ class
249  virtual void MakeClass( const TString& classFileName = TString("") ) const;
250 
251  // print help message
252  void PrintHelpMessage() const;
253 
254  //
255  // streamer methods for training information (creates "weight" files) --------
256  //
257  public:
258  void WriteStateToFile () const;
259  void ReadStateFromFile ();
260 
261  protected:
262  // the actual "weights"
263  virtual void AddWeightsXMLTo ( void* parent ) const = 0;
264  virtual void ReadWeightsFromXML ( void* wghtnode ) = 0;
265  virtual void ReadWeightsFromStream( std::istream& ) = 0; // backward compatibility
266  virtual void ReadWeightsFromStream( TFile& ) {} // backward compatibility
267 
268  private:
269  friend class MethodCategory;
270  friend class MethodCompositeBase;
271  void WriteStateToXML ( void* parent ) const;
272  void ReadStateFromXML ( void* parent );
273  void WriteStateToStream ( std::ostream& tf ) const; // needed for MakeClass
274  void WriteVarsToStream ( std::ostream& tf, const TString& prefix = "" ) const; // needed for MakeClass
275 
276 
277  public: // these two need to be public, they are used to read in-memory weight-files
278  void ReadStateFromStream ( std::istream& tf ); // backward compatibility
279  void ReadStateFromStream ( TFile& rf ); // backward compatibility
280  void ReadStateFromXMLString( const char* xmlstr ); // for reading from memory
281 
282  private:
283  // the variable information
284  void AddVarsXMLTo ( void* parent ) const;
285  void AddSpectatorsXMLTo ( void* parent ) const;
286  void AddTargetsXMLTo ( void* parent ) const;
287  void AddClassesXMLTo ( void* parent ) const;
288  void ReadVariablesFromXML ( void* varnode );
289  void ReadSpectatorsFromXML( void* specnode);
290  void ReadTargetsFromXML ( void* tarnode );
291  void ReadClassesFromXML ( void* clsnode );
292  void ReadVarsFromStream ( std::istream& istr ); // backward compatibility
293 
294  public:
295  // ---------------------------------------------------------------------------
296 
297  // write evaluation histograms into target file
298  virtual void WriteEvaluationHistosToFile(Types::ETreeType treetype);
299 
300  // write classifier-specific monitoring information to target file
301  virtual void WriteMonitoringHistosToFile() const;
302 
303  // ---------- public evaluation methods --------------------------------------
304 
305  // individual initialization for testing of each method
306  // overload this one for individual initialisation of the testing,
307  // it is then called automatically within the global "TestInit"
308 
309  // variables (and private member functions) for the Evaluation:
310  // get the efficiency. It fills a histogram for efficiency/vs/bkg
311  // and returns the one value fo the efficiency demanded for
312  // in the TString argument. (Watch the string format)
313  virtual Double_t GetEfficiency( const TString&, Types::ETreeType, Double_t& err );
314  virtual Double_t GetTrainingEfficiency(const TString& );
315  virtual std::vector<Float_t> GetMulticlassEfficiency( std::vector<std::vector<Float_t> >& purity );
316  virtual std::vector<Float_t> GetMulticlassTrainingEfficiency(std::vector<std::vector<Float_t> >& purity );
318  virtual Double_t GetSignificance() const;
319  virtual Double_t GetROCIntegral(TH1D *histS, TH1D *histB) const;
320  virtual Double_t GetROCIntegral(PDF *pdfS=0, PDF *pdfB=0) const;
321  virtual Double_t GetMaximumSignificance( Double_t SignalEvents, Double_t BackgroundEvents,
322  Double_t& optimal_significance_value ) const;
323  virtual Double_t GetSeparation( TH1*, TH1* ) const;
324  virtual Double_t GetSeparation( PDF* pdfS = 0, PDF* pdfB = 0 ) const;
325 
326  virtual void GetRegressionDeviation(UInt_t tgtNum, Types::ETreeType type, Double_t& stddev,Double_t& stddev90Percent ) const;
327  // ---------- public accessors -----------------------------------------------
328 
329  // classifier naming (a lot of names ... aren't they ;-)
330  const TString& GetJobName () const { return fJobName; }
331  const TString& GetMethodName () const { return fMethodName; }
333  Types::EMVA GetMethodType () const { return fMethodType; }
334  const char* GetName () const { return fMethodName.Data(); }
335  const TString& GetTestvarName () const { return fTestvar; }
336  const TString GetProbaName () const { return fTestvar + "_Proba"; }
337  TString GetWeightFileName() const;
338 
339  // build classifier name in Test tree
340  // MVA prefix (e.g., "TMVA_")
341  void SetTestvarName ( const TString & v="" ) { fTestvar = (v=="") ? ("MVA_" + GetMethodName()) : v; }
342 
343  // number of input variable used by classifier
344  UInt_t GetNvar() const { return DataInfo().GetNVariables(); }
345  UInt_t GetNVariables() const { return DataInfo().GetNVariables(); }
346  UInt_t GetNTargets() const { return DataInfo().GetNTargets(); };
347 
348  // internal names and expressions of input variables
349  const TString& GetInputVar ( Int_t i ) const { return DataInfo().GetVariableInfo(i).GetInternalName(); }
350  const TString& GetInputLabel( Int_t i ) const { return DataInfo().GetVariableInfo(i).GetLabel(); }
351  const char * GetInputTitle( Int_t i ) const { return DataInfo().GetVariableInfo(i).GetTitle(); }
352 
353  // normalisation and limit accessors
354  Double_t GetMean( Int_t ivar ) const { return GetTransformationHandler().GetMean(ivar); }
355  Double_t GetRMS ( Int_t ivar ) const { return GetTransformationHandler().GetRMS(ivar); }
356  Double_t GetXmin( Int_t ivar ) const { return GetTransformationHandler().GetMin(ivar); }
357  Double_t GetXmax( Int_t ivar ) const { return GetTransformationHandler().GetMax(ivar); }
358 
359  // sets the minimum requirement on the MVA output to declare an event signal-like
362 
363  // sets the minimum requirement on the MVA output to declare an event signal-like
365  void SetSignalReferenceCutOrientation( Double_t cutOrientation ) { fSignalReferenceCutOrientation = cutOrientation; }
366 
367  // pointers to ROOT directories
368  TDirectory* BaseDir() const;
369  TDirectory* MethodBaseDir() const;
370  TFile* GetFile() const {return fFile;}
371 
372  void SetMethodDir ( TDirectory* methodDir ) { fBaseDir = fMethodBaseDir = methodDir; }
373  void SetBaseDir( TDirectory* methodDir ){ fBaseDir = methodDir; }
374  void SetMethodBaseDir( TDirectory* methodDir ){ fMethodBaseDir = methodDir; }
376 
377  //Silent file
378  void SetSilentFile(Bool_t status) {fSilentFile=status;}
379  Bool_t IsSilentFile() const {return fSilentFile;}
380 
381  //Model Persistence
382  void SetModelPersistence(Bool_t status){fModelPersistence=status;}//added support to create/remove dir here if exits or not
384 
385  // the TMVA version can be obtained and checked using
386  // if (GetTrainingTMVAVersionCode()>TMVA_VERSION(3,7,2)) {...}
387  // or
388  // if (GetTrainingROOTVersionCode()>ROOT_VERSION(5,15,5)) {...}
393 
395  {
396  if(fTransformationPointer && takeReroutedIfAvailable) return *fTransformationPointer; else return fTransformation;
397  }
398  const TransformationHandler& GetTransformationHandler(Bool_t takeReroutedIfAvailable=true) const
399  {
400  if(fTransformationPointer && takeReroutedIfAvailable) return *fTransformationPointer; else return fTransformation;
401  }
402 
403  void RerouteTransformationHandler (TransformationHandler* fTargetTransformation) { fTransformationPointer=fTargetTransformation; }
404 
405  // ---------- event accessors ------------------------------------------------
406 
407  // returns reference to data set
408  // NOTE: this DataSet is the "original" dataset, i.e. the one seen by ALL Classifiers WITHOUT transformation
409  DataSet* Data() const { return (fTmpData) ? fTmpData : DataInfo().GetDataSet(); }
410  DataSetInfo& DataInfo() const { return fDataSetInfo; }
411 
412 
413  // event reference and update
414  // NOTE: these Event accessors make sure that you get the events transformed according to the
415  // particular classifiers transformation chosen
416  UInt_t GetNEvents () const { return Data()->GetNEvents(); }
417  const Event* GetEvent () const;
418  const Event* GetEvent ( const TMVA::Event* ev ) const;
419  const Event* GetEvent ( Long64_t ievt ) const;
420  const Event* GetEvent ( Long64_t ievt , Types::ETreeType type ) const;
421  const Event* GetTrainingEvent( Long64_t ievt ) const;
422  const Event* GetTestingEvent ( Long64_t ievt ) const;
423  const std::vector<TMVA::Event*>& GetEventCollection( Types::ETreeType type );
424 
426  // ---------- public auxiliary methods ---------------------------------------
427 
428  // this method is used to decide whether an event is signal- or background-like
429  // the reference cut "xC" is taken to be where
430  // Int_[-oo,xC] { PDF_S(x) dx } = Int_[xC,+oo] { PDF_B(x) dx }
431  virtual Bool_t IsSignalLike();
432  virtual Bool_t IsSignalLike(Double_t mvaVal);
433 
434 
435  Bool_t HasMVAPdfs() const { return fHasMVAPdfs; }
440 
441  // setter method for suppressing writing to XML and writing of standalone classes
442  void DisableWriting(Bool_t setter){ fModelPersistence = setter?kFALSE:kTRUE; }//DEPRECATED
443 
444  protected:
445  mutable const Event *fTmpEvent; //! temporary event when testing on a different DataSet than the own one
446  DataSet *fTmpData = nullptr; //! temporary dataset used when evaluating on a different data (used by MethodCategory::GetMvaValues)
447  // helper variables for JsMVA
449  bool fExitFromTraining = false;
451 
452  public:
453 
454  // initializing IPythonInteractive class (for JsMVA only)
455  inline void InitIPythonInteractive(){
456  if (fInteractive) delete fInteractive;
458  }
459 
460  // get training errors (for JsMVA only)
462 
463  // stop's the training process (for JsMVA only)
464  inline void ExitFromTraining(){
465  fExitFromTraining = true;
466  }
467 
468  // check's if the training ended (for JsMVA only)
469  inline bool TrainingEnded(){
471  delete fInteractive;
472  fInteractive = nullptr;
473  }
474  return fExitFromTraining;
475  }
476 
477  // get fIPyMaxIter
478  inline UInt_t GetMaxIter(){ return fIPyMaxIter; }
479 
480  // get fIPyCurrentIter
482 
483  protected:
484 
485  // ---------- protected accessors -------------------------------------------
486 
487  //TDirectory* LocalTDir() const { return Data().LocalRootDir(); }
488 
489  // weight file name and directory (given by global config variable)
490  void SetWeightFileName( TString );
491 
492  const TString& GetWeightFileDir() const { return fFileDir; }
493  void SetWeightFileDir( TString fileDir );
494 
495  // are input variables normalised ?
496  Bool_t IsNormalised() const { return fNormalise; }
497  void SetNormalised( Bool_t norm ) { fNormalise = norm; }
498 
499  // set number of input variables (only used by MethodCuts, could perhaps be removed)
500  // void SetNvar( Int_t n ) { fNvar = n; }
501 
502  // verbose and help flags
503  Bool_t Verbose() const { return fVerbose; }
504  Bool_t Help () const { return fHelp; }
505 
506  // ---------- protected event and tree accessors -----------------------------
507 
508  // names of input variables (if the original names are expressions, they are
509  // transformed into regexps)
510  const TString& GetInternalVarName( Int_t ivar ) const { return (*fInputVars)[ivar]; }
511  const TString& GetOriginalVarName( Int_t ivar ) const { return DataInfo().GetVariableInfo(ivar).GetExpression(); }
512 
513  Bool_t HasTrainingTree() const { return Data()->GetNTrainingEvents() != 0; }
514 
515  // ---------- protected auxiliary methods ------------------------------------
516 
517  protected:
518 
519  // make ROOT-independent C++ class for classifier response (classifier-specific implementation)
520  virtual void MakeClassSpecific( std::ostream&, const TString& = "" ) const {}
521 
522  // header and auxiliary classes
523  virtual void MakeClassSpecificHeader( std::ostream&, const TString& = "" ) const {}
524 
525  // static pointer to this object - required for ROOT finder (to be solved differently)(solved by Omar)
526  //static MethodBase* GetThisBase();
527 
528  // some basic statistical analysis
529  void Statistics( Types::ETreeType treeType, const TString& theVarName,
531  Double_t&, Double_t&, Double_t& );
532 
533  // if TRUE, write weights only to text files
534  Bool_t TxtWeightsOnly() const { return kTRUE; }
535 
536  protected:
537 
538  // access to event information that needs method-specific information
539 
541 
542  private:
543 
544  // ---------- private definitions --------------------------------------------
545  // Initialisation
546  void InitBase();
547  void DeclareBaseOptions();
548  void ProcessBaseOptions();
549 
550  // used in efficiency computation
551  enum ECutOrientation { kNegative = -1, kPositive = +1 };
553 
554  // ---------- private accessors ---------------------------------------------
555 
556  // reset required for RootFinder
558 
559  // ---------- private auxiliary methods --------------------------------------
560 
561  // PDFs for classifier response (required to compute signal probability and Rarity)
562  void CreateMVAPdfs();
563 
564  // for root finder
565  //virtual method to find ROOT
566  virtual Double_t GetValueForRoot ( Double_t ); // implementation
567 
568  // used for file parsing
569  Bool_t GetLine( std::istream& fin, char * buf );
570 
571  // fill test tree with classification or regression results
572  virtual void AddClassifierOutput ( Types::ETreeType type );
574  virtual void AddRegressionOutput ( Types::ETreeType type );
575  virtual void AddMulticlassOutput ( Types::ETreeType type );
576 
577  private:
578 
579  void AddInfoItem( void* gi, const TString& name,
580  const TString& value) const;
581 
582  // ========== class members ==================================================
583 
584  protected:
585 
586  // direct accessors
587  Ranking* fRanking; // pointer to ranking object (created by derived classifiers)
588  std::vector<TString>* fInputVars; // vector of input variables used in MVA
589 
590  // histogram binning
591  Int_t fNbins; // number of bins in input variable histograms
592  Int_t fNbinsMVAoutput; // number of bins in MVA output histograms
593  Int_t fNbinsH; // number of bins in evaluation histograms
594 
595  Types::EAnalysisType fAnalysisType; // method-mode : true --> regression, false --> classification
596 
597  std::vector<Float_t>* fRegressionReturnVal; // holds the return-values for the regression
598  std::vector<Float_t>* fMulticlassReturnVal; // holds the return-values for the multiclass classification
599 
600  private:
601 
602  // MethodCuts redefines some of the evaluation variables and histograms -> must access private members
603  friend class MethodCuts;
604 
605 
606  // data sets
607  DataSetInfo& fDataSetInfo; //! the data set information (sometimes needed)
608 
609  Double_t fSignalReferenceCut; // minimum requirement on the MVA output to declare an event signal-like
610  Double_t fSignalReferenceCutOrientation; // minimum requirement on the MVA output to declare an event signal-like
611  Types::ESBType fVariableTransformType; // this is the event type (sig or bgd) assumed for variable transform
612 
613  // naming and versioning
614  TString fJobName; // name of job -> user defined, appears in weight files
615  TString fMethodName; // name of the method (set in derived class)
616  Types::EMVA fMethodType; // type of method (set in derived class)
617  TString fTestvar; // variable used in evaluation, etc (mostly the MVA)
618  UInt_t fTMVATrainingVersion; // TMVA version used for training
619  UInt_t fROOTTrainingVersion; // ROOT version used for training
620  Bool_t fConstructedFromWeightFile; // is it obtained from weight file?
621 
622  // Directory structure: dataloader/fMethodBaseDir/fBaseDir
623  // where the first directory name is defined by the method type
624  // and the second is user supplied (the title given in Factory::BookMethod())
625  TDirectory* fBaseDir; // base directory for the instance, needed to know where to jump back from localDir
626  mutable TDirectory* fMethodBaseDir; // base directory for the method
627  //this will be the next way to save results
629 
630  //SilentFile
632  //Model Persistence
634 
635  TString fParentDir; // method parent name, like booster name
636 
637  TString fFileDir; // unix sub-directory for weight files (default: DataLoader's Name + "weights")
638  TString fWeightFile; // weight file name
639 
640  private:
641 
642  TH1* fEffS; // efficiency histogram for rootfinder
643 
644  PDF* fDefaultPDF; // default PDF definitions
645  PDF* fMVAPdfS; // signal MVA PDF
646  PDF* fMVAPdfB; // background MVA PDF
647 
648  // TH1D* fmvaS; // PDFs of MVA distribution (signal)
649  // TH1D* fmvaB; // PDFs of MVA distribution (background)
650  PDF* fSplS; // PDFs of MVA distribution (signal)
651  PDF* fSplB; // PDFs of MVA distribution (background)
652  TSpline* fSpleffBvsS; // splines for signal eff. versus background eff.
653 
654  PDF* fSplTrainS; // PDFs of training MVA distribution (signal)
655  PDF* fSplTrainB; // PDFs of training MVA distribution (background)
656  TSpline* fSplTrainEffBvsS; // splines for training signal eff. versus background eff.
657 
658  private:
659 
660  // basic statistics quantities of MVA
661  Double_t fMeanS; // mean (signal)
662  Double_t fMeanB; // mean (background)
663  Double_t fRmsS; // RMS (signal)
664  Double_t fRmsB; // RMS (background)
665  Double_t fXmin; // minimum (signal and background)
666  Double_t fXmax; // maximum (signal and background)
667 
668  // variable preprocessing
669  TString fVarTransformString; // labels variable transform method
670 
671  TransformationHandler* fTransformationPointer; // pointer to the rest of transformations
672  TransformationHandler fTransformation; // the list of transformations
673 
674 
675  // help and verbosity
676  Bool_t fVerbose; // verbose flag
677  TString fVerbosityLevelString; // verbosity level (user input string)
678  EMsgType fVerbosityLevel; // verbosity level
679  Bool_t fHelp; // help flag
680  Bool_t fHasMVAPdfs; // MVA Pdfs are created for this classifier
681 
682  Bool_t fIgnoreNegWeightsInTraining;// If true, events with negative weights are not used in training
683 
684  protected:
685 
687 
688  // for signal/background
689  UInt_t fSignalClass; // index of the Signal-class
690  UInt_t fBackgroundClass; // index of the Background-class
691 
692  private:
693 
694  // timing variables
695  Double_t fTrainTime; // for timing measurements
696  Double_t fTestTime; // for timing measurements
697 
698  // orientation of cut: depends on signal and background mean values
699  ECutOrientation fCutOrientation; // +1 if Sig>Bkg, -1 otherwise
700 
701  // for root finder
702  TSpline1* fSplRefS; // helper splines for RootFinder (signal)
703  TSpline1* fSplRefB; // helper splines for RootFinder (background)
704 
705  TSpline1* fSplTrainRefS; // helper splines for RootFinder (signal)
706  TSpline1* fSplTrainRefB; // helper splines for RootFinder (background)
707 
708  mutable std::vector<const std::vector<TMVA::Event*>*> fEventCollections; // if the method needs the complete event-collection, the transformed event coll. ist stored here.
709 
710  public:
711  Bool_t fSetupCompleted; // is method setup
712 
713  private:
714 
715  // This is a workaround for OSx where static thread_local data members are
716  // not supported. The C++ solution would indeed be the following:
717 // static MethodBase*& GetThisBaseThreadLocal() {TTHREAD_TLS(MethodBase*) fgThisBase(nullptr); return fgThisBase; };
718 
719  // ===== depreciated options, kept for backward compatibility =====
720  private:
721 
722  Bool_t fNormalise; // normalise input variables
723  Bool_t fUseDecorr; // synonymous for decorrelation
724  TString fVariableTransformTypeString; // labels variable transform type
725  Bool_t fTxtWeightsOnly; // if TRUE, write weights only to text files
726  Int_t fNbinsMVAPdf; // number of bins used in histogram that creates PDF
727  Int_t fNsmoothMVAPdf; // number of times a histogram is smoothed before creating the PDF
728 
729  protected:
731  ClassDef(MethodBase,0); // Virtual base class for all TMVA method
732 
733  };
734 } // namespace TMVA
735 
736 
737 
738 
739 
740 
741 
742 // ========== INLINE FUNCTIONS =========================================================
743 
744 
745 //_______________________________________________________________________
746 inline const TMVA::Event* TMVA::MethodBase::GetEvent( const TMVA::Event* ev ) const
747 {
748  return GetTransformationHandler().Transform(ev);
749 }
750 
752 {
753  if(fTmpEvent)
754  return GetTransformationHandler().Transform(fTmpEvent);
755  else
756  return GetTransformationHandler().Transform(Data()->GetEvent());
757 }
758 
760 {
761  assert(fTmpEvent==0);
762  return GetTransformationHandler().Transform(Data()->GetEvent(ievt));
763 }
764 
766 {
767  assert(fTmpEvent==0);
768  return GetTransformationHandler().Transform(Data()->GetEvent(ievt, type));
769 }
770 
772 {
773  assert(fTmpEvent==0);
774  return GetEvent(ievt, Types::kTraining);
775 }
776 
778 {
779  assert(fTmpEvent==0);
780  return GetEvent(ievt, Types::kTesting);
781 }
782 
783 #endif
TMVA::MethodBase::TestClassification
virtual void TestClassification()
initialization
Definition: MethodBase.cxx:1125
TMVA::MethodBase::fSignalReferenceCut
Double_t fSignalReferenceCut
the data set information (sometimes needed)
Definition: MethodBase.h:609
TMVA::MethodBase::AddClassesXMLTo
void AddClassesXMLTo(void *parent) const
write class info to XML
Definition: MethodBase.cxx:1801
TMVA::MethodBase::GetTransformationHandler
TransformationHandler & GetTransformationHandler(Bool_t takeReroutedIfAvailable=true)
Definition: MethodBase.h:394
TMVA::MethodBase::fSilentFile
Bool_t fSilentFile
Definition: MethodBase.h:631
TMVA::MethodBase::fModelPersistence
Bool_t fModelPersistence
Definition: MethodBase.h:633
TMVA::IPythonInteractive::fNumGraphs
Int_t fNumGraphs
Definition: MethodBase.h:107
TMVA::IPythonInteractive::IPythonInteractive
IPythonInteractive()
standard constructor
Definition: MethodBase.cxx:146
TMVA::MethodBase::WriteStateToStream
void WriteStateToStream(std::ostream &tf) const
general method used in writing the header of the weight files where the used variables,...
Definition: MethodBase.cxx:1267
TMVA::MethodCuts
Multivariate optimisation of signal efficiency for given background efficiency, applying rectangular ...
Definition: MethodCuts.h:61
TMVA::MethodBase::fSignalClass
UInt_t fSignalClass
Definition: MethodBase.h:689
TMVA::MethodBase::BaseDir
TDirectory * BaseDir() const
returns the ROOT directory where info/histograms etc of the corresponding MVA method instance are sto...
Definition: MethodBase.cxx:1980
TMVA::MethodBase::fHelp
Bool_t fHelp
Definition: MethodBase.h:679
TMVA::MethodBase::WriteVarsToStream
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
Definition: MethodBase.cxx:1710
TMVA::MethodBase::Reset
virtual void Reset()
Definition: MethodBase.h:193
TMVA::MethodBase::GetProba
virtual Double_t GetProba(const Event *ev)
Definition: MethodBase.cxx:2247
TMVA::MethodBase::fVarTransformString
TString fVarTransformString
Definition: MethodBase.h:669
TMVA::IPythonInteractive::fMultiGraph
TMultiGraph * fMultiGraph
Definition: MethodBase.h:103
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:100
TMVA::Types::kMulticlass
@ kMulticlass
Definition: Types.h:131
TMVA::MethodBase::GetMulticlassEfficiency
virtual std::vector< Float_t > GetMulticlassEfficiency(std::vector< std::vector< Float_t > > &purity)
Definition: MethodBase.cxx:2703
TMVA::MethodBase::fVerbosityLevel
EMsgType fVerbosityLevel
Definition: MethodBase.h:678
TMVA::MethodBase::GetSeparation
virtual Double_t GetSeparation(TH1 *, TH1 *) const
compute "separation" defined as
Definition: MethodBase.cxx:2789
TMVA::MethodBase::GetProbaName
const TString GetProbaName() const
Definition: MethodBase.h:336
TMVA::MethodBase::fSplRefS
TSpline1 * fSplRefS
Definition: MethodBase.h:702
TMVA::MethodBase::Data
DataSet * Data() const
Definition: MethodBase.h:409
TMVA::MethodBase::SetModelPersistence
void SetModelPersistence(Bool_t status)
Definition: MethodBase.h:382
TMVA::IPythonInteractive::Init
void Init(std::vector< TString > &graphTitles)
This function gets some title and it creates a TGraph for every title.
Definition: MethodBase.cxx:169
TMVA::MethodBase::GetROCIntegral
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
Definition: MethodBase.cxx:2822
TMVA::MethodBase::fTransformation
TransformationHandler fTransformation
Definition: MethodBase.h:672
TMVA::Configurable
Definition: Configurable.h:45
TMVA::MethodBase::kROOT
@ kROOT
Definition: MethodBase.h:122
TMVA::MethodBase::GetAnalysisType
Types::EAnalysisType GetAnalysisType() const
Definition: MethodBase.h:437
TMVA::MethodBase::IsConstructedFromWeightFile
Bool_t IsConstructedFromWeightFile() const
Definition: MethodBase.h:540
TMVA::Types::kRegression
@ kRegression
Definition: Types.h:130
TMVA::MethodBase::ReadStateFromXMLString
void ReadStateFromXMLString(const char *xmlstr)
for reading from memory
Definition: MethodBase.cxx:1469
TMVA::IPythonInteractive::~IPythonInteractive
~IPythonInteractive()
standard destructor
Definition: MethodBase.cxx:154
TMVA::Experimental::Classification
Definition: Classification.h:163
TMVA::MethodBase::ReadWeightsFromStream
virtual void ReadWeightsFromStream(std::istream &)=0
TMVA::MethodBase::SetupMethod
void SetupMethod()
setup of methods
Definition: MethodBase.cxx:406
TMVA::MethodBase::WriteStateToFile
void WriteStateToFile() const
write options and weights to file note that each one text file for the main configuration information...
Definition: MethodBase.cxx:1404
TMVA::MethodBase::GetWeightFileName
TString GetWeightFileName() const
retrieve weight file name
Definition: MethodBase.cxx:2076
TString::Data
const char * Data() const
Definition: TString.h:369
TMVA::MethodBase::fRegressionReturnVal
std::vector< Float_t > * fRegressionReturnVal
Definition: MethodBase.h:597
TMVA::MethodBase::IsModelPersistence
Bool_t IsModelPersistence() const
Definition: MethodBase.h:383
TrainingHistory.h
TMVA::MethodBase::fNbins
Int_t fNbins
Definition: MethodBase.h:591
TNamed::GetTitle
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:48
TMVA::Ranking
Ranking for variables in method (implementation)
Definition: Ranking.h:48
TMVA::MethodBase::ReadStateFromXML
void ReadStateFromXML(void *parent)
Definition: MethodBase.cxx:1480
TMVA::DataSetInfo::GetDataSet
DataSet * GetDataSet() const
returns data set
Definition: DataSetInfo.cxx:480
TMVA::MethodBase::fIPyMaxIter
UInt_t fIPyMaxIter
Definition: MethodBase.h:450
TMVA::MethodBase::GetXmax
Double_t GetXmax(Int_t ivar) const
Definition: MethodBase.h:357
TMVA::MethodBase::GetLine
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 ...
Definition: MethodBase.cxx:2142
TMVA::MethodBase::IsNormalised
Bool_t IsNormalised() const
Definition: MethodBase.h:496
IMethod.h
TMVA::MethodBase::fMVAPdfB
PDF * fMVAPdfB
Definition: MethodBase.h:646
TMVA::MethodBase::SetSilentFile
void SetSilentFile(Bool_t status)
Definition: MethodBase.h:378
TMVA::MethodBase::fExitFromTraining
bool fExitFromTraining
Definition: MethodBase.h:449
Long64_t
long long Long64_t
Definition: RtypesCore.h:80
TMVA::MethodBase::fMeanS
Double_t fMeanS
Definition: MethodBase.h:661
TMVA::MethodBase::DeclareCompatibilityOptions
virtual void DeclareCompatibilityOptions()
options that are used ONLY for the READER to ensure backward compatibility they are hence without any...
Definition: MethodBase.cxx:596
TMVA::Types::kTesting
@ kTesting
Definition: Types.h:146
TTree
A TTree represents a columnar dataset.
Definition: TTree.h:79
TH1D
1-D histogram with a double per channel (see TH1 documentation)}
Definition: TH1.h:618
TMVA::MethodCrossValidation
Definition: MethodCrossValidation.h:38
TMVA::DataSetInfo::GetNVariables
UInt_t GetNVariables() const
Definition: DataSetInfo.h:127
TMVA::TransformationHandler
Class that contains all the data information.
Definition: TransformationHandler.h:56
TMVA::MethodBase::GetMulticlassTrainingEfficiency
virtual std::vector< Float_t > GetMulticlassTrainingEfficiency(std::vector< std::vector< Float_t > > &purity)
Definition: MethodBase.cxx:2715
TMVA::MethodBase::ReadWeightsFromXML
virtual void ReadWeightsFromXML(void *wghtnode)=0
TMVA::MethodBase::TrainMethod
void TrainMethod()
Definition: MethodBase.cxx:650
TMVA::IPythonInteractive::NotInitialized
bool NotInitialized()
Definition: MethodBase.h:103
TMVA::MethodBase::GetTestTime
Double_t GetTestTime() const
Definition: MethodBase.h:166
TMVA::MethodBase::fSetupCompleted
Bool_t fSetupCompleted
Definition: MethodBase.h:711
TMVA::MethodBase::fTMVATrainingVersion
UInt_t fTMVATrainingVersion
Definition: MethodBase.h:618
TMVA::MethodBase::fBackgroundClass
UInt_t fBackgroundClass
Definition: MethodBase.h:690
TMVA::MethodBase::ECutOrientation
ECutOrientation
Definition: MethodBase.h:551
TMVA::MethodBase::fDefaultPDF
PDF * fDefaultPDF
Definition: MethodBase.h:644
TMVA::TransformationHandler::Transform
const Event * Transform(const Event *) const
the transformation
Definition: TransformationHandler.cxx:152
TMVA::MethodBase::ReadTargetsFromXML
void ReadTargetsFromXML(void *tarnode)
read target info from XML
Definition: MethodBase.cxx:1959
TMVA::MethodBase::AddClassifierOutput
virtual void AddClassifierOutput(Types::ETreeType type)
prepare tree branch with the method's discriminating variable
Definition: MethodBase.cxx:868
TMVA::MethodBase::GetFile
TFile * GetFile() const
Definition: MethodBase.h:370
TMVA::MethodBase::fMulticlassReturnVal
std::vector< Float_t > * fMulticlassReturnVal
Definition: MethodBase.h:598
TMVA::MethodBase::fDataSetInfo
DataSetInfo & fDataSetInfo
Definition: MethodBase.h:607
TMVA::MethodBase::HasMVAPdfs
Bool_t HasMVAPdfs() const
Definition: MethodBase.h:435
TMVA::MethodBase::Train
virtual void Train()=0
TMVA::MethodBase::AddMulticlassOutput
virtual void AddMulticlassOutput(Types::ETreeType type)
prepare tree branch with the method's discriminating variable
Definition: MethodBase.cxx:794
x
Double_t x[n]
Definition: legend1.C:17
TMVA::MethodBase::GetRegressionValues
const std::vector< Float_t > & GetRegressionValues(const TMVA::Event *const ev)
Definition: MethodBase.h:214
TSpline
Base class for spline implementation containing the Draw/Paint methods.
Definition: TSpline.h:31
TMVA::MethodBase::fSplRefB
TSpline1 * fSplRefB
Definition: MethodBase.h:703
TMVA::MethodBase::GetNTargets
UInt_t GetNTargets() const
Definition: MethodBase.h:346
TMVA::MethodBase::IsSignalLike
virtual Bool_t IsSignalLike()
uses a pre-set cut on the MVA output (SetSignalReferenceCut and SetSignalReferenceCutOrientation) for...
Definition: MethodBase.cxx:854
TMVA::MethodBase::TrainingEnded
bool TrainingEnded()
Definition: MethodBase.h:469
TMVA::MethodBase::CreateMVAPdfs
void CreateMVAPdfs()
Create PDFs of the MVA output variables.
Definition: MethodBase.cxx:2185
TMVA::MethodBase::ReadVariablesFromXML
void ReadVariablesFromXML(void *varnode)
read variable info from XML
Definition: MethodBase.cxx:1837
TMVA::MethodBase::fWeightFile
TString fWeightFile
Definition: MethodBase.h:638
TMVA::MethodBase::fNbinsMVAoutput
Int_t fNbinsMVAoutput
Definition: MethodBase.h:592
TMVA::MethodBase::ReadStateFromStream
void ReadStateFromStream(std::istream &tf)
read the header from the weight files of the different MVA methods
Definition: MethodBase.cxx:1590
TMVA::MethodBase::SetSignalReferenceCut
void SetSignalReferenceCut(Double_t cut)
Definition: MethodBase.h:364
TMVA::MethodBase::fVariableTransformType
Types::ESBType fVariableTransformType
Definition: MethodBase.h:611
TMVA::MethodBase::fMethodBaseDir
TDirectory * fMethodBaseDir
Definition: MethodBase.h:626
TMVA::TransformationHandler::GetMean
Double_t GetMean(Int_t ivar, Int_t cls=-1) const
Definition: TransformationHandler.cxx:934
TString
Basic string class.
Definition: TString.h:136
TMVA::Types::GetMethodName
TString GetMethodName(Types::EMVA method) const
Definition: Types.cxx:135
TMVA::MethodBase::AddSpectatorsXMLTo
void AddSpectatorsXMLTo(void *parent) const
write spectator info to XML
Definition: MethodBase.cxx:1778
TMatrixT< Double_t >
TMVA::MethodBase::GetJobName
const TString & GetJobName() const
Definition: MethodBase.h:330
TMVA::MethodCategory
Class for categorizing the phase space.
Definition: MethodCategory.h:58
TMVA::MethodBase::GetTrainingROOTVersionString
TString GetTrainingROOTVersionString() const
calculates the ROOT version string from the training version code on the fly
Definition: MethodBase.cxx:3385
TMVA::MethodBase::GetTrainingTMVAVersionString
TString GetTrainingTMVAVersionString() const
calculates the TMVA version string from the training version code on the fly
Definition: MethodBase.cxx:3373
v
@ v
Definition: rootcling_impl.cxx:3664
TString.h
TFile.h
TMVA::MethodBase::fVariableTransformTypeString
TString fVariableTransformTypeString
Definition: MethodBase.h:724
TMVA::MethodBase::GetInputTitle
const char * GetInputTitle(Int_t i) const
Definition: MethodBase.h:351
TMVA::MethodCompositeBase
Virtual base class for combining several TMVA method.
Definition: MethodCompositeBase.h:50
TMVA::DataSetInfo::GetVariableInfo
VariableInfo & GetVariableInfo(Int_t i)
Definition: DataSetInfo.h:105
bool
TMVA::IPythonInteractive::AddPoint
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.
Definition: MethodBase.cxx:207
TMVA::MethodBase::ProcessBaseOptions
void ProcessBaseOptions()
the option string is decoded, for available options see "DeclareOptions"
Definition: MethodBase.cxx:540
TMVA::MethodBase::DoMulticlass
Bool_t DoMulticlass() const
Definition: MethodBase.h:439
TMVA::MethodBase::fResults
Results * fResults
Definition: MethodBase.h:730
TMVA::MethodBase::GetNVariables
UInt_t GetNVariables() const
Definition: MethodBase.h:345
TMVA::MethodBase::IgnoreEventsWithNegWeightsInTraining
Bool_t IgnoreEventsWithNegWeightsInTraining() const
Definition: MethodBase.h:686
TMVA::MethodBase::kPositive
@ kPositive
Definition: MethodBase.h:551
TMVA::MethodBase::fFileDir
TString fFileDir
Definition: MethodBase.h:637
TMVA::MethodBase::MakeClassSpecificHeader
virtual void MakeClassSpecificHeader(std::ostream &, const TString &="") const
Definition: MethodBase.h:523
TMVA::MethodBase::GetMvaValue
virtual Double_t GetMvaValue(Double_t *errLower=0, Double_t *errUpper=0)=0
TMVA::MethodBase::fHasMVAPdfs
Bool_t fHasMVAPdfs
Definition: MethodBase.h:680
TMVA::MethodBase::SetTestTime
void SetTestTime(Double_t testTime)
Definition: MethodBase.h:165
TMVA::MethodBase::Init
virtual void Init()=0
TMVA::MethodBase::DataInfo
DataSetInfo & DataInfo() const
Definition: MethodBase.h:410
TMVA::MethodBase::fSplB
PDF * fSplB
Definition: MethodBase.h:651
TMVA::MethodBase::GetTrainingROOTVersionCode
UInt_t GetTrainingROOTVersionCode() const
Definition: MethodBase.h:390
TMVA::MethodBase::GetTrainingTMVAVersionCode
UInt_t GetTrainingTMVAVersionCode() const
Definition: MethodBase.h:389
TMVA::MethodBase::ProcessOptions
virtual void ProcessOptions()=0
TMVA::Types::ESBType
ESBType
Definition: Types.h:136
TMVA::MethodBase::fEffS
TH1 * fEffS
Definition: MethodBase.h:642
TMVA::MethodBase::fSplS
PDF * fSplS
Definition: MethodBase.h:650
TMVA::MethodBase::fMeanB
Double_t fMeanB
Definition: MethodBase.h:662
TMVA::MethodBase::GetRarity
virtual Double_t GetRarity(Double_t mvaVal, Types::ESBType reftype=Types::kBackground) const
compute rarity:
Definition: MethodBase.cxx:2285
TMVA::DataSetInfo
Class that contains all the data information.
Definition: DataSetInfo.h:62
TMVA::MethodBase::fTransformationPointer
TransformationHandler * fTransformationPointer
Definition: MethodBase.h:671
TMVA::MethodBase::GetXmin
Double_t GetXmin(Int_t ivar) const
Definition: MethodBase.h:356
TMVA::MethodBase::fCutOrientation
ECutOrientation fCutOrientation
Definition: MethodBase.h:699
TMVA::MethodBase::GetNvar
UInt_t GetNvar() const
Definition: MethodBase.h:344
TMVA::MethodBase::RerouteTransformationHandler
void RerouteTransformationHandler(TransformationHandler *fTargetTransformation)
Definition: MethodBase.h:403
TMVA::MethodBase::GetTrainingEvent
const Event * GetTrainingEvent(Long64_t ievt) const
Definition: MethodBase.h:771
TMVA::MethodBase::ReadClassesFromXML
void ReadClassesFromXML(void *clsnode)
read number of classes from XML
Definition: MethodBase.cxx:1917
TMVA::MethodBase::GetMaxIter
UInt_t GetMaxIter()
Definition: MethodBase.h:478
TMVA::MethodBase::fInteractive
IPythonInteractive * fInteractive
temporary dataset used when evaluating on a different data (used by MethodCategory::GetMvaValues)
Definition: MethodBase.h:448
TMVA::MethodBase::SetWeightFileName
void SetWeightFileName(TString)
set the weight file name (depreciated)
Definition: MethodBase.cxx:2068
TMVA::MethodBase::WriteMonitoringHistosToFile
virtual void WriteMonitoringHistosToFile() const
write special monitoring histograms to file dummy implementation here --------------—
Definition: MethodBase.cxx:2133
TMVA::MethodBase::GetMethodName
const TString & GetMethodName() const
Definition: MethodBase.h:331
TMVA::MethodBase::Verbose
Bool_t Verbose() const
Definition: MethodBase.h:503
TMVA::MethodBase::AddRegressionOutput
virtual void AddRegressionOutput(Types::ETreeType type)
prepare tree branch with the method's discriminating variable
Definition: MethodBase.cxx:744
TMVA::MethodBase::GetMvaValues
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
Definition: MethodBase.cxx:897
TMVA::MethodBase::GetCurrentIter
UInt_t GetCurrentIter()
Definition: MethodBase.h:481
TMVA::MethodBase::GetOriginalVarName
const TString & GetOriginalVarName(Int_t ivar) const
Definition: MethodBase.h:511
TMVA::MethodBase::fTmpData
DataSet * fTmpData
temporary event when testing on a different DataSet than the own one
Definition: MethodBase.h:446
TMVA::MethodBoost
Class for boosting a TMVA method.
Definition: MethodBoost.h:58
TMVA::Types::EAnalysisType
EAnalysisType
Definition: Types.h:128
TransformationHandler.h
TMVA::MethodBase::GetMaximumSignificance
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 ...
Definition: MethodBase.cxx:2886
TMVA::MethodBase::MethodBase
MethodBase(const TString &jobName, Types::EMVA methodType, const TString &methodTitle, DataSetInfo &dsi, const TString &theOption="")
standard constructor
Definition: MethodBase.cxx:237
TMVA::Types::ETreeType
ETreeType
Definition: Types.h:144
TMVA::MethodBase::fMethodName
TString fMethodName
Definition: MethodBase.h:615
TMVA::MethodBase::CheckSetup
virtual void CheckSetup()
check may be overridden by derived class (sometimes, eg, fitters are used which can only be implement...
Definition: MethodBase.cxx:433
TMVA::MethodBase::GetSignalReferenceCutOrientation
Double_t GetSignalReferenceCutOrientation() const
Definition: MethodBase.h:361
TMVA::MethodBase::AddVarsXMLTo
void AddVarsXMLTo(void *parent) const
write variable info to XML
Definition: MethodBase.cxx:1762
TMVA::MethodBase::fTxtWeightsOnly
Bool_t fTxtWeightsOnly
Definition: MethodBase.h:725
TMVA::DataSet::GetNEvents
Long64_t GetNEvents(Types::ETreeType type=Types::kMaxTreeType) const
Definition: DataSet.h:206
TMVA::MethodBase::fROOTTrainingVersion
UInt_t fROOTTrainingVersion
Definition: MethodBase.h:619
TMVA::MethodBase::fEventCollections
std::vector< const std::vector< TMVA::Event * > * > fEventCollections
Definition: MethodBase.h:708
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:101
TMVA::MethodBase::fTmpEvent
const Event * fTmpEvent
Definition: MethodBase.h:445
TMVA::MethodBase::~MethodBase
virtual ~MethodBase()
destructor
Definition: MethodBase.cxx:364
TMVA::MethodBase::GetMulticlassValues
virtual const std::vector< Float_t > & GetMulticlassValues()
Definition: MethodBase.h:227
TMVA::MethodBase::SetMethodBaseDir
void SetMethodBaseDir(TDirectory *methodDir)
Definition: MethodBase.h:374
TMVA::MethodBase::WriteEvaluationHistosToFile
virtual void WriteEvaluationHistosToFile(Types::ETreeType treetype)
writes all MVA evaluation histograms to file
Definition: MethodBase.cxx:2094
TMVA::MethodBase::TestRegression
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
Definition: MethodBase.cxx:991
TMVA::TSpline1
Linear interpolation of TGraph.
Definition: TSpline1.h:43
TMVA::DataSet
Class that contains all the data information.
Definition: DataSet.h:58
TMVA::RootFinder
Root finding using Brents algorithm (translated from CERNLIB function RZERO)
Definition: RootFinder.h:48
TMVA::MethodBase::fRanking
Ranking * fRanking
Definition: MethodBase.h:587
TMVA::MethodBase::NoErrorCalc
void NoErrorCalc(Double_t *const err, Double_t *const errUpper)
Definition: MethodBase.cxx:836
Event.h
TMVA::IPythonInteractive::fIndex
Int_t fIndex
Definition: MethodBase.h:108
TMVA::MethodBase::GetNEvents
UInt_t GetNEvents() const
Definition: MethodBase.h:416
TMVA::MethodBase::ReadStateFromFile
void ReadStateFromFile()
Function to write options and weights to file.
Definition: MethodBase.cxx:1426
TMVA::Factory
This is the main MVA steering class.
Definition: Factory.h:80
TMVA::MethodBase::GetWeightFileDir
const TString & GetWeightFileDir() const
Definition: MethodBase.h:492
TMVA::MethodBase::fVerbose
Bool_t fVerbose
Definition: MethodBase.h:676
TMVA::MethodBase::fSpleffBvsS
TSpline * fSpleffBvsS
Definition: MethodBase.h:652
TMVA::MethodBase::fIPyCurrentIter
UInt_t fIPyCurrentIter
Definition: MethodBase.h:450
TMVA::MethodBase::fNsmoothMVAPdf
Int_t fNsmoothMVAPdf
Definition: MethodBase.h:727
TMVA::MethodBase::GetKSTrainingVsTest
virtual Double_t GetKSTrainingVsTest(Char_t SorB, TString opt="X")
Definition: MethodBase.cxx:3396
TMVA::MethodBase::Statistics
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...
Definition: MethodBase.cxx:2942
TMVA::MethodBase::AddWeightsXMLTo
virtual void AddWeightsXMLTo(void *parent) const =0
TMVA::MethodBase::OptimizeTuningParameters
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.
Definition: MethodBase.cxx:623
TMVA::MethodBase::SetWeightFileDir
void SetWeightFileDir(TString fileDir)
set directory of weight file
Definition: MethodBase.cxx:2059
TMVA::MethodBase::fRmsS
Double_t fRmsS
Definition: MethodBase.h:663
TMVA::MethodBase::fJobName
TString fJobName
Definition: MethodBase.h:614
TMVA::MethodBase::DeclareBaseOptions
void DeclareBaseOptions()
define the options (their key words) that can be set in the option string here the options valid for ...
Definition: MethodBase.cxx:509
TMVA::MethodBase::GetMethodTypeName
TString GetMethodTypeName() const
Definition: MethodBase.h:332
TMVA::MethodBase
Virtual base Class for all MVA method.
Definition: MethodBase.h:111
TMVA::MethodBase::GetEventCollection
const std::vector< TMVA::Event * > & GetEventCollection(Types::ETreeType type)
returns the event collection (i.e.
Definition: MethodBase.cxx:3351
TMVA::MethodBase::DisableWriting
void DisableWriting(Bool_t setter)
Definition: MethodBase.h:442
TMVA::Types::kBackground
@ kBackground
Definition: Types.h:138
Types.h
Configurable.h
TMVA::Results
Class that is the base-class for a vector of result.
Definition: Results.h:57
TMVA::MethodBase::fSplTrainRefS
TSpline1 * fSplTrainRefS
Definition: MethodBase.h:705
TMVA::MethodBase::fTrainTime
Double_t fTrainTime
Definition: MethodBase.h:695
TMVA::MethodBase::fInputVars
std::vector< TString > * fInputVars
Definition: MethodBase.h:588
TFile
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
Definition: TFile.h:54
TMVA::VariableInfo::GetInternalName
const TString & GetInternalName() const
Definition: VariableInfo.h:58
TMVA::MethodBase::SetMethodDir
void SetMethodDir(TDirectory *methodDir)
Definition: MethodBase.h:372
TMVA::MethodBase::kTEXT
@ kTEXT
Definition: MethodBase.h:122
TMVA::MethodBase::WriteStateToXML
void WriteStateToXML(void *parent) const
general method used in writing the header of the weight files where the used variables,...
Definition: MethodBase.cxx:1331
unsigned int
TMVA::MethodBase::InitBase
void InitBase()
default initialization called by all constructors
Definition: MethodBase.cxx:441
TMVA::MethodBase::GetDataMvaValues
virtual std::vector< Double_t > GetDataMvaValues(DataSet *data=nullptr, Long64_t firstEvt=0, Long64_t lastEvt=-1, Bool_t logProgress=false)
get all the MVA values for the events of the given Data type
Definition: MethodBase.cxx:939
TMVA::MethodBase::DoRegression
Bool_t DoRegression() const
Definition: MethodBase.h:438
TMVA::MethodBase::fTestvar
TString fTestvar
Definition: MethodBase.h:617
TMVA::MethodBase::IsSilentFile
Bool_t IsSilentFile() const
Definition: MethodBase.h:379
TMVA::IMethod
Interface for all concrete MVA method implementations.
Definition: IMethod.h:53
TMVA::PDF
PDF wrapper for histograms; uses user-defined spline interpolation.
Definition: PDF.h:63
TMVA::Types::kTraining
@ kTraining
Definition: Types.h:145
TMVA::MethodBase::ReadVarsFromStream
void ReadVarsFromStream(std::istream &istr)
Read the variables (name, min, max) for a given data transformation method from the stream.
Definition: MethodBase.cxx:1725
TMVA::MethodBase::GetInputLabel
const TString & GetInputLabel(Int_t i) const
Definition: MethodBase.h:350
TMultiGraph
A TMultiGraph is a collection of TGraph (or derived) objects.
Definition: TMultiGraph.h:36
TMVA::MethodBase::fSplTrainB
PDF * fSplTrainB
Definition: MethodBase.h:655
TMVA::MethodBase::SetTuneParameters
virtual void SetTuneParameters(std::map< TString, Double_t > tuneParameters)
set the tuning parameters according to the argument This is just a dummy .
Definition: MethodBase.cxx:644
TMVA::MethodBase::GetTestvarName
const TString & GetTestvarName() const
Definition: MethodBase.h:335
TMVA::DataSetInfo::GetNTargets
UInt_t GetNTargets() const
Definition: DataSetInfo.h:128
TMVA::MethodBase::fXmax
Double_t fXmax
Definition: MethodBase.h:666
TMVA::MethodBase::AddInfoItem
void AddInfoItem(void *gi, const TString &name, const TString &value) const
xml writing
Definition: MethodBase.cxx:1306
TMVA::IPythonInteractive::Get
TMultiGraph * Get()
Definition: MethodBase.h:102
TMVA::MethodBase::fMethodType
Types::EMVA fMethodType
Definition: MethodBase.h:616
TMVA::MethodBase::EWeightFileType
EWeightFileType
Definition: MethodBase.h:122
TMVA::MethodBase::fRmsB
Double_t fRmsB
Definition: MethodBase.h:664
TMVA::MethodBase::fXmin
Double_t fXmin
Definition: MethodBase.h:665
TMVA::MethodBase::GetRMS
Double_t GetRMS(Int_t ivar) const
Definition: MethodBase.h:355
TMVA::MethodBase::GetSignificance
virtual Double_t GetSignificance() const
compute significance of mean difference
Definition: MethodBase.cxx:2776
TMVA::MethodBase::GetInputVar
const TString & GetInputVar(Int_t i) const
Definition: MethodBase.h:349
TMVA::IPythonInteractive::fGraphs
std::vector< TGraph * > fGraphs
Definition: MethodBase.h:106
Double_t
double Double_t
Definition: RtypesCore.h:59
TMVA::MethodBase::fBaseDir
TDirectory * fBaseDir
Definition: MethodBase.h:625
TGraph
A TGraph is an object made of two arrays X and Y with npoints each.
Definition: TGraph.h:41
TMVA::IPythonInteractive
This class is needed by JsMVA, and it's a helper class for tracking errors during the training in Jup...
Definition: MethodBase.h:94
TMVA::MethodBase::ExitFromTraining
void ExitFromTraining()
Definition: MethodBase.h:464
TMVA::MethodBase::fMVAPdfS
PDF * fMVAPdfS
Definition: MethodBase.h:645
TMVA::MethodBase::TxtWeightsOnly
Bool_t TxtWeightsOnly() const
Definition: MethodBase.h:534
TMVA::MethodBase::MakeClass
virtual void MakeClass(const TString &classFileName=TString("")) const
create reader class for method (classification only at present)
Definition: MethodBase.cxx:3007
TMVA::MethodBase::SetAnalysisType
virtual void SetAnalysisType(Types::EAnalysisType type)
Definition: MethodBase.h:436
TMVA::IPythonInteractive::ClearGraphs
void ClearGraphs()
This function sets the point number to 0 for all graphs.
Definition: MethodBase.cxx:193
TMVA::MethodBase::Help
Bool_t Help() const
Definition: MethodBase.h:504
TMVA::MethodBase::GetRegressionValues
virtual const std::vector< Float_t > & GetRegressionValues()
Definition: MethodBase.h:221
TMVA::Types::Instance
static Types & Instance()
the the single instance of "Types" if existing already, or create it (Singleton)
Definition: Types.cxx:69
TMVA::MethodBase::GetTestingEvent
const Event * GetTestingEvent(Long64_t ievt) const
Definition: MethodBase.h:777
file
Definition: file.py:1
TMVA::Types::EMVA
EMVA
Definition: Types.h:78
TH1F
1-D histogram with a float per channel (see TH1 documentation)}
Definition: TH1.h:575
TMVA::MethodBase::kNegative
@ kNegative
Definition: MethodBase.h:551
TMVA::MethodBase::GetMulticlassConfusionMatrix
virtual TMatrixD GetMulticlassConfusionMatrix(Double_t effB, Types::ETreeType type)
Construct a confusion matrix for a multiclass classifier.
Definition: MethodBase.cxx:2750
TMVA::MethodBase::GetName
const char * GetName() const
Definition: MethodBase.h:334
TMVA::MethodBase::MakeClassSpecific
virtual void MakeClassSpecific(std::ostream &, const TString &="") const
Definition: MethodBase.h:520
TMVA::MethodBase::MethodBaseDir
TDirectory * MethodBaseDir() const
returns the ROOT directory where all instances of the corresponding MVA method are stored
Definition: MethodBase.cxx:2020
TMVA::Event
Definition: Event.h:51
TMVA::TransformationHandler::GetMin
Double_t GetMin(Int_t ivar, Int_t cls=-1) const
Definition: TransformationHandler.cxx:972
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TMVA::MethodBase::SetBaseDir
void SetBaseDir(TDirectory *methodDir)
Definition: MethodBase.h:373
TH1
TH1 is the base class of all histogram classes in ROOT.
Definition: TH1.h:58
TMVA::MethodBase::fSplTrainS
PDF * fSplTrainS
Definition: MethodBase.h:654
TMVA::MethodBase::SetSignalReferenceCutOrientation
void SetSignalReferenceCutOrientation(Double_t cutOrientation)
Definition: MethodBase.h:365
TMVA::MethodBase::fNbinsH
Int_t fNbinsH
Definition: MethodBase.h:593
TMVA::MethodBase::ResetThisBase
void ResetThisBase()
TMVA::MethodBase::GetEvent
const Event * GetEvent() const
Definition: MethodBase.h:751
TMVA::MethodBase::GetEfficiency
virtual Double_t GetEfficiency(const TString &, Types::ETreeType, Double_t &err)
fill background efficiency (resp.
Definition: MethodBase.cxx:2302
TMVA::MethodBase::TestMulticlass
virtual void TestMulticlass()
test multiclass classification
Definition: MethodBase.cxx:1098
TMVA::VariableInfo::GetLabel
const TString & GetLabel() const
Definition: VariableInfo.h:59
name
char name[80]
Definition: TGX11.cxx:110
TMVA::MethodBase::GetMean
Double_t GetMean(Int_t ivar) const
Definition: MethodBase.h:354
TMVA::TransformationHandler::GetRMS
Double_t GetRMS(Int_t ivar, Int_t cls=-1) const
Definition: TransformationHandler.cxx:953
TMVA::MethodBase::fSignalReferenceCutOrientation
Double_t fSignalReferenceCutOrientation
Definition: MethodBase.h:610
TMVA::MethodBase::GetMethodType
Types::EMVA GetMethodType() const
Definition: MethodBase.h:333
TDirectory
Describe directory structure in memory.
Definition: TDirectory.h:45
TMVA::MethodBase::GetTransformationHandler
const TransformationHandler & GetTransformationHandler(Bool_t takeReroutedIfAvailable=true) const
Definition: MethodBase.h:398
TMVA::VariableInfo::GetExpression
const TString & GetExpression() const
Definition: VariableInfo.h:57
TMVA::MethodBase::SetFile
void SetFile(TFile *file)
Definition: MethodBase.h:375
TMVA::MethodBase::SetTestvarName
void SetTestvarName(const TString &v="")
Definition: MethodBase.h:341
TMVA::MethodBase::fTrainHistory
TrainingHistory fTrainHistory
Definition: MethodBase.h:425
TMVA::MethodBase::fNormalise
Bool_t fNormalise
Definition: MethodBase.h:722
TMVA::MethodBase::fFile
TFile * fFile
Definition: MethodBase.h:628
TMVA::MethodBase::GetTrainingHistory
virtual const std::vector< Float_t > & GetTrainingHistory(const char *)
Definition: MethodBase.h:233
TMVA::MethodBase::PrintHelpMessage
void PrintHelpMessage() const
prints out method-specific help method
Definition: MethodBase.cxx:3268
TMVA::MethodBase::SetTrainTime
void SetTrainTime(Double_t trainTime)
Definition: MethodBase.h:161
TMVA::MethodBase::CreateRanking
virtual const Ranking * CreateRanking()=0
TMVA::MethodBase::AddClassifierOutputProb
virtual void AddClassifierOutputProb(Types::ETreeType type)
prepare tree branch with the method's discriminating variable
Definition: MethodBase.cxx:950
TMVA::MethodBase::GetSignalReferenceCut
Double_t GetSignalReferenceCut() const
Definition: MethodBase.h:360
TMVA::MethodBase::GetTrainingEfficiency
virtual Double_t GetTrainingEfficiency(const TString &)
Definition: MethodBase.cxx:2528
TMVA::MethodBase::fVerbosityLevelString
TString fVerbosityLevelString
Definition: MethodBase.h:677
TMVA::DataSet::GetNTrainingEvents
Long64_t GetNTrainingEvents() const
Definition: DataSet.h:68
TMVA::MethodBase::AddOutput
void AddOutput(Types::ETreeType type, Types::EAnalysisType analysisType)
Definition: MethodBase.cxx:1315
TMVA::MethodBase::GetValueForRoot
virtual Double_t GetValueForRoot(Double_t)
returns efficiency as function of cut
Definition: MethodBase.cxx:3324
TMVA::MethodBase::HasTrainingTree
Bool_t HasTrainingTree() const
Definition: MethodBase.h:513
TMVA::MethodBase::fSplTrainEffBvsS
TSpline * fSplTrainEffBvsS
Definition: MethodBase.h:656
TMVA::MethodBase::InitIPythonInteractive
void InitIPythonInteractive()
Definition: MethodBase.h:455
type
int type
Definition: TGX11.cxx:121
TMVA::TransformationHandler::GetMax
Double_t GetMax(Int_t ivar, Int_t cls=-1) const
Definition: TransformationHandler.cxx:991
TMVA::MethodBase::fSplTrainRefB
TSpline1 * fSplTrainRefB
Definition: MethodBase.h:706
TMVA::MethodBase::fParentDir
TString fParentDir
Definition: MethodBase.h:635
TMVA::MethodBase::fConstructedFromWeightFile
Bool_t fConstructedFromWeightFile
Definition: MethodBase.h:620
Results.h
TMVA::TrainingHistory
Tracking data from training.
Definition: TrainingHistory.h:31
Char_t
char Char_t
Definition: RtypesCore.h:33
Classification
Class to perform two class classification.
TMVA::MethodBase::SetNormalised
void SetNormalised(Bool_t norm)
Definition: MethodBase.h:497
DataSet.h
TMVA::MethodBase::AddTargetsXMLTo
void AddTargetsXMLTo(void *parent) const
write target info to XML
Definition: MethodBase.cxx:1821
TMVA::MethodBase::DeclareOptions
virtual void DeclareOptions()=0
TMVA::MethodBase::GetInternalVarName
const TString & GetInternalVarName(Int_t ivar) const
Definition: MethodBase.h:510
TMVA::MethodBase::GetRegressionDeviation
virtual void GetRegressionDeviation(UInt_t tgtNum, Types::ETreeType type, Double_t &stddev, Double_t &stddev90Percent) const
Definition: MethodBase.cxx:724
TMVA::MethodBase::fTestTime
Double_t fTestTime
Definition: MethodBase.h:696
TMVA::MethodBase::ProcessSetup
void ProcessSetup()
process all options the "CheckForUnusedOptions" is done in an independent call, since it may be overr...
Definition: MethodBase.cxx:423
TMVA::MethodBase::fAnalysisType
Types::EAnalysisType fAnalysisType
Definition: MethodBase.h:595
TMVA::CrossValidation
Class to perform cross validation, splitting the dataloader into folds.
Definition: CrossValidation.h:124
TMVA::MethodBase::fIgnoreNegWeightsInTraining
Bool_t fIgnoreNegWeightsInTraining
Definition: MethodBase.h:682
TMVA::MethodBase::ReadSpectatorsFromXML
void ReadSpectatorsFromXML(void *specnode)
read spectator info from XML
Definition: MethodBase.cxx:1877
TMVA
create variable transformations
Definition: GeneticMinimizer.h:22
int
TMVA::MethodBase::GetCutOrientation
ECutOrientation GetCutOrientation() const
Definition: MethodBase.h:552
TMVA::MethodBase::GetInteractiveTrainingError
TMultiGraph * GetInteractiveTrainingError()
Definition: MethodBase.h:461
TMVA::MethodBase::fNbinsMVAPdf
Int_t fNbinsMVAPdf
Definition: MethodBase.h:726
TMVA::MethodBase::fUseDecorr
Bool_t fUseDecorr
Definition: MethodBase.h:723
TMVA::MethodBase::GetTrainTime
Double_t GetTrainTime() const
Definition: MethodBase.h:162