Package weka.clusterers
Class FilteredClusterer
java.lang.Object
weka.clusterers.AbstractClusterer
weka.clusterers.SingleClustererEnhancer
weka.clusterers.FilteredClusterer
- All Implemented Interfaces:
Serializable
,Cloneable
,Clusterer
,CapabilitiesHandler
,CapabilitiesIgnorer
,CommandlineRunnable
,Drawable
,OptionHandler
,RevisionHandler
Class for running an arbitrary clusterer on data
that has been passed through an arbitrary filter. Like the clusterer, the
structure of the filter is based exclusively on the training data and test
instances will be processed by the filter without changing their structure.
Valid options are:
-F <filter specification> Full class name of filter to use, followed by filter options. eg: "weka.filters.unsupervised.attribute.Remove -V -R 1,2" (default: weka.filters.AllFilter)
-W Full name of base 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)Based on code from the FilteredClassifier by Len Trigg.
- Version:
- $Revision: 15519 $
- Author:
- Len Trigg (trigg@cs.waikato.ac.nz), FracPete (fracpete at waikato dot ac dot nz)
- See Also:
-
Field Summary
Fields inherited from interface weka.core.Drawable
BayesNet, Newick, NOT_DRAWABLE, TREE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
buildClusterer
(Instances data) Build the clusterer on the filtered data.double[]
distributionForInstance
(Instance instance) Classifies a given instance after filtering.Returns the tip text for this property.Returns default capabilities of the clusterer.Gets the filter used.String[]
Gets the current settings of the clusterer.Returns the revision string.Returns a string describing this clusterer.graph()
Returns graph describing the clusterer (if possible).int
Returns the type of graph this clusterer represents.Returns an enumeration describing the available options.static void
Main method for testing this class.void
Sets the filter.void
setOptions
(String[] options) Parses a given list of options.toString()
Output a representation of this clusterer.Methods inherited from class weka.clusterers.SingleClustererEnhancer
clustererTipText, getClusterer, numberOfClusters, setClusterer
Methods inherited from class weka.clusterers.AbstractClusterer
clusterInstance, debugTipText, doNotCheckCapabilitiesTipText, forName, getDebug, getDoNotCheckCapabilities, makeCopies, makeCopy, postExecution, preExecution, run, runClusterer, setDebug, setDoNotCheckCapabilities
-
Constructor Details
-
FilteredClusterer
public FilteredClusterer()Default constructor.
-
-
Method Details
-
globalInfo
Returns a string describing this clusterer.- Returns:
- a description of the clusterer suitable for displaying in the explorer/experimenter gui
-
listOptions
Returns an enumeration describing the available options.- Specified by:
listOptions
in interfaceOptionHandler
- Overrides:
listOptions
in classSingleClustererEnhancer
- Returns:
- an enumeration of all the available options.
-
setOptions
Parses a given list of options. Valid options are:-F <filter specification> Full class name of filter to use, followed by filter options. eg: "weka.filters.unsupervised.attribute.Remove -V -R 1,2" (default: weka.filters.AllFilter)
-W Full name of base 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 classSingleClustererEnhancer
- Parameters:
options
- the list of options as an array of strings- Throws:
Exception
- if an option is not supported
-
getOptions
Gets the current settings of the clusterer.- Specified by:
getOptions
in interfaceOptionHandler
- Overrides:
getOptions
in classSingleClustererEnhancer
- Returns:
- an array of strings suitable for passing to setOptions
-
filterTipText
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setFilter
Sets the filter.- Parameters:
filter
- the filter with all options set.
-
getFilter
Gets the filter used.- Returns:
- the filter
-
getCapabilities
Returns default capabilities of the clusterer.- Specified by:
getCapabilities
in interfaceCapabilitiesHandler
- Specified by:
getCapabilities
in interfaceClusterer
- Overrides:
getCapabilities
in classSingleClustererEnhancer
- Returns:
- the capabilities of this clusterer
- See Also:
-
buildClusterer
Build the clusterer on the filtered data.- Specified by:
buildClusterer
in interfaceClusterer
- Specified by:
buildClusterer
in classAbstractClusterer
- Parameters:
data
- the training data- Throws:
Exception
- if the clusterer could not be built successfully
-
distributionForInstance
Classifies a given instance after filtering.- Specified by:
distributionForInstance
in interfaceClusterer
- Overrides:
distributionForInstance
in classAbstractClusterer
- Parameters:
instance
- the instance to be classified- Returns:
- the class distribution for the given instance
- Throws:
Exception
- if instance could not be classified successfully
-
toString
Output a representation of this clusterer. -
graphType
public int graphType()Returns the type of graph this clusterer represents. -
graph
Returns graph describing the clusterer (if possible). -
getRevision
Returns the revision string.- Specified by:
getRevision
in interfaceRevisionHandler
- Overrides:
getRevision
in classAbstractClusterer
- Returns:
- the revision
-
main
Main method for testing this class.- Parameters:
args
- the commandline options, use "-h" for help
-