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
49namespace 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 virtual void MakeClass( const TString& = TString("") ) const {};
97
98 private :
99
100 // initializing mostly monitoring tools of the category process
101 void Init();
102
103 // the option handling methods
104 void DeclareOptions();
105 void ProcessOptions();
106
107 // build the cut formula for event categorization
108 Bool_t PassesCut( const Event* ev, UInt_t methodIdx );
109
110 protected:
111
112 // vectors that contain the added methods and the cuts on which they are to be called
113 std::vector<IMethod*> fMethods;
114 std::vector<TCut> fCategoryCuts;
115 std::vector<UInt_t> fCategorySpecIdx;
116 std::vector<TString> fVars;
117 std::vector <std::vector <UInt_t> > fVarMaps;
118
119 // get help message text
120 void GetHelpMessage() const;
121
122 TMVA::DataSetInfo& CreateCategoryDSI(const TCut&, const TString&, const TString&);
123
124 private:
125
126 void InitCircularTree(const DataSetInfo& dsi);
127
128 TTree * fCatTree; //! needed in conjunction with TTreeFormulas for evaluation category expressions
129 std::vector<TTreeFormula*> fCatFormulas;
130
132 friend class Factory; // DSMTEST
133 friend class Reader; // DSMTEST
134 friend class MethodBoost; // DSMTEST
135
137 };
138}
139
140#endif
unsigned int UInt_t
Definition: RtypesCore.h:44
bool Bool_t
Definition: RtypesCore.h:61
double Double_t
Definition: RtypesCore.h:57
#define ClassDef(name, id)
Definition: Rtypes.h:322
int type
Definition: TGX11.cxx:120
A specialized string object used for TTree selections.
Definition: TCut.h:25
Class to perform two class classification.
Class that contains all the data information.
Definition: DataSetInfo.h:60
Class that contains all the data information.
This is the main MVA steering class.
Definition: Factory.h:81
Interface for all concrete MVA method implementations.
Definition: IMethod.h:54
friend class MethodCategory
Definition: MethodBase.h:268
Class for boosting a TMVA method.
Definition: MethodBoost.h:58
Class for categorizing the phase space.
void InitCircularTree(const DataSetInfo &dsi)
initialize the circular tree
void GetHelpMessage() const
Get help message text.
void Init()
initialize the method
Bool_t PassesCut(const Event *ev, UInt_t methodIdx)
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...
void ProcessOptions()
process user options
virtual void MakeClass(const TString &=TString("")) const
create reader class for method (classification only at present)
Double_t GetMvaValue(Double_t *err=0, Double_t *errUpper=0)
returns the mva value of the right sub-classifier
std::vector< std::vector< UInt_t > > fVarMaps
TMVA::DataSetInfo & CreateCategoryDSI(const TCut &, const TString &, const TString &)
create a DataSetInfo object for a sub-classifier
std::vector< IMethod * > fMethods
void DeclareOptions()
options for this method
DataSetManager * fDataSetManager
void AddWeightsXMLTo(void *parent) const
create XML description of Category classifier
const Ranking * CreateRanking()
no ranking
std::vector< UInt_t > fCategorySpecIdx
std::vector< TString > fVars
virtual ~MethodCategory(void)
destructor
virtual const std::vector< Float_t > & GetRegressionValues()
returns the mva value of the right sub-classifier
std::vector< TTreeFormula * > fCatFormulas
needed in conjunction with TTreeFormulas for evaluation category expressions
std::vector< TCut > fCategoryCuts
TMVA::IMethod * AddMethod(const TCut &, const TString &theVariables, Types::EMVA theMethod, const TString &theTitle, const TString &theOptions)
adds sub-classifier for a category
void ReadWeightsFromXML(void *wghtnode)
read weights of sub-classifiers of MethodCategory from xml weight file
void Train(void)
train all sub-classifiers
Virtual base class for combining several TMVA method.
Ranking for variables in method (implementation)
Definition: Ranking.h:48
The Reader class serves to use the MVAs in a specific analysis context.
Definition: Reader.h:63
EAnalysisType
Definition: Types.h:127
Basic string class.
Definition: TString.h:131
A TTree represents a columnar dataset.
Definition: TTree.h:78
create variable transformations