public class EM extends RandomizableDensityBasedClusterer implements NumberOfClustersRequestable, WeightedInstancesHandler
-N <num> number of clusters. If omitted or -1 specified, then cross validation is used to select the number of clusters.
-I <num> max iterations. (default 100)
-V verbose.
-M <num> minimum allowable standard deviation for normal density computation (default 1e-6)
-O Display model in old format (good when there are many clusters)
-S <num> Random number seed. (default 100)
Constructor and Description |
---|
EM()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
buildClusterer(Instances data)
Generates a clusterer.
|
double[] |
clusterPriors()
Returns the cluster priors.
|
String |
debugTipText()
Returns the tip text for this property
|
String |
displayModelInOldFormatTipText()
Returns the tip text for this property
|
Capabilities |
getCapabilities()
Returns default capabilities of the clusterer (i.e., the ones of
SimpleKMeans).
|
double[][][] |
getClusterModelsNumericAtts()
Return the normal distributions for the cluster models
|
double[] |
getClusterPriors()
Return the priors for the clusters
|
boolean |
getDebug()
Get debug mode
|
boolean |
getDisplayModelInOldFormat()
Get whether to display model output in the old, original
format.
|
int |
getMaxIterations()
Get the maximum number of iterations
|
double |
getMinStdDev()
Get the minimum allowable standard deviation.
|
int |
getNumClusters()
Get the number of clusters
|
String[] |
getOptions()
Gets the current settings of EM.
|
String |
getRevision()
Returns the revision string.
|
String |
globalInfo()
Returns a string describing this clusterer
|
Enumeration |
listOptions()
Returns an enumeration describing the available options.
|
double[] |
logDensityPerClusterForInstance(Instance inst)
Computes the log of the conditional density (per cluster) for a given instance.
|
static void |
main(String[] argv)
Main method for testing this class.
|
String |
maxIterationsTipText()
Returns the tip text for this property
|
String |
minStdDevTipText()
Returns the tip text for this property
|
int |
numberOfClusters()
Returns the number of clusters.
|
String |
numClustersTipText()
Returns the tip text for this property
|
void |
setDebug(boolean v)
Set debug mode - verbose output
|
void |
setDisplayModelInOldFormat(boolean d)
Set whether to display model output in the old, original
format.
|
void |
setMaxIterations(int i)
Set the maximum number of iterations to perform
|
void |
setMinStdDev(double m)
Set the minimum value for standard deviation when calculating
normal density.
|
void |
setMinStdDevPerAtt(double[] m) |
void |
setNumClusters(int n)
Set the number of clusters (-1 to select by CV).
|
void |
setOptions(String[] options)
Parses a given list of options.
|
String |
toString()
Outputs the generated clusters into a string.
|
getSeed, seedTipText, setSeed
distributionForInstance, logDensityForInstance, logJointDensitiesForInstance, makeCopies
clusterInstance, forName, makeCopies, makeCopy, runClusterer
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
clusterInstance
public String globalInfo()
public Enumeration listOptions()
listOptions
in interface OptionHandler
listOptions
in class RandomizableDensityBasedClusterer
public void setOptions(String[] options) throws Exception
-N <num> number of clusters. If omitted or -1 specified, then cross validation is used to select the number of clusters.
-I <num> max iterations. (default 100)
-V verbose.
-M <num> minimum allowable standard deviation for normal density computation (default 1e-6)
-O Display model in old format (good when there are many clusters)
-S <num> Random number seed. (default 100)
setOptions
in interface OptionHandler
setOptions
in class RandomizableDensityBasedClusterer
options
- the list of options as an array of stringsException
- if an option is not supportedpublic String displayModelInOldFormatTipText()
public void setDisplayModelInOldFormat(boolean d)
d
- true if model ouput is to be shown in the old formatpublic boolean getDisplayModelInOldFormat()
public String minStdDevTipText()
public void setMinStdDev(double m)
m
- minimum value for standard deviationpublic void setMinStdDevPerAtt(double[] m)
public double getMinStdDev()
public String numClustersTipText()
public void setNumClusters(int n) throws Exception
setNumClusters
in interface NumberOfClustersRequestable
n
- the number of clustersException
- if n is 0public int getNumClusters()
public String maxIterationsTipText()
public void setMaxIterations(int i) throws Exception
i
- the number of iterationsException
- if i is less than 1public int getMaxIterations()
public String debugTipText()
public void setDebug(boolean v)
v
- true for verbose outputpublic boolean getDebug()
public String[] getOptions()
getOptions
in interface OptionHandler
getOptions
in class RandomizableDensityBasedClusterer
public double[][][] getClusterModelsNumericAtts()
double[][][]
valuepublic double[] getClusterPriors()
double[]
valuepublic String toString()
public int numberOfClusters() throws Exception
numberOfClusters
in interface Clusterer
numberOfClusters
in class AbstractClusterer
Exception
- if number of clusters could not be returned
successfullypublic Capabilities getCapabilities()
getCapabilities
in interface Clusterer
getCapabilities
in interface CapabilitiesHandler
getCapabilities
in class AbstractClusterer
Capabilities
public void buildClusterer(Instances data) throws Exception
buildClusterer
in interface Clusterer
buildClusterer
in class AbstractClusterer
data
- set of instances serving as training dataException
- if the clusterer has not been
generated successfullypublic double[] clusterPriors()
clusterPriors
in interface DensityBasedClusterer
clusterPriors
in class AbstractDensityBasedClusterer
public double[] logDensityPerClusterForInstance(Instance inst) throws Exception
logDensityPerClusterForInstance
in interface DensityBasedClusterer
logDensityPerClusterForInstance
in class AbstractDensityBasedClusterer
inst
- the instance to compute the density forException
- if the density could not be computed
successfullypublic String getRevision()
getRevision
in interface RevisionHandler
getRevision
in class AbstractClusterer
public static void main(String[] argv)
argv
- should contain the following arguments: -t training file [-T test file] [-N number of clusters] [-S random seed]
Copyright © 2012 University of Waikato, Hamilton, NZ. All Rights Reserved.