Package moa.clusterers.kmeanspm
Class ClusteringFeature
- java.lang.Object
-
- moa.AbstractMOAObject
-
- moa.cluster.Cluster
-
- moa.cluster.SphereCluster
-
- moa.clusterers.kmeanspm.ClusteringFeature
-
- All Implemented Interfaces:
Serializable
,MOAObject
public class ClusteringFeature extends SphereCluster
Provides a ClusteringFeature. 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 ClusteringFeature(double[] center, double radius)
Creates a ClusteringFeature.ClusteringFeature(double[] center, int numPoints, double[] sumPoints, double sumSquaredPoints, double radius)
Creates a ClusteringFeature.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(int numPoints, double[] sumPoints, double sumSquaredPoints)
Adds a point to the ClusteringFeature.double
calcKMeansCosts(double[] center)
Calculates the k-means costs of the ClusteringFeature too a center.double
calcKMeansCosts(double[] center, double[] point)
Calculates the k-means costs of the ClusteringFeature and a point too a center.double
calcKMeansCosts(double[] center, ClusteringFeature points)
Calculates the k-means costs of the ClusteringFeature and another ClusteringFeature too a center.void
getDescription(StringBuilder sb, int indent)
Returns a string representation of this object.int
getNumPoints()
Returns the number of points of the ClusteringFeature.double[]
getSumPoints()
Returns the sum of points of the ClusteringFeature.double
getSumSquaredLength()
Returns the sum of the squared lengths of the ClusteringFeature.double
getThreshold()
Returns the threshold of the ClusteringFeature.void
merge(ClusteringFeature x)
Merges the ClusteringFeature with an other ClusteringFeature.void
printClusterCenter(Writer stream)
Writes the cluster center to a given stream.void
setNumPoints(int numPoints)
Sets the number of points of the ClusteringFeature.void
setSumPoints(double[] sumPoints)
Sets the sum of points of the ClusteringFeature.void
setSumSquaredLength(double sumSquaredLength)
Sets the sum of the squared lengths of the ClusteringFeature.void
setThreshold(double threshold)
Sets the threshold of the ClusteringFeature.Cluster
toCluster()
Creates a Cluster of the ClusteringFeature.double[]
toClusterCenter()
Creates the cluster center of the ClusteringFeature.-
Methods inherited from class moa.cluster.SphereCluster
combine, getCenter, getCenterDistance, getCenterDistance, getClusterSpecificInfo, getDistanceVector, getDistanceVector, getHullDistance, getInclusionProbability, getRadius, getWeight, merge, overlapRadiusDegree, overlapSave, sample, setCenter, setRadius, setWeight
-
Methods inherited from class moa.cluster.Cluster
getGroundTruth, getId, getInfo, getMeasureValue, isGroundTruth, setGroundTruth, setId, setMeasureValue, setMeasureValue
-
Methods inherited from class moa.AbstractMOAObject
copy, copy, measureByteSize, measureByteSize, toString
-
-
-
-
Constructor Detail
-
ClusteringFeature
public ClusteringFeature(double[] center, int numPoints, double[] sumPoints, double sumSquaredPoints, double radius)
Creates a ClusteringFeature.- Parameters:
center
- the center pointnumPoints
- the number of pointssumPoints
- the sum of all pointssumSquaredPoints
- the sum of the squared lengthsradius
- the radius
-
ClusteringFeature
public ClusteringFeature(double[] center, double radius)
Creates a ClusteringFeature.- Parameters:
center
- the center pointradius
- the radius
-
-
Method Detail
-
add
public void add(int numPoints, double[] sumPoints, double sumSquaredPoints)
Adds a point to the ClusteringFeature.- Parameters:
numPoints
- the number of points to addsumPoints
- the sum of points to addsumSquaredPoints
- the sum of the squared lengths to add
-
merge
public void merge(ClusteringFeature x)
Merges the ClusteringFeature with an other ClusteringFeature.- Parameters:
x
- the ClusteringFeature to merge with
-
toCluster
public Cluster toCluster()
Creates a Cluster of the ClusteringFeature.- Returns:
- a Cluster
-
toClusterCenter
public double[] toClusterCenter()
Creates the cluster center of the ClusteringFeature.- Returns:
- the cluster center
-
printClusterCenter
public void printClusterCenter(Writer stream) throws IOException
Writes the cluster center to a given stream.- Parameters:
stream
- the stream- Throws:
IOException
- If an I/O error occurs
-
getNumPoints
public int getNumPoints()
Returns the number of points of the ClusteringFeature.- Returns:
- the number of points
-
setNumPoints
public void setNumPoints(int numPoints)
Sets the number of points of the ClusteringFeature.- Parameters:
numPoints
- the number of points of the ClusteringFeature to set
-
getSumPoints
public double[] getSumPoints()
Returns the sum of points of the ClusteringFeature.- Returns:
- the sum of points
-
setSumPoints
public void setSumPoints(double[] sumPoints)
Sets the sum of points of the ClusteringFeature.- Parameters:
sumPoints
- the sum of points of the ClusteringFeature to set
-
getSumSquaredLength
public double getSumSquaredLength()
Returns the sum of the squared lengths of the ClusteringFeature.- Returns:
- the sum of the squared lengths
-
setSumSquaredLength
public void setSumSquaredLength(double sumSquaredLength)
Sets the sum of the squared lengths of the ClusteringFeature.- Parameters:
sumSquaredLength
- the sum of the squared lengths of the ClusteringFeature to set
-
getThreshold
public double getThreshold()
Returns the threshold of the ClusteringFeature.- Returns:
- the threshold
-
setThreshold
public void setThreshold(double threshold)
Sets the threshold of the ClusteringFeature.- Parameters:
threshold
- the threshold of the ClusteringFeature to set
-
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.- Specified by:
getDescription
in interfaceMOAObject
- Overrides:
getDescription
in classCluster
- Parameters:
sb
- the stringbuilder to add the descriptionindent
- the number of characters to indent
-
calcKMeansCosts
public double calcKMeansCosts(double[] center)
Calculates the k-means costs of the ClusteringFeature too a center.- Parameters:
center
- the center too calculate the costs- Returns:
- the costs
-
calcKMeansCosts
public double calcKMeansCosts(double[] center, double[] point)
Calculates the k-means costs of the ClusteringFeature and a point too a center.- Parameters:
center
- the center too calculate the costspoint
- the point too calculate the costs- Returns:
- the costs
-
calcKMeansCosts
public double calcKMeansCosts(double[] center, ClusteringFeature points)
Calculates the k-means costs of the ClusteringFeature and another ClusteringFeature too a center.- Parameters:
center
- the center too calculate the costspoints
- the points too calculate the costs- Returns:
- the costs
-
-