mlpack  2.0.1
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType > Class Template Reference

A rectangle type tree tree, such as an R-tree or X-tree. More...

Classes

class  DualTreeTraverser
 A dual tree traverser for rectangle type trees. More...
 
class  SingleTreeTraverser
 A single traverser for rectangle type trees. More...
 
struct  SplitHistoryStruct
 The X tree requires that the tree records it's "split history". More...
 

Public Types

typedef MatType Mat
 So other classes can use TreeType::Mat. More...
 
typedef struct mlpack::tree::RectangleTree::SplitHistoryStruct SplitHistoryStruct
 The X tree requires that the tree records it's "split history". More...
 

Public Member Functions

 RectangleTree (const MatType &data, const size_t maxLeafSize=20, const size_t minLeafSize=8, const size_t maxNumChildren=5, const size_t minNumChildren=2, const size_t firstDataIndex=0)
 Construct this as the root node of a rectangle type tree using the given dataset. More...
 
 RectangleTree (MatType &&data, const size_t maxLeafSize=20, const size_t minLeafSize=8, const size_t maxNumChildren=5, const size_t minNumChildren=2, const size_t firstDataIndex=0)
 Construct this as the root node of a rectangle tree type using the given dataset, and taking ownership of the given dataset. More...
 
 RectangleTree (RectangleTree *parentNode)
 Construct this as an empty node with the specified parent. More...
 
 RectangleTree (const RectangleTree &other, const bool deepCopy=true)
 Create a rectangle tree by copying the other tree. More...
 
template<typename Archive >
 RectangleTree (Archive &ar, const typename boost::enable_if< typename Archive::is_loading >::type *=0)
 Construct the tree from a boost::serialization archive. More...
 
 ~RectangleTree ()
 Deletes this node, deallocating the memory for the children and calling their destructors in turn. More...
 
size_t Begin () const
 Return the index of the beginning point of this subset. More...
 
size_t & Begin ()
 Modify the index of the beginning point of this subset. More...
 
const bound::HRectBound< MetricType > & Bound () const
 Return the bound object for this node. More...
 
bound::HRectBound< MetricType > & Bound ()
 Modify the bound object for this node. More...
 
void Center (arma::vec &center)
 Get the centroid of the node and store it in the given vector. More...
 
RectangleTreeChild (const size_t child) const
 Get the specified child. More...
 
RectangleTreeChild (const size_t child)
 Modify the specified child. More...
 
const std::vector< RectangleTree * > & Children () const
 Get the children of this node. More...
 
std::vector< RectangleTree * > & Children ()
 Modify the children of this node. More...
 
void CondenseTree (const arma::vec &point, std::vector< bool > &relevels, const bool usePoint)
 Condense the bounding rectangles for this node based on the removal of the point specified by the arma::vec&. More...
 
size_t Count () const
 Return the number of points in this subset. More...
 
size_t & Count ()
 Modify the number of points in this subset. More...
 
const MatType & Dataset () const
 Get the dataset which the tree is built on. More...
 
MatType & Dataset ()
 Modify the dataset which the tree is built on. Be careful! More...
 
bool DeletePoint (const size_t point)
 Deletes a point in the tree. More...
 
bool DeletePoint (const size_t point, std::vector< bool > &relevels)
 Deletes a point in the tree, tracking levels. More...
 
size_t Descendant (const size_t index) const
 Return the index (with reference to the dataset) of a particular descendant of this node. More...
 
RectangleTreeExactClone ()
 Make an exact copy of this node, pointers and everything. More...
 
const RectangleTreeFindByBeginCount (size_t begin, size_t count) const
 Find a node in this tree by its begin and count (const). More...
 
RectangleTreeFindByBeginCount (size_t begin, size_t count)
 Find a node in this tree by its begin and count. More...
 
double FurthestDescendantDistance () const
 Return the furthest possible descendant distance. More...
 
double FurthestPointDistance () const
 Return the furthest distance to a point held in this node. More...
 
void InsertNode (RectangleTree *node, const size_t level, std::vector< bool > &relevels)
 Inserts a node into the tree, tracking which levels have been inserted into. More...
 
