Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
LDA.h
Go to the documentation of this file.
1 // $Id$
2 /**********************************************************************************
3  * Project: TMVA - a Root-integrated toolkit for multivariate data analysis *
4  * Package: TMVA *
5  * Class : LDA *
6  * Web : http://tmva.sourceforge.net *
7  * *
8  * Description: *
9  * Local LDA method used by MethodKNN to compute MVA value. *
10  * This is experimental code under development. This class computes *
11  * parameters of signal and background PDFs using Gaussian approximation. *
12  * *
13  * Author: *
14  * John Alison John.Alison@cern.ch - University of Pennsylvania, USA *
15  * *
16  * Copyright (c) 2007: *
17  * CERN, Switzerland *
18  * MPI-K Heidelberg, Germany *
19  * University of Pennsylvania, USA *
20  * *
21  * Redistribution and use in source and binary forms, with or without *
22  * modification, are permitted according to the terms listed in LICENSE *
23  * (http://tmva.sourceforge.net/LICENSE) *
24  **********************************************************************************/
25 
26 #ifndef ROOT_TMVA_LDA
27 #define ROOT_TMVA_LDA
28 
29 
30 // C/C++
31 #include <map>
32 #include <vector>
33 
34 // ROOT
35 #include "Rtypes.h"
36 #include "TMatrixFfwd.h"
37 
38 typedef std::vector<std::vector<Float_t> > LDAEvents;
39 
40 namespace TMVA {
41 
42  class MsgLogger;
43 
44  class LDA {
45 
46  public:
47 
48  LDA(Float_t tolerence = 1.0e-5, Bool_t debug = false);
49  ~LDA();
50 
51  // Signal probability with Gaussian approximation
52  Float_t GetProb(const std::vector<Float_t>& x, Int_t k);
53 
54  // Log likelihood function with Gaussian approximation
55  Float_t GetLogLikelihood(const std::vector<Float_t>& x, Int_t k);
56 
57  // Create LDA matrix using local events found by knn method
58  void Initialize(const LDAEvents& inputSignal, const LDAEvents& inputBackground);
59 
60  private:
61 
62  // Probability value using Gaussian approximation
63  Float_t FSub(const std::vector<Float_t>& x, Int_t k);
64 
65  MsgLogger& Log() const { return *fLogger; }
66 
67  private:
68 
69  // data members
70  Float_t fTolerence; // documentation!
71  UInt_t fNumParams; // documentation!
72  std::map<Int_t, std::vector<Float_t> > fMu; // documentation!
73  TMatrixF* fSigma; // documentation!
74  TMatrixF* fSigmaInverse; // documentation!
75  std::map<Int_t, Float_t> fEventFraction; // documentation!
76  Bool_t fDebug; // documentation!
77 
78  mutable MsgLogger *fLogger; // message logging service
79  };
80 }
81 #endif