The KDE class is a template class for performing Kernel Density Estimations. More...
Public Types | |
| typedef TreeType< MetricType, kde::KDEStat, MatType > | Tree |
| Convenience typedef. More... | |
Public Member Functions | |
| KDE (const double relError=0.05, const double absError=0, KernelType kernel=KernelType(), const KDEMode mode=DUAL_TREE_MODE, MetricType metric=MetricType()) | |
| Initialize KDE object using custom instantiated Metric and Kernel objects. More... | |
| KDE (const KDE &other) | |
| Construct KDE object as a copy of the given model. More... | |
| KDE (KDE &&other) | |
| Construct KDE object taking ownership of the given model. More... | |
| ~KDE () | |
| Destroy the KDE object. More... | |
| double | AbsoluteError () const |
| Get absolute error tolerance. More... | |
| void | AbsoluteError (const double newError) |
| Modify absolute error tolerance (0 <= newError). More... | |
| void | Evaluate (MatType querySet, arma::vec &estimations) |
| Estimate density of each point in the query set given the data of the reference set. More... | |
| void | Evaluate (Tree *queryTree, const std::vector< size_t > &oldFromNewQueries, arma::vec &estimations) |
| Estimate density of each point in the query set given the data of an already created query tree. More... | |
| void | Evaluate (arma::vec &estimations) |
| Estimate density of each point in the reference set given the data of the reference set. More... | |
| bool | IsTrained () const |
| Check whether KDE model is trained or not. More... | |
| const KernelType & | Kernel () const |
| Get the kernel. More... | |
| KernelType & | Kernel () |
| Modify the kernel. More... | |
| const MetricType & | Metric () const |
| Get the metric. More... | |
| MetricType & | Metric () |
| Modify the metric. More... | |
| KDEMode | Mode () const |
| Get the mode of KDE. More... | |
| KDEMode & | Mode () |
| Modify the mode of KDE. More... | |
| KDE & | operator= (KDE other) |
| Copy a KDE model. More... | |
| bool | OwnsReferenceTree () const |
| Check whether reference tree is owned by the KDE model. More... | |
| Tree * | ReferenceTree () |
| Get the reference tree. More... | |
| double | RelativeError () const |
| Get relative error tolerance. More... | |
| void | RelativeError (const double newError) |
| Modify relative error tolerance (0 <= newError <= 1). More... | |
template < typename Archive > | |
| void | serialize (Archive &ar, const unsigned int) |
| Serialize the model. More... | |
| void | Train (MatType referenceSet) |
| Trains the KDE model. More... | |
| void | Train (Tree *referenceTree, std::vector< size_t > *oldFromNewReferences) |
| Trains the KDE model. More... | |
The KDE class is a template class for performing Kernel Density Estimations.
In statistics, kernel density estimation is a way to estimate the probability density function of a variable in a non parametric way. This implementation performs this estimation using a tree-independent dual-tree algorithm. Details about this algorithm are available in KDERules.
| KernelType | Kernel function to use for KDE calculations. |
| MetricType | Metric to use for KDE calculations. |
| MatType | Type of data to use. |
| TreeType | Type of tree to use; must satisfy the TreeType policy API. |
| DualTreeTraversalType | Type of dual-tree traversal to use. |
| SingleTreeTraversalType | Type of single-tree traversal to use. |
| typedef TreeType<MetricType, kde::KDEStat, MatType> Tree |
| KDE | ( | const double | relError = 0.05, |
| const double | absError = 0, |
||
| KernelType | kernel = KernelType(), |
||
| const KDEMode | mode = DUAL_TREE_MODE, |
||
| MetricType | metric = MetricType() |
||
| ) |
Initialize KDE object using custom instantiated Metric and Kernel objects.
| relError | Relative error tolerance of the model. |
| absError | Absolute error tolerance of the model. |
| kernel | Instantiated kernel object. |
| mode | Mode for the algorithm. |
| metric | Instantiated metric object. |
| ~KDE | ( | ) |
Destroy the KDE object.
If this object created any trees, they will be deleted. If you created the trees then you have to delete them yourself.
|
inline |
| void AbsoluteError | ( | const double | newError | ) |
Modify absolute error tolerance (0 <= newError).
| void Evaluate | ( | MatType | querySet, |
| arma::vec & | estimations | ||
| ) |
Estimate density of each point in the query set given the data of the reference set.
The result is stored in an estimations vector. Estimations might not be normalized.
| querySet | Set of query points to get the density of. |
| estimations | Object which will hold the density of each query point. |
| void Evaluate | ( | Tree * | queryTree, |
| const std::vector< size_t > & | oldFromNewQueries, | ||
| arma::vec & | estimations | ||
| ) |
Estimate density of each point in the query set given the data of an already created query tree.
The result is stored in an estimations vector. Estimations might not be normalized.
| queryTree | Tree of query points to get the density of. |
| oldFromNewQueries | Mappings of query points to the tree dataset. |
| estimations | Object which will hold the density of each query point. |
| void Evaluate | ( | arma::vec & | estimations | ) |
Estimate density of each point in the reference set given the data of the reference set.
It does not compute the estimation of a point with itself. The result is stored in an estimations vector. Estimations might not be normalized.
| estimations | Object which will hold the density of each reference point. |
|
inline |
|
inline |
|
inline |
| void RelativeError | ( | const double | newError | ) |
Modify relative error tolerance (0 <= newError <= 1).
| void serialize | ( | Archive & | ar, |
| const unsigned | int | ||
| ) |
Serialize the model.
Referenced by KDE< KernelType, MetricType, MatType, TreeType, DualTreeTraversalType, SingleTreeTraversalType >::Mode().
| void Train | ( | MatType | referenceSet | ) |
Trains the KDE model.
It builds a tree using a reference set.
Use std::move if the reference set is no longer needed.
| referenceSet | Set of reference data. |
| void Train | ( | Tree * | referenceTree, |
| std::vector< size_t > * | oldFromNewReferences | ||
| ) |
Trains the KDE model.
Sets the reference tree to an already created tree.
| referenceTree | Built reference tree. |
| oldFromNewReferences | Permutations of reference points obtained during tree generation. |