void InsertPoint (const size_t point)
 Inserts a point into the tree. More...
 
void InsertPoint (const size_t point, std::vector< bool > &relevels)
 Inserts a point into the tree, tracking which levels have been inserted into. More...
 
bool IsLeaf () const
 Return whether or not this node is a leaf (true if it has no children). More...
 
const MatType & LocalDataset () const
 Get the local dataset of this node. More...
 
MatType & LocalDataset ()
 Modify the local dataset of this node. More...
 
double MaxDistance (const RectangleTree *other) const
 Return the maximum distance to another node. More...
 
template<typename VecType >
double MaxDistance (const VecType &point, typename boost::enable_if< IsVector< VecType > >::type *=0) const
 Return the maximum distance to another point. More...
 
size_t MaxLeafSize () const
 Return the maximum leaf size. More...
 
size_t & MaxLeafSize ()
 Modify the maximum leaf size. More...
 
size_t MaxNumChildren () const
 Return the maximum number of children (in a non-leaf node). More...
 
size_t & MaxNumChildren ()
 Modify the maximum number of children (in a non-leaf node). More...
 
MetricType Metric () const
 Get the metric which the tree uses. More...
 
double MinDistance (const RectangleTree *other) const
 Return the minimum distance to another node. More...
 
template<typename VecType >
double MinDistance (const VecType &point, typename boost::enable_if< IsVector< VecType > >::type *=0) const
 Return the minimum distance to another point. More...
 
double MinimumBoundDistance () const
 Return the minimum distance from the center to any edge of the bound. More...
 
size_t MinLeafSize () const
 Return the minimum leaf size. More...
 
size_t & MinLeafSize ()
 Modify the minimum leaf size. More...
 
size_t MinNumChildren () const
 Return the minimum number of children (in a non-leaf node). More...
 
size_t & MinNumChildren ()
 Modify the minimum number of children (in a non-leaf node). More...
 
void NullifyData ()
 Set dataset to null. More...
 
size_t NumChildren () const
 Return the number of child nodes. (One level beneath this one only.) More...
 
size_t & NumChildren ()
 Modify the number of child nodes. Be careful. More...
 
size_t NumDescendants () const
 Return the number of descendants of this node. More...
 
size_t NumPoints () const
 Return the number of points in this node (returns 0 if this node is not a leaf). More...
 
RectangleTreeParent () const
 Gets the parent of this node. More...
 
RectangleTree *& Parent ()
 Modify the parent of this node. More...
 
double ParentDistance () const
 Return the distance from the center of this node to the center of the parent node. More...
 
double & ParentDistance ()
 Modify the distance from the center of this node to the center of the parent node. More...
 
size_t Point (const size_t index) const
 Return the index (with reference to the dataset) of a particular point in this node. More...
 
const std::vector< size_t > & Points () const
 Get the points vector for this node. More...
 
std::vector< size_t > & Points ()
 Modify the points vector for this node. Be careful! More...
 
math::Range RangeDistance (const RectangleTree *other) const
 Return the minimum and maximum distance to another node. More...
 
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. More...
 
bool RemoveNode (const RectangleTree *node, std::vector< bool > &relevels)
 Removes a node from the tree. More...
 
template<typename Archive >
void Serialize (Archive &ar, const unsigned int)
 Serialize the tree. More...
 
bool ShrinkBoundForBound (const bound::HRectBound< MetricType > &changedBound)
 Shrink the bound object of this node for the removal of a child node. More...
 
bool ShrinkBoundForPoint (const arma::vec &point)
 Shrink the bound object of this node for the removal of a point. More...
 
void SoftDelete ()
 Delete this node of the tree, but leave the stuff contained in it intact. More...
 
const SplitHistoryStructSplitHistory () const
 Return the split history object of this node. More...
 
SplitHistoryStructSplitHistory ()
 Modify the split history object of this node. More...
 
const StatisticType & Stat () const
 Return the statistic object for this node. More...
 
StatisticType & Stat ()
 Modify the statistic object for this node. More...
 
size_t TreeDepth () const
 Obtains the number of levels below this node in the tree, starting with this. More...
 
size_t TreeSize () const
 Obtains the number of nodes in the tree, starting with this. More...
 

