org.ddogleg.clustering.gmm
Class ExpectationMaximizationGmm_F64
- java.lang.Object
-
- org.ddogleg.clustering.gmm.ExpectationMaximizationGmm_F64
-
- All Implemented Interfaces:
- ComputeClusters<double[]>
public class ExpectationMaximizationGmm_F64 extends java.lang.Object implements ComputeClusters<double[]>
Standard expectation maximization based approach to fitting mixture-of-Gaussian models to a set of data. A locally optimal maximum likelihood estimate is found. The full covariance is found. Some other variants will estimate just diagonal elements or a single covariance, but that isn't yet supported.Converged if, , where D is the sum of point from cluster distance at iteration 'i', and tol is the convergence tolerance threshold.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static classExpectationMaximizationGmm_F64.PointInfo
-
Constructor Summary
Constructors Constructor and Description ExpectationMaximizationGmm_F64(int maxIterations, double convergeTol, InitializeGmm_F64 selectInitial)Configures EM parameters
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description AssignCluster<double[]>getAssignment()Returns a class which is used to assign a point to a cluster.doublegetDistanceMeasure()Returns the sum of all the distances between each point in the set.voidinit(int pointDimension, long randomSeed)Must be called first to initializes internal data structures.voidprocess(java.util.List<double[]> points, int numCluster)Computes a set of clusters which segment the points into numCluster sets.voidsetVerbose(boolean verbose)If set to true then information about status will be printed to standard out.
-
-
-
Constructor Detail
-
ExpectationMaximizationGmm_F64
public ExpectationMaximizationGmm_F64(int maxIterations, double convergeTol, InitializeGmm_F64 selectInitial)Configures EM parameters- Parameters:
maxIterations- Maximum number of iterationsconvergeTol- If the relative change in score is less or equal than this amount it has convergedselectInitial- Used to select initial seeds for the clusters
-
-
Method Detail
-
init
public void init(int pointDimension, long randomSeed)Description copied from interface:ComputeClustersMust be called first to initializes internal data structures. Only needs to be called once.- Specified by:
initin interfaceComputeClusters<double[]>- Parameters:
pointDimension- Number of degrees of freedom in each point.randomSeed- Seed for any random number generators used internally.
-
process
public void process(java.util.List<double[]> points, int numCluster)Description copied from interface:ComputeClustersComputes a set of clusters which segment the points into numCluster sets.- Specified by:
processin interfaceComputeClusters<double[]>- Parameters:
points- Set of points which are to be clustered. Not modified.numCluster- Number of clusters it will use to split the points.
-
getAssignment
public AssignCluster<double[]> getAssignment()
Description copied from interface:ComputeClustersReturns a class which is used to assign a point to a cluster. Only invoked after
ComputeClusters.process(java.util.List<D>, int)has been called.WARNING: The returned data structure is recycled each time compute clusters is called. Create a copy if you wish to avoid having it modified.
- Specified by:
getAssignmentin interfaceComputeClusters<double[]>- Returns:
- Instance of
AssignCluster.
-
getDistanceMeasure
public double getDistanceMeasure()
Description copied from interface:ComputeClustersReturns the sum of all the distances between each point in the set. Can be used to evaluate the quality of fit for all the clusters. Can only be used to compare when the same number of clusters is uesd.
NOTE: The specific distance measure is not specified and is application specific.- Specified by:
getDistanceMeasurein interfaceComputeClusters<double[]>- Returns:
- sum of distance between each point and their respective clusters.
-
setVerbose
public void setVerbose(boolean verbose)
Description copied from interface:ComputeClustersIf set to true then information about status will be printed to standard out. By default verbose is off- Specified by:
setVerbosein interfaceComputeClusters<double[]>- Parameters:
verbose- true for versbose mode. False for quite mode.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG