[mlpack] 04/11: Remove rs_model.cpp.
Barak A. Pearlmutter
barak+git at pearlmutter.net
Thu Aug 31 13:19:49 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 0689cbb2745dbd183f5d2e64c465f1cfce1c7dc8
Author: Ryan Curtin <ryan at ratml.org>
Date: Fri Aug 25 19:52:26 2017 -0400
Remove rs_model.cpp.
---
src/mlpack/methods/range_search/rs_model.cpp | 218 ---------------------------
1 file changed, 218 deletions(-)
diff --git a/src/mlpack/methods/range_search/rs_model.cpp b/src/mlpack/methods/range_search/rs_model.cpp
deleted file mode 100644
index 8a280a3..0000000
--- a/src/mlpack/methods/range_search/rs_model.cpp
+++ /dev/null
@@ -1,218 +0,0 @@
-/**
- * @file rs_model.cpp
- * @author Ryan Curtin
- *
- * Implementation of the range search model class.
- *
- * mlpack is free software; you may redistribute it and/or modify it under the
- * terms of the 3-clause BSD license. You should have received a copy of the
- * 3-clause BSD license along with mlpack. If not, see
- * http://www.opensource.org/licenses/BSD-3-Clause for more information.
- */
-#include "rs_model.hpp"
-#include <mlpack/core/math/random_basis.hpp>
-
-using namespace std;
-using namespace mlpack;
-using namespace mlpack::range;
-
-/**
- * Initialize the RSModel with the given tree type and whether or not a random
- * basis should be used.
- */
-RSModel::RSModel(TreeTypes treeType, bool randomBasis) :
- treeType(treeType),
- leafSize(0),
- randomBasis(randomBasis)
-{
- // Nothing to do.
-}
-
-// Clean memory, if necessary.
-RSModel::~RSModel()
-{
- boost::apply_visitor(DeleteVisitor(), rSearch);
-}
-
-void RSModel::BuildModel(arma::mat&& referenceSet,
- const size_t leafSize,
- const bool naive,
- const bool singleMode)
-{
- // Initialize random basis if necessary.
- if (randomBasis)
- {
- Log::Info << "Creating random basis..." << endl;
- math::RandomBasis(q, referenceSet.n_rows);
- }
-
- this->leafSize = leafSize;
-
- // Clean memory, if necessary.
- boost::apply_visitor(DeleteVisitor(), rSearch);
-
- // Do we need to modify the reference set?
- if (randomBasis)
- referenceSet = q * referenceSet;
-
- if (!naive)
- {
- Timer::Start("tree_building");
- Log::Info << "Building reference tree..." << endl;
- }
-
- switch (treeType)
- {
- case KD_TREE:
- rSearch = new RSType<tree::KDTree> (naive, singleMode);
- break;
-
- case COVER_TREE:
- rSearch = new RSType<tree::StandardCoverTree>(naive, singleMode);
- break;
-
- case R_TREE:
- rSearch = new RSType<tree::RTree>(naive,singleMode);
- break;
-
- case R_STAR_TREE:
- rSearch = new RSType<tree::RStarTree>(naive, singleMode);
- break;
-
- case BALL_TREE:
- rSearch = new RSType<tree::BallTree>(naive, singleMode);
- break;
-
- case X_TREE:
- rSearch = new RSType<tree::XTree>(naive, singleMode);
- break;
-
- case HILBERT_R_TREE:
- rSearch = new RSType<tree::HilbertRTree>(naive, singleMode);
- break;
-
- case R_PLUS_TREE:
- rSearch = new RSType<tree::RPlusTree>(naive, singleMode);
- break;
-
- case R_PLUS_PLUS_TREE:
- rSearch = new RSType<tree::RPlusPlusTree>(naive, singleMode);
- break;
-
- case VP_TREE:
- rSearch = new RSType<tree::VPTree>(naive, singleMode);
- break;
-
- case RP_TREE:
- rSearch = new RSType<tree::RPTree>(naive, singleMode);
- break;
-
- case MAX_RP_TREE:
- rSearch = new RSType<tree::MaxRPTree>(naive, singleMode);
- break;
-
- case UB_TREE:
- rSearch = new RSType<tree::UBTree>(naive, singleMode);
- break;
-
- case OCTREE:
- rSearch = new RSType<tree::Octree>(naive, singleMode);
- break;
- }
-
- TrainVisitor tn(std::move(referenceSet), leafSize);
- boost::apply_visitor(tn, rSearch);
-
- if (!naive)
- {
- Timer::Stop("tree_building");
- Log::Info << "Tree built." << endl;
- }
-}
-
-// Perform range search.
-void RSModel::Search(arma::mat&& querySet,
- const math::Range& range,
- vector<vector<size_t>>& neighbors,
- vector<vector<double>>& distances)
-{
- // We may need to map the query set randomly.
- if (randomBasis)
- querySet = q * querySet;
-
- Log::Info << "Search for points in the range [" << range.Lo() << ", "
- << range.Hi() << "] with ";
- if (!Naive() && !SingleMode())
- Log::Info << "dual-tree " << TreeName() << " search..." << endl;
- else if (!Naive())
- Log::Info << "single-tree " << TreeName() << " search..." << endl;
- else
- Log::Info << "brute-force (naive) search..." << endl;
-
-
- BiSearchVisitor search(querySet, range, neighbors, distances,
- leafSize);
- boost::apply_visitor(search, rSearch);
-}
-
-// Perform range search (monochromatic case).
-void RSModel::Search(const math::Range& range,
- vector<vector<size_t>>& neighbors,
- vector<vector<double>>& distances)
-{
- Log::Info << "Search for points in the range [" << range.Lo() << ", "
- << range.Hi() << "] with ";
- if (!Naive() && !SingleMode())
- Log::Info << "dual-tree " << TreeName() << " search..." << endl;
- else if (!Naive())
- Log::Info << "single-tree " << TreeName() << " search..." << endl;
- else
- Log::Info << "brute-force (naive) search..." << endl;
-
- MonoSearchVisitor search(range, neighbors, distances);
- boost::apply_visitor(search, rSearch);
-}
-
-// Get the name of the tree type.
-std::string RSModel::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";
- case BALL_TREE:
- return "ball tree";
- case X_TREE:
- return "X tree";
- case HILBERT_R_TREE:
- return "Hilbert R tree";
- case R_PLUS_TREE:
- return "R+ tree";
- case R_PLUS_PLUS_TREE:
- return "R++ tree";
- case VP_TREE:
- return "vantage point tree";
- case RP_TREE:
- return "random projection tree (mean split)";
- case MAX_RP_TREE:
- return "random projection tree (max split)";
- case UB_TREE:
- return "UB tree";
- case OCTREE:
- return "octree";
- default:
- return "unknown tree";
- }
-}
-
-// Clean memory.
-void RSModel::CleanMemory()
-{
- boost::apply_visitor(DeleteVisitor(), rSearch);
-}
--
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