Class 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 Detail

      • ClusteringFeature

        public ClusteringFeature​(double[] center,
                                 int numPoints,
                                 double[] sumPoints,
                                 double sumSquaredPoints,
                                 double radius)
        Creates a ClusteringFeature.
        Parameters:
        center - the center point
        numPoints - the number of points
        sumPoints - the sum of all points
        sumSquaredPoints - the sum of the squared lengths
        radius - the radius
      • ClusteringFeature

        public ClusteringFeature​(double[] center,
                                 double radius)
        Creates a ClusteringFeature.
        Parameters:
        center - the center point
        radius - 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 add
        sumPoints - the sum of points to add
        sumSquaredPoints - 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 in AbstractMOAObject.toString to give a string representation of the object.
        Specified by:
        getDescription in interface MOAObject
        Overrides:
        getDescription in class Cluster
        Parameters:
        sb - the stringbuilder to add the description
        indent - 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 costs
        point - 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 costs
        points - the points too calculate the costs
        Returns:
        the costs