Scroll to navigation

mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >(3) MLPACK mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >(3)

NAME

mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType > -
A binary space partitioning tree, such as a KD-tree or a ball tree.

SYNOPSIS

Classes


class DualTreeTraverser
 
A dual-tree traverser for binary space trees; see dual_tree_traverser.hpp. class SingleTreeTraverser
 
A single-tree traverser for binary space trees; see single_tree_traverser.hpp for implementation.

Public Types


typedef MatType Mat
 
So other classes can use TreeType::Mat.

Public Member Functions


BinarySpaceTree (MatType &data, const size_t maxLeafSize=20)
 
Construct this as the root node of a binary space tree using the given dataset. BinarySpaceTree (MatType &data, std::vector< size_t > &oldFromNew, const size_t maxLeafSize=20)
 
Construct this as the root node of a binary space tree using the given dataset. BinarySpaceTree (MatType &data, std::vector< size_t > &oldFromNew, std::vector< size_t > &newFromOld, const size_t maxLeafSize=20)
 
Construct this as the root node of a binary space tree using the given dataset. BinarySpaceTree (MatType &data, const size_t begin, const size_t count, BinarySpaceTree *parent=NULL, const size_t maxLeafSize=20)
 
Construct this node on a subset of the given matrix, starting at column begin and using count points. BinarySpaceTree (MatType &data, const size_t begin, const size_t count, std::vector< size_t > &oldFromNew, BinarySpaceTree *parent=NULL, const size_t maxLeafSize=20)
 
Construct this node on a subset of the given matrix, starting at column begin_in and using count_in points. BinarySpaceTree (MatType &data, const size_t begin, const size_t count, std::vector< size_t > &oldFromNew, std::vector< size_t > &newFromOld, BinarySpaceTree *parent=NULL, const size_t maxLeafSize=20)
 
Construct this node on a subset of the given matrix, starting at column begin_in and using count_in points. BinarySpaceTree (const BinarySpaceTree &other)
 
Create a binary space tree by copying the other tree. ~BinarySpaceTree ()
 
Deletes this node, deallocating the memory for the children and calling their destructors in turn. size_t Begin () const
 
Return the index of the beginning point of this subset. size_t & Begin ()
 
Modify the index of the beginning point of this subset. const BoundType & Bound () const
 
Return the bound object for this node. BoundType & Bound ()
 
Return the bound object for this node. void Centroid (arma::vec &centroid)
 
Get the centroid of the node and store it in the given vector. BinarySpaceTree & Child (const size_t child) const
 
Return the specified child (0 will be left, 1 will be right). size_t Count () const
 
Return the number of points in this subset. size_t & Count ()
 
Modify the number of points in this subset. const MatType & Dataset () const
 
Get the dataset which the tree is built on. MatType & Dataset ()
 
Modify the dataset which the tree is built on. Be careful! size_t Descendant (const size_t index) const
 
Return the index (with reference to the dataset) of a particular descendant of this node. size_t End () const
 
Gets the index one beyond the last index in the subset. size_t ExtendTree (const size_t level)
 
Fills the tree to the specified level. const BinarySpaceTree * FindByBeginCount (size_t begin, size_t count) const
 
Find a node in this tree by its begin and count (const). BinarySpaceTree * FindByBeginCount (size_t begin, size_t count)
 
Find a node in this tree by its begin and count. double FurthestDescendantDistance () const
 
Return the furthest possible descendant distance. double FurthestPointDistance () const
 
Return the furthest distance to a point held in this node. size_t GetSplitDimension () const
 
Returns the dimension this parent's children are split on. bool IsLeaf () const
 
Return whether or not this node is a leaf (true if it has no children). BinarySpaceTree * Left () const
 
Gets the left child of this node. BinarySpaceTree *& Left ()
 
Modify the left child of this node. double MaxDistance (const BinarySpaceTree *other) const
 
Return the maximum distance to another node. template<typename VecType > double MaxDistance (const VecType &point, typename boost::enable_if< IsVector< VecType > >::type *=0) const
 
Return the maximum distance to another point. size_t MaxLeafSize () const
 
Return the max leaf size. size_t & MaxLeafSize ()
 
Modify the max leaf size. BoundType::MetricType Metric () const
 
