ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
MethodCategory.h
Go to the documentation of this file.
1 // @(#)root/tmva $Id$
2 // Author: Andreas Hoecker, Joerg Stelzer, Helge Voss, Kai Voss,Or Cohen
3 
4 /**********************************************************************************
5  * Project: TMVA - a Root-integrated toolkit for multivariate data analysis *
6  * Package: TMVA *
7  * Class : MethodCompositeBase *
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  * 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: *
21  * CERN, Switzerland *
22  * U. of Victoria, Canada *
23  * MPI-K Heidelberg, Germany *
24  * LAPP, Annecy, France *
25  * *
26  * Redistribution and use in source and binary forms, with or without *
27  * modification, are permitted according to the terms listed in LICENSE *
28  * (http://tmva.sourceforge.net/LICENSE) *
29  **********************************************************************************/
30 
31 #ifndef ROOT_TMVA_MethodCategory
32 #define ROOT_TMVA_MethodCategory
33 
34 //////////////////////////////////////////////////////////////////////////
35 // //
36 // MethodCategory //
37 // //
38 // Class for categorizing the phase space //
39 // //
40 //////////////////////////////////////////////////////////////////////////
41 
42 #include <iosfwd>
43 #include <vector>
44 
45 #ifndef ROOT_TMVA_MethodBase
46 #include "TMVA/MethodBase.h"
47 #endif
48 
49 #ifndef ROOT_TMVA_MethodCompositeBase
51 #endif
52 
53 namespace TMVA {
54 
55  class Factory; // DSMTEST
56  class Reader; // DSMTEST
57  class MethodBoost; // DSMTEST
58  class DataSetManager; // DSMTEST
59 
61 
62  public :
63 
64  // constructors
65  MethodCategory( const TString& jobName,
66  const TString& methodTitle,
67  DataSetInfo& theData,
68  const TString& theOption = "",
69  TDirectory* theTargetDir = NULL );
70 
72  const TString& theWeightFile,
73  TDirectory* theTargetDir = NULL );
74 
75  virtual ~MethodCategory( void );
76 
77  virtual Bool_t HasAnalysisType( Types::EAnalysisType type, UInt_t numberClasses, UInt_t /*numberTargets*/ );
78  // training and boosting all the classifiers
79  void Train( void );
80 
81  // ranking of input variables
82  const Ranking* CreateRanking();
83 
84  // saves the name and options string of the boosted classifier
86  const TString& theVariables,
87  Types::EMVA theMethod,
88  const TString& theTitle,
89  const TString& theOptions);
90 
91  void AddWeightsXMLTo( void* parent ) const;
92  void ReadWeightsFromXML( void* wghtnode );
93 
94  Double_t GetMvaValue( Double_t* err=0, Double_t* errUpper = 0 );
95 
96  // regression response
97  virtual const std::vector<Float_t>& GetRegressionValues();
98 
99  virtual void MakeClass( const TString& = TString("") ) const {};
100 
101  private :
102 
103  // initializing mostly monitoring tools of the category process
104  void Init();
105 
106  // the option handling methods
107  void DeclareOptions();
108  void ProcessOptions();
109 
110  // build the cut formula for event categorization
111  Bool_t PassesCut( const Event* ev, UInt_t methodIdx );
112 
113  protected:
114 
115  // vectors that contain the added methods and the cuts on which they are to be called
116  std::vector<IMethod*> fMethods;
117  std::vector<TCut> fCategoryCuts;
118  std::vector<UInt_t> fCategorySpecIdx;
119  std::vector<TString> fVars;
120  std::vector <std::vector <UInt_t> > fVarMaps;
121 
122  // get help message text
123  void GetHelpMessage() const;
124 
125  TMVA::DataSetInfo& CreateCategoryDSI(const TCut&, const TString&, const TString&);
126 
127  private:
128 
129  void InitCircularTree(const DataSetInfo& dsi);
130 
131  TTree * fCatTree; //! needed in conjunction with TTreeFormulas for evaluation category expressions
132  std::vector<TTreeFormula*> fCatFormulas;
133 
135  friend class Factory; // DSMTEST
136  friend class Reader; // DSMTEST
137  friend class MethodBoost; // DSMTEST
138 
140  };
141 }
142 
143 #endif
std::vector< IMethod * > fMethods
void Init()
initialize the method
TMVA::IMethod * AddMethod(const TCut &, const TString &theVariables, Types::EMVA theMethod, const TString &theTitle, const TString &theOptions)
adds sub-classifier for a category
void AddWeightsXMLTo(void *parent) const
create XML description of Category classifier
void InitCircularTree(const DataSetInfo &dsi)
initialize the circular tree
EAnalysisType
Definition: Types.h:124
std::vector< TCut > fCategoryCuts
std::vector< UInt_t > fCategorySpecIdx
Basic string class.
Definition: TString.h:137
bool Bool_t
Definition: RtypesCore.h:59
virtual ~MethodCategory(void)
destructor
void GetHelpMessage() const
Get help message text.
std::vector< std::vector< UInt_t > > fVarMaps
#define ClassDef(name, id)
Definition: Rtypes.h:254
void DeclareOptions()
options for this method
MethodCategory(const TString &jobName, const TString &methodTitle, DataSetInfo &theData, const TString &theOption="", TDirectory *theTargetDir=NULL)
A specialized string object used for TTree selections.
Definition: TCut.h:27
std::vector< TTreeFormula * > fCatFormulas
needed in conjunction with TTreeFormulas for evaluation category expressions
const Ranking * CreateRanking()
no ranking
TMVA::DataSetInfo & CreateCategoryDSI(const TCut &, const TString &, const TString &)
create a DataSetInfo object for a sub-classifier
unsigned int UInt_t
Definition: RtypesCore.h:42
DataSetManager * fDataSetManager
void Train(void)
train all sub-classifiers
double Double_t
Definition: RtypesCore.h:55
Describe directory structure in memory.
Definition: TDirectory.h:44
int type
Definition: TGX11.cxx:120
virtual Bool_t HasAnalysisType(Types::EAnalysisType type, UInt_t numberClasses, UInt_t)
check whether method category has analysis type the method type has to be the same for all sub-method...
std::vector< TString > fVars
Double_t GetMvaValue(Double_t *err=0, Double_t *errUpper=0)
returns the mva value of the right sub-classifier
#define NULL
Definition: Rtypes.h:82
A TTree object has a header with a name and a title.
Definition: TTree.h:98
void ReadWeightsFromXML(void *wghtnode)
read weights of sub-classifiers of MethodCategory from xml weight file
Bool_t PassesCut(const Event *ev, UInt_t methodIdx)
virtual const std::vector< Float_t > & GetRegressionValues()
returns the mva value of the right sub-classifier
virtual void MakeClass(const TString &=TString("")) const
create reader class for method (classification only at present)
void ProcessOptions()
process user options