Package moa.clusterers.kmeanspm
Class ClusteringTreeNode
- java.lang.Object
-
- moa.AbstractMOAObject
-
- moa.clusterers.kmeanspm.ClusteringTreeNode
-
- All Implemented Interfaces:
Serializable
,MOAObject
- Direct Known Subclasses:
ClusteringTreeHeadNode
public class ClusteringTreeNode extends AbstractMOAObject
Provides a tree of ClusterFeatures. Citation: Hendrik Fichtenberger, Marc Gillé, Melanie Schmidt, Chris Schwiegelshohn, Christian Sohler: BICO: BIRCH Meets Coresets for k-Means Clustering. ESA 2013: 481-492 (2013) http://ls2-www.cs.tu-dortmund.de/bico/- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ClusteringTreeNode(double[] center, ClusteringFeature cf)
Creates a tree node for a ClusterFeature.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
addChild(ClusteringTreeNode e)
Adds a child node.Clustering
addToClustering(Clustering clustering)
Adds all ClusterFeatures of the tree with this node as the root to a Clustering.List<double[]>
addToClusteringCenters(List<double[]> clustering)
Adds all clustering centers of the ClusterFeatures of the tree with this node as the root to a List of points.void
clearChildren()
Removes all children nodes.int
count()
Deprecated.double[]
getCenter()
Gets the representation of the ClusteringFeatureList<ClusteringTreeNode>
getChildren()
Gets aList
of the children nodes.ClusteringFeature
getClusteringFeature()
Gets the ClusteringFeature of this node.void
getDescription(StringBuilder sb, int indent)
Returns a string representation of this object.double
getThreshold()
Gets the threshold of this node.boolean
hasNoChildren()
Returnstrue
if this node contains no children nodes.ClusteringTreeNode
nearestChild(double[] pointA)
Searches for the nearest child node by comparing each representation.void
printClusteringCenters(Writer stream)
Writes all clustering centers of the ClusterFeatures of the tree with this node as the root to a given stream.void
setCenter(double[] center)
Sets the representation of the ClusteringFeaturevoid
setThreshold(double threshold)
Gets the threshold of this node.-
Methods inherited from class moa.AbstractMOAObject
copy, copy, measureByteSize, measureByteSize, toString
-
-
-
-
Constructor Detail
-
ClusteringTreeNode
public ClusteringTreeNode(double[] center, ClusteringFeature cf)
Creates a tree node for a ClusterFeature.- Parameters:
center
- representation of the ClusterFeaturecf
- the ClusterFeature
-
-
Method Detail
-
count
@Deprecated public int count()
Deprecated.Counts the elements in tree with this node as the root.- Returns:
- the number of elements
-
addToClustering
public Clustering addToClustering(Clustering clustering)
Adds all ClusterFeatures of the tree with this node as the root to a Clustering.- Parameters:
clustering
- the Clustering to add the ClusterFeatures too.- Returns:
- the input Clustering
-
addToClusteringCenters
public List<double[]> addToClusteringCenters(List<double[]> clustering)
Adds all clustering centers of the ClusterFeatures of the tree with this node as the root to a List of points.- Parameters:
clustering
- the List to add the clustering centers too.- Returns:
- the input List
-
printClusteringCenters
public void printClusteringCenters(Writer stream) throws IOException
Writes all clustering centers of the ClusterFeatures of the tree with this node as the root to a given stream.- Parameters:
stream
- the stream- Throws:
IOException
- If an I/O error occurs
-
getCenter
public double[] getCenter()
Gets the representation of the ClusteringFeature- Returns:
- the representation of the ClusteringFeature
-
setCenter
public void setCenter(double[] center)
Sets the representation of the ClusteringFeature- Parameters:
center
- the representation of the ClusteringFeature to set
-
getClusteringFeature
public ClusteringFeature getClusteringFeature()
Gets the ClusteringFeature of this node.- Returns:
- the ClusteringFeature
-
getChildren
public List<ClusteringTreeNode> getChildren()
Gets aList
of the children nodes.- Returns:
- a
List
of the children nodes
-
getDescription
public void getDescription(StringBuilder sb, int indent)
Description copied from interface:MOAObject
Returns a string representation of this object. Used inAbstractMOAObject.toString
to give a string representation of the object.- Parameters:
sb
- the stringbuilder to add the descriptionindent
- the number of characters to indent
-
nearestChild
public ClusteringTreeNode nearestChild(double[] pointA)
Searches for the nearest child node by comparing each representation.- Parameters:
pointA
- to find the nearest child for- Returns:
- the child node which is the nearest
-
addChild
public boolean addChild(ClusteringTreeNode e)
Adds a child node.- Parameters:
e
- the child node to add- Returns:
true
- See Also:
List.add(java.lang.Object)
-
clearChildren
public void clearChildren()
Removes all children nodes.- See Also:
List.clear()
-
hasNoChildren
public boolean hasNoChildren()
Returnstrue
if this node contains no children nodes.- Returns:
true
if this node contains no children nodes- See Also:
List.isEmpty()
-
getThreshold
public double getThreshold()
Gets the threshold of this node.- Returns:
- the threshold
-
setThreshold
public void setThreshold(double threshold)
Gets the threshold of this node.- Parameters:
threshold
- the threshold to set
-
-