Get the metric which the tree uses. double MinDistance (const BinarySpaceTree *other) const
 
Return the minimum distance to another node. template<typename VecType > double MinDistance (const VecType &point, typename boost::enable_if< IsVector< VecType > >::type *=0) const
 
Return the minimum distance to another point. double MinimumBoundDistance () const
 
Return the minimum distance from the center of the node to any bound edge. size_t NumChildren () const
 
Return the number of children in this node. size_t NumDescendants () const
 
Return the number of descendants of this node. size_t NumPoints () const
 
Return the number of points in this node (0 if not a leaf). BinarySpaceTree * Parent () const
 
Gets the parent of this node. BinarySpaceTree *& Parent ()
 
Modify the parent of this node. double ParentDistance () const
 
Return the distance from the center of this node to the center of the parent node. double & ParentDistance ()
 
Modify the distance from the center of this node to the center of the parent node. size_t Point (const size_t index) const
 
Return the index (with reference to the dataset) of a particular point in this node. math::Range RangeDistance (const BinarySpaceTree *other) const
 
Return the minimum and maximum distance to another node. template<typename VecType > math::Range RangeDistance (const VecType &point, typename boost::enable_if< IsVector< VecType > >::type *=0) const
 
Return the minimum and maximum distance to another point. BinarySpaceTree * Right () const
 
Gets the right child of this node. BinarySpaceTree *& Right ()
 
Modify the right child of this node. size_t SplitDimension () const
 
Get the split dimension for this node. size_t & SplitDimension ()
 
Modify the split dimension for this node. const StatisticType & Stat () const
 
Return the statistic object for this node. StatisticType & Stat ()
 
Return the statistic object for this node. std::string ToString () const
 
Returns a string representation of this object. size_t TreeDepth () const
 
Obtains the number of levels below this node in the tree, starting with this. size_t TreeSize () const
 
Obtains the number of nodes in the tree, starting with this.

Static Public Member Functions


static bool HasSelfChildren ()
 
Returns false: this tree type does not have self children.

Private Member Functions


BinarySpaceTree (const size_t begin, const size_t count, BoundType bound, StatisticType stat, const int maxLeafSize=20)
 
Private copy constructor, available only to fill (pad) the tree to a specified level. BinarySpaceTree * CopyMe ()
 
void SplitNode (MatType &data)
 
Splits the current node, assigning its left and right children recursively. void SplitNode (MatType &data, std::vector< size_t > &oldFromNew)
 
Splits the current node, assigning its left and right children recursively.

Private Attributes


size_t begin
 
The index of the first point in the dataset contained in this node (and its children). BoundType bound
 
The bound object for this node. size_t count
 
The number of points of the dataset contained in this node (and its children). MatType & dataset
 
The dataset. double furthestDescendantDistance
 
The worst possible distance to the furthest descendant, cached to speed things up. BinarySpaceTree * left
 
The left child node. size_t maxLeafSize
 
The max leaf size. double minimumBoundDistance
 
The minimum distance from the center to any edge of the bound. BinarySpaceTree * parent
 
The parent node (NULL if this is the root of the tree). double parentDistance
 
The distance from the centroid of this node to the centroid of the parent. BinarySpaceTree * right
 
The right child node. size_t splitDimension
 
The dimension this node split on if it is a parent. StatisticType stat
 
Any extra data contained in the node.

Detailed Description

template<typename BoundType, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>>class mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >

A binary space partitioning tree, such as a KD-tree or a ball tree.
Once the bound and type of dataset is defined, the tree will construct itself. Call the constructor with the dataset to build the tree on, and the entire tree will be built.
This particular tree does not allow growth, so you cannot add or delete nodes from it. If you need to add or delete a node, the better procedure is to rebuild the tree entirely.
This tree does take one runtime parameter in the constructor, which is the max leaf size to be used.
Template Parameters:
BoundType The bound used for each node. The valid types of bounds and the necessary skeleton interface for this class can be found in bounds/.
 
StatisticType Extra data contained in the node. See statistic.hpp for the necessary skeleton interface.
 
MatType The dataset class.
 
SplitType The class that partitions the dataset/points at a particular node into two parts. Its definition decides the way this split is done.
Definition at line 59 of file binary_space_tree.hpp.

Member Typedef Documentation

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> typedef MatType mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >:: Mat

