Logo ROOT  
Reference Guide
MethodHMatrix.h
Go to the documentation of this file.
1 // @(#)root/tmva $Id$
2 // Author: Andreas Hoecker, Joerg Stelzer, Helge Voss, Kai Voss
3 
4 /**********************************************************************************
5  * Project: TMVA - a Root-integrated toolkit for multivariate data analysis *
6  * Package: TMVA *
7  * Class : MethodHMatrix *
8  * Web : http://tmva.sourceforge.net *
9  * *
10  * Description: *
11  * H-Matrix method, which is implemented as a simple comparison of *
12  * chi-squared estimators for signal and background, taking into account *
13  * the linear correlations between the input variables. *
14  * Method is (also) used by D0 Collaboration (FNAL) for electron *
15  * identification; for more information, see, eg, *
16  * http://www-d0.fnal.gov/d0dist/dist/packages/tau_hmchisq/devel/doc/ *
17  * *
18  * Authors (alphabetical): *
19  * Andreas Hoecker <Andreas.Hocker@cern.ch> - CERN, Switzerland *
20  * Helge Voss <Helge.Voss@cern.ch> - MPI-K Heidelberg, Germany *
21  * Kai Voss <Kai.Voss@cern.ch> - U. of Victoria, Canada *
22  * *
23  * Copyright (c) 2005: *
24  * CERN, Switzerland *
25  * U. of Victoria, Canada *
26  * MPI-K Heidelberg, 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_MethodHMatrix
34 #define ROOT_TMVA_MethodHMatrix
35 
36 //////////////////////////////////////////////////////////////////////////
37 // //
38 // MethodHMatrix //
39 // //
40 // H-Matrix method, which is implemented as a simple comparison of //
41 // chi-squared estimators for signal and background, taking into //
42 // account the linear correlations between the input variables //
43 // //
44 //////////////////////////////////////////////////////////////////////////
45 
46 #include "TMVA/MethodBase.h"
47 #include "TMatrixDfwd.h"
48 #include "TVectorD.h"
49 
50 namespace TMVA {
51 
52  class MethodHMatrix : public MethodBase {
53 
54  public:
55 
56  MethodHMatrix( const TString& jobName,
57  const TString& methodTitle,
58  DataSetInfo& theData,
59  const TString& theOption = "");
60 
61  MethodHMatrix( DataSetInfo& theData,
62  const TString& theWeightFile);
63 
64  virtual ~MethodHMatrix();
65 
66  virtual Bool_t HasAnalysisType( Types::EAnalysisType type, UInt_t numberClasses, UInt_t numberTargets );
67 
68  // training method
69  void Train();
70 
72 
73  // write weights to file
74  void AddWeightsXMLTo( void* parent ) const;
75 
76  // read weights from file
77  void ReadWeightsFromStream( std::istream& istr );
78  void ReadWeightsFromXML( void* wghtnode );
79  // calculate the MVA value
80  Double_t GetMvaValue( Double_t* err = 0, Double_t* errUpper = 0 );
81 
82  // ranking of input variables
83  const Ranking* CreateRanking() { return 0; }
84 
85  protected:
86 
87  // make ROOT-independent C++ class for classifier response (classifier-specific implementation)
88  void MakeClassSpecific( std::ostream&, const TString& ) const;
89 
90  // get help message text
91  void GetHelpMessage() const;
92 
93  private:
94 
95  // the option handling methods
96  void DeclareOptions();
97  void ProcessOptions();
98 
99  // returns chi2 estimator for given type (signal or background)
101 
102  // compute correlation matrices
104 
105  // arrays of input evt vs. variable
106  TMatrixD* fInvHMatrixS; // inverse H-matrix (signal)
107  TMatrixD* fInvHMatrixB; // inverse H-matrix (background)
108  TVectorD* fVecMeanS; // vector of mean values (signal)
109  TVectorD* fVecMeanB; // vector of mean values (background)
110 
111  // default initialisation method called by all constructors
112  void Init();
113 
114  ClassDef(MethodHMatrix,0); // H-Matrix method, a simple comparison of chi-squared estimators for signal and background
115  };
116 
117 } // namespace TMVA
118 
119 #endif
TMatrixDfwd.h
TMVA::MethodHMatrix::~MethodHMatrix
virtual ~MethodHMatrix()
destructor
Definition: MethodHMatrix.cxx:127
TVectorD.h
TMVA::MethodHMatrix::fInvHMatrixS
TMatrixD * fInvHMatrixS
Definition: MethodHMatrix.h:106
TMVA::MethodHMatrix::MethodHMatrix
MethodHMatrix(const TString &jobName, const TString &methodTitle, DataSetInfo &theData, const TString &theOption="")
standard constructor for the H-Matrix method
Definition: MethodHMatrix.cxx:83
TMVA::MethodHMatrix::Train
void Train()
computes H-matrices for signal and background samples
Definition: MethodHMatrix.cxx:162
TMVA::MethodBase::ReadWeightsFromStream
virtual void ReadWeightsFromStream(std::istream &)=0
TMVA::MethodHMatrix::ReadWeightsFromXML
void ReadWeightsFromXML(void *wghtnode)
read weights from XML file
Definition: MethodHMatrix.cxx:340
TMVA::Ranking
Ranking for variables in method (implementation)
Definition: Ranking.h:48
TMVA::MethodHMatrix::HasAnalysisType
virtual Bool_t HasAnalysisType(Types::EAnalysisType type, UInt_t numberClasses, UInt_t numberTargets)
FDA can handle classification with 2 classes and regression with one regression-target.
Definition: MethodHMatrix.cxx:138
TMVA::MethodHMatrix::fVecMeanS
TVectorD * fVecMeanS
Definition: MethodHMatrix.h:108
TMVA::MethodHMatrix::DeclareOptions
void DeclareOptions()
MethodHMatrix options: none (apart from those implemented in MethodBase)
Definition: MethodHMatrix.cxx:148
TMVA::MethodHMatrix::ComputeCovariance
void ComputeCovariance(Bool_t, TMatrixD *)
compute covariance matrix
Definition: MethodHMatrix.cxx:204
MethodBase.h
TString
Basic string class.
Definition: TString.h:136
TMatrixT< Double_t >
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TMVA::MethodHMatrix::CreateRanking
const Ranking * CreateRanking()
Definition: MethodHMatrix.h:83
bool
TMVA::Types::ESBType
ESBType
Definition: Types.h:136
TMVA::MethodHMatrix::fInvHMatrixB
TMatrixD * fInvHMatrixB
Definition: MethodHMatrix.h:107
TMVA::DataSetInfo
Class that contains all the data information.
Definition: DataSetInfo.h:62
TMVA::Types::EAnalysisType
EAnalysisType
Definition: Types.h:128
TMVA::MethodHMatrix::AddWeightsXMLTo
void AddWeightsXMLTo(void *parent) const
create XML description for HMatrix classification
Definition: MethodHMatrix.cxx:328
TMVA::MethodHMatrix::Init
void Init()
default initialization called by all constructors
Definition: MethodHMatrix.cxx:111
TMVA::MethodHMatrix::GetChi2
Double_t GetChi2(Types::ESBType)
compute chi2-estimator for event according to type (signal/background)
Definition: MethodHMatrix.cxx:287
TMVA::MethodBase
Virtual base Class for all MVA method.
Definition: MethodBase.h:111
TMVA::MethodHMatrix::MakeClassSpecific
void MakeClassSpecific(std::ostream &, const TString &) const
write Fisher-specific classifier response
Definition: MethodHMatrix.cxx:382
unsigned int
TMVA::MethodHMatrix::GetHelpMessage
void GetHelpMessage() const
get help message text
Definition: MethodHMatrix.cxx:477
TVectorT< Double_t >
Double_t
double Double_t
Definition: RtypesCore.h:59
TMVA::MethodHMatrix::fVecMeanB
TVectorD * fVecMeanB
Definition: MethodHMatrix.h:109
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
type
int type
Definition: TGX11.cxx:121
TMVA::MethodHMatrix
H-Matrix method, which is implemented as a simple comparison of chi-squared estimators for signal and...
Definition: MethodHMatrix.h:52
TMVA
create variable transformations
Definition: GeneticMinimizer.h:22
TMVA::MethodHMatrix::GetMvaValue
Double_t GetMvaValue(Double_t *err=0, Double_t *errUpper=0)
returns the H-matrix signal estimator
Definition: MethodHMatrix.cxx:271
TMVA::MethodHMatrix::ReadWeightsFromStream
virtual void ReadWeightsFromStream(std::istream &)=0
TMVA::MethodHMatrix::ProcessOptions
void ProcessOptions()
process user options
Definition: MethodHMatrix.cxx:155