Static Public Member Functions

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

Protected Member Functions

 RectangleTree ()
 A default constructor. More...
 

Private Member Functions

 RectangleTree (const size_t begin, const size_t count, bound::HRectBound< MetricType > bound, StatisticType stat, const int maxLeafSize=20)
 Private copy constructor, available only to fill (pad) the tree to a specified level. More...
 
RectangleTreeCopyMe ()
 
void SplitNode (std::vector< bool > &relevels)
 Splits the current node, recursing up the tree. More...
 

Private Attributes

size_t begin
 The index of the first point in the dataset contained in this node (and its children). More...
 
bound::HRectBound< metric::EuclideanDistancebound
 The bound object for this node. More...
 
std::vector< RectangleTree * > children
 The child nodes (Starting at 0 and ending at (numChildren-1) ). More...
 
size_t count
 The number of points in the dataset contained in this node (and its children). More...
 
const MatType * dataset
 The dataset. More...
 
MatType * localDataset
 The local dataset. More...
 
size_t maxLeafSize
 The max leaf size. More...
 
size_t maxNumChildren
 The max number of child nodes a non-leaf node can have. More...
 
size_t minLeafSize
 The minimum leaf size. More...
 
size_t minNumChildren
 The minimum number of child nodes a non-leaf node can have. More...
 
size_t numChildren
 The number of child nodes actually in use (0 if this is a leaf node). More...
 
bool ownsDataset
 Whether or not we are responsible for deleting the dataset. More...
 
RectangleTreeparent
 The parent node (NULL if this is the root of the tree). More...
 
double parentDistance
 The distance from the centroid of this node to the centroid of the parent. More...
 
std::vector< size_t > points
 The mapping to the dataset. More...
 
SplitHistoryStruct splitHistory
 A struct to store the "split history" for X trees. More...
 
StatisticType stat
 Any extra data contained in the node. More...
 

Detailed Description

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
class mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >

A rectangle type tree tree, such as an R-tree or X-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 tree does allow growth, so you can add and delete nodes from it.

Template Parameters
MetricTypeThis must be EuclideanDistance, but the template parameter is required to satisfy the TreeType API.
StatisticTypeExtra data contained in the node. See statistic.hpp for the necessary skeleton interface.
MatTypeThe dataset class.
SplitTypeThe type of split to use when inserting points.
DescentTypeThe heuristic to use when descending the tree to insert points.

Definition at line 50 of file rectangle_tree.hpp.

Member Typedef Documentation

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
typedef MatType mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::Mat

So other classes can use TreeType::Mat.

Definition at line 123 of file rectangle_tree.hpp.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
typedef struct mlpack::tree::RectangleTree::SplitHistoryStruct mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::SplitHistoryStruct

The X tree requires that the tree records it's "split history".

To make this easy, we use the following structure.

Constructor & Destructor Documentation

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::RectangleTree ( const MatType &  data,
const size_t  maxLeafSize = 20,
const size_t  minLeafSize = 8,
const size_t  maxNumChildren = 5,
const size_t  minNumChildren = 2,
const size_t  firstDataIndex = 0 
)

Construct this as the root node of a rectangle type tree using the given dataset.

This will modify the ordering of the points in the dataset!

Parameters
dataDataset from which to create the tree. This will be modified!
maxLeafSizeMaximum size of each leaf in the tree.
minLeafSizeMinimum size of each leaf in the tree.
maxNumChildrenThe maximum number of child nodes a non-leaf node may have.
minNumChildrenThe minimum number of child nodes a non-leaf node may have.
firstDataIndexThe index of the first data point. UNUSED UNLESS WE ADD SUPPORT FOR HAVING A "CENTERAL" DATA MATRIX.
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::RectangleTree ( MatType &&  data,
const size_t  maxLeafSize = 20,
const size_t  minLeafSize = 8,
const size_t  maxNumChildren = 5,
const size_t  minNumChildren = 2,
const size_t  firstDataIndex = 0 
)

Construct this as the root node of a rectangle tree type using the given dataset, and taking ownership of the given dataset.