So other classes can use TreeType::Mat.
Definition at line 94 of file binary_space_tree.hpp.

Constructor & Destructor Documentation

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >:: BinarySpaceTree (MatType &data, const size_tmaxLeafSize = 20)

Construct this as the root node of a binary space tree using the given dataset. This will modify the ordering of the points in the dataset!
Parameters:
data Dataset to create tree from. This will be modified!
 
maxLeafSize Size of each leaf in the tree.
Referenced by mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::CopyMe().

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >:: BinarySpaceTree (MatType &data, std::vector< size_t > &oldFromNew, const size_tmaxLeafSize = 20)

Construct this as the root node of a binary space tree using the given dataset. This will modify the ordering of points in the dataset! A mapping of the old point indices to the new point indices is filled.
Parameters:
data Dataset to create tree from. This will be modified!
 
oldFromNew Vector which will be filled with the old positions for each new point.
 
maxLeafSize Size of each leaf in the tree.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >:: BinarySpaceTree (MatType &data, std::vector< size_t > &oldFromNew, std::vector< size_t > &newFromOld, const size_tmaxLeafSize = 20)

Construct this as the root node of a binary space tree using the given dataset. This will modify the ordering of points in the dataset! A mapping of the old point indices to the new point indices is filled, as well as a mapping of the new point indices to the old point indices.
Parameters:
data Dataset to create tree from. This will be modified!
 
oldFromNew Vector which will be filled with the old positions for each new point.
 
newFromOld Vector which will be filled with the new positions for each old point.
 
maxLeafSize Size of each leaf in the tree.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >:: BinarySpaceTree (MatType &data, const size_tbegin, const size_tcount, BinarySpaceTree< BoundType, StatisticType, MatType, SplitType > *parent = NULL, const size_tmaxLeafSize = 20)

Construct this node on a subset of the given matrix, starting at column begin and using count points. The ordering of that subset of points will be modified! This is used for recursive tree-building by the other constructors which don't specify point indices.
Parameters:
data Dataset to create tree from. This will be modified!
 
begin Index of point to start tree construction with.
 
count Number of points to use to construct tree.
 
maxLeafSize Size of each leaf in the tree.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >:: BinarySpaceTree (MatType &data, const size_tbegin, const size_tcount, std::vector< size_t > &oldFromNew, BinarySpaceTree< BoundType, StatisticType, MatType, SplitType > *parent = NULL, const size_tmaxLeafSize = 20)

Construct this node on a subset of the given matrix, starting at column begin_in and using count_in points. The ordering of that subset of points will be modified! This is used for recursive tree-building by the other constructors which don't specify point indices.
A mapping of the old point indices to the new point indices is filled, but it is expected that the vector is already allocated with size greater than or equal to (begin_in + count_in), and if that is not true, invalid memory reads (and writes) will occur.
Parameters:
data Dataset to create tree from. This will be modified!
 
begin Index of point to start tree construction with.
 
count Number of points to use to construct tree.
 
oldFromNew Vector which will be filled with the old positions for each new point.
 
maxLeafSize Size of each leaf in the tree.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >:: BinarySpaceTree (MatType &data, const size_tbegin, const size_tcount, std::vector< size_t > &oldFromNew, std::vector< size_t > &newFromOld, BinarySpaceTree< BoundType, StatisticType, MatType, SplitType > *parent = NULL, const size_tmaxLeafSize = 20)

Construct this node on a subset of the given matrix, starting at column begin_in and using count_in points. The ordering of that subset of points will be modified! This is used for recursive tree-building by the other constructors which don't specify point indices.
A mapping of the old point indices to the new point indices is filled, as well as a mapping of the new point indices to the old point indices. It is expected that the vector is already allocated with size greater than or equal to (begin_in + count_in), and if that is not true, invalid memory reads (and writes) will occur.
Parameters:
data Dataset to create tree from. This will be modified!
 
begin Index of point to start tree construction with.
 
count Number of points to use to construct tree.
 
oldFromNew Vector which will be filled with the old positions for each new point.
 
newFromOld Vector which will be filled with the new positions for each old point.
 
maxLeafSize Size of each leaf in the tree.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >:: BinarySpaceTree (const BinarySpaceTree< BoundType, StatisticType, MatType, SplitType > &other)

