mlpack  master
Classes | Public Types | Static Public Member Functions | Static Private Member Functions | List of all members
mlpack::tree::VantagePointSplit< BoundType, MatType, MaxNumSamples > Class Template Reference

The class splits a binary space partitioning tree node according to the median distance to the vantage point. More...

Classes

struct  SplitInfo
 A struct that contains an information about the split. More...
 

Public Types

typedef MatType::elem_type ElemType
 The matrix element type. More...
 
typedef BoundType::MetricType MetricType
 The bounding shape type. More...
 

Static Public Member Functions

template<typename VecType >
static bool AssignToLeftNode (const VecType &point, const SplitInfo &splitInfo)
 Indicates that a point should be assigned to the left subtree. More...
 
static size_t PerformSplit (MatType &data, const size_t begin, const size_t count, const SplitInfo &splitInfo)
 Perform the split process according to the information about the split. More...
 
static size_t PerformSplit (MatType &data, const size_t begin, const size_t count, const SplitInfo &splitInfo, std::vector< size_t > &oldFromNew)
 Perform the split process according to the information about the split and return the list of changed indices. More...
 
static bool SplitNode (const BoundType &bound, MatType &data, const size_t begin, const size_t count, SplitInfo &splitInfo)
 Split the node according to the distance to a vantage point. More...
 

Static Private Member Functions

static void SelectVantagePoint (const MetricType &metric, const MatType &data, const size_t begin, const size_t count, size_t &vantagePoint, ElemType &mu)
 Select the best vantage point, i.e., the point with the largest second moment of the distance from a number of random node points to the vantage point. More...
 

Detailed Description

template<typename BoundType, typename MatType = arma::mat, size_t MaxNumSamples = 100>
class mlpack::tree::VantagePointSplit< BoundType, MatType, MaxNumSamples >

The class splits a binary space partitioning tree node according to the median distance to the vantage point.

Thus points that are closer to the vantage point belong to the left subtree and points that are farther from the vantage point belong to the right subtree.

Definition at line 32 of file vantage_point_split.hpp.

Member Typedef Documentation

template<typename BoundType , typename MatType = arma::mat, size_t MaxNumSamples = 100>
typedef MatType::elem_type mlpack::tree::VantagePointSplit< BoundType, MatType, MaxNumSamples >::ElemType

The matrix element type.

Definition at line 36 of file vantage_point_split.hpp.

template<typename BoundType , typename MatType = arma::mat, size_t MaxNumSamples = 100>
typedef BoundType::MetricType mlpack::tree::VantagePointSplit< BoundType, MatType, MaxNumSamples >::MetricType

The bounding shape type.

Definition at line 38 of file vantage_point_split.hpp.

Member Function Documentation

template<typename BoundType , typename MatType = arma::mat, size_t MaxNumSamples = 100>
template<typename VecType >
static bool mlpack::tree::VantagePointSplit< BoundType, MatType, MaxNumSamples >::AssignToLeftNode ( const VecType &  point,
const SplitInfo splitInfo 
)
inlinestatic

Indicates that a point should be assigned to the left subtree.

This method returns true if a point should be assigned to the left subtree, i.e., if the distance from the point to the vantage point is less then the median value. Otherwise it returns false.

Parameters
pointThe point that is being assigned.
splitInfoAn information about the split.

Definition at line 138 of file vantage_point_split.hpp.

References mlpack::tree::VantagePointSplit< BoundType, MatType, MaxNumSamples >::SplitInfo::metric, mlpack::tree::VantagePointSplit< BoundType, MatType, MaxNumSamples >::SplitInfo::mu, mlpack::tree::VantagePointSplit< BoundType, MatType, MaxNumSamples >::SelectVantagePoint(), and mlpack::tree::VantagePointSplit< BoundType, MatType, MaxNumSamples >::SplitInfo::vantagePoint.

template<typename BoundType , typename MatType = arma::mat, size_t MaxNumSamples = 100>
static size_t mlpack::tree::VantagePointSplit< BoundType, MatType, MaxNumSamples >::PerformSplit ( MatType &  data,
const size_t  begin,
const size_t  count,
const SplitInfo splitInfo 
)
inlinestatic

Perform the split process according to the information about the split.

This will order the dataset such that points that belong to the left subtree are on the left of the split column, and points from the right subtree are on the right side of the split column.

Parameters
boundThe bound used for this node.
dataThe dataset used by the binary space tree.
beginIndex of the starting point in the dataset that belongs to this node.
countNumber of points in this node.
splitInfoThe information about the split.

Definition at line 93 of file vantage_point_split.hpp.

template<typename BoundType , typename MatType = arma::mat, size_t MaxNumSamples = 100>
static size_t mlpack::tree::VantagePointSplit< BoundType, MatType, MaxNumSamples >::PerformSplit ( MatType &  data,
const size_t  begin,
const size_t  count,
const SplitInfo splitInfo,
std::vector< size_t > &  oldFromNew 
)
inlinestatic

Perform the split process according to the information about the split and return the list of changed indices.

This will order the dataset such that points that belong to the left subtree are on the left of the split column, and points from the right subtree are on the right side of the split column.

Parameters
boundThe bound used for this node.
dataThe dataset used by the binary space tree.
beginIndex of the starting point in the dataset that belongs to this node.
countNumber of points in this node.
splitInfoThe information about the split.
oldFromNewVector which will be filled with the old positions for each new point.

Definition at line 118 of file vantage_point_split.hpp.

template<typename BoundType , typename MatType = arma::mat, size_t MaxNumSamples = 100>
static void mlpack::tree::VantagePointSplit< BoundType, MatType, MaxNumSamples >::SelectVantagePoint ( const MetricType metric,
const MatType &  data,
const size_t  begin,
const size_t  count,
size_t &  vantagePoint,
ElemType mu 
)
staticprivate

Select the best vantage point, i.e., the point with the largest second moment of the distance from a number of random node points to the vantage point.

Firstly this method selects no more than MaxNumSamples random points. Then it evaluates each point, i.e., calculates the corresponding second moment and selects the point with the largest moment. Each random point belongs to the node.

Parameters
metricThe metric used by the tree.
dataThe dataset used by the tree.
beginIndex of the starting point in the dataset that belongs to this node.
countNumber of points in this node.
vantagePointThe index of the vantage point in the dataset.
muThe median value of distance form the vantage point to a number of random points.

Referenced by mlpack::tree::VantagePointSplit< BoundType, MatType, MaxNumSamples >::AssignToLeftNode().

template<typename BoundType , typename MatType = arma::mat, size_t MaxNumSamples = 100>
static bool mlpack::tree::VantagePointSplit< BoundType, MatType, MaxNumSamples >::SplitNode ( const BoundType &  bound,
MatType &  data,
const size_t  begin,
const size_t  count,
SplitInfo splitInfo 
)
static

Split the node according to the distance to a vantage point.

Parameters
boundThe bound used for this node.
dataThe dataset used by the binary space tree.
beginIndex of the starting point in the dataset that belongs to this node.
countNumber of points in this node.
splitInfoAn information about the split. This information contains the vantage point and the median distance to the vantage point.

Referenced by mlpack::tree::VantagePointSplit< BoundType, MatType, MaxNumSamples >::SplitInfo::SplitInfo().


The documentation for this class was generated from the following file: