Package weka.classifiers.meta
Class ClassificationViaClustering
java.lang.Object
weka.classifiers.Classifier
weka.classifiers.meta.ClassificationViaClustering
- All Implemented Interfaces:
Serializable
,Cloneable
,CapabilitiesHandler
,OptionHandler
,RevisionHandler
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. Valid options are:
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. Valid options are:
-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)
- Version:
- $Revision: 1.5 $
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
buildClassifier
(Instances data) builds the classifierdouble
classifyInstance
(Instance instance) Classifies the given test instance.Returns the tip text for this propertyReturns default capabilities of the classifier.Get the clusterer used as the base learner.String[]
returns the options of the current setupReturns the revision string.Returns a string describing classifierGets an enumeration describing the available options.static void
Runs the classifier with the given optionsvoid
setClusterer
(Clusterer value) Set the base clusterer.void
setOptions
(String[] options) Parses the options for this object.toString()
Returns a string representation of the classifier.Methods inherited from class weka.classifiers.Classifier
debugTipText, distributionForInstance, forName, getDebug, makeCopies, makeCopy, setDebug
-
Constructor Details
-
ClassificationViaClustering
public ClassificationViaClustering()default constructor
-
-
Method Details
-
globalInfo
Returns a string describing classifier- Returns:
- a description suitable for displaying in the explorer/experimenter gui
-
listOptions
Gets an enumeration describing the available options.- Specified by:
listOptions
in interfaceOptionHandler
- Overrides:
listOptions
in classClassifier
- Returns:
- an enumeration of all the available options.
-
getOptions
returns the options of the current setup- Specified by:
getOptions
in interfaceOptionHandler
- Overrides:
getOptions
in classClassifier
- Returns:
- the current options
-
setOptions
Parses the options for this object. Valid options are:-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)
- Specified by:
setOptions
in interfaceOptionHandler
- Overrides:
setOptions
in classClassifier
- Parameters:
options
- the options to use- Throws:
Exception
- if setting of options fails
-
clustererTipText
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setClusterer
Set the base clusterer.- Parameters:
value
- the clusterer to use.
-
getClusterer
Get the clusterer used as the base learner.- Returns:
- the current clusterer
-
classifyInstance
Classifies the given test instance.- Overrides:
classifyInstance
in classClassifier
- Parameters:
instance
- the instance to be classified- Returns:
- the predicted most likely class for the instance or Instance.missingValue() if no prediction is made
- Throws:
Exception
- if an error occurred during the prediction
-
getCapabilities
Returns default capabilities of the classifier.- Specified by:
getCapabilities
in interfaceCapabilitiesHandler
- Overrides:
getCapabilities
in classClassifier
- Returns:
- the capabilities of this classifier
- See Also:
-
buildClassifier
builds the classifier- Specified by:
buildClassifier
in classClassifier
- Parameters:
data
- the training instances- Throws:
Exception
- if something goes wrong
-
toString
Returns a string representation of the classifier. -
getRevision
Returns the revision string.- Specified by:
getRevision
in interfaceRevisionHandler
- Overrides:
getRevision
in classClassifier
- Returns:
- the revision
-
main
Runs the classifier with the given options- Parameters:
args
- the commandline options
-