Class GMeans<C extends org.apache.commons.math3.ml.clustering.Clusterable>
- java.lang.Object
-
- ai.libs.jaicore.ml.clustering.learner.GMeans<C>
-
- 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.ILoggingCustomizableImplementation 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 usesKMeansPlusPlusClustereras 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=1GMeans(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 booleanandersonDarlingTest(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.StringgetLoggerName()java.util.List<C>getPoints()protected voidmergeCluster(java.util.Map<double[],java.util.List<C>> currentPoints)voidsetLoggerName(java.lang.String name)
-
-
-
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- PdistanceMeasure-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:
getLoggerNamein interfaceorg.api4.java.common.control.ILoggingCustomizable
-
setLoggerName
public void setLoggerName(java.lang.String name)
- Specified by:
setLoggerNamein interfaceorg.api4.java.common.control.ILoggingCustomizable
-
-