Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 * *
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 * (see tmva/doc/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 = nullptr, Double_t* errUpper = nullptr );
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
bool Bool_t
Definition RtypesCore.h:63
unsigned int UInt_t
Definition RtypesCore.h:46
long long Long64_t
Definition RtypesCore.h:80
#define ClassDef(name, id)
Definition Rtypes.h:337
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
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:62
Class that contains all the data information.
This is the main MVA steering class.
Definition Factory.h:80
Interface for all concrete MVA method implementations.
Definition IMethod.h:53
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)
virtual const std::vector< Float_t > & GetMulticlassValues()
returns the mva values of the multi-class right sub-classifier
std::vector< std::vector< UInt_t > > fVarMaps
Double_t GetMvaValue(Double_t *err=nullptr, Double_t *errUpper=nullptr)
returns the mva value of the right sub-classifier
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
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
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:64
Basic string class.
Definition TString.h:139
A TTree represents a columnar dataset.
Definition TTree.h:79
create variable transformations