[mlpack-git] master: Add a StatisticType for DTNN. (b068d3c)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Thu Mar 12 16:04:09 EDT 2015


Repository : https://github.com/mlpack/mlpack

On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/eddd7167d69b6c88b271ef2e51d1c20e13f1acd8...70342dd8e5c17e0c164cfb8189748671e9c0dd44

>---------------------------------------------------------------

commit b068d3c021d34a7071f091b3cf6bbc71bcd16321
Author: Ryan Curtin <ryan at ratml.org>
Date:   Thu Jan 29 22:47:20 2015 -0500

    Add a StatisticType for DTNN.


>---------------------------------------------------------------

b068d3c021d34a7071f091b3cf6bbc71bcd16321
 src/mlpack/methods/kmeans/dtnn_statistic.hpp | 49 ++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git a/src/mlpack/methods/kmeans/dtnn_statistic.hpp b/src/mlpack/methods/kmeans/dtnn_statistic.hpp
new file mode 100644
index 0000000..f6b0de6
--- /dev/null
+++ b/src/mlpack/methods/kmeans/dtnn_statistic.hpp
@@ -0,0 +1,49 @@
+/**
+ * @file dtnn_statistic.hpp
+ * @author Ryan Curtin
+ *
+ * Statistic for dual-tree nearest neighbor search based k-means clustering.
+ */
+#ifndef __MLPACK_METHODS_KMEANS_DTNN_STATISTIC_HPP
+#define __MLPACK_METHODS_KMEANS_DTNN_STATISTIC_HPP
+
+#include <mlpack/methods/neighbor_search/neighbor_search_stat.hpp>
+
+namespace mlpack {
+namespace kmeans {
+
+class DTNNStatistic : public
+    neighbor::NeighborSearchStat<neighbor::NearestNeighborSort>
+{
+ public:
+  DTNNStatistic() :
+      pruned(false),
+      iteration(0),
+      neighbor::NeighborSearchStat<neighbor::NearestNeighborSort>()
+  {
+    // Nothing to do.
+  }
+
+  DTNNStatistic(TreeType& /* node */) :
+      pruned(false),
+      iteration(0),
+      neighbor::NeighborSearchStat<neighbor::NearestNeighborSort>()
+  {
+    // Nothing to do.
+  }
+
+  bool Pruned() const { return pruned; }
+  bool& Pruned() { return pruned; }
+
+  size_t Iteration() const { return iteration; }
+  size_t& Iteration() { return iteration; }
+
+ private:
+  bool pruned;
+  size_t iteration;
+};
+
+} // namespace kmeans
+} // namespace mlpack
+
+#endif



More information about the mlpack-git mailing list