Class GMeans<C extends org.apache.commons.math3.ml.clustering.Clusterable>

  • Type Parameters:
    C - Points to cluster.
    All Implemented Interfaces:
    org.api4.java.common.control.ILoggingCustomizable

    public class GMeans<C extends org.apache.commons.math3.ml.clustering.Clusterable>
    extends java.lang.Object
    implements org.api4.java.common.control.ILoggingCustomizable
    Implementation of Gmeans based on Helen Beierlings implementation of GMeans(https://github.com/helebeen/AILibs/blob/master/JAICore/jaicore-modifiedISAC/src/main/java/jaicore/modifiedISAC/ModifiedISACgMeans.java).
    For more Information see: "Hamerly, G., and Elkan, C. 2003. Learning the k in kmeans. in proceedings of the seventeenth annual conference on neural information processing systems (nips)".

    This implementation uses KMeansPlusPlusClusterer as the k-means cluster algorithm.
    • Constructor Summary

      Constructors 
      Constructor Description
      GMeans​(java.util.Collection<C> toClusterPoints)
      Initializes a basic cluster for the given Point using Mannhatten distance and seed=1
      GMeans​(java.util.Collection<C> toClusterPoints, org.apache.commons.math3.ml.distance.DistanceMeasure distanceMeasure, int maxIterationsInInnerLoop, long seed)
      Initializes a cluster for the given Point using a given distance meassure and a seed.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected boolean andersonDarlingTest​(double[] d)  
      java.util.List<org.apache.commons.math3.ml.clustering.CentroidCluster<C>> cluster()  
      protected double[] difference​(double[] a, double[] b)  
      protected java.util.List<double[]> getCentersModifiable()  
      java.util.List<org.apache.commons.math3.ml.clustering.CentroidCluster<C>> getGmeansCluster()  
      java.lang.String getLoggerName()  
      java.util.List<C> getPoints()  
      protected void mergeCluster​(java.util.Map<double[],​java.util.List<C>> currentPoints)  
      void setLoggerName​(java.lang.String name)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GMeans

        public GMeans​(java.util.Collection<C> toClusterPoints)
        Initializes a basic cluster for the given Point using Mannhatten distance and seed=1
        Parameters:
        toClusterPoints - Points which should be clustered
      • GMeans

        public GMeans​(java.util.Collection<C> toClusterPoints,
                      org.apache.commons.math3.ml.distance.DistanceMeasure distanceMeasure,
                      int maxIterationsInInnerLoop,
                      long seed)
        Initializes a cluster for the given Point using a given distance meassure and a seed.
        Parameters:
        toClusterPoints - P
        distanceMeasure -
        seed -
    • Method Detail

      • cluster

        public java.util.List<org.apache.commons.math3.ml.clustering.CentroidCluster<C>> cluster()
      • mergeCluster

        protected void mergeCluster​(java.util.Map<double[],​java.util.List<C>> currentPoints)
      • andersonDarlingTest

        protected boolean andersonDarlingTest​(double[] d)
      • difference

        protected double[] difference​(double[] a,
                                      double[] b)
      • getGmeansCluster

        public java.util.List<org.apache.commons.math3.ml.clustering.CentroidCluster<C>> getGmeansCluster()
      • getCentersModifiable

        protected java.util.List<double[]> getCentersModifiable()
      • getPoints

        public java.util.List<C> getPoints()
      • getLoggerName

        public java.lang.String getLoggerName()
        Specified by:
        getLoggerName in interface org.api4.java.common.control.ILoggingCustomizable
      • setLoggerName

        public void setLoggerName​(java.lang.String name)
        Specified by:
        setLoggerName in interface org.api4.java.common.control.ILoggingCustomizable