ROOT  6.06/09
Reference Guide
KDEKernel.h
Go to the documentation of this file.
1 // @(#)root/tmva $Id$
2 // Author: Asen Christov
3 
4 /**********************************************************************************
5  * Project: TMVA - a Root-integrated toolkit for multivariate data analysis *
6  * Package: TMVA *
7  * Class : KDEKernel *
8  * Web : http://tmva.sourceforge.net *
9  * *
10  * Description: *
11  * The Probability Density Functions (PDFs) used for the Likelihood analysis *
12  * can suffer from low statistics of the training samples. This can couse *
13  * the PDFs to fluctuate instead to be smooth. Nonparamatric Kernel Density *
14  * Estimation is one of the methods to produse "smooth" PDFs. *
15  * *
16  * Authors (alphabetical): *
17  * Asen Christov <christov@physik.uni-freiburg.de> - Freiburg U., Germany *
18  * *
19  * Copyright (c) 2007: *
20  * CERN, Switzerland *
21  * MPI-K Heidelberg, Germany *
22  * Freiburg U., Germany *
23  * *
24  * Redistribution and use in source and binary forms, with or without *
25  * modification, are permitted according to the terms listed in LICENSE *
26  * (http://tmva.sourceforge.net/LICENSE) *
27  **********************************************************************************/
28 
29 #ifndef ROOT_TMVA_KDEKernel
30 #define ROOT_TMVA_KDEKernel
31 
32 //////////////////////////////////////////////////////////////////////////
33 // //
34 // KDEKernel //
35 // //
36 // KDE Kernel for "smoothing" the PDFs //
37 // //
38 //////////////////////////////////////////////////////////////////////////
39 
40 #ifndef ROOT_Rtypes
41 #include "Rtypes.h"
42 #endif
43 
44 class TH1;
45 class TH1F;
46 class TF1;
47 
48 namespace TMVA {
49 
50  class MsgLogger;
51 
52  class KDEKernel {
53 
54  public:
55 
56  enum EKernelType { kNone = 0, kGauss = 1 };
59 
60  public:
61 
62  KDEKernel( EKernelIter kiter = kNonadaptiveKDE, const TH1* hist = 0, Float_t lower_edge=0., Float_t upper_edge=1., EKernelBorder kborder = kNoTreatment, Float_t FineFactor = 1.);
63 
64  virtual ~KDEKernel( void );
65 
66  // calculates the integral of the Kernel function in the given bin.
67  Float_t GetBinKernelIntegral(Float_t lowr, Float_t highr, Float_t mean, Int_t binnum);
68 
69  // sets the type of Kernel to be used (Default 1 mean Gaussian)
70  void SetKernelType( EKernelType ktype = kGauss );
71 
72  // modified name (remove TMVA::)
73  const char* GetName() const { return "KDEKernel"; }
74 
75  private:
76 
77  Float_t fSigma; // Width of the Kernel function
78  EKernelIter fIter; // iteration number
79  Float_t fLowerEdge; // the lower edge of the PDF
80  Float_t fUpperEdge; // the upper edge of the PDF
81  Float_t fFineFactor; // fine tuning factor for Adaptive KDE: factor to multiply the "width" of the Kernel function
82  TF1 *fKernel_integ; // the integral of the Kernel function
83  EKernelBorder fKDEborder; // The method to take care about "border" effects
84  TH1F *fHist; // copy of input histogram
85  TH1F *fFirstIterHist; // histogram to be filled in the hidden iteration
86  TH1F *fSigmaHist; // contains the Sigmas Widths for adaptive KDE
87  Bool_t fHiddenIteration; // Defines if whats currently running is the
88  // (first) hidden iteration when doing adaptive KDE
89 
90  mutable MsgLogger* fLogger; // message logger
91  MsgLogger& Log() const { return *fLogger; }
92 
93  ClassDef(KDEKernel,0) // Kernel density estimator for PDF smoothing
94 
95  };// namespace TMVA
96 }
97 #endif // KDEKernel_H
const char * GetName() const
Definition: KDEKernel.h:73
Float_t fLowerEdge
Definition: KDEKernel.h:79
float Float_t
Definition: RtypesCore.h:53
Float_t fUpperEdge
Definition: KDEKernel.h:80
1-D histogram with a float per channel (see TH1 documentation)}
Definition: TH1.h:570
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
TH1F * fHist
Definition: KDEKernel.h:84
Float_t fFineFactor
Definition: KDEKernel.h:81
Bool_t fHiddenIteration
Definition: KDEKernel.h:87
#define ClassDef(name, id)
Definition: Rtypes.h:254
EKernelIter fIter
Definition: KDEKernel.h:78
EKernelBorder fKDEborder
Definition: KDEKernel.h:83
TH1F * fFirstIterHist
Definition: KDEKernel.h:85
TH1F * fSigmaHist
Definition: KDEKernel.h:86
MsgLogger * fLogger
Definition: KDEKernel.h:90
Float_t fSigma
Definition: KDEKernel.h:77
Float_t GetBinKernelIntegral(Float_t lowr, Float_t highr, Float_t mean, Int_t binnum)
calculates the integral of the Kernel
Definition: KDEKernel.cxx:217
virtual ~KDEKernel(void)
destructor
Definition: KDEKernel.cxx:76
The TH1 histogram class.
Definition: TH1.h:80
Abstract ClassifierFactory template that handles arbitrary types.
1-Dim function class
Definition: TF1.h:149
void SetKernelType(EKernelType ktype=kGauss)
fIter == 1 —> nonadaptive KDE fIter == 2 —> adaptive KDE
Definition: KDEKernel.cxx:112
MsgLogger & Log() const
Definition: KDEKernel.h:91
KDEKernel(EKernelIter kiter=kNonadaptiveKDE, const TH1 *hist=0, Float_t lower_edge=0., Float_t upper_edge=1., EKernelBorder kborder=kNoTreatment, Float_t FineFactor=1.)
TF1 * fKernel_integ
Definition: KDEKernel.h:82