Create a binary space tree by copying the other tree. Be careful! This can take a long time and use a lot of memory.
Parameters:
other Tree to be replicated.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::~ BinarySpaceTree ()

Deletes this node, deallocating the memory for the children and calling their destructors in turn. This will invalidate any pointers or references to any nodes which are children of this one.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >:: BinarySpaceTree (const size_tbegin, const size_tcount, BoundTypebound, StatisticTypestat, const intmaxLeafSize = 20) [inline], [private]

Private copy constructor, available only to fill (pad) the tree to a specified level.
Definition at line 460 of file binary_space_tree.hpp.

Member Function Documentation

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> size_t mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::Begin () const [inline]

Return the index of the beginning point of this subset.
Definition at line 438 of file binary_space_tree.hpp.
References mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::begin.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> size_t& mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::Begin () [inline]

Modify the index of the beginning point of this subset.
Definition at line 440 of file binary_space_tree.hpp.
References mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::begin.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> const BoundType& mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::Bound () const [inline]

Return the bound object for this node.
Definition at line 260 of file binary_space_tree.hpp.
References mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::bound.
Referenced by mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::MaxDistance(), mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::MinDistance(), and mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::RangeDistance().

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> BoundType& mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::Bound () [inline]

Return the bound object for this node.
Definition at line 262 of file binary_space_tree.hpp.
References mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::bound.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> void mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::Centroid (arma::vec &centroid) [inline]

Get the centroid of the node and store it in the given vector.
Definition at line 309 of file binary_space_tree.hpp.
References mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::bound.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> BinarySpaceTree& mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::Child (const size_tchild) const

Return the specified child (0 will be left, 1 will be right). If the index is greater than 1, this will return the right child.
Parameters:
child Index of child to return.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> BinarySpaceTree* mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::CopyMe () [inline], [private]

Definition at line 473 of file binary_space_tree.hpp.
References mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::begin, mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::BinarySpaceTree(), mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::bound, mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::count, mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::maxLeafSize, and mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::stat.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> size_t mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::Count () const [inline]

Return the number of points in this subset.
Definition at line 448 of file binary_space_tree.hpp.
References mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::count.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> size_t& mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::Count () [inline]

Modify the number of points in this subset.
Definition at line 450 of file binary_space_tree.hpp.
References mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::count.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> const MatType& mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::Dataset () const [inline]

Get the dataset which the tree is built on.
Definition at line 301 of file binary_space_tree.hpp.
References mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::dataset.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> MatType& mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::Dataset () [inline]

Modify the dataset which the tree is built on. Be careful!
Definition at line 303 of file binary_space_tree.hpp.
References mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::dataset.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> size_t mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::Descendant (const size_tindex) const

Return the index (with reference to the dataset) of a particular descendant of this node. The index should be greater than zero but less than the number of descendants.
Parameters:
index Index of the descendant.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> size_t mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::End () const

Gets the index one beyond the last index in the subset.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> size_t mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::ExtendTree (const size_tlevel)

Fills the tree to the specified level.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> const BinarySpaceTree* mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::FindByBeginCount (size_tbegin, size_tcount) const

Find a node in this tree by its begin and count (const). Every node is uniquely identified by these two numbers. This is useful for communicating position over the network, when pointers would be invalid.
Parameters:
begin The begin() of the node to find.
 
count The count() of the node to find.
Returns:
The found node, or NULL if not found.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> BinarySpaceTree* mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::FindByBeginCount (size_tbegin, size_tcount)

Find a node in this tree by its begin and count. Every node is uniquely identified by these two numbers. This is useful for communicating position over the network, when pointers would be invalid.
Parameters:
begin The begin() of the node to find.
 
count The count() of the node to find.
Returns:
The found node, or NULL if not found.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> double mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::FurthestDescendantDistance () const

Return the furthest possible descendant distance. This returns the maximum distance from the centroid to the edge of the bound and not the empirical quantity which is the actual furthest descendant distance. So the actual furthest descendant distance may be less than what this method returns (but it will never be greater than this).

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> double mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::FurthestPointDistance () const

Return the furthest distance to a point held in this node. If this is not a leaf node, then the distance is 0 because the node holds no points.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> size_t mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::GetSplitDimension () const

