Class 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.
      • Fields inherited from class weka.clusterers.SingleClustererEnhancer

        m_Clusterer
      • Fields inherited from class weka.clusterers.AbstractClusterer

        m_Debug, m_DoNotCheckCapabilities
    • 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
      • Methods inherited from interface weka.clusterers.Clusterer

        clusterInstance, numberOfClusters
    • Field Detail

      • m_Remove

        protected weka.filters.unsupervised.attribute.Remove m_Remove
        The filter for removing sample ID/database ID.
      • m_ActualClusterer

        protected weka.clusterers.DensityBasedClusterer m_ActualClusterer
        The actual clusterer.
    • Constructor Detail

      • SpectrumClusterer

        public SpectrumClusterer()
        Default constructor.
    • 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 interface weka.core.CapabilitiesHandler
        Specified by:
        getCapabilities in interface weka.clusterers.Clusterer
        Overrides:
        getCapabilities in class weka.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 interface weka.clusterers.Clusterer
        Specified by:
        buildClusterer in class weka.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 interface weka.clusterers.Clusterer
        Specified by:
        distributionForInstance in interface weka.clusterers.DensityBasedClusterer
        Overrides:
        distributionForInstance in class weka.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 interface weka.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 interface weka.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 interface weka.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 interface weka.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
        Overrides:
        toString in class Object
        Returns:
        a representation of this clusterer
      • getRevision

        public String getRevision()
        Returns the revision string.
        Specified by:
        getRevision in interface weka.core.RevisionHandler
        Overrides:
        getRevision in class weka.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