Logo ROOT  
Reference Guide
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 #include "TMVA/MethodBase.h"
46 
48 
49 namespace TMVA {
50 
51  class Factory; // DSMTEST
52  class Reader; // DSMTEST
53  class MethodBoost; // DSMTEST
54  class DataSetManager; // DSMTEST
55  namespace Experimental {
56  class Classification;
57  }
60 
61  public :
62 
63  // constructors
64  MethodCategory( const TString& jobName,
65  const TString& methodTitle,
66  DataSetInfo& theData,
67  const TString& theOption = "" );
68 
70  const TString& theWeightFile );
71 
72  virtual ~MethodCategory( void );
73 
74  virtual Bool_t HasAnalysisType( Types::EAnalysisType type, UInt_t numberClasses, UInt_t /*numberTargets*/ );
75  // training and boosting all the classifiers
76  void Train( void );
77 
78  // ranking of input variables
79  const Ranking* CreateRanking();
80 
81  // saves the name and options string of the boosted classifier
83  const TString& theVariables,
84  Types::EMVA theMethod,
85  const TString& theTitle,
86  const TString& theOptions);
87 
88  void AddWeightsXMLTo( void* parent ) const;
89  void ReadWeightsFromXML( void* wghtnode );
90 
91  Double_t GetMvaValue( Double_t* err=0, Double_t* errUpper = 0 );
92 
93  // regression response
94  virtual const std::vector<Float_t>& GetRegressionValues();
95 
96  // multi class response
97  virtual const std::vector<Float_t> &GetMulticlassValues();
98 
99  virtual void MakeClass( const TString& = TString("") ) const {};
100 
101  protected :
102 
103  // signal/background classification response for all current set of data
104  virtual std::vector<Double_t> GetMvaValues(Long64_t firstEvt = 0, Long64_t lastEvt = -1, Bool_t logProgress = false);
105 
106  private:
107  // initializing mostly monitoring tools of the category process
108  void Init();
109 
110  // the option handling methods
111  void DeclareOptions();
112  void ProcessOptions();
113 
114  // build the cut formula for event categorization
115  Bool_t PassesCut( const Event* ev, UInt_t methodIdx );
116 
117  protected:
118 
119  // vectors that contain the added methods and the cuts on which they are to be called
120  std::vector<IMethod*> fMethods;
121  std::vector<TCut> fCategoryCuts;
122  std::vector<UInt_t> fCategorySpecIdx;
123  std::vector<TString> fVars;
124  std::vector <std::vector <UInt_t> > fVarMaps;
125 
126  // get help message text
127  void GetHelpMessage() const;
128 
129  TMVA::DataSetInfo& CreateCategoryDSI(const TCut&, const TString&, const TString&);
130 
131  private:
132 
133  void InitCircularTree(const DataSetInfo& dsi);
134 
135  TTree * fCatTree; //! needed in conjunction with TTreeFormulas for evaluation category expressions
136  std::vector<TTreeFormula*> fCatFormulas;
137 
139  friend class Factory; // DSMTEST
140  friend class Reader; // DSMTEST
141  friend class MethodBoost; // DSMTEST
142 
144  };
145 }
146 
147 #endif
TMVA::MethodCategory::HasAnalysisType
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...
Definition: MethodCategory.cxx:116
TMVA::MethodCategory::AddMethod
TMVA::IMethod * AddMethod(const TCut &, const TString &theVariables, Types::EMVA theMethod, const TString &theTitle, const TString &theOptions)
adds sub-classifier for a category
Definition: MethodCategory.cxx:138
TCut
A specialized string object used for TTree selections.
Definition: TCut.h:25
TMVA::Experimental::Classification
Definition: Classification.h:163
TMVA::Ranking
Ranking for variables in method (implementation)
Definition: Ranking.h:48
TMVA::MethodCategory::GetRegressionValues
virtual const std::vector< Float_t > & GetRegressionValues()
returns the mva value of the right sub-classifier
Definition: MethodCategory.cxx:757
Long64_t
long long Long64_t
Definition: RtypesCore.h:80
TTree
A TTree represents a columnar dataset.
Definition: TTree.h:79
TMVA::MethodCategory::ProcessOptions
void ProcessOptions()
process user options
Definition: MethodCategory.cxx:537
TMVA::MethodCategory::fMethods
std::vector< IMethod * > fMethods
Definition: MethodCategory.h:120
MethodBase.h
TMVA::MethodCategory::fCategorySpecIdx
std::vector< UInt_t > fCategorySpecIdx
Definition: MethodCategory.h:122
TString
Basic string class.
Definition: TString.h:136
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TMVA::MethodCategory
Class for categorizing the phase space.
Definition: MethodCategory.h:58
TMVA::MethodCategory::PassesCut
Bool_t PassesCut(const Event *ev, UInt_t methodIdx)
Definition: MethodCategory.cxx:569
TMVA::MethodCompositeBase
Virtual base class for combining several TMVA method.
Definition: MethodCompositeBase.h:50
bool
TMVA::MethodCategory::DeclareOptions
void DeclareOptions()
options for this method
Definition: MethodCategory.cxx:131
TMVA::MethodCategory::AddWeightsXMLTo
void AddWeightsXMLTo(void *parent) const
create XML description of Category classifier
Definition: MethodCategory.cxx:444
TMVA::MethodCategory::~MethodCategory
virtual ~MethodCategory(void)
destructor
Definition: MethodCategory.cxx:104
TMVA::MethodCategory::fVarMaps
std::vector< std::vector< UInt_t > > fVarMaps
Definition: MethodCategory.h:124
TMVA::MethodCategory::fCatTree
TTree * fCatTree
Definition: MethodCategory.h:135
TMVA::DataSetInfo
Class that contains all the data information.
Definition: DataSetInfo.h:62
TMVA::MethodCategory::Train
void Train(void)
train all sub-classifiers
Definition: MethodCategory.cxx:367
TMVA::MethodCategory::MakeClass
virtual void MakeClass(const TString &=TString("")) const
create reader class for method (classification only at present)
Definition: MethodCategory.h:99
TMVA::MethodCategory::GetMvaValues
virtual std::vector< Double_t > GetMvaValues(Long64_t firstEvt=0, Long64_t lastEvt=-1, Bool_t logProgress=false)
returns the mva values of the right sub-classifier
Definition: MethodCategory.cxx:643
TMVA::MethodBoost
Class for boosting a TMVA method.
Definition: MethodBoost.h:58
TMVA::MethodBase::MethodCategory
friend class MethodCategory
Definition: MethodBase.h:269
TMVA::Types::EAnalysisType
EAnalysisType
Definition: Types.h:128
TMVA::MethodCategory::CreateRanking
const Ranking * CreateRanking()
no ranking
Definition: MethodCategory.cxx:562
TMVA::MethodCategory::InitCircularTree
void InitCircularTree(const DataSetInfo &dsi)
initialize the circular tree
Definition: MethodCategory.cxx:316
TMVA::MethodCategory::Init
void Init()
initialize the method
Definition: MethodCategory.cxx:309
TMVA::MethodCompositeBase::GetMvaValue
virtual Double_t GetMvaValue(Double_t *errLower=0, Double_t *errUpper=0)=0
TMVA::Factory
This is the main MVA steering class.
Definition: Factory.h:80
TMVA::MethodCategory::GetMulticlassValues
virtual const std::vector< Float_t > & GetMulticlassValues()
returns the mva values of the multi-class right sub-classifier
Definition: MethodCategory.cxx:715
UInt_t
unsigned int UInt_t
Definition: RtypesCore.h:46
TMVA::MethodCategory::fCatFormulas
std::vector< TTreeFormula * > fCatFormulas
needed in conjunction with TTreeFormulas for evaluation category expressions
Definition: MethodCategory.h:136
unsigned int
TMVA::IMethod
Interface for all concrete MVA method implementations.
Definition: IMethod.h:53
TMVA::DataSetManager
Class that contains all the data information.
Definition: DataSetManager.h:51
Double_t
double Double_t
Definition: RtypesCore.h:59
TMVA::Types::EMVA
EMVA
Definition: Types.h:78
TMVA::MethodCategory::CreateCategoryDSI
TMVA::DataSetInfo & CreateCategoryDSI(const TCut &, const TString &, const TString &)
create a DataSetInfo object for a sub-classifier
Definition: MethodCategory.cxx:200
TMVA::Event
Definition: Event.h:51
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TMVA::MethodCategory::fDataSetManager
DataSetManager * fDataSetManager
Definition: MethodCategory.h:138
TMVA::MethodCategory::fCategoryCuts
std::vector< TCut > fCategoryCuts
Definition: MethodCategory.h:121
TMVA::MethodCategory::ReadWeightsFromXML
void ReadWeightsFromXML(void *wghtnode)
read weights of sub-classifiers of MethodCategory from xml weight file
Definition: MethodCategory.cxx:465
MethodCompositeBase.h
type
int type
Definition: TGX11.cxx:121
TMVA::Reader
The Reader class serves to use the MVAs in a specific analysis context.
Definition: Reader.h:64
TMVA::MethodCategory::GetHelpMessage
void GetHelpMessage() const
Get help message text.
Definition: MethodCategory.cxx:547
Classification
Class to perform two class classification.
TMVA::MethodCategory::fVars
std::vector< TString > fVars
Definition: MethodCategory.h:123
TMVA
create variable transformations
Definition: GeneticMinimizer.h:22