SynAPSE  0.6.0
Synergistic Analysis of Phase Space Evolution
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
Public Member Functions | Private Member Functions | Private Attributes
KDE Class Reference

Computes the Kernel Density Estimator (KDE) of a set of points. More...

#include <KDE.hh>

Public Member Functions

 KDE ()
 Default constructor, initilizes everything to 0. More...
 
 KDE (std::vector< std::vector< double >> mat)
 Proper constructor, initilizes everything. More...
 
 KDE (const KDE &kde)
 Copy constructor. More...
 
KDE & operator= (const KDE &kde)
 Equality operator. More...
 
double operator() (const std::vector< double > &v) const
 Overloaded function operator, calls Evaluate. More...
 
double operator() (const double &v) const
 Overloaded function operator, calls Evaluate. More...
 
double operator() (const double *v) const
 Overloaded function operator, calls Evaluate. More...
 
 ~KDE ()
 Destructor. More...
 
double Evaluate (const std::vector< double > &v) const
 Performs the density estimation at an n-point v. More...
 
double Evaluate (const double &v) const
 Performs the density estimation at an n-point v. More...
 
double Evaluate (const double *v) const
 Performs the density estimation at an n-point v. More...
 
std::vector< double > FastFunction (std::vector< std::vector< double >> points, double eps=1e-3)
 Returns the value of the KDE in the d-dimensional point (fast algorithm) More...
 
double FunctionROOT (double *x, double *par)
 Returns the value of the KDE in the d-dimensional point (ROOT format) More...
 
void Initialize ()
 Initializes the KDE parameters, bandwidth. More...
 

Private Member Functions

Matrix< double > SilvermanBandwidth (std::vector< double > vsig, size_t n)
 Returns the Silverman bandwidth matrix of order n. More...
 
Matrix< double > ScottBandwidth (std::vector< double > vsig, size_t n)
 Returns the Scott bandwidth matrix of order n. More...
 

Private Attributes

std::string _btype
 Bandwidth algorithm name. More...
 
Matrix< double > _H
 nxn bandwidth matrix More...
 
std::vector< std::vector
< double > > 
_samples
 nxN sample matrix More...
 
DGaus _kernel
 Multivariate Gaussian Kernel. More...
 

Detailed Description

Computes the Kernel Density Estimator (KDE) of a set of points.

Constructor & Destructor Documentation

KDE::KDE ( )

Default constructor, initilizes everything to 0.

KDE::KDE ( std::vector< std::vector< double >>  mat)

Proper constructor, initilizes everything.

KDE::KDE ( const KDE &  kde)

Copy constructor.

KDE::~KDE ( )

Destructor.

Member Function Documentation

double KDE::Evaluate ( const std::vector< double > &  v) const

Performs the density estimation at an n-point v.

Parameters
vVector of coordinates of the n-point
double KDE::Evaluate ( const double &  v) const

Performs the density estimation at an n-point v.

Parameters
vOne dimensional value of the point
double KDE::Evaluate ( const double *  v) const

Performs the density estimation at an n-point v.

Parameters
vPointer to an array of coordinates of the n-point
std::vector< double > KDE::FastFunction ( std::vector< std::vector< double >>  points,
double  eps = 1e-3 
)

Returns the value of the KDE in the d-dimensional point (fast algorithm)

Parameters
pointsdxN matrix of points in which to evaluate the KDE
epsTolarable error with respect to the exact KDE
Returns
Approximated value of the KDE in all of the points (N-vector)
double KDE::FunctionROOT ( double *  x,
double *  par 
)

Returns the value of the KDE in the d-dimensional point (ROOT format)

Parameters
xd-array of variables
parArray of parameters
Returns
Value of the KDE in x
void KDE::Initialize ( )

Initializes the KDE parameters, bandwidth.

double KDE::operator() ( const std::vector< double > &  v) const
inline

Overloaded function operator, calls Evaluate.

Parameters
vVector of coordinates
double KDE::operator() ( const double &  v) const
inline

Overloaded function operator, calls Evaluate.

Parameters
vOne dimensional value
double KDE::operator() ( const double *  v) const
inline

Overloaded function operator, calls Evaluate.

Parameters
vPointer to an array of coordinates
KDE & KDE::operator= ( const KDE &  kde)

Equality operator.

Matrix< double > KDE::ScottBandwidth ( std::vector< double >  vsig,
size_t  n 
)
private

Returns the Scott bandwidth matrix of order n.

Parameters
vsigVector of standard deviations on the variables
nNumber of samples
Returns
Diagonal Scott bandwitdh
Matrix< double > KDE::SilvermanBandwidth ( std::vector< double >  vsig,
size_t  n 
)
private

Returns the Silverman bandwidth matrix of order n.

Parameters
vsigd-vector of standard deviations of the variables
nNumber of samples
Returns
Diagonal Silverman bandwitdh

Field Documentation

std::string KDE::_btype
private

Bandwidth algorithm name.

Matrix<double> KDE::_H
private

nxn bandwidth matrix

DGaus KDE::_kernel
private

Multivariate Gaussian Kernel.

std::vector<std::vector<double> > KDE::_samples
private

nxN sample matrix


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