mlpack  1.0.12
mrkd_statistic.hpp
Go to the documentation of this file.
1 
14 #ifndef __MLPACK_CORE_TREE_MRKD_STATISTIC_HPP
15 #define __MLPACK_CORE_TREE_MRKD_STATISTIC_HPP
16 
17 #include <mlpack/core.hpp>
18 
19 namespace mlpack {
20 namespace tree {
21 
26 {
27  public:
29  MRKDStatistic();
30 
36  template<typename TreeType>
37  MRKDStatistic(const TreeType& /* node */);
38 
42  std::string ToString() const;
43 
45  size_t Begin() const { return begin; }
47  size_t& Begin() { return begin; }
48 
50  size_t Count() const { return count; }
52  size_t& Count() { return count; }
53 
55  const arma::colvec& CenterOfMass() const { return centerOfMass; }
57  arma::colvec& CenterOfMass() { return centerOfMass; }
58 
60  size_t DominatingCentroid() const { return dominatingCentroid; }
62  size_t& DominatingCentroid() { return dominatingCentroid; }
63 
65  const std::vector<size_t>& Whitelist() const { return whitelist; }
67  std::vector<size_t>& Whitelist() { return whitelist; }
68 
69  private:
71  const arma::mat* dataset;
73  size_t begin;
75  size_t count;
82 
83  // Computed statistics.
85  arma::colvec centerOfMass;
88 
89  // There may be a better place to store this -- HRectBound?
92 
94  std::vector<size_t> whitelist;
97 };
98 
99 }; // namespace tree
100 }; // namespace mlpack
101 
102 // Include implementation.
103 #include "mrkd_statistic_impl.hpp"
104 
105 #endif // __MLPACK_CORE_TREE_MRKD_STATISTIC_HPP
MRKDStatistic()
Initialize an empty statistic.
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: load.hpp:23
std::vector< size_t > whitelist
The list of centroids that cannot own this hyperrectangle.
size_t begin
The initial item in the dataset, so we don't have to make a copy.
size_t DominatingCentroid() const
Get the index of the dominating centroid.
const arma::colvec & CenterOfMass() const
Get the center of mass.
size_t Begin() const
Get the index of the initial item in the dataset.
const MRKDStatistic * rightStat
The right child.
const MRKDStatistic * leftStat
The left child.
Statistic for multi-resolution kd-trees.
const std::vector< size_t > & Whitelist() const
Access the whitelist.
arma::colvec & CenterOfMass()
Modify the center of mass.
size_t & DominatingCentroid()
Modify the index of the dominating centroid.
size_t & Count()
Modify the number of items in the dataset.
bool isWhitelistValid
Whether or not the whitelist is valid.
size_t & Begin()
Modify the index of the initial item in the dataset.
std::vector< size_t > & Whitelist()
Modify the whitelist.
arma::colvec centerOfMass
The center of mass for this dataset.
size_t dominatingCentroid
The index of the dominating centroid of the associated hyperrectangle.
size_t Count() const
Get the number of items in the dataset.
double sumOfSquaredNorms
The sum of the squared Euclidean norms for this dataset.
std::string ToString() const
Returns a string representation of this object.
const MRKDStatistic * parentStat
A link to the parent node; NULL if this is the root.
size_t count
The number of items in the dataset.
const arma::mat * dataset
The data points this object contains.