Returns the dimension this parent's children are split on.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> static bool mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::HasSelfChildren () [inline], [static]

Returns false: this tree type does not have self children.
Definition at line 453 of file binary_space_tree.hpp.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> bool mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::IsLeaf () const

Return whether or not this node is a leaf (true if it has no children).

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> BinarySpaceTree* mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::Left () const [inline]

Gets the left child of this node.
Definition at line 281 of file binary_space_tree.hpp.
References mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::left.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> BinarySpaceTree*& mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::Left () [inline]

Modify the left child of this node.
Definition at line 283 of file binary_space_tree.hpp.
References mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::left.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> double mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::MaxDistance (const BinarySpaceTree< BoundType, StatisticType, MatType, SplitType > *other) const [inline]

Return the maximum distance to another node.
Definition at line 383 of file binary_space_tree.hpp.
References mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::bound, and mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::Bound().

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> template<typename VecType > double mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::MaxDistance (const VecType &point, typename boost::enable_if< IsVector< VecType > >::type * = 0) const [inline]

Return the maximum distance to another point.
Definition at line 405 of file binary_space_tree.hpp.
References mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::bound.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> size_t mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::MaxLeafSize () const [inline]

Return the max leaf size.
Definition at line 273 of file binary_space_tree.hpp.
References mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::maxLeafSize.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> size_t& mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::MaxLeafSize () [inline]

Modify the max leaf size.
Definition at line 275 of file binary_space_tree.hpp.
References mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::maxLeafSize.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> BoundType::MetricType mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::Metric () const [inline]

Get the metric which the tree uses.
Definition at line 306 of file binary_space_tree.hpp.
References mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::bound.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> double mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::MinDistance (const BinarySpaceTree< BoundType, StatisticType, MatType, SplitType > *other) const [inline]

Return the minimum distance to another node.
Definition at line 377 of file binary_space_tree.hpp.
References mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::bound, and mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::Bound().

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> template<typename VecType > double mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::MinDistance (const VecType &point, typename boost::enable_if< IsVector< VecType > >::type * = 0) const [inline]

Return the minimum distance to another point.
Definition at line 396 of file binary_space_tree.hpp.
References mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::bound.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> double mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::MinimumBoundDistance () const

Return the minimum distance from the center of the node to any bound edge.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> size_t mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::NumChildren () const

Return the number of children in this node.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> size_t mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::NumDescendants () const

Return the number of descendants of this node. For a non-leaf in a binary space tree, this is the number of points at the descendant leaves. For a leaf, this is the number of points in the leaf.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> size_t mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::NumPoints () const

Return the number of points in this node (0 if not a leaf).

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> BinarySpaceTree* mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::Parent () const [inline]

Gets the parent of this node.
Definition at line 291 of file binary_space_tree.hpp.
References mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::parent.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> BinarySpaceTree*& mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::Parent () [inline]

Modify the parent of this node.
Definition at line 293 of file binary_space_tree.hpp.
References mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::parent.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> double mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::ParentDistance () const [inline]

Return the distance from the center of this node to the center of the parent node.
Definition at line 334 of file binary_space_tree.hpp.
References mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::parentDistance.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> double& mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::ParentDistance () [inline]

Modify the distance from the center of this node to the center of the parent node.
Definition at line 337 of file binary_space_tree.hpp.
References mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::parentDistance.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> size_t mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::Point (const size_tindex) const

Return the index (with reference to the dataset) of a particular point in this node. This will happily return invalid indices if the given index is greater than the number of points in this node (obtained with NumPoints()) -- be careful.
Parameters:
index Index of point for which a dataset index is wanted.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> math::Range mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::RangeDistance (const BinarySpaceTree< BoundType, StatisticType, MatType, SplitType > *other) const [inline]

Return the minimum and maximum distance to another node.
Definition at line 389 of file binary_space_tree.hpp.
References mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::bound, and mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::Bound().

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> template<typename VecType > math::Range mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::RangeDistance (const VecType &point, typename boost::enable_if< IsVector< VecType > >::type * = 0) const [inline]

Return the minimum and maximum distance to another point.
Definition at line 415 of file binary_space_tree.hpp.
References mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::bound.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> BinarySpaceTree* mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::Right () const [inline]

