|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.core.neighboursearch.balltrees.BallNode
public class BallNode
Class representing a node of a BallTree.
Field Summary | |
---|---|
int |
m_End
The end index of the portion of the master index array, which stores indices of the instances/points the node contains. |
BallNode |
m_Left
The left child of the node. |
int |
m_NodeNumber
The node number/id. |
int |
m_NumInstances
The number of instances/points in the node. |
BallNode |
m_Right
The right child of the node. |
int |
m_SplitAttrib
The attribute that splits this node (not always used). |
double |
m_SplitVal
The value of m_SpiltAttrib that splits this node (not always used). |
int |
m_Start
The start index of the portion of the master index array, which stores the indices of the instances/points the node contains. |
Constructor Summary | |
---|---|
BallNode(int nodeNumber)
Constructor. |
|
BallNode(int start,
int end,
int nodeNumber)
Creates a new instance of BallNode. |
|
BallNode(int start,
int end,
int nodeNumber,
Instance pivot,
double radius)
Creates a new instance of BallNode. |
Method Summary | |
---|---|
static Instance |
calcCentroidPivot(int[] instList,
Instances insts)
Calculates the centroid pivot of a node. |
static Instance |
calcCentroidPivot(int start,
int end,
int[] instList,
Instances insts)
Calculates the centroid pivot of a node. |
static Instance |
calcPivot(BallNode child1,
BallNode child2,
Instances insts)
Calculates the centroid pivot of a node based on its two child nodes (if merging two nodes). |
static double |
calcRadius(BallNode child1,
BallNode child2,
Instance pivot,
DistanceFunction distanceFunction)
Calculates the radius of a node based on its two child nodes (if merging two nodes). |
static double |
calcRadius(int[] instList,
Instances insts,
Instance pivot,
DistanceFunction distanceFunction)
Calculates the radius of node. |
static double |
calcRadius(int start,
int end,
int[] instList,
Instances insts,
Instance pivot,
DistanceFunction distanceFunction)
Calculates the radius of a node. |
Instance |
getPivot()
Returns the pivot/centre of the node's ball. |
double |
getRadius()
Returns the radius of the node's ball. |
boolean |
isALeaf()
Returns true if the node is a leaf node (if both its left and right child are null). |
int |
numInstances()
Returns the number of instances in the hyper-spherical region of this node. |
void |
setPivot(Instance pivot)
Sets the pivot/centre of this nodes ball. |
void |
setRadius(double radius)
Sets the radius of the node's ball. |
void |
setStartEndIndices(int start,
int end)
Sets the the start and end index of the portion of the master index array that is assigned to this node. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public int m_Start
public int m_End
public int m_NumInstances
public int m_NodeNumber
public int m_SplitAttrib
public double m_SplitVal
public BallNode m_Left
public BallNode m_Right
Constructor Detail |
---|
public BallNode(int nodeNumber)
nodeNumber
- The node's number/id.public BallNode(int start, int end, int nodeNumber)
start
- The begining index of the portion of
the master index array belonging to this node.end
- The end index of the portion of the
master index array belonging to this node.nodeNumber
- The node's number/id.public BallNode(int start, int end, int nodeNumber, Instance pivot, double radius)
start
- The begining index of the portion of
the master index array belonging to this node.end
- The end index of the portion of the
master index array belonging to this node.nodeNumber
- The node's number/id.pivot
- The pivot/centre of the node's ball.radius
- The radius of the node's ball.Method Detail |
---|
public boolean isALeaf()
public void setStartEndIndices(int start, int end)
start
- The start index of the
master index array.end
- The end index of the master
indext array.public void setPivot(Instance pivot)
pivot
- The centre/pivot.public Instance getPivot()
public void setRadius(double radius)
radius
- The radius of the nodes ball.public double getRadius()
public int numInstances()
public static Instance calcCentroidPivot(int[] instList, Instances insts)
instList
- The indices array pointing to the
instances in the node.insts
- The actual instances. The instList
points to instances in this object.
public static Instance calcCentroidPivot(int start, int end, int[] instList, Instances insts)
start
- The start index marking the start of
the portion belonging to the node.end
- The end index marking the end of the
portion in the indices array that belongs to the node.instList
- The indices array pointing to the
instances in the node.insts
- The actual instances. The instList
points to instances in this object.
public static double calcRadius(int[] instList, Instances insts, Instance pivot, DistanceFunction distanceFunction) throws java.lang.Exception
instList
- The indices array containing the indices of the
instances inside the node.insts
- The actual instances object. instList points to
instances in this object.pivot
- The centre/pivot of the node.distanceFunction
- The distance fuction to use to calculate
the radius.
java.lang.Exception
- If there is some problem in calculating the
radius.public static double calcRadius(int start, int end, int[] instList, Instances insts, Instance pivot, DistanceFunction distanceFunction) throws java.lang.Exception
start
- The start index of the portion in indices array
that belongs to the node.end
- The end index of the portion in indices array
that belongs to the node.instList
- The indices array holding indices of
instances.insts
- The actual instances. instList points to
instances in this object.pivot
- The centre/pivot of the node.distanceFunction
- The distance function to use to
calculate the radius.
java.lang.Exception
- If there is some problem calculating the
radius.public static Instance calcPivot(BallNode child1, BallNode child2, Instances insts) throws java.lang.Exception
child1
- The first child of the node.child2
- The second child of the node.insts
- The set of instances on which
the tree is (or is to be) built.
java.lang.Exception
- If there is some problem calculating
the pivot.public static double calcRadius(BallNode child1, BallNode child2, Instance pivot, DistanceFunction distanceFunction) throws java.lang.Exception
child1
- The first child of the node.child2
- The second child of the node.pivot
- The centre/pivot of the node.distanceFunction
- The distance function to
use to calculate the radius
java.lang.Exception
- If there is some problem
in calculating the radius.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |