weka.clusterers
Class Cobweb

java.lang.Object
  |
  +--weka.clusterers.Clusterer
        |
        +--weka.clusterers.Cobweb
All Implemented Interfaces:
Cloneable, OptionHandler, Serializable

public class Cobweb
extends Clusterer
implements OptionHandler

See Also:
Serialized Form

Constructor Summary
Cobweb()
           
 
Method Summary
 void add(weka.clusterers.Cobweb.CTree node, weka.clusterers.Cobweb.CTree tree)
          Adds an example to the tree.
 weka.clusterers.Cobweb.CTree bestHost(weka.clusterers.Cobweb.CTree tree, weka.clusterers.Cobweb.CTree node, double aU, double baseU)
          Finds the best place to add a new node during training.
 weka.clusterers.Cobweb.CTree bestHostCluster(weka.clusterers.Cobweb.CTree tree, weka.clusterers.Cobweb.CTree node, double aU, double baseU)
          Finds the cluster that an unseen instance belongs to.
 void buildClusterer(Instances data)
          Builds the clusterer.
 int clusterInstance(Instance instance)
          Clusters an instance.
 int getAcuity()
          get the accuity value
 int getCutoff()
          get the cutoff
 String[] getOptions()
          Gets the current settings of Cobweb.
 Enumeration listOptions()
          Returns an enumeration describing the available options
static void main(String[] argv)
           
 int numberOfClusters()
          Returns the number of clusters.
 void setAcuity(int a)
          set the accuity.
 void setCutoff(int c)
          set the cutoff
 void setOptions(String[] options)
          Parses a given list of options.
 String toString()
          Returns a description of the clusterer as a string.
 
Methods inherited from class weka.clusterers.Clusterer
forName, makeCopies
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Cobweb

public Cobweb()
Method Detail

buildClusterer

public void buildClusterer(Instances data)
                    throws Exception
Builds the clusterer.

Specified by:
buildClusterer in class Clusterer
Parameters:
data - the training instances.
Throws:
Exception - if something goes wrong.

numberOfClusters

public int numberOfClusters()
                     throws Exception
Returns the number of clusters.

Specified by:
numberOfClusters in class Clusterer
Returns:
the number of clusters generated for a training dataset.
Throws:
Exception - if something goes wrong.

clusterInstance

public int clusterInstance(Instance instance)
                    throws Exception
Clusters an instance.

Specified by:
clusterInstance in class Clusterer
Parameters:
instance - the instance to cluster.
Returns:
the number of the assigned cluster as an interger if the class is enumerated, otherwise the predicted value
Throws:
Exception - if something goes wrong.

add

public void add(weka.clusterers.Cobweb.CTree node,
                weka.clusterers.Cobweb.CTree tree)
         throws Exception
Adds an example to the tree.

Parameters:
node - the node to be added.
tree - the tree.
Throws:
Exception - if something goes wrong.

bestHostCluster

public weka.clusterers.Cobweb.CTree bestHostCluster(weka.clusterers.Cobweb.CTree tree,
                                                    weka.clusterers.Cobweb.CTree node,
                                                    double aU,
                                                    double baseU)
                                             throws Exception
Finds the cluster that an unseen instance belongs to.

Parameters:
tree - the tree.
node - the node to be added.
aU - ??
baseU - ??
Throws:
Exception - if something goes wrong.

bestHost

public weka.clusterers.Cobweb.CTree bestHost(weka.clusterers.Cobweb.CTree tree,
                                             weka.clusterers.Cobweb.CTree node,
                                             double aU,
                                             double baseU)
                                      throws Exception
Finds the best place to add a new node during training.

Parameters:
tree - the tree.
node - the node to be added.
aU - ??
baseU - ??
Throws:
Exception - if something goes wrong.

toString

public String toString()
Returns a description of the clusterer as a string.

Overrides:
toString in class Object
Returns:
a string describing the clusterer.

listOptions

public Enumeration listOptions()
Returns an enumeration describing the available options

Specified by:
listOptions in interface OptionHandler
Returns:
an enumeration of all the available options

setOptions

public void setOptions(String[] options)
                throws Exception
Parses a given list of options. Valid options are:

-A <0-100>
Acuity.

-C <0-100>
Cutoff.

Specified by:
setOptions in interface OptionHandler
Parameters:
options - the list of options as an array of strings
Throws:
Exception - if an option is not supported

setAcuity

public void setAcuity(int a)
set the accuity.

Parameters:
a - the accuity between 0 and 100

getAcuity

public int getAcuity()
get the accuity value

Returns:
the accuity as a value between 0 and 100

setCutoff

public void setCutoff(int c)
set the cutoff

Parameters:
c - the cutoff between 0 and 100

getCutoff

public int getCutoff()
get the cutoff

Returns:
the cutoff as a value between 1 and 100\

getOptions

public String[] getOptions()
Gets the current settings of Cobweb.

Specified by:
getOptions in interface OptionHandler
Returns:
an array of strings suitable for passing to setOptions()

main

public static void main(String[] argv)