npstat is hosted by Hepforge, IPPP Durham
NPStat  5.10.0
npstat::ConstantBandwidthSmoother1D Class Reference

#include <ConstantBandwidthSmoother1D.hh>

Inheritance diagram for npstat::ConstantBandwidthSmoother1D:
npstat::AbsMarginalSmootherBase npstat::AbsPolyFilter1D

Public Member Functions

 ConstantBandwidthSmoother1D (unsigned nbins, double xmin, double xmax, int symbetaPower, unsigned kernelOrder, double bandwidth=0.0, double bwFactor=1.0, bool mirrorData=true, const char *label=0)
 
int symbetaPower () const
 
unsigned kernelOrder () const
 
double fixedBandwidth () const
 
double bwFactor () const
 
bool mirrorsData () const
 
unsigned dataLen () const
 
double selfContribution (unsigned) const
 
- Public Member Functions inherited from npstat::AbsMarginalSmootherBase
 AbsMarginalSmootherBase (unsigned nbins, double xmin, double xmax, const char *axisLabel=0)
 
void setAxisLabel (const char *axisLabel)
 
unsigned nBins () const
 
double xMin () const
 
double xMax () const
 
double binWidth () const
 
const std::string & getAxisLabel () const
 
gs::AbsArchive * getArchive () const
 
const std::string & getArchiveCategory () const
 
double lastBandwidth () const
 
void setArchive (gs::AbsArchive *ar, const char *category=0)
 
void unsetArchive ()
 
template<typename Numeric >
const HistoND< double > & smooth (const std::vector< Numeric > &inputPoints, double minValue=-std::numeric_limits< double >::max(), double maxValue=std::numeric_limits< double >::max(), double *bandwidthUsed=0)
 
template<typename Numeric >
const HistoND< double > & smooth (unsigned long uniqueId, unsigned dimNumber, const std::vector< Numeric > &inputPoints, double minValue=-std::numeric_limits< double >::max(), double maxValue=std::numeric_limits< double >::max(), double *bandwidthUsed=0)
 
template<typename Numeric >
const HistoND< double > & weightedSmooth (const std::vector< std::pair< Numeric, double > > &inputPoints, double minValue=-std::numeric_limits< double >::max(), double maxValue=std::numeric_limits< double >::max(), double *bandwidthUsed=0)
 
template<typename Numeric >
const HistoND< double > & weightedSmooth (unsigned long uniqueId, unsigned multivariatePointDimNumber, const std::vector< std::pair< Numeric, double > > &inputPoints, double minValue=-std::numeric_limits< double >::max(), double maxValue=std::numeric_limits< double >::max(), double *bandwidthUsed=0)
 

Detailed Description

1-d KDE implementation with constant bandwidth, using kernels from the beta family (or the Gaussian). Based on FFT, so it should be reasonably fast even if the number of bins is large. By default, the data is mirrored at the boundary to reduce the edge effects.

The output density is truncated non-negative and normalized.

Constructor & Destructor Documentation

◆ ConstantBandwidthSmoother1D()

npstat::ConstantBandwidthSmoother1D::ConstantBandwidthSmoother1D ( unsigned  nbins,
double  xmin,
double  xmax,
int  symbetaPower,
unsigned  kernelOrder,
double  bandwidth = 0.0,
double  bwFactor = 1.0,
bool  mirrorData = true,
const char *  label = 0 
)

Constructor arguments are as follows:

nbins, xmin, xmax – Parameters for the histogram which will be accumulated using the data sample to be smoothed. nbins should preferrably be a power of 2 (for subsequent FFT).

symbetaPower – Power of the symmetric beta kernel to use. Gaussian kernel chopped of at 12 sigma will be used in case this parameter is negative. This parameter must not exceed 10.

kernelOrder – Order of the kernel. Meaningful arguments are even numbers 2 or larger. Numbers below 2 will be converted to 2, 1 will be subtracted from odd numbers (poly degree is the kernel order minus 2).

bandwidth – Fixed bandwidth to use. Value of 0.0 (default) means to use the Gaussian plug-in estimate which will change from one dataset to another. Note that the bin width of the histogram with which "smoothHisto" method will be called is not necessarily the same from one call to another, so the usage of fixed bandwidth has to take this into account (basically, by also using the class DummyResponseBoxBuilder in the appropriate place which will lead to constant bin width).

bwFactor – Fudge factor for the bandwidth used for the density estimate (either for the plug-in bandwidth or for the fixed one provided by the previous argument).

mirrorData – If true, the data will be mirrored at the boundary.

label – Label for the axis. Useful in case smoothing results are stored for inspection.

Member Function Documentation

◆ dataLen()

unsigned npstat::ConstantBandwidthSmoother1D::dataLen ( ) const
inlinevirtual

Method that has to be overriden from AbsPolyFilter1D

Implements npstat::AbsPolyFilter1D.

◆ selfContribution()

double npstat::ConstantBandwidthSmoother1D::selfContribution ( unsigned  ) const
inlinevirtual

Method that has to be overriden from AbsPolyFilter1D. If the bandwidth is not fixed, the value returned by "selfContribution" will change after each call to "smooth" or "weightedSmooth".

Implements npstat::AbsPolyFilter1D.

◆ symbetaPower()

int npstat::ConstantBandwidthSmoother1D::symbetaPower ( ) const
inline

Simple inspector of object properties


The documentation for this class was generated from the following file: