[mlpack-git] master, mlpack-1.0.x: Some ToString added, some updated (typos and indent). Test updated. (c4e5809)
gitdub at big.cc.gt.atl.ga.us
gitdub at big.cc.gt.atl.ga.us
Thu Mar 5 21:41:54 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 c4e580998b47cc84f559ed8abb0b501828d7ebdf
Author: birm <birm at gatech.edu>
Date: Tue Feb 4 22:54:00 2014 +0000
Some ToString added, some updated (typos and indent). Test updated.
>---------------------------------------------------------------
c4e580998b47cc84f559ed8abb0b501828d7ebdf
src/mlpack/core/metrics/ip_metric_impl.hpp | 2 +-
.../aug_lagrangian_function_impl.hpp | 4 +-
.../aug_lagrangian/aug_lagrangian_impl.hpp | 4 +-
src/mlpack/core/optimizers/lbfgs/lbfgs_impl.hpp | 16 +--
src/mlpack/core/optimizers/lrsdp/lrsdp.hpp | 4 +
src/mlpack/core/optimizers/lrsdp/lrsdp_impl.hpp | 12 ++
src/mlpack/core/optimizers/sgd/sgd_impl.hpp | 11 +-
src/mlpack/core/tree/ballbound_impl.hpp | 4 +-
.../binary_space_tree/binary_space_tree_impl.hpp | 12 +-
src/mlpack/methods/det/dtree.cpp | 16 +++
src/mlpack/methods/det/dtree.hpp | 5 +
src/mlpack/methods/emst/dtb.hpp | 5 +
src/mlpack/methods/emst/dtb_impl.hpp | 13 ++
src/mlpack/methods/fastmks/fastmks.hpp | 5 +
src/mlpack/methods/fastmks/fastmks_impl.hpp | 12 ++
src/mlpack/methods/hmm/hmm.hpp | 5 +
src/mlpack/methods/hmm/hmm_impl.hpp | 12 ++
.../nca/nca_softmax_error_function_impl.hpp | 6 +-
src/mlpack/tests/to_string_test.cpp | 145 ++++++++++++++++++---
19 files changed, 244 insertions(+), 49 deletions(-)
diff --git a/src/mlpack/core/metrics/ip_metric_impl.hpp b/src/mlpack/core/metrics/ip_metric_impl.hpp
index 75af8c1..6b9661b 100644
--- a/src/mlpack/core/metrics/ip_metric_impl.hpp
+++ b/src/mlpack/core/metrics/ip_metric_impl.hpp
@@ -58,7 +58,7 @@ template<typename KernelType>
std::string IPMetric<KernelType>::ToString() const{
std::ostringstream convert;
convert << "IPMetric [" << this << "]" << std::endl;
- convert << "Kernel: " << localKernel << std::endl;
+ convert << " Kernel address: " << localKernel << std::endl;
return convert.str();
}
diff --git a/src/mlpack/core/optimizers/aug_lagrangian/aug_lagrangian_function_impl.hpp b/src/mlpack/core/optimizers/aug_lagrangian/aug_lagrangian_function_impl.hpp
index ca07c6d..f568b30 100644
--- a/src/mlpack/core/optimizers/aug_lagrangian/aug_lagrangian_function_impl.hpp
+++ b/src/mlpack/core/optimizers/aug_lagrangian/aug_lagrangian_function_impl.hpp
@@ -100,8 +100,8 @@ template<typename LagrangianFunction>
std::string AugLagrangianFunction<LagrangianFunction>::ToString() const{
std::ostringstream convert;
convert << "AugLagrangianFunction [" << this << "]" << std::endl;
- convert << "Lagrange multipliers: " << lambda << std::endl;
- convert << "Penalty parameter: " << sigma << std::endl;
+ convert << " Lagrange multipliers: " << lambda << std::endl;
+ convert << " Penalty parameter: " << sigma << std::endl;
return convert.str();
}
diff --git a/src/mlpack/core/optimizers/aug_lagrangian/aug_lagrangian_impl.hpp b/src/mlpack/core/optimizers/aug_lagrangian/aug_lagrangian_impl.hpp
index a440a9f..32648c7 100644
--- a/src/mlpack/core/optimizers/aug_lagrangian/aug_lagrangian_impl.hpp
+++ b/src/mlpack/core/optimizers/aug_lagrangian/aug_lagrangian_impl.hpp
@@ -55,8 +55,8 @@ std::string AugLagrangian<LagrangianFunction>::ToString() const{
std::ostringstream convert;
convert << "AugLagrangian [" << this << "]" << std::endl;
// Fix this! Why Only log? Ostream is lonely.
- Log::Debug << "Function to be Oprimized: " << function << std::endl;
- //Log::Debug << "L-BFGS Selected: " << lbfgs << std::endl;
+ Log::Debug << " Function to be Optimized: " << function << std::endl;
+ Log::Debug << "L-BFGS Selected: " << lbfgs << std::endl;
return convert.str();
}
diff --git a/src/mlpack/core/optimizers/lbfgs/lbfgs_impl.hpp b/src/mlpack/core/optimizers/lbfgs/lbfgs_impl.hpp
index 0332d88..708e844 100644
--- a/src/mlpack/core/optimizers/lbfgs/lbfgs_impl.hpp
+++ b/src/mlpack/core/optimizers/lbfgs/lbfgs_impl.hpp
@@ -425,15 +425,15 @@ template<typename FunctionType>
std::string L_BFGS<FunctionType>::ToString() const{
std::ostringstream convert;
convert << "L_BFGS [" << this << "]" << std::endl;
- convert << "Memory Size: " << numBasis << std::endl;
- convert << "Cube Size" << s.n_rows << "x" << s.n_cols << "x" << s.n_slices;
+ convert << " Memory Size: " << numBasis << std::endl;
+ convert << " Cube Size" << s.n_rows << "x" << s.n_cols << "x" << s.n_slices;
convert << std::endl;
- convert << "Maximum Iterations: " << maxIterations << std::endl;
- convert << "Armijo condition Parameter: " << armijoConstant << std::endl;
- convert << "Wolfe Parameter: " << wolfe << std::endl;
- convert << "Minimum Gradient: " << minGradientNorm << std::endl;
- convert << "Minimum Step of Line Search: " << minStep << std::endl;
- convert << "Maximum Step of Line Search: " << maxStep << std::endl;
+ convert << " Maximum Iterations: " << maxIterations << std::endl;
+ convert << " Armijo condition Parameter: " << armijoConstant << std::endl;
+ convert << " Wolfe Parameter: " << wolfe << std::endl;
+ convert << " Minimum Gradient: " << minGradientNorm << std::endl;
+ convert << " Minimum Step of Line Search: " << minStep << std::endl;
+ convert << " Maximum Step of Line Search: " << maxStep << std::endl;
return convert.str();
}
diff --git a/src/mlpack/core/optimizers/lrsdp/lrsdp.hpp b/src/mlpack/core/optimizers/lrsdp/lrsdp.hpp
index c273168..f87a5eb 100644
--- a/src/mlpack/core/optimizers/lrsdp/lrsdp.hpp
+++ b/src/mlpack/core/optimizers/lrsdp/lrsdp.hpp
@@ -116,6 +116,9 @@ class LRSDP
//! Modify the augmented Lagrangian object.
AugLagrangian<LRSDP>& AugLag() { return augLag; }
+ // convert the obkect into a string
+ std::string ToString() const;
+
private:
// Should probably use sparse matrices for some of these.
@@ -147,3 +150,4 @@ class LRSDP
#include "lrsdp_impl.hpp"
#endif
+
diff --git a/src/mlpack/core/optimizers/lrsdp/lrsdp_impl.hpp b/src/mlpack/core/optimizers/lrsdp/lrsdp_impl.hpp
index 2e34398..830aa3a 100644
--- a/src/mlpack/core/optimizers/lrsdp/lrsdp_impl.hpp
+++ b/src/mlpack/core/optimizers/lrsdp/lrsdp_impl.hpp
@@ -14,6 +14,17 @@
namespace mlpack {
namespace optimization {
+// convert the object to a string
+std::string LRSDP::ToString() const{
+ std::ostringstream convert;
+ convert << "LRSDP [" << this << "]" << std::endl;
+ convert << "Matrix Size: " << c.n_rows << "x" << c.n_cols << std::endl;
+ convert << "Initial point Size : " << initialPoint.n_rows << "x"
+ << initialPoint.n_cols << std::endl;
+ //convert << "AugLagrangian Info: " << std::endl << augLag;
+ return convert.str();
+}
+
// Custom specializations of the AugmentedLagrangianFunction for the LRSDP case.
template<>
double AugLagrangianFunction<LRSDP>::Evaluate(const arma::mat& coordinates)
@@ -107,3 +118,4 @@ void AugLagrangianFunction<LRSDP>::Gradient(const arma::mat& coordinates,
}; // namespace mlpack
#endif
+
diff --git a/src/mlpack/core/optimizers/sgd/sgd_impl.hpp b/src/mlpack/core/optimizers/sgd/sgd_impl.hpp
index a85b1c6..733949c 100644
--- a/src/mlpack/core/optimizers/sgd/sgd_impl.hpp
+++ b/src/mlpack/core/optimizers/sgd/sgd_impl.hpp
@@ -103,11 +103,12 @@ std::string SGD<DecomposableFunctionType>::ToString() const{
std::ostringstream convert;
convert << "SGD [" << this << "]" << std::endl;
// Fix this! Why Only log? Ostream is lonely.
- Log::Debug << "Function: " << function << std::endl;
- convert << "StepSize: " << stepSize << std::endl;
- convert << "Maximum Iterations: " << maxIterations << std::endl;
- convert << "Tolerance: " << tolerance << std::endl;
- convert << "Shuffle: " << shuffle << std::endl;
+ Log::Debug << " Function: " << function << std::endl;
+ convert << " StepSize: " << stepSize << std::endl;
+ convert << " Maximum Iterations: " << maxIterations << std::endl;
+ convert << " Tolerance: " << tolerance << std::endl;
+ convert << " Shuffle: " << shuffle << std::endl;
+ convert << std::endl;
return convert.str();
}
diff --git a/src/mlpack/core/tree/ballbound_impl.hpp b/src/mlpack/core/tree/ballbound_impl.hpp
index 26f0d29..0396653 100644
--- a/src/mlpack/core/tree/ballbound_impl.hpp
+++ b/src/mlpack/core/tree/ballbound_impl.hpp
@@ -198,8 +198,8 @@ std::string BallBound<VecType>::ToString() const
{
std::ostringstream convert;
convert << "BallBound [" << this << "]" << std::endl;
- convert << "Radius: " << radius << std::endl;
- convert << "Center: " << std::endl << center;
+ convert << " Radius: " << radius << std::endl;
+ convert << " Center: " << center << std::endl;
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 2bde605..022e9f9 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
@@ -678,12 +678,12 @@ 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: " << mlpack::util::Indent(bound.ToString());
- convert << "statistic: " << stat.ToString();
- convert << "leaf size: " << leafSize << std::endl;
- convert << "splitDimension: " << splitDimension << std::endl;
+ convert << " begin: " << begin << std::endl;
+ convert << " count: " << count << std::endl;
+ convert << " bound: " << mlpack::util::Indent(bound.ToString());
+ convert << " statistic: " << stat.ToString();
+ convert << " leaf size: " << leafSize << std::endl;
+ convert << " splitDimension: " << splitDimension << std::endl;
if (left != NULL)
{
convert << "left:" << std::endl;
diff --git a/src/mlpack/methods/det/dtree.cpp b/src/mlpack/methods/det/dtree.cpp
index 9693c4a..6178039 100644
--- a/src/mlpack/methods/det/dtree.cpp
+++ b/src/mlpack/methods/det/dtree.cpp
@@ -665,3 +665,19 @@ void DTree::ComputeVariableImportance(arma::vec& importances) const
nodes.push(curNode.Right());
}
}
+
+// Return string of object.
+std::string DTree::ToString() const
+{
+ std::ostringstream convert;
+ convert << "Density Estimation Tree [" << this << "]" << std::endl;
+ convert << " Start Node Index: " << start <<std::endl;
+ convert << " End Node Index: " << end <<std::endl;
+ convert << " Node Information:" << std::endl;
+ convert << " Splitting Dimension: " << splitDim << std::endl;
+ convert << " Splitting Value: " << splitValue << std::endl;
+ convert << " Is Root: " << root << std::endl;
+ convert << " # of points in Node to Total # of points" << ratio ;
+ convert << std::endl;
+ return convert.str();
+}
diff --git a/src/mlpack/methods/det/dtree.hpp b/src/mlpack/methods/det/dtree.hpp
index 57aa171..f8cadac 100644
--- a/src/mlpack/methods/det/dtree.hpp
+++ b/src/mlpack/methods/det/dtree.hpp
@@ -278,6 +278,11 @@ class DTree
//! Modify the minimum values.
arma::vec& MinVals() { return minVals; }
+ /**
+ * Returns a string representation of this object.
+ */
+ std::string ToString() const;
+
private:
// Utility methods.
diff --git a/src/mlpack/methods/emst/dtb.hpp b/src/mlpack/methods/emst/dtb.hpp
index 20ea088..3852fba 100644
--- a/src/mlpack/methods/emst/dtb.hpp
+++ b/src/mlpack/methods/emst/dtb.hpp
@@ -169,6 +169,11 @@ class DualTreeBoruvka
*/
void ComputeMST(arma::mat& results);
+ /**
+ * Returns a string representation of this object.
+ */
+ std::string ToString() const;
+
private:
/**
* Adds a single edge to the edge list
diff --git a/src/mlpack/methods/emst/dtb_impl.hpp b/src/mlpack/methods/emst/dtb_impl.hpp
index eea9f28..8b89ff4 100644
--- a/src/mlpack/methods/emst/dtb_impl.hpp
+++ b/src/mlpack/methods/emst/dtb_impl.hpp
@@ -294,6 +294,19 @@ void DualTreeBoruvka<MetricType, TreeType>::Cleanup()
}
}
+// convert the object to a string
+template<typename MetricType, typename TreeType>
+std::string DualTreeBoruvka<MetricType, TreeType>::ToString() const
+{
+ std::ostringstream convert;
+ convert << "Dual Tree Boruvka [" << this << "]" << std::endl;
+ //convert << " Data: " << data.n_rows << "x" << data.n_cols <<std::endl;
+ //convert << " Total Distance: " << totalDist <<std::endl;
+ //convert << " Naive: " << naive << std::endl;
+ //convert << " Metric" << metric << std::endl;
+ return convert.str();
+}
+
}; // namespace emst
}; // namespace mlpack
diff --git a/src/mlpack/methods/fastmks/fastmks.hpp b/src/mlpack/methods/fastmks/fastmks.hpp
index be1532c..916290f 100644
--- a/src/mlpack/methods/fastmks/fastmks.hpp
+++ b/src/mlpack/methods/fastmks/fastmks.hpp
@@ -179,6 +179,11 @@ class FastMKS
//! Modify the inner-product metric induced by the given kernel.
metric::IPMetric<KernelType>& Metric() { return metric; }
+ /**
+ * Returns a string representation of this object.
+ */
+ std::string ToString() const;
+
private:
//! The reference dataset.
const arma::mat& referenceSet;
diff --git a/src/mlpack/methods/fastmks/fastmks_impl.hpp b/src/mlpack/methods/fastmks/fastmks_impl.hpp
index 3f90d29..17bc189 100644
--- a/src/mlpack/methods/fastmks/fastmks_impl.hpp
+++ b/src/mlpack/methods/fastmks/fastmks_impl.hpp
@@ -300,6 +300,18 @@ void FastMKS<KernelType, TreeType>::InsertNeighbor(arma::Mat<size_t>& indices,
indices(pos, queryIndex) = neighbor;
}
+// Return string of object.
+template<typename KernelType, typename TreeType>
+std::string FastMKS<KernelType, TreeType>::ToString() const
+{
+ std::ostringstream convert;
+ convert << "FastMKS [" << this << "]" << std::endl;
+ convert << " Naive: " << naive << std::endl;
+ convert << " Single: " << single << std::endl;
+ Log::Debug << " Metric: " << metric << std::endl;
+ return convert.str();
+}
+
// Specialized implementation for tighter bounds for Gaussian.
/*
template<>
diff --git a/src/mlpack/methods/hmm/hmm.hpp b/src/mlpack/methods/hmm/hmm.hpp
index 8068ef2..4ea62f2 100644
--- a/src/mlpack/methods/hmm/hmm.hpp
+++ b/src/mlpack/methods/hmm/hmm.hpp
@@ -270,6 +270,11 @@ class HMM
//! Modify the tolerance of the Baum-Welch algorithm.
double& Tolerance() { return tolerance; }
+ /**
+ * Returns a string representation of this object.
+ */
+ std::string ToString() const;
+
private:
// Helper functions.
diff --git a/src/mlpack/methods/hmm/hmm_impl.hpp b/src/mlpack/methods/hmm/hmm_impl.hpp
index c73b6e7..4892040 100644
--- a/src/mlpack/methods/hmm/hmm_impl.hpp
+++ b/src/mlpack/methods/hmm/hmm_impl.hpp
@@ -489,6 +489,18 @@ void HMM<Distribution>::Backward(const arma::mat& dataSeq,
}
}
+template<typename Distribution>
+std::string HMM<Distribution>::ToString() const
+{
+ std::ostringstream convert;
+ convert << "HMM [" << this << "]" << std::endl;
+ convert << " Dimensionality: " << Dimensionality <<std::endl;
+ convert << " Tolerance: " << Tolerance <<std::endl;
+ convert << " Transition matrix: " << transition.n_rows << "x" ;
+ convert << transition.n_cols << std::endl;
+ return convert.str();
+}
+
}; // namespace hmm
}; // namespace mlpack
diff --git a/src/mlpack/methods/nca/nca_softmax_error_function_impl.hpp b/src/mlpack/methods/nca/nca_softmax_error_function_impl.hpp
index 17eb732..b2721b9 100644
--- a/src/mlpack/methods/nca/nca_softmax_error_function_impl.hpp
+++ b/src/mlpack/methods/nca/nca_softmax_error_function_impl.hpp
@@ -271,11 +271,11 @@ template<typename MetricType>
std::string SoftmaxErrorFunction<MetricType>::ToString() const{
std::ostringstream convert;
convert << "Sofmax Error Function [" << this << "]" << std::endl;
- convert << "Dataset: " << dataset.n_rows << "x" << dataset.n_cols
+ convert << " Dataset: " << dataset.n_rows << "x" << dataset.n_cols
<< std::endl;
- convert << "Labels: " << labels.n_elem << std::endl;
+ convert << " Labels: " << labels.n_elem << std::endl;
//convert << "Metric: " << metric << std::endl;
- convert << "Precalculated: " << precalculated << std::endl;
+ convert << " Precalculated: " << precalculated << std::endl;
return convert.str();
}
diff --git a/src/mlpack/tests/to_string_test.cpp b/src/mlpack/tests/to_string_test.cpp
index 6aa1c10..54c4cdf 100644
--- a/src/mlpack/tests/to_string_test.cpp
+++ b/src/mlpack/tests/to_string_test.cpp
@@ -33,6 +33,11 @@
#include <mlpack/core/tree/hrectbound.hpp>
#include <mlpack/core/tree/periodichrectbound.hpp>
#include <mlpack/core/tree/statistic.hpp>
+#include <mlpack/methods/cf/cf.hpp>
+#include <mlpack/methods/det/dtree.hpp>
+#include <mlpack/methods/emst/dtb.hpp>
+#include <mlpack/methods/fastmks/fastmks.hpp>
+#include <mlpack/methods/gmm/gmm.hpp>
using namespace mlpack;
using namespace mlpack::kernel;
@@ -49,61 +54,81 @@ BOOST_AUTO_TEST_SUITE(ToStringTest);
BOOST_AUTO_TEST_CASE(DiscreteDistributionString)
{
DiscreteDistribution d;
- Log::Info << d;
+ Log::Debug << d;
+ std::string s = d.ToString();
+ BOOST_REQUIRE_NE(s, "");
}
BOOST_AUTO_TEST_CASE(GaussianDistributionString)
{
GaussianDistribution d;
- Log::Info << d;
+ Log::Debug << d;
+ std::string s = d.ToString();
+ BOOST_REQUIRE_NE(s, "");
}
BOOST_AUTO_TEST_CASE(CosineDistanceString)
{
CosineDistance d;
- Log::Info << d;
+ Log::Debug << d;
+ std::string s = d.ToString();
+ BOOST_REQUIRE_NE(s, "");
}
BOOST_AUTO_TEST_CASE(EpanechnikovKernelString)
{
EpanechnikovKernel d;
- Log::Info << d;
+ Log::Debug << d;
+ std::string s = d.ToString();
+ BOOST_REQUIRE_NE(s, "");
}
BOOST_AUTO_TEST_CASE(ExampleKernelString)
{
ExampleKernel d;
- Log::Info << d;
+ Log::Debug << d;
+ std::string s = d.ToString();
+ BOOST_REQUIRE_NE(s, "");
}
BOOST_AUTO_TEST_CASE(GaussianKernelString)
{
GaussianKernel d;
- Log::Info << d;
+ Log::Debug << d;
+ std::string s = d.ToString();
+ BOOST_REQUIRE_NE(s, "");
}
BOOST_AUTO_TEST_CASE(HyperbolicTangentKernelString)
{
HyperbolicTangentKernel d;
- Log::Info << d;
+ Log::Debug << d;
+ std::string s = d.ToString();
+ BOOST_REQUIRE_NE(s, "");
}
BOOST_AUTO_TEST_CASE(LaplacianKernelString)
{
LaplacianKernel d;
- Log::Info << d;
+ Log::Debug << d;
+ std::string s = d.ToString();
+ BOOST_REQUIRE_NE(s, "");
}
BOOST_AUTO_TEST_CASE(LinearKernelString)
{
LinearKernel d;
- Log::Info << d;
+ Log::Debug << d;
+ std::string s = d.ToString();
+ BOOST_REQUIRE_NE(s, "");
}
BOOST_AUTO_TEST_CASE(PolynomialKernelString)
{
PolynomialKernel d;
- Log::Info << d;
+ Log::Debug << d;
+ std::string s = d.ToString();
+ BOOST_REQUIRE_NE(s, "");
}
BOOST_AUTO_TEST_CASE(PSpectrumStringKernelString)
@@ -111,37 +136,49 @@ BOOST_AUTO_TEST_CASE(PSpectrumStringKernelString)
const std::vector<std::vector<std::string> > s;
const size_t t=1;
PSpectrumStringKernel d(s,t);
- Log::Info << d;
+ Log::Debug << d;
+ std::string sttm = d.ToString();
+ BOOST_REQUIRE_NE(sttm, "");
}
BOOST_AUTO_TEST_CASE(SphericalKernelString)
{
SphericalKernel d;
- Log::Info << d;
+ Log::Debug << d;
+ std::string s = d.ToString();
+ BOOST_REQUIRE_NE(s, "");
}
BOOST_AUTO_TEST_CASE(TriangularKernelString)
{
TriangularKernel d;
- Log::Info << d;
+ Log::Debug << d;
+ std::string s = d.ToString();
+ BOOST_REQUIRE_NE(s, "");
}
BOOST_AUTO_TEST_CASE(IPMetricString)
{
IPMetric<TriangularKernel> d;
- Log::Info << d;
+ Log::Debug << d;
+ std::string s = d.ToString();
+ BOOST_REQUIRE_NE(s, "");
}
BOOST_AUTO_TEST_CASE(LMetricString)
{
LMetric<1> d;
- Log::Info << d;
+ Log::Debug << d;
+ std::string s = d.ToString();
+ BOOST_REQUIRE_NE(s, "");
}
BOOST_AUTO_TEST_CASE(MahalanobisDistanceString)
{
MahalanobisDistance<> d;
- Log::Info << d;
+ Log::Debug << d;
+ std::string s = d.ToString();
+ BOOST_REQUIRE_NE(s, "");
}
BOOST_AUTO_TEST_CASE(SGDString)
@@ -150,7 +187,9 @@ BOOST_AUTO_TEST_CASE(SGDString)
const arma::Col<size_t> v(2);
SoftmaxErrorFunction<> a(g,v);
mlpack::optimization::SGD<SoftmaxErrorFunction<> > d(a);
- Log::Info << d;
+ Log::Debug << d;
+ std::string s = d.ToString();
+ BOOST_REQUIRE_NE(s, "");
}
BOOST_AUTO_TEST_CASE(L_BFGSString)
@@ -159,7 +198,9 @@ BOOST_AUTO_TEST_CASE(L_BFGSString)
const arma::Col<size_t> v(2);
SoftmaxErrorFunction<> a(g,v);
mlpack::optimization::L_BFGS<SoftmaxErrorFunction<> > d(a);
- Log::Info << d;
+ Log::Debug << d;
+ std::string s = d.ToString();
+ BOOST_REQUIRE_NE(s, "");
}
BOOST_AUTO_TEST_CASE(AugLagString)
@@ -169,13 +210,77 @@ BOOST_AUTO_TEST_CASE(AugLagString)
<mlpack::optimization::AugLagrangianTestFunction> q(a);
mlpack::optimization::AugLagrangian
<mlpack::optimization::AugLagrangianTestFunction> d(a);
- Log::Info << d;
+ Log::Debug << d;
+ std::string s = d.ToString();
+ BOOST_REQUIRE_NE(s, "");
}
BOOST_AUTO_TEST_CASE(BallBoundString)
{
BallBound<> d;
- Log::Info << d;
+ Log::Debug << d;
+ std::string s = d.ToString();
+ BOOST_REQUIRE_NE(s, "");
+}
+
+BOOST_AUTO_TEST_CASE(BinSpaceString)
+{
+ arma::mat q(2,2);
+ q.randu();
+ BinarySpaceTree<HRectBound<1> > d(q);
+ Log::Debug << d;
+ std::string s = d.ToString();
+ BOOST_REQUIRE_NE(s, "");
+}
+
+/**
+BOOST_AUTO_TEST_CASE(CFString)
+{
+ arma::mat c(10,10);
+ mlpack::cf::CF d(c);
+ Log::Debug << d;
+ std::string s = d.ToString();
+ BOOST_REQUIRE_NE(s, "");
+}
+**/
+BOOST_AUTO_TEST_CASE(DetString)
+{
+ arma::mat c(4,4);
+ c.randn();
+ mlpack::det::DTree d(c);
+ Log::Debug << d;
+ std::string s = d.ToString();
+ BOOST_REQUIRE_NE(s, "");
+}
+
+BOOST_AUTO_TEST_CASE(EmstString)
+{
+ arma::mat c(4,4);
+ c.randn();
+ mlpack::emst::DualTreeBoruvka<> d(c);
+ Log::Debug << d;
+ std::string s = d.ToString();
+ BOOST_REQUIRE_NE(s, "");
+}
+
+BOOST_AUTO_TEST_CASE(FastMKSString)
+{
+ arma::mat c(4,4);
+ c.randn();
+ mlpack::fastmks::FastMKS<LinearKernel> d(c);
+ Log::Debug << d;
+ std::string s = d.ToString();
+ BOOST_REQUIRE_NE(s, "");
+}
+
+BOOST_AUTO_TEST_CASE(GMMString)
+{
+ arma::mat c(400,40);
+ c.randn();
+ mlpack::gmm::GMM<> d(5, 4);
+ Log::Debug << d;
+ std::string s = d.ToString();
+ BOOST_REQUIRE_NE(s, "");
}
BOOST_AUTO_TEST_SUITE_END();
More information about the mlpack-git
mailing list