Parameters
dataDataset from which to create the tree.
maxLeafSizeMaximum size of each leaf in the tree.
minLeafSizeMinimum size of each leaf in the tree.
maxNumChildrenThe maximum number of child nodes a non-leaf node may have.
minNumChildrenThe minimum number of child nodes a non-leaf node may have.
firstDataIndexThe index of the first data point. UNUSED UNLESS WE ADD SUPPORT FOR HAVING A "CENTERAL" DATA MATRIX.
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::RectangleTree ( RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType > *  parentNode)
explicit

Construct this as an empty node with the specified parent.

Copying the parameters (maxLeafSize, minLeafSize, maxNumChildren, minNumChildren, firstDataIndex) from the parent.

Parameters
parentNodeThe parent of the node that is being constructed.
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::RectangleTree ( const RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType > &  other,
const bool  deepCopy = true 
)

Create a rectangle tree by copying the other tree.

Be careful! This can take a long time and use a lot of memory.

Parameters
otherThe tree to be copied.
deepCopyIf false, the children are not recursively copied.
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
template<typename Archive >
mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::RectangleTree ( Archive &  ar,
const typename boost::enable_if< typename Archive::is_loading >::type *  = 0 
)

Construct the tree from a boost::serialization archive.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::~RectangleTree ( )

Deletes this node, deallocating the memory for the children and calling their destructors in turn.

This will invalidate any younters or references to any nodes which are children of this one.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::RectangleTree ( const size_t  begin,
const size_t  count,
bound::HRectBound< MetricType >  bound,
StatisticType  stat,
const int  maxLeafSize = 20 
)
inlineprivate

Private copy constructor, available only to fill (pad) the tree to a specified level.

TO BE REMOVED

Definition at line 534 of file rectangle_tree.hpp.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::RectangleTree ( )
protected

A default constructor.

This is meant to only be used with boost::serialization, which is allowed with the friend declaration below. This does not return a valid tree! This method must be protected, so that the serialization shim can work with the default constructor.

Referenced by mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::CopyMe().

Member Function Documentation

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
size_t mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::Begin ( ) const
inline

Return the index of the beginning point of this subset.

Definition at line 517 of file rectangle_tree.hpp.

References mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::begin.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
size_t& mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::Begin ( )
inline

Modify the index of the beginning point of this subset.

Definition at line 519 of file rectangle_tree.hpp.

References mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::begin.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
const bound::HRectBound<MetricType>& mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::Bound ( ) const
inline
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
bound::HRectBound<MetricType>& mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::Bound ( )
inline

Modify the bound object for this node.

Definition at line 312 of file rectangle_tree.hpp.

References mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::bound.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
void mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::Center ( arma::vec &  center)
inline

Get the centroid of the node and store it in the given vector.

Definition at line 371 of file rectangle_tree.hpp.

References mlpack::bound::HRectBound< MetricType >::Center().

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
RectangleTree& mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::Child ( const size_t  child) const
inline

Get the specified child.

Parameters
childIndex of child to return.

Definition at line 415 of file rectangle_tree.hpp.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
RectangleTree& mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::Child ( const size_t  child)
inline
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
const std::vector<RectangleTree*>& mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::Children ( ) const
inline
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
std::vector<RectangleTree*>& mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::Children ( )
inline
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
void mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::CondenseTree ( const arma::vec &  point,
std::vector< bool > &  relevels,
const bool  usePoint 
)

Condense the bounding rectangles for this node based on the removal of the point specified by the arma::vec&.

This recurses up the tree. If a node goes below the minimum fill, this function will fix the tree.

Parameters
pointThe arma::vec& of the point that was removed to require this condesation of the tree.
usePointTrue if we use the optimized version of the algorithm that is possible when we now what point was deleted. False otherwise (eg. if we deleted a node instead of a point).
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
RectangleTree* mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::CopyMe ( )
inlineprivate
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
size_t mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::Count ( ) const
inline

Return the number of points in this subset.

Definition at line 522 of file rectangle_tree.hpp.

References mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::count.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
size_t& mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::Count ( )
inline

Modify the number of points in this subset.

Definition at line 524 of file rectangle_tree.hpp.

References mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::count.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
const MatType& mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::Dataset ( ) const
inline

