[mlpack-svn] r14542 - in mlpack/trunk/src/mlpack/core/tree: binary_space_tree cover_tree
fastlab-svn at coffeetalk-1.cc.gatech.edu
fastlab-svn at coffeetalk-1.cc.gatech.edu
Wed Mar 13 15:41:58 EDT 2013
Author: rcurtin
Date: 2013-03-13 15:41:58 -0400 (Wed, 13 Mar 2013)
New Revision: 14542
Modified:
mlpack/trunk/src/mlpack/core/tree/binary_space_tree/binary_space_tree.hpp
mlpack/trunk/src/mlpack/core/tree/cover_tree/cover_tree.hpp
mlpack/trunk/src/mlpack/core/tree/cover_tree/cover_tree_impl.hpp
Log:
Allow returning of instantiated metric and centroid.
Modified: mlpack/trunk/src/mlpack/core/tree/binary_space_tree/binary_space_tree.hpp
===================================================================
--- mlpack/trunk/src/mlpack/core/tree/binary_space_tree/binary_space_tree.hpp 2013-03-13 19:41:03 UTC (rev 14541)
+++ mlpack/trunk/src/mlpack/core/tree/binary_space_tree/binary_space_tree.hpp 2013-03-13 19:41:58 UTC (rev 14542)
@@ -279,6 +279,9 @@
//! Get the metric which the tree uses.
typename BoundType::MetricType Metric() const { return bound.Metric(); }
+ //! Get the centroid of the node and store it in the given vector.
+ void Centroid(arma::vec& centroid) { bound.Centroid(centroid); }
+
//! Return the number of children in this node.
size_t NumChildren() const;
Modified: mlpack/trunk/src/mlpack/core/tree/cover_tree/cover_tree.hpp
===================================================================
--- mlpack/trunk/src/mlpack/core/tree/cover_tree/cover_tree.hpp 2013-03-13 19:41:03 UTC (rev 14541)
+++ mlpack/trunk/src/mlpack/core/tree/cover_tree/cover_tree.hpp 2013-03-13 19:41:58 UTC (rev 14542)
@@ -285,6 +285,12 @@
//! Modify the distance to the furthest descendant.
double& FurthestDescendantDistance() { return furthestDescendantDistance; }
+ //! Get the centroid of the node and store it in the given vector.
+ void Centroid(arma::vec& centroid) const { centroid = dataset.col(point); }
+
+ //! Get the instantiated metric.
+ MetricType& Metric() const { return *metric; }
+
private:
//! Reference to the matrix which this tree is built on.
const arma::mat& dataset;
Modified: mlpack/trunk/src/mlpack/core/tree/cover_tree/cover_tree_impl.hpp
===================================================================
--- mlpack/trunk/src/mlpack/core/tree/cover_tree/cover_tree_impl.hpp 2013-03-13 19:41:03 UTC (rev 14541)
+++ mlpack/trunk/src/mlpack/core/tree/cover_tree/cover_tree_impl.hpp 2013-03-13 19:41:58 UTC (rev 14542)
@@ -221,6 +221,7 @@
if (nearSetSize == 0)
{
this->scale = INT_MIN;
+ stat = StatisticType(*this);
return;
}
More information about the mlpack-svn
mailing list