Logo ROOT   6.16/01
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
50namespace 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
unsigned int UInt_t
Definition: RtypesCore.h:42
bool Bool_t
Definition: RtypesCore.h:59
double Double_t
Definition: RtypesCore.h:55
#define ClassDef(name, id)
Definition: Rtypes.h:324
int type
Definition: TGX11.cxx:120
Class that contains all the data information.
Definition: DataSetInfo.h:60
Virtual base Class for all MVA method.
Definition: MethodBase.h:109
virtual void ReadWeightsFromStream(std::istream &)=0
H-Matrix method, which is implemented as a simple comparison of chi-squared estimators for signal and...
Definition: MethodHMatrix.h:52
virtual ~MethodHMatrix()
destructor
MethodHMatrix(const TString &jobName, const TString &methodTitle, DataSetInfo &theData, const TString &theOption="")
standard constructor for the H-Matrix method
TMatrixD * fInvHMatrixS
void ComputeCovariance(Bool_t, TMatrixD *)
compute covariance matrix
void DeclareOptions()
MethodHMatrix options: none (apart from those implemented in MethodBase)
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.
Double_t GetChi2(Types::ESBType)
compute chi2-estimator for event according to type (signal/background)
void ProcessOptions()
process user options
void MakeClassSpecific(std::ostream &, const TString &) const
write Fisher-specific classifier response
void Init()
default initialization called by all constructors
void GetHelpMessage() const
get help message text
const Ranking * CreateRanking()
Definition: MethodHMatrix.h:83
void ReadWeightsFromXML(void *wghtnode)
read weights from XML file
void Train()
computes H-matrices for signal and background samples
Double_t GetMvaValue(Double_t *err=0, Double_t *errUpper=0)
returns the H-matrix signal estimator
void ReadWeightsFromStream(std::istream &istr)
read variable names and min/max NOTE: the latter values are mandatory for the normalisation in the re...
TMatrixD * fInvHMatrixB
void AddWeightsXMLTo(void *parent) const
create XML description for HMatrix classification
Ranking for variables in method (implementation)
Definition: Ranking.h:48
EAnalysisType
Definition: Types.h:127
Basic string class.
Definition: TString.h:131
Abstract ClassifierFactory template that handles arbitrary types.