Get the dataset which the tree is built on.

Definition at line 353 of file rectangle_tree.hpp.

References mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::dataset.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
MatType& mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::Dataset ( )
inline

Modify the dataset which the tree is built on. Be careful!

Definition at line 355 of file rectangle_tree.hpp.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
bool mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::DeletePoint ( const size_t  point)

Deletes a point in the tree.

The point will be removed from the data matrix of the leaf node where it is store and the bounding rectangles will be updated. However, the point will be kept in the centeral dataset. (The user may remove it from there if he wants, but he must not change the indices of the other points.) Returns true if the point is successfully removed and false if it is not. (ie. the point is not in the tree)

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
bool mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::DeletePoint ( const size_t  point,
std::vector< bool > &  relevels 
)

Deletes a point in the tree, tracking levels.

The point will be removed from the data matrix of the leaf node where it is store and the bounding rectangles will be updated. However, the point will be kept in the centeral dataset. (The user may remove it from there if he wants, but he must not change the indices of the other points.) Returns true if the point is successfully removed and false if it is not. (ie. the point is not in the tree)

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
size_t mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::Descendant ( const size_t  index) 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
indexIndex of the descendant.

Referenced by mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::Child().

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
RectangleTree* mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::ExactClone ( )

Make an exact copy of this node, pointers and everything.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
const RectangleTree* mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::FindByBeginCount ( size_t  begin,
size_t  count 
) 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
beginThe begin() of the node to find.
countThe count() of the node to find.
Returns
The found node, or NULL if not found.
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
RectangleTree* mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::FindByBeginCount ( size_t  begin,
size_t  count 
)

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
beginThe begin() of the node to find.
countThe count() of the node to find.
Returns
The found node, or NULL if not found.
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
double mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::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).

Referenced by mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::Children().

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
double mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::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.

Referenced by mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::Children().

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
static bool mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::HasSelfChildren ( )
inlinestatic

Returns false: this tree type does not have self children.

Definition at line 527 of file rectangle_tree.hpp.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
void mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::InsertNode ( RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType > *  node,
const size_t  level,
std::vector< bool > &  relevels 
)

Inserts a node into the tree, tracking which levels have been inserted into.

The node will be inserted so that the tree remains valid.

Parameters
nodeThe node to be inserted.
levelThe depth that should match the node where this node is finally inserted. This should be the number returned by calling TreeDepth() from the node that originally contained "node".
relevelsThe levels that have been reinserted to on this top level insertion.
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
void mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::InsertPoint ( const size_t  point)

Inserts a point into the tree.

The point will be copied to the data matrix of the leaf node where it is finally inserted, but we pass by reference since it may be passed many times before it actually reaches a leaf.

Parameters
pointThe point (arma::vec&) to be inserted.
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
void mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::InsertPoint ( const size_t  point,
std::vector< bool > &  relevels 
)

Inserts a point into the tree, tracking which levels have been inserted into.

The point will be copied to the data matrix of the leaf node where it is finally inserted, but we pass by reference since it may be passed many times before it actually reaches a leaf.

Parameters
pointThe point (arma::vec&) to be inserted.
relevelsThe levels that have been reinserted to on this top level insertion.
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
bool mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::IsLeaf ( ) const

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

Referenced by mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::SplitHistory().

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
const MatType& mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::LocalDataset ( ) const
inline
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
MatType& mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::LocalDataset ( )
inline

Modify the local dataset of this node.

Definition at line 365 of file rectangle_tree.hpp.

References mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::localDataset.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
double mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::MaxDistance ( const RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType > *  other) const
inline
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
template<typename VecType >
double mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::MaxDistance ( const VecType &  point,
typename boost::enable_if< IsVector< VecType > >::type *  = 0 
) const
inline

Return the maximum distance to another point.

Definition at line 489 of file rectangle_tree.hpp.

References mlpack::bound::HRectBound< MetricType >::MaxDistance().

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
size_t mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::MaxLeafSize ( ) const
inline
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
size_t& mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::MaxLeafSize ( )
inline
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
size_t mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::MaxNumChildren ( ) const
inline

Return the maximum number of children (in a non-leaf node).

