Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 * *
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 * (see tmva/doc/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 = nullptr, Double_t* errUpper = nullptr );
81
82 // ranking of input variables
83 const Ranking* CreateRanking() { return nullptr; }
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
bool Bool_t
Definition RtypesCore.h:63
double Double_t
Definition RtypesCore.h:59
#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
Class that contains all the data information.
Definition DataSetInfo.h:62
Virtual base Class for all MVA method.
Definition MethodBase.h:111
virtual void ReadWeightsFromStream(std::istream &)=0
H-Matrix method, which is implemented as a simple comparison of chi-squared estimators for signal and...
Double_t GetMvaValue(Double_t *err=nullptr, Double_t *errUpper=nullptr)
returns the H-matrix signal estimator
virtual ~MethodHMatrix()
destructor
TMatrixD * fInvHMatrixS
inverse H-matrix (signal)
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
TVectorD * fVecMeanS
vector of mean values (signal)
const Ranking * CreateRanking()
void ReadWeightsFromXML(void *wghtnode)
read weights from XML file
void Train()
computes H-matrices for signal and background samples
TVectorD * fVecMeanB
vector of mean values (background)
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
inverse H-matrix (background)
void AddWeightsXMLTo(void *parent) const
create XML description for HMatrix classification
Ranking for variables in method (implementation)
Definition Ranking.h:48
Basic string class.
Definition TString.h:139
create variable transformations