kde_stat.hpp
Go to the documentation of this file.
1 
12 #ifndef MLPACK_METHODS_KDE_STAT_HPP
13 #define MLPACK_METHODS_KDE_STAT_HPP
14 
15 #include <mlpack/prereqs.hpp>
16 
17 namespace mlpack {
18 namespace kde {
19 
24 class KDEStat
25 {
26  public:
28  KDEStat() :
29  mcBeta(0),
30  mcAlpha(0),
31  accumAlpha(0),
32  accumError(0)
33  { /* Nothing to do.*/ }
34 
36  template<typename TreeType>
37  KDEStat(TreeType& /* node */) :
38  mcBeta(0),
39  mcAlpha(0),
40  accumAlpha(0),
41  accumError(0)
42  { /* Nothing to do. */ }
43 
45  inline double MCBeta() const { return mcBeta; }
46 
48  inline double& MCBeta() { return mcBeta; }
49 
51  inline double AccumAlpha() const { return accumAlpha; }
52 
54  inline double& AccumAlpha() { return accumAlpha; }
55 
57  inline double AccumError() const { return accumError; }
58 
60  inline double& AccumError() { return accumError; }
61 
63  inline double MCAlpha() const { return mcAlpha; }
64 
66  inline double& MCAlpha() { return mcAlpha; }
67 
69  template<typename Archive>
70  void serialize(Archive& ar, const uint32_t /* version */)
71  {
72  ar(CEREAL_NVP(mcBeta));
73  ar(CEREAL_NVP(mcAlpha));
74  ar(CEREAL_NVP(accumAlpha));
75  ar(CEREAL_NVP(accumError));
76  }
77 
78  private:
80  double mcBeta;
81 
83  double mcAlpha;
84 
86  double accumAlpha;
87 
89  double accumError;
90 };
91 
92 } // namespace kde
93 } // namespace mlpack
94 
95 #endif
void serialize(Archive &ar, const uint32_t)
Serialize the statistic to/from an archive.
Definition: kde_stat.hpp:70
double AccumAlpha() const
Get accumulated Monte Carlo alpha of the node.
Definition: kde_stat.hpp:51
Linear algebra utility functions, generally performed on matrices or vectors.
double MCBeta() const
Get accumulated Monte Carlo alpha of the node.
Definition: kde_stat.hpp:45
The core includes that mlpack expects; standard C++ includes and Armadillo.
double & MCBeta()
Modify accumulated Monte Carlo alpha of the node.
Definition: kde_stat.hpp:48
double & AccumAlpha()
Modify accumulated Monte Carlo alpha of the node.
Definition: kde_stat.hpp:54
Extra data for each node in the tree for the task of kernel density estimation.
Definition: kde_stat.hpp:24
KDEStat(TreeType &)
Initialization for a fully initialized node.
Definition: kde_stat.hpp:37
double & MCAlpha()
Modify Monte Carlo alpha of the node.
Definition: kde_stat.hpp:66
double & AccumError()
Modify accumulated error tolerance of the node.
Definition: kde_stat.hpp:60
double MCAlpha() const
Get Monte Carlo alpha of the node.
Definition: kde_stat.hpp:63
KDEStat()
Initialize the statistic.
Definition: kde_stat.hpp:28
double AccumError() const
Get accumulated error tolerance of the node.
Definition: kde_stat.hpp:57