Package weka.clusterers
Class SpectrumClusterer
- java.lang.Object
-
- weka.clusterers.AbstractClusterer
-
- weka.clusterers.SingleClustererEnhancer
-
- weka.clusterers.SpectrumClusterer
-
- All Implemented Interfaces:
Serializable
,Cloneable
,weka.clusterers.Clusterer
,weka.clusterers.DensityBasedClusterer
,weka.core.CapabilitiesHandler
,weka.core.CapabilitiesIgnorer
,weka.core.CommandlineRunnable
,weka.core.OptionHandler
,weka.core.RevisionHandler
public class SpectrumClusterer extends weka.clusterers.SingleClustererEnhancer implements weka.clusterers.DensityBasedClusterer
Automatically removes some IDs from the dataset before training the base classifier: id, db_id, sample_id.
Valid options are:
-D If set, classifier is run in debug mode and may output additional info to the console
-W Full name of base classifier. (default: weka.classifiers.functions.GPD)
Options specific to classifier weka.classifiers.functions.GPD:
-D If set, classifier is run in debug mode and may output additional info to the console
-L <double> Level of Gaussian Noise. (default: 1.0)
-G <double> Gamma for the RBF kernel. (default: 0.01)
-N Whether to 0=normalize/1=standardize/2=neither. (default: 0=normalize)
-D If set, classifier is run in debug mode and may output additional info to the console
- Version:
- $Revision: 2242 $
- Author:
- Len Trigg ([email protected])
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected weka.clusterers.DensityBasedClusterer
m_ActualClusterer
The actual clusterer.protected weka.filters.unsupervised.attribute.Remove
m_Remove
The filter for removing sample ID/database ID.
-
Constructor Summary
Constructors Constructor Description SpectrumClusterer()
Default constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
buildClusterer(weka.core.Instances data)
Build the clusterer on the filtered data.double[]
clusterPriors()
Returns the prior probability of each cluster.double[]
distributionForInstance(weka.core.Instance instance)
Clusters a given instance after filtering.protected weka.core.Instance
filter(weka.core.Instance instance)
Filters the instance if the Remove filter has been set up, otherwise it just returns the instance as it is.weka.core.Capabilities
getCapabilities()
Returns default capabilities of the clusterer.String
getRevision()
Returns the revision string.String
globalInfo()
Returns a string describing this clusterer.double
logDensityForInstance(weka.core.Instance instance)
Computes the density for a given instance.double[]
logDensityPerClusterForInstance(weka.core.Instance instance)
Computes the log of the conditional density (per cluster) for a given instance.double[]
logJointDensitiesForInstance(weka.core.Instance inst)
Returns the logs of the joint densities for a given instance.static void
main(String[] args)
Main method for executing this clusterer.String
toString()
Output a representation of this clusterer-
Methods inherited from class weka.clusterers.SingleClustererEnhancer
clustererTipText, defaultClustererString, getClusterer, getClustererSpec, getOptions, listOptions, numberOfClusters, setClusterer, setOptions
-
Methods inherited from class weka.clusterers.AbstractClusterer
clusterInstance, debugTipText, doNotCheckCapabilitiesTipText, forName, getDebug, getDoNotCheckCapabilities, makeCopies, makeCopy, postExecution, preExecution, run, runClusterer, setDebug, setDoNotCheckCapabilities
-
-
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing this clusterer.- Returns:
- a description of the clusterer suitable for displaying in the explorer/experimenter gui
-
getCapabilities
public weka.core.Capabilities getCapabilities()
Returns default capabilities of the clusterer.- Specified by:
getCapabilities
in interfaceweka.core.CapabilitiesHandler
- Specified by:
getCapabilities
in interfaceweka.clusterers.Clusterer
- Overrides:
getCapabilities
in classweka.clusterers.SingleClustererEnhancer
- Returns:
- the capabilities of this clusterer
-
buildClusterer
public void buildClusterer(weka.core.Instances data) throws Exception
Build the clusterer on the filtered data.- Specified by:
buildClusterer
in interfaceweka.clusterers.Clusterer
- Specified by:
buildClusterer
in classweka.clusterers.AbstractClusterer
- Parameters:
data
- the training data- Throws:
Exception
- if the clusterer could not be built successfully
-
filter
protected weka.core.Instance filter(weka.core.Instance instance) throws Exception
Filters the instance if the Remove filter has been set up, otherwise it just returns the instance as it is.- Parameters:
instance
- the instance to filter, if required- Returns:
- the filtered instance
- Throws:
Exception
- if filtering fails
-
distributionForInstance
public double[] distributionForInstance(weka.core.Instance instance) throws Exception
Clusters a given instance after filtering.- Specified by:
distributionForInstance
in interfaceweka.clusterers.Clusterer
- Specified by:
distributionForInstance
in interfaceweka.clusterers.DensityBasedClusterer
- Overrides:
distributionForInstance
in classweka.clusterers.AbstractClusterer
- Parameters:
instance
- the instance to be clustered- Returns:
- the cluster distribution for the given instance
- Throws:
Exception
- if instance could not be clustered successfully
-
clusterPriors
public double[] clusterPriors() throws Exception
Returns the prior probability of each cluster.- Specified by:
clusterPriors
in interfaceweka.clusterers.DensityBasedClusterer
- Returns:
- the prior probability for each cluster
- Throws:
Exception
- if priors could not be returned successfully
-
logDensityPerClusterForInstance
public double[] logDensityPerClusterForInstance(weka.core.Instance instance) throws Exception
Computes the log of the conditional density (per cluster) for a given instance.- Specified by:
logDensityPerClusterForInstance
in interfaceweka.clusterers.DensityBasedClusterer
- Parameters:
instance
- the instance to compute the density for- Returns:
- an array containing the estimated densities
- Throws:
Exception
- if the density could not be computed successfully
-
logDensityForInstance
public double logDensityForInstance(weka.core.Instance instance) throws Exception
Computes the density for a given instance.- Specified by:
logDensityForInstance
in interfaceweka.clusterers.DensityBasedClusterer
- Parameters:
instance
- the instance to compute the density for- Returns:
- the density.
- Throws:
Exception
- if the density could not be computed successfully
-
logJointDensitiesForInstance
public double[] logJointDensitiesForInstance(weka.core.Instance inst) throws Exception
Returns the logs of the joint densities for a given instance.- Specified by:
logJointDensitiesForInstance
in interfaceweka.clusterers.DensityBasedClusterer
- Parameters:
inst
- the instance- Returns:
- the array of values
- Throws:
Exception
- if values could not be computed
-
toString
public String toString()
Output a representation of this clusterer
-
getRevision
public String getRevision()
Returns the revision string.- Specified by:
getRevision
in interfaceweka.core.RevisionHandler
- Overrides:
getRevision
in classweka.clusterers.AbstractClusterer
- Returns:
- the revision
-
main
public static void main(String[] args)
Main method for executing this clusterer.- Parameters:
args
- the commandline options, use -h for help
-
-