Computes the k-Nearest Neighbour (kNN) density estimator of a set of points.
More...
#include <KNearestNeighbours.hh>
Computes the k-Nearest Neighbour (kNN) density estimator of a set of points.
Computes the volume and density of the hypersphere containing the k nearest neighbours.
| KNearestNeighbours::KNearestNeighbours |
( |
| ) |
|
Default constructor, initilizes everything to 0.
| KNearestNeighbours::KNearestNeighbours |
( |
const std::vector< std::vector< double >> & |
points, |
|
|
const size_t |
k, |
|
|
bool |
rotate = false |
|
) |
| |
Normal constructor, fills the cloud with the provided points.
- Parameters
-
| points | N points to fill the cloud with |
| k | Number of neighbours to probe |
| rotate | If true, use the metric of the covariance matrix |
| KNearestNeighbours::~KNearestNeighbours |
( |
| ) |
|
| double KNearestNeighbours::Density |
( |
const std::vector< double > & |
point | ) |
const |
Returns the density of points in the hypersphere that contains the k NN of a point.
| double KNearestNeighbours::Distance |
( |
const std::vector< double > & |
point | ) |
const |
Returns the distance to the k^th NN of a point.
| double KNearestNeighbours::Evaluate |
( |
const std::vector< double > & |
v | ) |
const |
Performs the density estimation at an n-point v.
- Parameters
-
| v | Vector of coordinates of the n-point |
| double KNearestNeighbours::Evaluate |
( |
const double & |
v | ) |
const |
Performs the density estimation at an n-point v.
- Parameters
-
| v | One dimensional value of the point |
| double KNearestNeighbours::Evaluate |
( |
const double * |
v | ) |
const |
Performs the density estimation at an n-point v.
- Parameters
-
| v | Pointer to an array of coordinates of the n-point |
| const size_t& KNearestNeighbours::GetDimension |
( |
| ) |
const |
|
inline |
Returns the dimension of the space.
| void KNearestNeighbours::Initialize |
( |
| ) |
|
Checks that the input is sensible.
| double KNearestNeighbours::operator() |
( |
const std::vector< double > & |
v | ) |
const |
|
inline |
Overloaded function operator, calls Evaluate.
- Parameters
-
| double KNearestNeighbours::operator() |
( |
const double & |
v | ) |
const |
|
inline |
Overloaded function operator, calls Evaluate.
- Parameters
-
| double KNearestNeighbours::operator() |
( |
const double * |
v | ) |
const |
|
inline |
Overloaded function operator, calls Evaluate.
- Parameters
-
| v | Pointer to an array of coordinates |
| double KNearestNeighbours::Volume |
( |
const std::vector< double > & |
point | ) |
const |
Returns the volume of the hypersphere that contains the k NN of a point.
| size_t KNearestNeighbours::_dim |
|
private |
| size_t KNearestNeighbours::_k |
|
private |
Number of neighbours to consider.
| KDTree* KNearestNeighbours::_kdtree |
|
private |
k-d Tree of the points to find NNs
| TMatrixD KNearestNeighbours::_metric |
|
private |
| std::vector<std::vector<double> > KNearestNeighbours::_points |
|
private |
| bool KNearestNeighbours::_rotate |
|
private |
Whether or not a rotated metric is used.
| double KNearestNeighbours::_scale |
|
private |
Scaling factor of the metric.
The documentation for this class was generated from the following files: