|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.clusterers.ClusterEvaluation
public class ClusterEvaluation
Class for evaluating clustering models.
Valid options are: -t name of the training fileweka.core.Drawable
interface.
Drawable
,
Serialized FormConstructor Summary | |
---|---|
ClusterEvaluation()
Constructor. |
Method Summary | |
---|---|
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 |
Methods inherited from class java.lang.Object |
---|
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ClusterEvaluation()
Method Detail |
---|
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 cluster
java.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 used
java.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 stats
java.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 options
java.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-validation
java.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 generator
java.lang.Exception
- if a clusterer could not be generatedpublic boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the object to compare against
public java.lang.String getRevision()
getRevision
in interface RevisionHandler
public static void main(java.lang.String[] args)
args
- the options
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |