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=KDEDefaultParams::relError, const double absError=KDEDefaultParams::absError, const KernelTypes kernelType=KernelTypes::GAUSSIAN_KERNEL, const TreeTypes treeType=TreeTypes::KD_TREE, const bool monteCarlo=KDEDefaultParams::mode, const double mcProb=KDEDefaultParams::mcProb, const size_t initialSampleSize=KDEDefaultParams::initialSampleSize, const double mcEntryCoef=KDEDefaultParams::mcEntryCoef, const double mcBreakCoef=KDEDefaultParams::mcBreakCoef) | |
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... | |
void | AbsoluteError (const double newAbsError) |
Modify the absolute error tolerance. More... | |
double | Bandwidth () const |
Get the bandwidth of the kernel. More... | |
void | Bandwidth (const double newBandwidth) |
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... | |
KernelTypes & | KernelType () |
Modify the kernel type of the model. More... | |
double | MCBreakCoefficient () const |
Get Monte Carlo break coefficient. More... | |
void | MCBreakCoefficient (const double newBreakCoef) |
Modify Monte Carlo break coefficient. More... | |
double | MCEntryCoefficient () const |
Get Monte Carlo entry coefficient. More... | |
void | MCEntryCoefficient (const double newEntryCoef) |
Modify Monte Carlo entry coefficient. More... | |
size_t | MCInitialSampleSize () const |
Get the initial sample size for Monte Carlo estimations. More... | |
void | MCInitialSampleSize (const size_t newSampleSize) |
Modify the initial sample size for Monte Carlo estimations. More... | |
double | MCProbability () const |
Get Monte Carlo probability of error being bounded by relative error. More... | |
void | MCProbability (const double newMCProb) |
Modify Monte Carlo probability of error being bounded by relative error. More... | |
KDEMode | Mode () const |
Get the mode of the model. More... | |
KDEMode & | Mode () |
Modify the mode of the model. More... | |
bool | MonteCarlo () const |
Get whether the model is using Monte Carlo estimations or not. More... | |
void | MonteCarlo (const bool newMonteCarlo) |
Modify whether the model is using Monte Carlo estimations or not. More... | |
KDEModel & | operator= (KDEModel other) |
Copy the given model. More... | |
double | RelativeError () const |
Get the relative error tolerance. More... | |
void | RelativeError (const double newRelError) |
Modify the relative error tolerance. More... | |
template < typename Archive > | |
void | serialize (Archive &ar, const unsigned int version) |
Serialize the KDE model. More... | |
TreeTypes | TreeType () const |
Get the tree type of the model. More... | |
TreeTypes & | TreeType () |
Modify the tree type of the model. More... | |
Definition at line 362 of file kde_model.hpp.
enum KernelTypes |
Enumerator | |
---|---|
GAUSSIAN_KERNEL | |
EPANECHNIKOV_KERNEL | |
LAPLACIAN_KERNEL | |
SPHERICAL_KERNEL | |
TRIANGULAR_KERNEL |
Definition at line 374 of file kde_model.hpp.
enum TreeTypes |
Enumerator | |
---|---|
KD_TREE | |
BALL_TREE | |
COVER_TREE | |
OCTREE | |
R_TREE |
Definition at line 365 of file kde_model.hpp.
KDEModel | ( | const double | bandwidth = 1.0 , |
const double | relError = KDEDefaultParams::relError , |
||
const double | absError = KDEDefaultParams::absError , |
||
const KernelTypes | kernelType = KernelTypes::GAUSSIAN_KERNEL , |
||
const TreeTypes | treeType = TreeTypes::KD_TREE , |
||
const bool | monteCarlo = KDEDefaultParams::mode , |
||
const double | mcProb = KDEDefaultParams::mcProb , |
||
const size_t | initialSampleSize = KDEDefaultParams::initialSampleSize , |
||
const double | mcEntryCoef = KDEDefaultParams::mcEntryCoef , |
||
const double | mcBreakCoef = KDEDefaultParams::mcBreakCoef |
||
) |
Initialize KDEModel.
bandwidth | Bandwidth to use for the kernel. |
relError | Maximum 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. |
absError | Maximum 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. |
kernelType | Type of kernel to use. |
treeType | Type of tree to use. |
monteCarlo | Whether to use Monte Carlo estimations when possible. |
Probability | of a Monte Carlo estimation to be bounded by relative error tolerance. |
initialSampleSize | Initial sample size for Monte Carlo estimations. |
mcEntryCoef | Coefficient to control how much larger does the amount of node descendants has to be compared to the initial sample size in order for it to be a candidate for Monte Carlo estimations. |
mcBreakCoef | Coefficient to control what fraction of the node's descendants evaluated is the limit before Monte Carlo estimation recurses. |
|
inline |
Get the absolute error tolerance.
Definition at line 516 of file kde_model.hpp.
void AbsoluteError | ( | const double | newAbsError | ) |
Modify the absolute error tolerance.
|
inline |
Get the bandwidth of the kernel.
Definition at line 504 of file kde_model.hpp.
void Bandwidth | ( | const double | newBandwidth | ) |
Modify the bandwidth of the kernel.
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.
referenceSet | Set of reference points. |
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.
querySet | Set of query points. |
estimations | Vector where the results will be stored in the same order as the query points. |
void Evaluate | ( | arma::vec & | estimations | ) |
Perform kernel density estimation on the reference set.
If possible, it returns normalized estimations.
estimations | Vector where the results will be stored in the same order as the query points. |
|
inline |
Get the kernel type of the model.
Definition at line 528 of file kde_model.hpp.
|
inline |
Modify the kernel type of the model.
Definition at line 531 of file kde_model.hpp.
|
inline |
Get Monte Carlo break coefficient.
Definition at line 558 of file kde_model.hpp.
References BOOST_TEMPLATE_CLASS_VERSION(), and mlpack::bindings::tests::CleanMemory().
void MCBreakCoefficient | ( | const double | newBreakCoef | ) |
Modify Monte Carlo break coefficient.
|
inline |
Get Monte Carlo entry coefficient.
Definition at line 552 of file kde_model.hpp.
void MCEntryCoefficient | ( | const double | newEntryCoef | ) |
Modify Monte Carlo entry coefficient.
|
inline |
Get the initial sample size for Monte Carlo estimations.
Definition at line 546 of file kde_model.hpp.
void MCInitialSampleSize | ( | const size_t | newSampleSize | ) |
Modify the initial sample size for Monte Carlo estimations.
|
inline |
Get Monte Carlo probability of error being bounded by relative error.
Definition at line 540 of file kde_model.hpp.
void MCProbability | ( | const double | newMCProb | ) |
Modify Monte Carlo probability of error being bounded by relative error.
KDEMode Mode | ( | ) | const |
Get the mode of the model.
KDEMode& Mode | ( | ) |
Modify the mode of the model.
|
inline |
Get whether the model is using Monte Carlo estimations or not.
Definition at line 534 of file kde_model.hpp.
void MonteCarlo | ( | const bool | newMonteCarlo | ) |
Modify whether the model is using Monte Carlo estimations or not.
Copy the given model.
Use std::move if the object to copy is no longer needed.
other | KDEModel to copy. |
|
inline |
Get the relative error tolerance.
Definition at line 510 of file kde_model.hpp.
void RelativeError | ( | const double | newRelError | ) |
Modify the relative error tolerance.
void serialize | ( | Archive & | ar, |
const unsigned int | version | ||
) |
Serialize the KDE model.
|
inline |
Get the tree type of the model.
Definition at line 522 of file kde_model.hpp.
|
inline |
Modify the tree type of the model.
Definition at line 525 of file kde_model.hpp.