Definition at line 338 of file rectangle_tree.hpp.

References mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::maxNumChildren.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
size_t& mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::MaxNumChildren ( )
inline

Modify the maximum number of children (in a non-leaf node).

Definition at line 340 of file rectangle_tree.hpp.

References mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::maxNumChildren.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
MetricType mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::Metric ( ) const
inline

Get the metric which the tree uses.

Definition at line 368 of file rectangle_tree.hpp.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
double mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::MinDistance ( const RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType > *  other) const
inline
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
template<typename VecType >
double mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::MinDistance ( const VecType &  point,
typename boost::enable_if< IsVector< VecType > >::type *  = 0 
) const
inline

Return the minimum distance to another point.

Definition at line 480 of file rectangle_tree.hpp.

References mlpack::bound::HRectBound< MetricType >::MinDistance().

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
double mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::MinimumBoundDistance ( ) const
inline

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

Currently, this returns 0, which doesn't break algorithms, but it isn't necessarily correct, either.

Definition at line 401 of file rectangle_tree.hpp.

References mlpack::bound::HRectBound< MetricType >::MinWidth().

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
size_t mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::MinLeafSize ( ) const
inline
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
size_t& mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::MinLeafSize ( )
inline
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
size_t mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::MinNumChildren ( ) const
inline

Return the minimum number of children (in a non-leaf node).

Definition at line 343 of file rectangle_tree.hpp.

References mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::minNumChildren.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
size_t& mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::MinNumChildren ( )
inline

Modify the minimum number of children (in a non-leaf node).

Definition at line 345 of file rectangle_tree.hpp.

References mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::minNumChildren.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
void mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::NullifyData ( )

Set dataset to null.

Used for memory management. Be cafeful.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
size_t mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::NumChildren ( ) const
inline

Return the number of child nodes. (One level beneath this one only.)

Definition at line 374 of file rectangle_tree.hpp.

References mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::numChildren.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
size_t& mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::NumChildren ( )
inline

Modify the number of child nodes. Be careful.

Definition at line 376 of file rectangle_tree.hpp.

References mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::numChildren.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
size_t mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::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.

Referenced by mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::Child().

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
size_t mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::NumPoints ( ) const

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

Referenced by mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::Child().

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
RectangleTree* mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::Parent ( ) const
inline
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
RectangleTree*& mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::Parent ( )
inline
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
double mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::ParentDistance ( ) const
inline

Return the distance from the center of this node to the center of the parent node.

Definition at line 405 of file rectangle_tree.hpp.

References mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::parentDistance.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
double& mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::ParentDistance ( )
inline

Modify the distance from the center of this node to the center of the parent node.

Definition at line 408 of file rectangle_tree.hpp.

References mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::parentDistance.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
size_t mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::Point ( const size_t  index) 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
indexIndex of point for which a dataset index is wanted.

Referenced by mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::Child().

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
const std::vector<size_t>& mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::Points ( ) const
inline

Get the points vector for this node.

Definition at line 358 of file rectangle_tree.hpp.

References mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::points.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
std::vector<size_t>& mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::Points ( )
inline

Modify the points vector for this node. Be careful!

Definition at line 360 of file rectangle_tree.hpp.

References mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::points.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
math::Range mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::RangeDistance ( const RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType > *  other) const
inline
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
template<typename VecType >
math::Range mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::RangeDistance ( const VecType &  point,
typename boost::enable_if< IsVector< VecType > >::type *  = 0 
) const
inline
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
bool mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::RemoveNode ( const RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType > *  node,
std::vector< bool > &  relevels 
)

Removes a node from the tree.

You are responsible for deleting it if you wish to do so.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
template<typename Archive >
void mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::Serialize ( Archive &  ar,
const unsigned  int 
)

Serialize the tree.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
bool mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::ShrinkBoundForBound ( const bound::HRectBound< MetricType > &  changedBound)

Shrink the bound object of this node for the removal of a child node.

Parameters
boundThe HRectBound<>& of the bound that was removed to reqire this shrinking.
Returns
true if the bound needed to be changed, false if it did not.
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
bool mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::ShrinkBoundForPoint ( const arma::vec &  point)

