Public Types

enum  KernelTypes
{
  GAUSSIAN_KERNEL
,
  EPANECHNIKOV_KERNEL
,
  LAPLACIAN_KERNEL
,
  SPHERICAL_KERNEL
,
  TRIANGULAR_KERNEL

}
 
enum  TreeTypes
{
  KD_TREE
,
  BALL_TREE
,
  COVER_TREE
,
  OCTREE
,
  R_TREE

}
 

Public Member Functions

 KDEModel (const double bandwidth=1.0, const double relError=0.05, const double absError=0, const KernelTypes kernelType=KernelTypes::GAUSSIAN_KERNEL, const TreeTypes treeType=TreeTypes::KD_TREE)
 Initialize KDEModel. More...

 
 KDEModel (const KDEModel &other)
 Copy constructor of the given model. More...

 
 KDEModel (KDEModel &&other)
 Move constructor of the given model. Takes ownership of the model. More...

 
 ~KDEModel ()
 Destroy the KDEModel object. More...

 
double AbsoluteError () const
 Get the absolute error tolerance. More...

 
double & AbsoluteError ()
 Modify the absolute error tolerance. More...

 
double Bandwidth () const
 Get the bandwidth of the kernel. More...

 
double & Bandwidth ()
 Modify the bandwidth of the kernel. More...

 
void BuildModel (arma::mat &&referenceSet)
 Build the KDE model with the given parameters and then trains it with the given reference data. More...

 
void Evaluate (arma::mat &&querySet, arma::vec &estimations)
 Perform kernel density estimation on the given query set. More...

 
void Evaluate (arma::vec &estimations)
 Perform kernel density estimation on the reference set. More...

 
KernelTypes KernelType () const
 Get the kernel type of the model. More...

 
KernelTypesKernelType ()
 Modify the kernel type of the model. More...

 
KDEMode Mode () const
 Get the mode of the model. More...

 
KDEModeMode ()
 Modify the mode of the model. More...

 
KDEModeloperator= (KDEModel other)
 Copy the given model. More...

 
double RelativeError () const
 Get the relative error tolerance. More...

 
double & RelativeError ()
 Modify the relative error tolerance. More...

 
template
<
typename
Archive
>
void serialize (Archive &ar, const unsigned int)
 Serialize the KDE model. More...

 
TreeTypes TreeType () const
 Get the tree type of the model. More...

 
TreeTypesTreeType ()
 Modify the tree type of the model. More...

 

Detailed Description

Definition at line 193 of file kde_model.hpp.

Member Enumeration Documentation

◆ KernelTypes

Enumerator
GAUSSIAN_KERNEL 
EPANECHNIKOV_KERNEL 
LAPLACIAN_KERNEL 
SPHERICAL_KERNEL 
TRIANGULAR_KERNEL 

Definition at line 205 of file kde_model.hpp.

◆ TreeTypes

enum TreeTypes
Enumerator
KD_TREE 
BALL_TREE 
COVER_TREE 
OCTREE 
R_TREE 

Definition at line 196 of file kde_model.hpp.

Constructor & Destructor Documentation

◆ KDEModel() [1/3]

KDEModel ( const double  bandwidth = 1.0,
const double  relError = 0.05,
const double  absError = 0,
const KernelTypes  kernelType = KernelTypes::GAUSSIAN_KERNEL,
const TreeTypes  treeType = TreeTypes::KD_TREE 
)

Initialize KDEModel.

Parameters
bandwidthBandwidth to use for the kernel.
relErrorMaximum relative error tolerance for each point in the model. For example, 0.05 means that each value must be within 5% of the true KDE value.
absErrorMaximum absolute error tolerance for each point in the model. For example, 0.1 means that for each point the value can have a maximum error of 0.1 units.
kernelTypeType of kernel to use.
treeTypeType of tree to use.

◆ KDEModel() [2/3]

KDEModel ( const KDEModel other)

Copy constructor of the given model.

◆ KDEModel() [3/3]

KDEModel ( KDEModel &&  other)

Move constructor of the given model. Takes ownership of the model.

◆ ~KDEModel()

~KDEModel ( )

Destroy the KDEModel object.

Member Function Documentation

◆ AbsoluteError() [1/2]

double AbsoluteError ( ) const
inline

Get the absolute error tolerance.

Definition at line 315 of file kde_model.hpp.

◆ AbsoluteError() [2/2]

double& AbsoluteError ( )
inline

Modify the absolute error tolerance.

Definition at line 318 of file kde_model.hpp.

◆ Bandwidth() [1/2]

double Bandwidth ( ) const
inline

Get the bandwidth of the kernel.

Definition at line 303 of file kde_model.hpp.

◆ Bandwidth() [2/2]

double& Bandwidth ( )
inline

Modify the bandwidth of the kernel.

Definition at line 306 of file kde_model.hpp.

◆ BuildModel()

void BuildModel ( arma::mat &&  referenceSet)

Build the KDE model with the given parameters and then trains it with the given reference data.

Takes possession of the reference set to avoid a copy, so the reference set will not be usable after this.

Parameters
referenceSetSet of reference points.

◆ Evaluate() [1/2]

void Evaluate ( arma::mat &&  querySet,
arma::vec &  estimations 
)

Perform kernel density estimation on the given query set.

Takes possession of the query set to avoid a copy, so the query set will not be usable after this. If possible, it returns normalized estimations.

Precondition
The model has to be previously created with BuildModel.
Parameters
querySetSet of query points.
estimationsVector where the results will be stored in the same order as the query points.

◆ Evaluate() [2/2]

void Evaluate ( arma::vec &  estimations)

Perform kernel density estimation on the reference set.

If possible, it returns normalized estimations.

Precondition
The model has to be previously created with BuildModel.
Parameters
estimationsVector where the results will be stored in the same order as the query points.

◆ KernelType() [1/2]

KernelTypes KernelType ( ) const
inline

Get the kernel type of the model.

Definition at line 327 of file kde_model.hpp.

◆ KernelType() [2/2]

KernelTypes& KernelType ( )
inline

Modify the kernel type of the model.

Definition at line 330 of file kde_model.hpp.

References mlpack::bindings::tests::CleanMemory().

◆ Mode() [1/2]

KDEMode Mode ( ) const

Get the mode of the model.

◆ Mode() [2/2]

KDEMode& Mode ( )

Modify the mode of the model.

◆ operator=()

KDEModel& operator= ( KDEModel  other)

Copy the given model.

Use std::move if the object to copy is no longer needed.

Parameters
otherKDEModel to copy.

◆ RelativeError() [1/2]

double RelativeError ( ) const
inline

Get the relative error tolerance.

Definition at line 309 of file kde_model.hpp.

◆ RelativeError() [2/2]

double& RelativeError ( )
inline

Modify the relative error tolerance.

Definition at line 312 of file kde_model.hpp.

◆ serialize()

void serialize ( Archive &  ar,
const unsigned  int 
)

Serialize the KDE model.

◆ TreeType() [1/2]

TreeTypes TreeType ( ) const
inline

Get the tree type of the model.

Definition at line 321 of file kde_model.hpp.

◆ TreeType() [2/2]

TreeTypes& TreeType ( )
inline

Modify the tree type of the model.

Definition at line 324 of file kde_model.hpp.


The documentation for this class was generated from the following file:
  • /home/ryan/src/mlpack.org/_src/mlpack-3.1.0/src/mlpack/methods/kde/kde_model.hpp