[mlpack-git] master: Give name of tree in output. (c7f92a5)
gitdub at big.cc.gt.atl.ga.us
gitdub at big.cc.gt.atl.ga.us
Tue Oct 20 09:48:00 EDT 2015
Repository : https://github.com/mlpack/mlpack
On branch : master
Link : https://github.com/mlpack/mlpack/compare/67e0a132c7f62820c734eb508fe1bc83128a3e13...00eccfdb0d315de3d94bfa1da84cc1dc65c8af39
>---------------------------------------------------------------
commit c7f92a5f62300d4b789f62c533105d73cb72b958
Author: Ryan Curtin <ryan at ratml.org>
Date: Mon Oct 19 20:48:09 2015 +0000
Give name of tree in output.
>---------------------------------------------------------------
c7f92a5f62300d4b789f62c533105d73cb72b958
src/mlpack/methods/neighbor_search/ns_model.hpp | 2 ++
.../methods/neighbor_search/ns_model_impl.hpp | 27 ++++++++++++++++++----
2 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/src/mlpack/methods/neighbor_search/ns_model.hpp b/src/mlpack/methods/neighbor_search/ns_model.hpp
index 952ed9e..6412922 100644
--- a/src/mlpack/methods/neighbor_search/ns_model.hpp
+++ b/src/mlpack/methods/neighbor_search/ns_model.hpp
@@ -120,6 +120,8 @@ class NSModel
void Search(const size_t k,
arma::Mat<size_t>& neighbors,
arma::mat& distances);
+
+ std::string TreeName(int treeType) const;
};
} // namespace neighbor
diff --git a/src/mlpack/methods/neighbor_search/ns_model_impl.hpp b/src/mlpack/methods/neighbor_search/ns_model_impl.hpp
index af5f3fb..1f9ba6f 100644
--- a/src/mlpack/methods/neighbor_search/ns_model_impl.hpp
+++ b/src/mlpack/methods/neighbor_search/ns_model_impl.hpp
@@ -289,9 +289,9 @@ void NSModel<SortPolicy>::Search(arma::mat&& querySet,
Log::Info << "Searching for " << k << " nearest neighbors with ";
if (!Naive() && !SingleMode())
- Log::Info << "dual-tree search..." << std::endl;
+ Log::Info << "dual-tree " << TreeName() << " search..." << std::endl;
else if (!Naive())
- Log::Info << "single-tree search..." << std::endl;
+ Log::Info << "single-tree " << TreeName() << " search..." << std::endl;
else
Log::Info << "brute-force (naive) search..." << std::endl;
@@ -351,9 +351,9 @@ void NSModel<SortPolicy>::Search(const size_t k,
{
Log::Info << "Searching for " << k << " nearest neighbors with ";
if (!Naive() && !SingleMode())
- Log::Info << "dual-tree search..." << std::endl;
+ Log::Info << "dual-tree " << TreeName() << " search..." << std::endl;
else if (!Naive())
- Log::Info << "single-tree search..." << std::endl;
+ Log::Info << "single-tree " << TreeName() << " search..." << std::endl;
else
Log::Info << "brute-force (naive) search..." << std::endl;
@@ -374,6 +374,25 @@ void NSModel<SortPolicy>::Search(const size_t k,
}
}
+//! Get the name of the tree type.
+template<typename SortPolicy>
+void NSModel<SortPolicy>::TreeName() const
+{
+ switch (treeType)
+ {
+ case KD_TREE:
+ return "kd-tree";
+ case COVER_TREE:
+ return "cover tree";
+ case R_TREE:
+ return "R tree";
+ case R_STAR_TREE:
+ return "R* tree";
+ default:
+ return "unknown tree";
+ }
+}
+
} // namespace neighbor
} // namespace mlpack
More information about the mlpack-git
mailing list