13 #ifndef MLPACK_CORE_TREE_SPILL_TREE_SPACE_SPLIT_IMPL_HPP 14 #define MLPACK_CORE_TREE_SPILL_TREE_SPACE_SPLIT_IMPL_HPP 21 template<
typename MetricType,
typename MatType>
25 const arma::Col<size_t>& ,
30 size_t splitDim = data.n_rows;
33 for (
size_t d = 0; d < data.n_rows; d++)
35 const double width = bound[d].Width();
49 midValue = bound[splitDim].Mid();
54 template<
typename MetricType,
typename MatType>
55 template<
typename BoundType>
59 const arma::Col<size_t>& points,
66 size_t fst = points[rand() % points.n_elem];
67 size_t snd = points[0];
68 double max = metric.Evaluate(data.col(fst), data.col(snd));
70 for (
size_t i = 1; i < points.n_elem; ++i)
72 double dist = metric.Evaluate(data.col(fst), data.col(points[i]));
82 for (
size_t i = 0; i < points.n_elem; ++i)
84 double dist = metric.Evaluate(data.col(fst), data.col(points[i]));
96 projVector =
ProjVector(data.col(snd) - data.col(fst));
98 arma::vec midPoint = (data.col(snd) + data.col(fst)) / 2;
100 midValue = projVector.
Project(midPoint);
double Project(const VecType &point, typename std::enable_if_t< IsVector< VecType >::value > *=0) const
Project the given point on the projection vector.
Definition: projection_vector.hpp:119
AxisParallelProjVector defines an axis-parallel projection vector.
Definition: projection_vector.hpp:24
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
static bool GetProjVector(const bound::HRectBound< MetricType > &bound, const MatType &data, const arma::Col< size_t > &points, AxisParallelProjVector &projVector, double &midValue)
Create a projection vector based on the given set of point.
Definition: space_split_impl.hpp:22
ProjVector defines a general projection vector (not necessarily axis-parallel).
Definition: projection_vector.hpp:91