[mlpack-git] master, mlpack-1.0.x: Minor changes to ToString() output. (fdc2679)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Thu Mar 5 21:43:14 EST 2015


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

On branches: master,mlpack-1.0.x
Link       : https://github.com/mlpack/mlpack/compare/904762495c039e345beba14c1142fd719b3bd50e...f94823c800ad6f7266995c700b1b630d5ffdcf40

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

commit fdc26793822b42ac808a20e0532912b6da47c009
Author: Ryan Curtin <ryan at ratml.org>
Date:   Mon Feb 10 14:59:28 2014 +0000

    Minor changes to ToString() output.


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

fdc26793822b42ac808a20e0532912b6da47c009
 src/mlpack/core/tree/ballbound_impl.hpp            |  2 +-
 .../binary_space_tree/binary_space_tree_impl.hpp   | 26 ++++++++++++----------
 src/mlpack/core/tree/hrectbound_impl.hpp           |  6 +++--
 3 files changed, 19 insertions(+), 15 deletions(-)

diff --git a/src/mlpack/core/tree/ballbound_impl.hpp b/src/mlpack/core/tree/ballbound_impl.hpp
index 0396653..649e094 100644
--- a/src/mlpack/core/tree/ballbound_impl.hpp
+++ b/src/mlpack/core/tree/ballbound_impl.hpp
@@ -199,7 +199,7 @@ std::string BallBound<VecType>::ToString() const
   std::ostringstream convert;
   convert << "BallBound [" << this << "]" << std::endl;
   convert << "  Radius:  " << radius << std::endl;
-  convert << "  Center:  " << center << std::endl;
+  convert << "  Center:" << std::endl << center;
   return convert.str();
 }
 
diff --git a/src/mlpack/core/tree/binary_space_tree/binary_space_tree_impl.hpp b/src/mlpack/core/tree/binary_space_tree/binary_space_tree_impl.hpp
index e782765..9150afa 100644
--- a/src/mlpack/core/tree/binary_space_tree/binary_space_tree_impl.hpp
+++ b/src/mlpack/core/tree/binary_space_tree/binary_space_tree_impl.hpp
@@ -710,23 +710,25 @@ std::string BinarySpaceTree<BoundType, StatisticType, MatType>::ToString() const
 {
   std::ostringstream convert;
   convert << "BinarySpaceTree [" << this << "]" << std::endl;
-  convert << "  begin: " << begin << std::endl;
-  convert << "  count: " << count << std::endl;
-  convert << "  bound: " << std::endl;
-  convert << mlpack::util::Indent(bound.ToString(),2);
-  convert << "  statistic: " << std::endl;
-  convert << mlpack::util::Indent(stat.ToString(),2);
-  convert << "  leaf size: " << leafSize << std::endl;
-  convert << "  splitDimension: " << splitDimension << std::endl;
+  convert << "  First point: " << begin << std::endl;
+  convert << "  Number of descendants: " << count << std::endl;
+  convert << "  Bound: " << std::endl;
+  convert << mlpack::util::Indent(bound.ToString(), 2);
+  convert << "  Statistic: " << std::endl;
+  convert << mlpack::util::Indent(stat.ToString(), 2);
+  convert << "  Leaf size: " << leafSize << std::endl;
+  convert << "  Split dimension: " << splitDimension << std::endl;
+
+  // How many levels should we print?  This will print every level of the tree.
   if (left != NULL)
   {
-    convert << "left:" << std::endl;
-    convert << mlpack::util::Indent(left->ToString());
+    convert << " Left child:" << std::endl;
+    convert << mlpack::util::Indent(left->ToString(), 2);
   }
   if (right != NULL)
   {
-    convert << "right:" << std::endl;
-    convert << mlpack::util::Indent(right->ToString());
+    convert << " Right child:" << std::endl;
+    convert << mlpack::util::Indent(right->ToString(), 2);
   }
   return convert.str();
 }
diff --git a/src/mlpack/core/tree/hrectbound_impl.hpp b/src/mlpack/core/tree/hrectbound_impl.hpp
index f2fdd63..bc9983a 100644
--- a/src/mlpack/core/tree/hrectbound_impl.hpp
+++ b/src/mlpack/core/tree/hrectbound_impl.hpp
@@ -389,8 +389,10 @@ std::string HRectBound<Power, TakeRoot>::ToString() const
 {
   std::ostringstream convert;
   convert << "HRectBound [" << this << "]" << std::endl;
-  convert << "dim: " << dim << std::endl;
-  convert << "bounds: " << std::endl;
+  convert << "  Power: " << Power << std::endl;
+  convert << "  TakeRoot: " << (TakeRoot ? "true" : "false") << std::endl;
+  convert << "  Dimensionality: " << dim << std::endl;
+  convert << "  Bounds: " << std::endl;
   for (size_t i = 0; i < dim; ++i)
     convert << util::Indent(bounds[i].ToString()) << std::endl;
 



More information about the mlpack-git mailing list