Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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 cause *
13  * the PDFs to fluctuate instead to be smooth. Nonparamatric Kernel Density *
14  * Estimation is one of the methods to produce "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 #include "Rtypes.h"
41 
42 class TH1;
43 class TH1F;
44 class TF1;
45 
46 namespace TMVA {
47 
48  class MsgLogger;
49 
50  class KDEKernel {
51 
52  public:
53 
54  enum EKernelType { kNone = 0, kGauss = 1 };
55  enum EKernelIter { kNonadaptiveKDE = 1, kAdaptiveKDE = 2 };
56  enum EKernelBorder { kNoTreatment = 1, kKernelRenorm = 2, kSampleMirror = 3 };
57 
58  public:
59 
60  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.);
61 
62  virtual ~KDEKernel( void );
63 
64  // calculates the integral of the Kernel function in the given bin.
65  Float_t GetBinKernelIntegral(Float_t lowr, Float_t highr, Float_t mean, Int_t binnum);
66 
67  // sets the type of Kernel to be used (Default 1 mean Gaussian)
68  void SetKernelType( EKernelType ktype = kGauss );
69 
70  // modified name (remove TMVA::)
71  const char* GetName() const { return "KDEKernel"; }
72 
73  private:
74 
75  Float_t fSigma; // Width of the Kernel function
76  EKernelIter fIter; // iteration number
77  Float_t fLowerEdge; // the lower edge of the PDF
78  Float_t fUpperEdge; // the upper edge of the PDF
79  Float_t fFineFactor; // fine tuning factor for Adaptive KDE: factor to multiply the "width" of the Kernel function
80  TF1 *fKernel_integ; // the integral of the Kernel function
81  EKernelBorder fKDEborder; // The method to take care about "border" effects
82  TH1F *fHist; // copy of input histogram
83  TH1F *fFirstIterHist; // histogram to be filled in the hidden iteration
84  TH1F *fSigmaHist; // contains the Sigmas Widths for adaptive KDE
85  Bool_t fHiddenIteration; // Defines if whats currently running is the
86  // (first) hidden iteration when doing adaptive KDE
87 
88  mutable MsgLogger* fLogger; // message logger
89  MsgLogger& Log() const { return *fLogger; }
90 
91  ClassDef(KDEKernel,0); // Kernel density estimator for PDF smoothing
92 
93  };// namespace TMVA
94 }
95 #endif // KDEKernel_H