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

This class splits a binary space tree. More...

Classes

struct  SplitInfo
 An information about the partition. More...
 

Public Types

typedef MatType::elem_type ElemType
 The element type held by the matrix 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 &, MatType &data, const size_t begin, const size_t count, SplitInfo &splitInfo)
 Split the node according to the mean value in the dimension with maximum width. More...
 

Static Private Member Functions

static ElemType GetAveragePointDistance (MatType &data, const arma::uvec &samples)
 Get the average distance between points in the dataset. More...
 
static bool GetDotMedian (const MatType &data, const arma::uvec &samples, const arma::Col< ElemType > &direction, ElemType &splitVal)
 Get the median of scalar products of the sampled points and the normal to the hyperplane (i.e. More...
 
static bool GetMeanMedian (const MatType &data, const arma::uvec &samples, arma::Col< ElemType > &mean, ElemType &splitVal)
 Get the mean point and the median of distance from the mean to any point of the dataset. More...
 

Detailed Description

template<typename BoundType, typename MatType = arma::mat>
class mlpack::tree::RPTreeMeanSplit< BoundType, MatType >

This class splits a binary space tree.

This class provides two different kinds of split. The mean split (i.e. all points are split by the median of their distance to the mean point) is performed if the average distance between points multiplied by a constant is greater than the diameter of the node. Otherwise, the median split (i.e. the node is split by a random hyperplane) is performed.

Definition at line 33 of file rp_tree_mean_split.hpp.

Member Typedef Documentation

template<typename BoundType , typename MatType = arma::mat>
typedef MatType::elem_type mlpack::tree::RPTreeMeanSplit< BoundType, MatType >::ElemType

The element type held by the matrix type.

Definition at line 37 of file rp_tree_mean_split.hpp.

Member Function Documentation

template<typename BoundType , typename MatType = arma::mat>
template<typename VecType >
static bool mlpack::tree::RPTreeMeanSplit< BoundType, MatType >::AssignToLeftNode ( const VecType &  point,
const SplitInfo splitInfo 
)
inlinestatic
template<typename BoundType , typename MatType = arma::mat>
static ElemType mlpack::tree::RPTreeMeanSplit< BoundType, MatType >::GetAveragePointDistance ( MatType &  data,
const arma::uvec &  samples 
)
staticprivate

Get the average distance between points in the dataset.

Parameters
dataThe dataset used by the binary space tree.
samplesThe indices of points that will be used for the calculation.

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

template<typename BoundType , typename MatType = arma::mat>
static bool mlpack::tree::RPTreeMeanSplit< BoundType, MatType >::GetDotMedian ( const MatType &  data,
const arma::uvec &  samples,
const arma::Col< ElemType > &  direction,
ElemType splitVal 
)
staticprivate

Get the median of scalar products of the sampled points and the normal to the hyperplane (i.e.

the position of the hyperplane).

Parameters
dataThe dataset used by the binary space tree.
samplesThe indices of points that will be used for the calculation.
directionThe normal to the hyperplane.
splitValThe median value.

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

template<typename BoundType , typename MatType = arma::mat>
static bool mlpack::tree::RPTreeMeanSplit< BoundType, MatType >::GetMeanMedian ( const MatType &  data,
const arma::uvec &  samples,
arma::Col< ElemType > &  mean,
ElemType splitVal 
)
staticprivate

Get the mean point and the median of distance from the mean to any point of the dataset.

Parameters
dataThe dataset used by the binary space tree.
samplesThe indices of points that will be used for the calculation.
meanThe mean point.
splitValThe median value.

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

template<typename BoundType , typename MatType = arma::mat>
static size_t mlpack::tree::RPTreeMeanSplit< BoundType, MatType >::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 83 of file rp_tree_mean_split.hpp.

template<typename BoundType , typename MatType = arma::mat>
static size_t mlpack::tree::RPTreeMeanSplit< BoundType, MatType >::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 108 of file rp_tree_mean_split.hpp.

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

Split the node according to the mean value in the dimension with maximum width.

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 direction and the value.

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