All Packages  Class Hierarchy  This Package  Previous  Next  Index  WEKA's home

Class weka.clusterers.DistributionMetaClusterer

java.lang.Object
    |
    +----weka.clusterers.Clusterer
            |
            +----weka.clusterers.DistributionClusterer
                    |
                    +----weka.clusterers.DistributionMetaClusterer

public class DistributionMetaClusterer
extends DistributionClusterer
implements OptionHandler
Class for wrapping a Clusterer to make it return a distribution. Simply outputs a probabiltry of 1 for the chosen cluster and 0 for the others.

Version:
$Revision: 1.6 $
Author:
Richard Kirkby (rkirkby@cs.waikato.ac.nz)

Constructor Index

 o DistributionMetaClusterer()
Default constructor.
 o DistributionMetaClusterer(Clusterer)
Contructs a DistributionMetaClusterer wrapping a given Clusterer.

Method Index

 o buildClusterer(Instances)
Builds a clusterer for a set of instances.
 o densityForInstance(Instance)
Computes the density for a given instance.
 o distributionForInstance(Instance)
Returns the cluster probability distribution for an instance.
 o getClusterer()
Gets the clusterer being wrapped.
 o getOptions()
Gets the current settings of the clusterer.
 o listOptions()
Returns an enumeration describing the available options..
 o main(String[])
Main method for testing this class.
 o numberOfClusters()
Returns the number of clusters.
 o setClusterer(Clusterer)
Sets the clusterer to wrap.
 o setOptions(String[])
Parses a given list of options.
 o toString()
Returns a description of the clusterer.

Constructor Detail

 o DistributionMetaClusterer
public DistributionMetaClusterer()
          Default constructor.
 o DistributionMetaClusterer
public DistributionMetaClusterer(Clusterer toWrap)
          Contructs a DistributionMetaClusterer wrapping a given Clusterer.
Parameters:
toWrap - the clusterer to wrap around

Method Detail

 o buildClusterer
public void buildClusterer(Instances data) throws java.lang.Exception
          Builds a clusterer for a set of instances.
Parameters:
instances - the instances to train the clusterer with
Throws:
java.lang.Exception - if the clusterer hasn't been set or something goes wrong
Overrides:
buildClusterer in class Clusterer
 o densityForInstance
public double densityForInstance(Instance instance) throws java.lang.Exception
          Computes the density for a given instance.
Parameters:
instance - the instance to compute the density for
Returns:
the density.
Throws:
java.lang.Exception - if the density could not be computed successfully
Overrides:
densityForInstance in class DistributionClusterer
 o distributionForInstance
public double[] distributionForInstance(Instance instance) throws java.lang.Exception
          Returns the cluster probability distribution for an instance. Will simply have a probability of 1 for the chosen cluster and 0 for the others.
Parameters:
instance - the instance to be clustered
Returns:
the probability distribution
Overrides:
distributionForInstance in class DistributionClusterer
 o numberOfClusters
public int numberOfClusters() throws java.lang.Exception
          Returns the number of clusters.
Returns:
the number of clusters generated for a training dataset.
Throws:
java.lang.Exception - if number of clusters could not be returned successfully
Overrides:
numberOfClusters in class Clusterer
 o toString
public java.lang.String toString()
          Returns a description of the clusterer.
Returns:
a string containing a description of the clusterer
Overrides:
toString in class java.lang.Object
 o setClusterer
public void setClusterer(Clusterer toWrap)
          Sets the clusterer to wrap.
Parameters:
toWrap - the clusterer
 o getClusterer
public Clusterer getClusterer()
          Gets the clusterer being wrapped.
Returns:
the clusterer
 o listOptions
public java.util.Enumeration listOptions()
          Returns an enumeration describing the available options..
Returns:
an enumeration of all the available options.
 o setOptions
public void setOptions(java.lang.String options[]) throws java.lang.Exception
          Parses a given list of options. Valid options are:

-W clusterer name
Clusterer to wrap. (required)

Parameters:
options - the list of options as an array of strings
Throws:
java.lang.Exception - if an option is not supported
 o getOptions
public java.lang.String[] getOptions()
          Gets the current settings of the clusterer.
Returns:
an array of strings suitable for passing to setOptions()
 o main
public static void main(java.lang.String argv[])
          Main method for testing this class.
Parameters:
argv - the options

All Packages  Class Hierarchy  This Package  Previous  Next  Index  WEKA's home