Shrink the bound object of this node for the removal of a point.

Parameters
pointThe arma::vec& of the point that was removed to require this shrinking.
Returns
true if the bound needed to be changed, false if it did not.
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
void mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::SoftDelete ( )

Delete this node of the tree, but leave the stuff contained in it intact.

This is used when splitting a node, where the data in this tree is moved to two other trees.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
const SplitHistoryStruct& mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::SplitHistory ( ) const
inline

Return the split history object of this node.

Definition at line 320 of file rectangle_tree.hpp.

References mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::splitHistory.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
SplitHistoryStruct& mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::SplitHistory ( )
inline
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
void mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::SplitNode ( std::vector< bool > &  relevels)
private

Splits the current node, recursing up the tree.

Parameters
relevelsVector to track which levels have been inserted to.

Referenced by mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::CopyMe().

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
const StatisticType& mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::Stat ( ) const
inline

Return the statistic object for this node.

Definition at line 315 of file rectangle_tree.hpp.

References mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::stat.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
StatisticType& mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::Stat ( )
inline

Modify the statistic object for this node.

Definition at line 317 of file rectangle_tree.hpp.

References mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::stat.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
size_t mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::TreeDepth ( ) const

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

Referenced by mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::RangeDistance().

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
size_t mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::TreeSize ( ) const

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

Referenced by mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::RangeDistance().

Member Data Documentation

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
size_t mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::begin
private

The index of the first point in the dataset contained in this node (and its children).

THIS IS ALWAYS 0 AT THE MOMENT. IT EXISTS MERELY IN CASE I THINK OF A WAY TO CHANGE THAT. IN OTHER WORDS, IT WILL PROBABLY BE REMOVED.

Definition at line 95 of file rectangle_tree.hpp.

Referenced by mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::Begin().

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
bound::HRectBound<metric::EuclideanDistance> mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::bound
private
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
std::vector<RectangleTree*> mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::children
private

The child nodes (Starting at 0 and ending at (numChildren-1) ).

Definition at line 88 of file rectangle_tree.hpp.

Referenced by mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::Children().

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
size_t mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::count
private

The number of points in the dataset contained in this node (and its children).

Definition at line 98 of file rectangle_tree.hpp.

Referenced by mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::Count().

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
const MatType* mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::dataset
private
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
MatType* mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::localDataset
private
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
size_t mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::maxLeafSize
private
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
size_t mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::maxNumChildren
private

The max number of child nodes a non-leaf node can have.

Definition at line 82 of file rectangle_tree.hpp.

Referenced by mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::MaxNumChildren().

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
size_t mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::minLeafSize
private
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
size_t mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::minNumChildren
private

The minimum number of child nodes a non-leaf node can have.

Definition at line 84 of file rectangle_tree.hpp.

Referenced by mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::MinNumChildren().

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
size_t mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::numChildren
private

The number of child nodes actually in use (0 if this is a leaf node).

Definition at line 86 of file rectangle_tree.hpp.

Referenced by mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::NumChildren().

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
bool mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::ownsDataset
private

Whether or not we are responsible for deleting the dataset.

This is probably not aligned well...

Definition at line 115 of file rectangle_tree.hpp.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
RectangleTree* mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::parent
private

The parent node (NULL if this is the root of the tree).

Definition at line 90 of file rectangle_tree.hpp.

Referenced by mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::Parent().

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
double mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::parentDistance
private

The distance from the centroid of this node to the centroid of the parent.

Definition at line 110 of file rectangle_tree.hpp.

Referenced by mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::ParentDistance().

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
std::vector<size_t> mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::points
private
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
SplitHistoryStruct mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::splitHistory
private

A struct to store the "split history" for X trees.

Definition at line 108 of file rectangle_tree.hpp.

Referenced by mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::SplitHistory().

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = RTreeSplit, typename DescentType = RTreeDescentHeuristic>
StatisticType mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::stat
private

Any extra data contained in the node.

Definition at line 106 of file rectangle_tree.hpp.

Referenced by mlpack::tree::RectangleTree< MetricType, StatisticType, MatType, SplitType, DescentType >::Stat().


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