Documentation of 'jsat.clustering.kmeans.GMeans' Java class
GMeans
jsat.clustering.kmeans

Class GMeans

  • All Implemented Interfaces:
    java.io.Serializable, Clusterer, KClusterer, Parameterized


    public class GMeans
    extends KMeans
    This class provides a method of performing KMeans clustering when the value of K is not known. It works by recursively splitting means up to some specified maximum. value.

    When the value of K is specified, the implementation will simply call the regular KMeans object it was constructed with.

    See: Hamerly, G.,&Elkan, C. (2003). Learning the K in K-Means. In seventeenth annual conference on neural information processing systems (NIPS) (pp. 281–288). Retrieved from here
    See Also:
    Serialized Form
    • Constructor Detail

      • GMeans

        public GMeans()
      • GMeans

        public GMeans(KMeans kmeans)
      • GMeans

        public GMeans(GMeans toCopy)
    • Method Detail

      • setTrustH0

        public void setTrustH0(boolean trustH0)
        Each new cluster will be tested for normality, with the null hypothesis H0 being that the cluster is normal. If this is set to true then an optimization is done that once a center fails to reject the null hypothesis, it will never be tested again. This is a safe assumption when setIterativeRefine(boolean) is set to false, but otherwise may not quite be true.

        When trustH0 is true (the default option), G-Means will make at most O(k) runs of k-means for the final value of k chosen. When false, at most O(k2) runs of k-means will occur.
        Parameters:
        trustH0 - true if a centroid shouldn't be re-tested once it fails to split.
      • getTrustH0

        public boolean getTrustH0()
        Returns:
        true if cluster that fail to split wont be re-tested. false if they will.
      • setMinClusterSize

        public void setMinClusterSize(int minClusterSize)
        Sets the minimum size for splitting a cluster.
        Parameters:
        minClusterSize - the minimum number of data points that must be present in a cluster to consider splitting it
      • getMinClusterSize

        public int getMinClusterSize()
        Returns:
        the minimum number of data points that must be present in a cluster to consider splitting it
      • setIterativeRefine

        public void setIterativeRefine(boolean refineCenters)
        Sets whether or not the set of all cluster centers should be refined at every iteration. By default this is true and part of how the GMeans algorithm is described. Setting this to false can result in large speedups at the potential cost of quality.
        Parameters:
        refineCenters - true to refine the cluster centers at every step, false to skip this step of the algorithm.
      • getIterativeRefine

        public boolean getIterativeRefine()
        Returns:
        true if the cluster centers are refined at every step, false if skipping this step of the algorithm.
      • cluster

        public int[] cluster(DataSet dataSet,
                             int[] designations)
        Description copied from interface: Clusterer
        Performs clustering on the given data set. Parameters may be estimated by the method, or other heuristics performed.
        Specified by:
        cluster in interface Clusterer
        Overrides:
        cluster in class KMeans
        Parameters:
        dataSet - the data set to perform clustering on
        designations - the array which will contain the designated values. The array will be altered and returned by the function. If null is given, a new array will be created and returned.
        Returns:
        an array indicating for each value indicating the cluster designation. This is the same array as designations, or a new one if the input array was null
      • cluster

        public int[] cluster(DataSet dataSet,
                             boolean parallel,
                             int[] designations)
        Description copied from interface: Clusterer
        Performs clustering on the given data set. Parameters may be estimated by the method, or other heuristics performed.
        Specified by:
        cluster in interface Clusterer
        Overrides:
        cluster in class KMeans
        Parameters:
        dataSet - the data set to perform clustering on
        parallel - true if multiple threads should be used to perform clustering. false if it should be done in a single threaded manner.
        designations - the array which will contain the designated values. The array will be altered and returned by the function. If null is given, a new array will be created and returned.
        Returns:
        the int[]
      • cluster

        public int[] cluster(DataSet dataSet,
                             int lowK,
                             int highK,
                             boolean parallel,
                             int[] designations)
        Specified by:
        cluster in interface KClusterer
        Overrides:
        cluster in class KMeans
      • getIterationLimit

        public int getIterationLimit()
        Description copied from class: KMeans
        Returns the maximum number of iterations of the ElkanKMeans algorithm that will be performed.
        Overrides:
        getIterationLimit in class KMeans
        Returns:
        the maximum number of iterations of the ElkanKMeans algorithm that will be performed.
      • setIterationLimit

        public void setIterationLimit(int iterLimit)
        Description copied from class: KMeans
        Sets the maximum number of iterations allowed
        Overrides:
        setIterationLimit in class KMeans
        Parameters:
        iterLimit - the maximum number of iterations of the ElkanKMeans algorithm

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.