public class BottomUpConstructor extends BallTreeConstructor implements TechnicalInformationHandler
@techreport{Omohundro1989,
author = {Stephen M. Omohundro},
institution = {International Computer Science Institute},
month = {December},
number = {TR-89-063},
title = {Five Balltree Construction Algorithms},
year = {1989}
}
Valid options are:
-N <value> Set maximum number of instances in a leaf node (default: 40)
-R Set internal nodes' radius to the sum of the child balls radii. So that it contains the child balls.
| Modifier and Type | Class and Description |
|---|---|
protected class |
BottomUpConstructor.TempNode
Temp class to represent either a leaf node or an internal node.
|
m_DistanceFunction, m_FullyContainChildBalls, m_Instances, m_InstList, m_MaxDepth, m_MaxInstancesInLeaf, m_MaxRelLeafRadius, m_NumLeaves, m_NumNodes| Constructor and Description |
|---|
BottomUpConstructor()
Creates a new instance of BottomUpConstructor.
|
| Modifier and Type | Method and Description |
|---|---|
int[] |
addInstance(BallNode node,
Instance inst)
Adds an instance to the ball tree.
|
BallNode |
buildTree()
Builds the ball tree bottom up.
|
Instance |
calcPivot(BottomUpConstructor.TempNode node1,
BottomUpConstructor.TempNode node2,
Instances insts)
Calculates the centroid pivot of a node based on its
two child nodes.
|
double |
calcRadius(BottomUpConstructor.TempNode n1,
BottomUpConstructor.TempNode n2)
Calculates the radius of a node based on its two
child nodes.
|
java.lang.String |
getRevision()
Returns the revision string.
|
TechnicalInformation |
getTechnicalInformation()
Returns an instance of a TechnicalInformation object, containing detailed
information about the technical background of this class, e.g., paper
reference or book this class is based on.
|
java.lang.String |
globalInfo()
Returns a string describing this nearest neighbour search algorithm.
|
protected BallNode |
makeBallTree(BottomUpConstructor.TempNode node,
int startidx,
int endidx,
int[] instList,
int depth,
double rootRadius)
Makes ball tree nodes of temp nodes that were used
in the merging process.
|
protected BallNode |
mergeNodes(java.util.ArrayList<BottomUpConstructor.TempNode> list,
int startIdx,
int endIdx,
int[] instList)
Merges nodes into one top node.
|
containChildBallsTipText, getContainChildBalls, getMaxDepth, getMaxInstancesInLeaf, getMaxRelativeLeafRadius, getNumLeaves, getNumNodes, getOptions, listOptions, maxInstancesInLeafTipText, maxRelativeLeafRadiusTipText, setContainChildBalls, setEuclideanDistanceFunction, setInstanceList, setInstances, setMaxInstancesInLeaf, setMaxRelativeLeafRadius, setOptionspublic BottomUpConstructor()
public java.lang.String globalInfo()
public TechnicalInformation getTechnicalInformation()
getTechnicalInformation in interface TechnicalInformationHandlerpublic BallNode buildTree() throws java.lang.Exception
buildTree in class BallTreeConstructorjava.lang.Exception - If there is problem building
the tree.protected BallNode mergeNodes(java.util.ArrayList<BottomUpConstructor.TempNode> list, int startIdx, int endIdx, int[] instList) throws java.lang.Exception
list - List of bottom most nodes (the actual
instances).startIdx - The index marking the start of
the portion of master index array containing
instances that need to be merged.endIdx - The index marking the end of
the portion of master index array containing
instances that need to be merged.instList - The master index array.java.lang.Exception - If there is some problem
merging the nodes.protected BallNode makeBallTree(BottomUpConstructor.TempNode node, int startidx, int endidx, int[] instList, int depth, double rootRadius) throws java.lang.Exception
node - The temp root node.startidx - The index marking the start of the
portion of master index array containing instances
to be merged.endidx - The index marking the end of the
portion of master index array containing instances
to be merged.instList - The master index array.depth - The depth of the provided temp node.rootRadius - The smallest ball enclosing all
data points.java.lang.Exception - If there is some problem.public int[] addInstance(BallNode node, Instance inst) throws java.lang.Exception
addInstance in class BallTreeConstructornode - The root node of the tree.inst - The instance to add to the tree.java.lang.Exception - Always as BottomUpConstructor
does not allow addition of instances after batch
construction.public Instance calcPivot(BottomUpConstructor.TempNode node1, BottomUpConstructor.TempNode node2, Instances insts) throws java.lang.Exception
node1 - The first child node.node2 - The second child node.insts - The instance on which the tree is to be
built.java.lang.Exception - If there is some problem calculating
the centre/pivot of the node.public double calcRadius(BottomUpConstructor.TempNode n1, BottomUpConstructor.TempNode n2) throws java.lang.Exception
n1 - The first child node.n2 - The second child node.java.lang.Exception - If there is some problem
in calculating the radius.public java.lang.String getRevision()
getRevision in interface RevisionHandlergetRevision in class BallTreeConstructor