[mlpack] 30/207: Refactored range search model to include boost variant and visitor paradigm
Barak A. Pearlmutter
barak+git at pearlmutter.net
Thu Mar 23 17:53:38 UTC 2017
This is an automated email from the git hooks/post-receive script.
bap pushed a commit to branch master
in repository mlpack.
commit 7d6f24aacc9ae81b712abd6d05ff5f1679d56a4c
Author: dinesh Raj <dinu.iota at gmail.com>
Date: Mon Feb 6 23:32:58 2017 +0530
Refactored range search model to include boost variant and visitor paradigm
---
src/mlpack/methods/range_search/rs_model.hpp | 24 +++++++++++------------
src/mlpack/methods/range_search/rs_model_impl.hpp | 24 +++++++++++------------
2 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/src/mlpack/methods/range_search/rs_model.hpp b/src/mlpack/methods/range_search/rs_model.hpp
index 3ef6424..4544097 100644
--- a/src/mlpack/methods/range_search/rs_model.hpp
+++ b/src/mlpack/methods/range_search/rs_model.hpp
@@ -40,7 +40,7 @@ struct RSModelName
};
/**
- * MonoSearchVisitor executes a monochromatic neighbor search on the given
+ * MonoSearchVisitor executes a monochromatic range search on the given
* RSType. Range Search is performed on the reference set itself, no querySet.
*/
class MonoSearchVisitor : public boost::static_visitor<void>
@@ -65,9 +65,9 @@ class MonoSearchVisitor : public boost::static_visitor<void>
};
/**
- * BiSearchVisitor executes a bichromatic neighbor search on the given RSType.
+ * BiSearchVisitor executes a bichromatic range search on the given RSType.
* We use template specialization to differentiate those tree types that
- * accept leafSize as a parameter. In these cases, before doing neighbor search,
+ * accept leafSize as a parameter. In these cases, before doing range search,
* a query tree with proper leafSize is built from the querySet.
*/
class BiSearchVisitor : public boost::static_visitor<void>
@@ -84,7 +84,7 @@ class BiSearchVisitor : public boost::static_visitor<void>
//! The number of points in a leaf (for BinarySpaceTrees).
const size_t leafSize;
- //! Bichromatic neighbor search on the given RSType considering the leafSize.
+ //! Bichromatic range search on the given RSType considering the leafSize.
template<typename RSType>
void SearchLeaf(RSType* rs) const;
@@ -95,19 +95,19 @@ class BiSearchVisitor : public boost::static_visitor<void>
typename TreeMatType> class TreeType>
using RSTypeT = RSType<TreeType>;
- //! Default Bichromatic neighbor search on the given RSType instance.
+ //! Default Bichromatic range search on the given RSType instance.
template<template<typename TreeMetricType,
typename TreeStatType,
typename TreeMatType> class TreeType>
void operator()(RSTypeT<TreeType>* rs) const;
- //! Bichromatic neighbor search on the given RSType specialized for KDTrees.
+ //! Bichromatic range search on the given RSType specialized for KDTrees.
void operator()(RSTypeT<tree::KDTree>* rs) const;
- //! Bichromatic neighbor search on the given RSType specialized for BallTrees.
+ //! Bichromatic range search on the given RSType specialized for BallTrees.
void operator()(RSTypeT<tree::BallTree>* rs) const;
- //! Bichromatic neighbor search specialized for octrees.
+ //! Bichromatic range search specialized for octrees.
void operator()(RSTypeT<tree::Octree>* rs) const;
//! Construct the BiSearchVisitor.
@@ -211,8 +211,8 @@ template<typename Archive>
class SingleModeVisitor : public boost::static_visitor<bool&>
{
public:
- template<typename NSType>
- bool& operator()(NSType *ns) const;
+ template<typename RSType>
+ bool& operator()(RSType *ns) const;
};
/**
@@ -221,8 +221,8 @@ template<typename Archive>
class NaiveVisitor : public boost::static_visitor<bool&>
{
public:
- template<typename NSType>
- bool& operator()(NSType *ns) const;
+ template<typename RSType>
+ bool& operator()(RSType *ns) const;
};
class RSModel
diff --git a/src/mlpack/methods/range_search/rs_model_impl.hpp b/src/mlpack/methods/range_search/rs_model_impl.hpp
index 3fde0f5..351a96b 100644
--- a/src/mlpack/methods/range_search/rs_model_impl.hpp
+++ b/src/mlpack/methods/range_search/rs_model_impl.hpp
@@ -24,7 +24,7 @@ void MonoSearchVisitor::operator()(RSType *rs) const
{
if (rs)
return rs->Search(range, neighbors, distances);
- throw std::runtime_error("no neighbor search model initialized");
+ throw std::runtime_error("no range search model initialized");
}
//! Save parameters for bichromatic range search.
@@ -49,7 +49,7 @@ void BiSearchVisitor::operator()(RSTypeT<TreeType>* rs) const
{
if (rs)
return rs->Search(querySet, range, neighbors, distances);
- throw std::runtime_error("no neighbor search model initialized");
+ throw std::runtime_error("no range search model initialized");
}
//! Bichromatic range search on the given RSType specialized for KDTrees.
@@ -57,7 +57,7 @@ void BiSearchVisitor::operator()(RSTypeT<tree::KDTree>* rs) const
{
if (rs)
return SearchLeaf(rs);
- throw std::runtime_error("no neighbor search model initialized");
+ throw std::runtime_error("no range search model initialized");
}
//! Bichromatic range search on the given RSType specialized for BallTrees.
@@ -65,7 +65,7 @@ void BiSearchVisitor::operator()(RSTypeT<tree::BallTree>* rs) const
{
if (rs)
return SearchLeaf(rs);
- throw std::runtime_error("no neighbor search model initialized");
+ throw std::runtime_error("no range search model initialized");
}
//! Bichromatic range search specialized for Ocrees.
@@ -73,7 +73,7 @@ void BiSearchVisitor::operator()(RSTypeT<tree::Octree>* rs) const
{
if (rs)
return SearchLeaf(rs);
- throw std::runtime_error("no neighbor search model initialized");
+ throw std::runtime_error("no range search model initialized");
}
//! Bichromatic range search on the given RSType considering the leafSize.
@@ -127,7 +127,7 @@ void TrainVisitor::operator()(RSTypeT<TreeType>* rs) const
{
if (rs)
return rs->Train(std::move(referenceSet));
- throw std::runtime_error("no neighbor search model initialized");
+ throw std::runtime_error("no range search model initialized");
}
//! Train on the given RSType specialized for KDTrees.
@@ -135,7 +135,7 @@ void TrainVisitor::operator()(RSTypeT<tree::KDTree>* rs) const
{
if (rs)
return TrainLeaf(rs);
- throw std::runtime_error("no neighbor search model initialized");
+ throw std::runtime_error("no range search model initialized");
}
//! Train on the given RSType specialized for BallTrees.
@@ -143,7 +143,7 @@ void TrainVisitor::operator()(RSTypeT<tree::BallTree>* rs) const
{
if (rs)
return TrainLeaf(rs);
- throw std::runtime_error("no neighbor search model initialized");
+ throw std::runtime_error("no range search model initialized");
}
//! Train specialized for Octrees.
@@ -151,7 +151,7 @@ void TrainVisitor::operator()(RSTypeT<tree::Octree>* rs) const
{
if (rs)
return TrainLeaf(rs);
- throw std::runtime_error("no neighbor search model initialized");
+ throw std::runtime_error("no range search model initialized");
}
//! Train on the given RSType considering the leafSize.
@@ -183,7 +183,7 @@ const arma::mat& ReferenceSetVisitor::operator()(RSType* rs) const
{
if (rs)
return rs->ReferenceSet();
- throw std::runtime_error("no neighbor search model initialized");
+ throw std::runtime_error("no range search model initialized");
}
//! For cleaning memory
@@ -216,7 +216,7 @@ template<typename RSType>
{
if (rs)
return rs->SingleMode();
- throw std::runtime_error("no neighbor search model initialized");
+ throw std::runtime_error("no range search model initialized");
}
//! Exposes Naive() function of given RSType
@@ -225,7 +225,7 @@ template<typename RSType>
{
if (rs)
return rs->Naive();
- throw std::runtime_error("no neighbor search model initialized");
+ throw std::runtime_error("no range search model initialized");
}
// Serialize the model.
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/mlpack.git
More information about the debian-science-commits
mailing list