KHC-tree, a binary space-partitioning tree. More...
#include <shark/Models/Trees/KHCTree.h>
Public Types | |
typedef IndexedIterator< typename boost::range_iterator< Container const >::type > | const_iterator |
Public Member Functions | |
KHCTree (Container const &points, kernel_type const *kernel, TreeConstruction tc=TreeConstruction()) | |
double | squaredDistanceLowerBound (value_type const &reference) const |
Protected Member Functions | |
KHCTree (KHCTree *parent, std::size_t *list, std::size_t size) | |
(internal) construction of a non-root node | |
template<class Range > | |
void | buildTree (TreeConstruction tc, Range &points) |
template<class Range > | |
void | calculateNormal (Range const &samples) |
double | funct (value_type const &reference) const |
function describing the separating hyperplane | |
Protected Attributes | |
kernel_type const * | mep_kernel |
kernel function | |
const_iterator | mep_positive |
"positive" side cluster center | |
const_iterator | mep_negative |
"negative" side cluster center | |
double | m_normalInvNorm |
one divided by squared distance between "positive" and "negative" cluster center | |
BinaryTree * | mep_parent |
parent node | |
BinaryTree * | mp_left |
"left" child node | |
BinaryTree * | mp_right |
"right" child node | |
std::size_t * | mp_indexList |
list of indices to points in the dataset | |
std::size_t | m_size |
number of points in this node | |
std::size_t | m_nodes |
number of nodes in the sub-tree represented by this node | |
KHC-tree, a binary space-partitioning tree.
Since the KHCTree needs direct access to the elements, it's template parameter is not the actual point type But the Range, the points are stored in. Be aware that this range should be a View when a Dataset is used as storage, since during construction, the KHC-Tree needs random access to the elements.
typedef IndexedIterator<typename boost::range_iterator<Container const>::type> shark::KHCTree< Container, CuttingAccuracy >::const_iterator |
|
inline |
Construct the tree from data. It is assumed that the container exceeds the lifetime of the KHCTree (which holds only references to the points), and that the memory locations of the points remain unchanged.
Definition at line 89 of file KHCTree.h.
References shark::KHCTree< Container, CuttingAccuracy >::buildTree(), shark::KHCTree< Container, CuttingAccuracy >::m_size, and shark::KHCTree< Container, CuttingAccuracy >::mp_indexList.
|
inlineprotected |
|
inlineprotected |
(internal) construction method: median-cuts of the dimension with widest spread
Definition at line 147 of file KHCTree.h.
References shark::KHCTree< Container, CuttingAccuracy >::calculateNormal(), shark::KHCTree< Container, CuttingAccuracy >::funct(), shark::BinaryTree< Container::value_type >::left(), shark::KHCTree< Container, CuttingAccuracy >::m_nodes, shark::KHCTree< Container, CuttingAccuracy >::m_size, shark::TreeConstruction::maxBucketSize(), shark::TreeConstruction::maxDepth(), shark::KHCTree< Container, CuttingAccuracy >::mp_indexList, shark::KHCTree< Container, CuttingAccuracy >::mp_left, shark::KHCTree< Container, CuttingAccuracy >::mp_right, shark::TreeConstruction::nextDepthLevel(), shark::BinaryTree< InputT >::nodes(), shark::BinaryTree< Container::value_type >::right(), and shark::BinaryTree< Container::value_type >::splitList().
Referenced by shark::KHCTree< Container, CuttingAccuracy >::KHCTree().
|
inlineprotected |
Definition at line 200 of file KHCTree.h.
References shark::batchSize(), shark::AbstractKernelFunction< InputTypeT >::featureDistanceSqr(), shark::KHCTree< Container, CuttingAccuracy >::m_normalInvNorm, shark::KHCTree< Container, CuttingAccuracy >::mep_kernel, shark::KHCTree< Container, CuttingAccuracy >::mep_negative, and shark::KHCTree< Container, CuttingAccuracy >::mep_positive.
Referenced by shark::KHCTree< Container, CuttingAccuracy >::buildTree().
|
inlineprotected |
function describing the separating hyperplane
Definition at line 221 of file KHCTree.h.
References shark::AbstractKernelFunction< InputTypeT >::eval(), shark::KHCTree< Container, CuttingAccuracy >::m_normalInvNorm, shark::KHCTree< Container, CuttingAccuracy >::mep_kernel, shark::KHCTree< Container, CuttingAccuracy >::mep_negative, and shark::KHCTree< Container, CuttingAccuracy >::mep_positive.
Referenced by shark::KHCTree< Container, CuttingAccuracy >::buildTree().
|
inline |
Definition at line 113 of file KHCTree.h.
References shark::KHCTree< Container, CuttingAccuracy >::mep_parent, and shark::KHCTree< Container, CuttingAccuracy >::mp_right.
|
protected |
number of nodes in the sub-tree represented by this node
Definition at line 361 of file BinaryTree.h.
Referenced by shark::KHCTree< Container, CuttingAccuracy >::buildTree().
|
protected |
one divided by squared distance between "positive" and "negative" cluster center
Definition at line 238 of file KHCTree.h.
Referenced by shark::KHCTree< Container, CuttingAccuracy >::calculateNormal(), and shark::KHCTree< Container, CuttingAccuracy >::funct().
|
protected |
number of points in this node
Definition at line 358 of file BinaryTree.h.
Referenced by shark::KHCTree< Container, CuttingAccuracy >::buildTree(), and shark::KHCTree< Container, CuttingAccuracy >::KHCTree().
|
protected |
kernel function
Definition at line 229 of file KHCTree.h.
Referenced by shark::KHCTree< Container, CuttingAccuracy >::calculateNormal(), and shark::KHCTree< Container, CuttingAccuracy >::funct().
|
protected |
"negative" side cluster center
Definition at line 235 of file KHCTree.h.
Referenced by shark::KHCTree< Container, CuttingAccuracy >::calculateNormal(), and shark::KHCTree< Container, CuttingAccuracy >::funct().
|
protected |
parent node
Definition at line 346 of file BinaryTree.h.
Referenced by shark::KHCTree< Container, CuttingAccuracy >::squaredDistanceLowerBound().
|
protected |
"positive" side cluster center
Definition at line 232 of file KHCTree.h.
Referenced by shark::KHCTree< Container, CuttingAccuracy >::calculateNormal(), and shark::KHCTree< Container, CuttingAccuracy >::funct().
|
protected |
list of indices to points in the dataset
Definition at line 355 of file BinaryTree.h.
Referenced by shark::KHCTree< Container, CuttingAccuracy >::buildTree(), and shark::KHCTree< Container, CuttingAccuracy >::KHCTree().
|
protected |
"left" child node
Definition at line 349 of file BinaryTree.h.
Referenced by shark::KHCTree< Container, CuttingAccuracy >::buildTree().
|
protected |
"right" child node
Definition at line 352 of file BinaryTree.h.
Referenced by shark::KHCTree< Container, CuttingAccuracy >::buildTree(), and shark::KHCTree< Container, CuttingAccuracy >::squaredDistanceLowerBound().