Gets the right child of this node.
Definition at line 286 of file binary_space_tree.hpp.
References mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::right.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> BinarySpaceTree*& mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::Right () [inline]

Modify the right child of this node.
Definition at line 288 of file binary_space_tree.hpp.
References mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::right.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> size_t mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::SplitDimension () const [inline]

Get the split dimension for this node.
Definition at line 296 of file binary_space_tree.hpp.
References mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::splitDimension.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> size_t& mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::SplitDimension () [inline]

Modify the split dimension for this node.
Definition at line 298 of file binary_space_tree.hpp.
References mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::splitDimension.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> void mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::SplitNode (MatType &data) [private]

Splits the current node, assigning its left and right children recursively.
Parameters:
data Dataset which we are using.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> void mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::SplitNode (MatType &data, std::vector< size_t > &oldFromNew) [private]

Splits the current node, assigning its left and right children recursively. Also returns a list of the changed indices.
Parameters:
data Dataset which we are using.
 
oldFromNew Vector holding permuted indices.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> const StatisticType& mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::Stat () const [inline]

Return the statistic object for this node.
Definition at line 265 of file binary_space_tree.hpp.
References mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::stat.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> StatisticType& mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::Stat () [inline]

Return the statistic object for this node.
Definition at line 267 of file binary_space_tree.hpp.
References mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::stat.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> std::string mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::ToString () const

Returns a string representation of this object.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> size_t mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::TreeDepth () const

Obtains the number of levels below this node in the tree, starting with this.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> size_t mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::TreeSize () const

Obtains the number of nodes in the tree, starting with this.

Member Data Documentation

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> size_t mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::begin [private]

The index of the first point in the dataset contained in this node (and its children).
Definition at line 70 of file binary_space_tree.hpp.
Referenced by mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::Begin(), and mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::CopyMe().

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> BoundType mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::bound [private]

The bound object for this node.
Definition at line 77 of file binary_space_tree.hpp.
Referenced by mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::Bound(), mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::Centroid(), mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::CopyMe(), mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::MaxDistance(), mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::Metric(), mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::MinDistance(), and mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::RangeDistance().

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> size_t mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::count [private]

The number of points of the dataset contained in this node (and its children).
Definition at line 73 of file binary_space_tree.hpp.
Referenced by mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::CopyMe(), and mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::Count().

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> MatType& mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::dataset [private]

The dataset.
Definition at line 90 of file binary_space_tree.hpp.
Referenced by mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::Dataset().

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> double mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::furthestDescendantDistance [private]

The worst possible distance to the furthest descendant, cached to speed things up.
Definition at line 86 of file binary_space_tree.hpp.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> BinarySpaceTree* mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::left [private]

The left child node.
Definition at line 63 of file binary_space_tree.hpp.
Referenced by mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::Left().

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> size_t mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::maxLeafSize [private]

The max leaf size.
Definition at line 75 of file binary_space_tree.hpp.
Referenced by mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::CopyMe(), and mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::MaxLeafSize().

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> double mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::minimumBoundDistance [private]

The minimum distance from the center to any edge of the bound.
Definition at line 88 of file binary_space_tree.hpp.

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> BinarySpaceTree* mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::parent [private]

The parent node (NULL if this is the root of the tree).
Definition at line 67 of file binary_space_tree.hpp.
Referenced by mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::Parent().

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> double mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::parentDistance [private]

The distance from the centroid of this node to the centroid of the parent.
Definition at line 83 of file binary_space_tree.hpp.
Referenced by mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::ParentDistance().

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> BinarySpaceTree* mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::right [private]

The right child node.
Definition at line 65 of file binary_space_tree.hpp.
Referenced by mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::Right().

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> size_t mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::splitDimension [private]

The dimension this node split on if it is a parent.
Definition at line 81 of file binary_space_tree.hpp.
Referenced by mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::SplitDimension().

template<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit<BoundType, MatType>> StatisticType mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::stat [private]

Any extra data contained in the node.
Definition at line 79 of file binary_space_tree.hpp.
Referenced by mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::CopyMe(), and mlpack::tree::BinarySpaceTree< BoundType, StatisticType, MatType, SplitType >::Stat().

Author

Generated automatically by Doxygen for MLPACK from the source code.
Tue Sep 9 2014 Version 1.0.10