|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.classifiers.Classifier
weka.classifiers.meta.ClassificationViaClustering
public class ClassificationViaClustering
A simple meta-classifier that uses a clusterer for classification. For cluster algorithms that use a fixed number of clusterers, like SimpleKMeans, the user has to make sure that the number of clusters to generate are the same as the number of class labels in the dataset in order to obtain a useful model.
Note: at prediction time, a missing value is returned if no cluster is found for the instance.
The code is based on the 'clusters to classes' functionality of the weka.clusterers.ClusterEvaluation class by Mark Hall.
-D If set, classifier is run in debug mode and may output additional info to the console
-W Full name of clusterer. (default: weka.clusterers.SimpleKMeans)
Options specific to clusterer weka.clusterers.SimpleKMeans:
-N <num> number of clusters. (default 2).
-V Display std. deviations for centroids.
-M Replace missing values with mean/mode.
-S <num> Random number seed. (default 10)
Constructor Summary | |
---|---|
ClassificationViaClustering()
default constructor |
Method Summary | |
---|---|
void |
buildClassifier(Instances data)
builds the classifier |
double |
classifyInstance(Instance instance)
Classifies the given test instance. |
java.lang.String |
clustererTipText()
Returns the tip text for this property |
Capabilities |
getCapabilities()
Returns default capabilities of the classifier. |
Clusterer |
getClusterer()
Get the clusterer used as the base learner. |
java.lang.String[] |
getOptions()
returns the options of the current setup |
java.lang.String |
getRevision()
Returns the revision string. |
java.lang.String |
globalInfo()
Returns a string describing classifier |
java.util.Enumeration |
listOptions()
Gets an enumeration describing the available options. |
static void |
main(java.lang.String[] args)
Runs the classifier with the given options |
void |
setClusterer(Clusterer value)
Set the base clusterer. |
void |
setOptions(java.lang.String[] options)
Parses the options for this object. |
java.lang.String |
toString()
Returns a string representation of the classifier. |
Methods inherited from class weka.classifiers.Classifier |
---|
debugTipText, distributionForInstance, forName, getDebug, makeCopies, makeCopy, setDebug |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ClassificationViaClustering()
Method Detail |
---|
public java.lang.String globalInfo()
public java.util.Enumeration listOptions()
listOptions
in interface OptionHandler
listOptions
in class Classifier
public java.lang.String[] getOptions()
getOptions
in interface OptionHandler
getOptions
in class Classifier
public void setOptions(java.lang.String[] options) throws java.lang.Exception
-D If set, classifier is run in debug mode and may output additional info to the console
-W Full name of clusterer. (default: weka.clusterers.SimpleKMeans)
Options specific to clusterer weka.clusterers.SimpleKMeans:
-N <num> number of clusters. (default 2).
-V Display std. deviations for centroids.
-M Replace missing values with mean/mode.
-S <num> Random number seed. (default 10)
setOptions
in interface OptionHandler
setOptions
in class Classifier
options
- the options to use
java.lang.Exception
- if setting of options failspublic java.lang.String clustererTipText()
public void setClusterer(Clusterer value)
value
- the clusterer to use.public Clusterer getClusterer()
public double classifyInstance(Instance instance) throws java.lang.Exception
classifyInstance
in class Classifier
instance
- the instance to be classified
java.lang.Exception
- if an error occurred during the predictionpublic Capabilities getCapabilities()
getCapabilities
in interface CapabilitiesHandler
getCapabilities
in class Classifier
Capabilities
public void buildClassifier(Instances data) throws java.lang.Exception
buildClassifier
in class Classifier
data
- the training instances
java.lang.Exception
- if something goes wrongpublic java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getRevision()
getRevision
in interface RevisionHandler
getRevision
in class Classifier
public static void main(java.lang.String[] args)
args
- the commandline options
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |