KDEKernel.h

Go to the documentation of this file.
00001 // @(#)root/tmva $Id: KDEKernel.h 29195 2009-06-24 10:39:49Z brun $ 
00002 // Author: Asen Christov
00003 
00004 /**********************************************************************************
00005  * Project: TMVA - a Root-integrated toolkit for multivariate data analysis       *
00006  * Package: TMVA                                                                  *
00007  * Class  : KDEKernel                                                             *
00008  * Web    : http://tmva.sourceforge.net                                           *
00009  *                                                                                *
00010  * Description:                                                                   *
00011  *      The Probability Density Functions (PDFs) used for the Likelihood analysis *
00012  *      can suffer from low statistics of the training samples. This can couse    *
00013  *      the PDFs to fluctuate instead to be smooth. Nonparamatric Kernel Density  *
00014  *      Estimation is one of the methods to produse "smooth" PDFs.                *
00015  *                                                                                *
00016  * Authors (alphabetical):                                                        *
00017  *      Asen Christov   <christov@physik.uni-freiburg.de> - Freiburg U., Germany  *
00018  *                                                                                *
00019  * Copyright (c) 2007:                                                            *
00020  *      CERN, Switzerland                                                         * 
00021  *      MPI-K Heidelberg, Germany                                                 * 
00022  *      Freiburg U., Germany                                                      * 
00023  *                                                                                *
00024  * Redistribution and use in source and binary forms, with or without             *
00025  * modification, are permitted according to the terms listed in LICENSE           *
00026  * (http://tmva.sourceforge.net/LICENSE)                                          *
00027  **********************************************************************************/
00028 
00029 #ifndef ROOT_TMVA_KDEKernel
00030 #define ROOT_TMVA_KDEKernel
00031 
00032 //////////////////////////////////////////////////////////////////////////
00033 //                                                                      //
00034 // KDEKernel                                                            //
00035 //                                                                      //
00036 // KDE Kernel for "smoothing" the PDFs                                  //
00037 //                                                                      //
00038 //////////////////////////////////////////////////////////////////////////
00039 
00040 class TH1;
00041 class TH1F;
00042 class TF1;
00043 
00044 namespace TMVA {
00045 
00046    class MsgLogger;
00047 
00048    class KDEKernel {
00049 
00050    public:
00051 
00052       enum EKernelType   { kNone = 0, kGauss = 1 };
00053       enum EKernelIter   { kNonadaptiveKDE = 1, kAdaptiveKDE = 2 };
00054       enum EKernelBorder { kNoTreatment = 1, kKernelRenorm = 2, kSampleMirror = 3 };
00055     
00056    public:
00057        
00058       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.);
00059       
00060       virtual ~KDEKernel( void );
00061     
00062       // calculates the integral of the Kernel function in the given bin.
00063       Float_t GetBinKernelIntegral(Float_t lowr, Float_t highr, Float_t mean, Int_t binnum);
00064       
00065       // sets the type of Kernel to be used (Default 1 mean Gaussian)
00066       void SetKernelType( EKernelType ktype = kGauss );
00067       
00068       // modified name (remove TMVA::)
00069       const char* GetName() const { return "KDEKernel"; }
00070 
00071    private:
00072       
00073       Float_t       fSigma;             // Width of the Kernel function
00074       EKernelIter   fIter;              // iteration number
00075       Float_t       fLowerEdge;         // the lower edge of the PDF
00076       Float_t       fUpperEdge;         // the upper edge of the PDF
00077       Float_t       fFineFactor;        // fine tuning factor for Adaptive KDE: factor to multiply the "width" of the Kernel function
00078       TF1          *fKernel_integ;      // the integral of the Kernel function
00079       EKernelBorder fKDEborder;         // The method to take care about "border" effects
00080       TH1F         *fHist;              // copy of input histogram
00081       TH1F         *fFirstIterHist;      // histogram to be filled in the hidden iteration
00082       TH1F         *fSigmaHist;         // contains the Sigmas Widths for adaptive KDE 
00083       Bool_t        fHiddenIteration;   // Defines if whats currently running is the 
00084                                      // (first) hidden iteration when doing adaptive KDE
00085 
00086       mutable MsgLogger* fLogger;   // message logger
00087       MsgLogger& Log() const { return *fLogger; }    
00088       
00089       ClassDef(KDEKernel,0) // Kernel density estimator for PDF smoothing
00090       
00091    };// namespace TMVA
00092 }
00093 #endif // KDEKernel_H

Generated on Tue Jul 5 14:27:30 2011 for ROOT_528-00b_version by  doxygen 1.5.1