public class ClusterEvaluation extends java.lang.Object implements java.io.Serializable, RevisionHandler
weka.core.Drawable interface.
Drawable,
Serialized Form| Constructor and Description |
|---|
ClusterEvaluation()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
clusterResultsToString()
return the results of clustering.
|
static double |
crossValidateModel(DensityBasedClusterer clusterer,
Instances data,
int numFolds,
java.util.Random random)
Perform a cross-validation for DensityBasedClusterer on a set of instances.
|
static java.lang.String |
crossValidateModel(java.lang.String clustererString,
Instances data,
int numFolds,
java.lang.String[] options,
java.util.Random random)
Performs a cross-validation for a DensityBasedClusterer clusterer on a set
of instances.
|
boolean |
equals(java.lang.Object obj)
Tests whether the current evaluation object is equal to another evaluation
object
|
static java.lang.String |
evaluateClusterer(Clusterer clusterer,
java.lang.String[] options)
Evaluates a clusterer with the options given in an array of strings.
|
void |
evaluateClusterer(Instances test)
Evaluate the clusterer on a set of instances.
|
void |
evaluateClusterer(Instances test,
java.lang.String testFileName)
Evaluate the clusterer on a set of instances.
|
void |
evaluateClusterer(Instances test,
java.lang.String testFileName,
boolean outputModel)
Evaluate the clusterer on a set of instances.
|
int[] |
getClassesToClusters()
Return the array (ordered by cluster number) of minimum error class to
cluster mappings
|
double[] |
getClusterAssignments()
Return an array of cluster assignments corresponding to the most recent set
of instances clustered.
|
double |
getLogLikelihood()
Return the log likelihood corresponding to the most recent set of instances
clustered.
|
int |
getNumClusters()
Return the number of clusters found for the most recent call to
evaluateClusterer
|
java.lang.String |
getRevision()
Returns the revision string.
|
static void |
main(java.lang.String[] args)
Main method for testing this class.
|
static void |
mapClasses(int numClusters,
int lev,
int[][] counts,
int[] clusterTotals,
double[] current,
double[] best,
int error)
Finds the minimum error mapping of classes to clusters.
|
void |
setClusterer(Clusterer clusterer)
set the clusterer
|
public ClusterEvaluation()
public void setClusterer(Clusterer clusterer)
clusterer - the clusterer to usepublic java.lang.String clusterResultsToString()
public int getNumClusters()
public double[] getClusterAssignments()
public int[] getClassesToClusters()
public double getLogLikelihood()
double valuepublic void evaluateClusterer(Instances test) throws java.lang.Exception
test - the set of instances to clusterjava.lang.Exception - if something goes wrongpublic void evaluateClusterer(Instances test, java.lang.String testFileName) throws java.lang.Exception
test - the set of instances to clustertestFileName - the name of the test file for incremental testing, if
"" or null then not usedjava.lang.Exception - if something goes wrongpublic void evaluateClusterer(Instances test, java.lang.String testFileName, boolean outputModel) throws java.lang.Exception
test - the set of instances to clustertestFileName - the name of the test file for incremental testing, if
"" or null then not usedoutputModel - true if the clustering model is to be output as well as
the statsjava.lang.Exception - if something goes wrongpublic static void mapClasses(int numClusters,
int lev,
int[][] counts,
int[] clusterTotals,
double[] current,
double[] best,
int error)
numClusters - the number of clusterslev - the cluster being processedcounts - the counts of classes in clustersclusterTotals - the total number of examples in each clustercurrent - the current path through the class to cluster assignment
treebest - the best assignment path seenerror - accumulates the error for a particular pathpublic static java.lang.String evaluateClusterer(Clusterer clusterer, java.lang.String[] options) throws java.lang.Exception
clusterer - machine learning clustereroptions - the array of string containing the optionsjava.lang.Exception - if model could not be evaluated successfullypublic static double crossValidateModel(DensityBasedClusterer clusterer, Instances data, int numFolds, java.util.Random random) throws java.lang.Exception
clusterer - the clusterer to usedata - the training datanumFolds - number of folds of cross validation to performrandom - random number seed for cross-validationjava.lang.Exception - if an error occurspublic static java.lang.String crossValidateModel(java.lang.String clustererString,
Instances data,
int numFolds,
java.lang.String[] options,
java.util.Random random)
throws java.lang.Exception
clustererString - a string naming the class of the clustererdata - the data on which the cross-validation is to be performednumFolds - the number of folds for the cross-validationoptions - the options to the clustererrandom - a random number generatorjava.lang.Exception - if a clusterer could not be generatedpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectobj - the object to compare againstpublic java.lang.String getRevision()
getRevision in interface RevisionHandlerpublic static void main(java.lang.String[] args)
args - the options