public class ClusterEvaluation extends Object implements Serializable, RevisionHandler
weka.core.Drawable interface.
Drawable,
Serialized Form| Constructor and Description |
|---|
ClusterEvaluation()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
String |
clusterResultsToString()
return the results of clustering.
|
static double |
crossValidateModel(DensityBasedClusterer clusterer,
Instances data,
int numFolds,
Random random)
Perform a cross-validation for DensityBasedClusterer on a set of instances.
|
static String |
crossValidateModel(String clustererString,
Instances data,
int numFolds,
String[] options,
Random random)
Performs a cross-validation
for a DensityBasedClusterer clusterer on a set of instances.
|
boolean |
equals(Object obj)
Tests whether the current evaluation object is equal to another
evaluation object
|
static String |
evaluateClusterer(Clusterer clusterer,
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,
String testFileName)
Evaluate the clusterer on a set of instances.
|
void |
evaluateClusterer(Instances test,
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
|
String |
getRevision()
Returns the revision string.
|
static void |
main(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 String clusterResultsToString()
public int getNumClusters()
public double[] getClusterAssignments()
public int[] getClassesToClusters()
public double getLogLikelihood()
double valuepublic void evaluateClusterer(Instances test) throws Exception
test - the set of instances to clusterException - if something goes wrongpublic void evaluateClusterer(Instances test, String testFileName) throws Exception
test - the set of instances to clustertestFileName - the name of the test file for incremental testing,
if "" or null then not usedException - if something goes wrongpublic void evaluateClusterer(Instances test, String testFileName, boolean outputModel) throws 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 statsException - 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 String evaluateClusterer(Clusterer clusterer, String[] options) throws Exception
clusterer - machine learning clustereroptions - the array of string containing the optionsException - if model could not be evaluated successfullypublic static double crossValidateModel(DensityBasedClusterer clusterer, Instances data, int numFolds, Random random) throws Exception
clusterer - the clusterer to usedata - the training datanumFolds - number of folds of cross validation to performrandom - random number seed for cross-validationException - if an error occurspublic static String crossValidateModel(String clustererString, Instances data, int numFolds, String[] options, Random random) throws 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 generatorException - if a clusterer could not be generatedpublic boolean equals(Object obj)
public String getRevision()
getRevision in interface RevisionHandlerpublic static void main(String[] args)
args - the optionsCopyright © 2012 University of Waikato, Hamilton, NZ. All Rights Reserved.