mlpack: a scalable c++ machine learning library
mlpack  2.0.2
ra_query_stat.hpp
Go to the documentation of this file.
1 
15 #ifndef mlpack_METHODS_RANN_RA_QUERY_STAT_HPP
16 #define mlpack_METHODS_RANN_RA_QUERY_STAT_HPP
17 
18 #include <mlpack/core.hpp>
19 
21 
24 
25 namespace mlpack {
26 namespace neighbor {
27 
36 template<typename SortPolicy>
38 {
39  public:
44  RAQueryStat() : bound(SortPolicy::WorstDistance()), numSamplesMade(0) { }
45 
49  template<typename TreeType>
50  RAQueryStat(const TreeType& /* node */) :
51  bound(SortPolicy::WorstDistance()),
53  { }
54 
56  double Bound() const { return bound; }
58  double& Bound() { return bound; }
59 
61  size_t NumSamplesMade() const { return numSamplesMade; }
63  size_t& NumSamplesMade() { return numSamplesMade; }
64 
66  template<typename Archive>
67  void Serialize(Archive& ar, const unsigned int /* version */)
68  {
69  ar & data::CreateNVP(bound, "bound");
70  ar & data::CreateNVP(numSamplesMade, "numSamplesMade");
71  }
72 
73  private:
75  double bound;
78 };
79 
80 } // namespace neighbor
81 } // namespace mlpack
82 
83 #endif
size_t numSamplesMade
The minimum number of samples made by any query in this node.
Linear algebra utility functions, generally performed on matrices or vectors.
FirstShim< T > CreateNVP(T &t, const std::string &name, typename boost::enable_if< HasSerialize< T >>::type *=0)
Call this function to produce a name-value pair; this is similar to BOOST_SERIALIZATION_NVP(), but should be used for types that have a Serialize() function (or contain a type that has a Serialize() function) instead of a serialize() function.
Extra data for each node in the tree.
void Serialize(Archive &ar, const unsigned int)
Serialize the statistic.
size_t NumSamplesMade() const
Get the number of samples made.
double & Bound()
Modify the bound.
Include all of the base components required to write mlpack methods, and the main mlpack Doxygen docu...
RAQueryStat(const TreeType &)
Initialization for a node.
double Bound() const
Get the bound.
size_t & NumSamplesMade()
Modify the number of samples made.
double bound
The bound on the node&#39;s neighbor distances.
RAQueryStat()
Initialize the statistic with the worst possible distance according to our sorting policy...