Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template<typename SortPolicy,
- template<typename TreeMetricType,
- typename TreeStatType,
- typename TreeMatType> class TreeType>
- class NSTypeClass
- {
- public:
- using NSType = NeighborSearch<SortPolicy,
- metric::EuclideanDistance,
- arma::mat,
- TreeType,
- TreeType<metric::EuclideanDistance,
- NeighborSearchStat<SortPolicy>,
- arma::mat>::template DualTreeTraverser>;
- };
- class TrainVisitor : public boost::static_visitor<void>
- {
- private:
- arma::mat&& referenceSet;
- size_t leafSize;
- template<typename NSType>
- void TrainLeaf(NSType* ns) const;
- public:
- //tree::KDTree
- template<typename SortPolicy>
- void operator()(typename NSTypeClass<SortPolicy,tree::KDTree>::NSType *ns) const
- {
- if (ns)
- return TrainLeaf(ns);
- throw std::runtime_error("no neighbor search model initialized");
- }
- //tree::BallTree
- template<typename SortPolicy>
- void operator()(typename NSTypeClass<SortPolicy,tree::BallTree>::NSType *ns) const
- {
- if (ns)
- return TrainLeaf(ns);
- throw std::runtime_error("no neighbor search model initialized");
- }//*/
- template<typename NSType>
- void operator()(NSType *ns) const
- {
- if (ns)
- return ns->Train(std::move(referenceSet));
- throw std::runtime_error("no neighbor search model initialized");
- }
- TrainVisitor(arma::mat&& referenceSet, const size_t leafSize);
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement