weka.clusterers

## Class Cobweb

- java.lang.Object
- - weka.clusterers.AbstractClusterer
  - - weka.clusterers.RandomizableClusterer
    - - weka.clusterers.Cobweb

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, Clusterer, UpdateableClusterer, CapabilitiesHandler, CapabilitiesIgnorer, Drawable, OptionHandler, Randomizable, RevisionHandler, TechnicalInformationHandler

      public class Cobweb
      extends RandomizableClusterer
      implements Drawable, TechnicalInformationHandler, UpdateableClusterer

  Class implementing the Cobweb and Classit clustering algorithms.
  Note: the application of node operators (merging, splitting etc.) in terms of ordering and priority differs (and is somewhat ambiguous) between the original Cobweb and Classit papers. This algorithm always compares the best host, adding a new leaf, merging the two best hosts, and splitting the best host when considering where to place a new instance.
  For more information see:
  D. Fisher (1987). Knowledge acquisition via incremental conceptual clustering. Machine Learning. 2(2):139-172.
  J. H. Gennari, P. Langley, D. Fisher (1990). Models of incremental concept formation. Artificial Intelligence. 40:11-61.

  BibTeX:

       @article{Fisher1987,
          author = {D. Fisher},
          journal = {Machine Learning},
          number = {2},
          pages = {139-172},
          title = {Knowledge acquisition via incremental conceptual clustering},
          volume = {2},
          year = {1987}
       }

       @article{Gennari1990,
          author = {J. H. Gennari and P. Langley and D. Fisher},
          journal = {Artificial Intelligence},
          pages = {11-61},
          title = {Models of incremental concept formation},
          volume = {40},
          year = {1990}
       }

  Valid options are:

       -A <acuity>
        Acuity.
        (default=1.0)

       -C <cutoff>
        Cutoff.
        (default=0.002)

       -S <num>
        Random number seed.
        (default 42)

  Version:
    $Revision: 10203 $
  Author:
    Mark Hall
  See Also:
    `RandomizableClusterer`, `Drawable`, Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `class` | `Cobweb.CNode` Inner class handling node operations for Cobweb.

  - ### Field Summary

    - ### Fields inherited from interface weka.core.Drawable

      `BayesNet, Newick, NOT_DRAWABLE, TREE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Cobweb()` default constructor

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `acuityTipText()` Returns the tip text for this property
    `void` | `addInstance(Instance newInstance)` Deprecated. updateClusterer(Instance) should be used instead
    `void` | `buildClusterer(Instances data)` Builds the clusterer.
    `int` | `clusterInstance(Instance instance)` Classifies a given instance.
    `java.lang.String` | `cutoffTipText()` Returns the tip text for this property
    `double` | `getAcuity()` get the acuity value
    `Capabilities` | `getCapabilities()` Returns default capabilities of the clusterer.
    `double` | `getCutoff()` get the cutoff
    `java.lang.String[]` | `getOptions()` Gets the current settings of Cobweb.
    `java.lang.String` | `getRevision()` Returns the revision string.
    `boolean` | `getSaveInstanceData()` Get the value of saveInstances.
    `TechnicalInformation` | `getTechnicalInformation()` Returns an instance of a TechnicalInformation object, containing detailed information about the technical background of this class, e.g., paper reference or book this class is based on.
    `Cobweb.CNode` | `getTreeRoot()` Get the root of the tree.
    `java.lang.String` | `globalInfo()` Returns a string describing this clusterer
    `java.lang.String` | `graph()` Generates the graph string of the Cobweb tree
    `int` | `graphType()` Returns the type of graphs this class represents
    `java.util.Enumeration<Option>` | `listOptions()` Returns an enumeration describing the available options.
    `static void` | `main(java.lang.String[] argv)` Main method.
    `int` | `numberOfClusters()` Returns the number of clusters.
    `java.lang.String` | `saveInstanceDataTipText()` Returns the tip text for this property
    `java.lang.String` | `seedTipText()` Returns the tip text for this property
    `void` | `setAcuity(double a)` set the acuity.
    `void` | `setCutoff(double c)` set the cutoff
    `void` | `setOptions(java.lang.String[] options)` Parses a given list of options.
    `void` | `setSaveInstanceData(boolean newsaveInstances)` Set the value of saveInstances.
    `java.lang.String` | `toString()` Returns a description of the clusterer as a string.
    `void` | `updateClusterer(Instance newInstance)` Adds an instance to the clusterer.
    `void` | `updateFinished()` Singals the end of the updating.

    - ### Methods inherited from class weka.clusterers.RandomizableClusterer

      `getSeed, setSeed`

    - ### Methods inherited from class weka.clusterers.AbstractClusterer

      `debugTipText, distributionForInstance, doNotCheckCapabilitiesTipText, forName, getDebug, getDoNotCheckCapabilities, makeCopies, makeCopy, runClusterer, setDebug, setDoNotCheckCapabilities`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### Cobweb

          public Cobweb()

      default constructor

  - ### Method Detail

    - #### globalInfo

          public java.lang.String globalInfo()

      Returns a string describing this clusterer
      Returns:
        a description of the evaluator suitable for displaying in the explorer/experimenter gui

    - #### getTechnicalInformation

          public TechnicalInformation getTechnicalInformation()

      Returns an instance of a TechnicalInformation object, containing detailed information about the technical background of this class, e.g., paper reference or book this class is based on.
      Specified by:
        `getTechnicalInformation` in interface `TechnicalInformationHandler`
      Returns:
        the technical information about this class

    - #### getCapabilities

          public Capabilities getCapabilities()

      Returns default capabilities of the clusterer.
      Specified by:
        `getCapabilities` in interface `Clusterer`
      Specified by:
        `getCapabilities` in interface `CapabilitiesHandler`
      Overrides:
        `getCapabilities` in class `AbstractClusterer`
      Returns:
        the capabilities of this clusterer
      See Also:
        `Capabilities`

    - #### buildClusterer

          public void buildClusterer(Instances data)
                              throws java.lang.Exception

      Builds the clusterer.
      Specified by:
        `buildClusterer` in interface `Clusterer`
      Specified by:
        `buildClusterer` in class `AbstractClusterer`
      Parameters:
        `data` - the training instances.
      Throws:
        `java.lang.Exception` - if something goes wrong.

    - #### updateFinished

          public void updateFinished()

      Singals the end of the updating.
      Specified by:
        `updateFinished` in interface `UpdateableClusterer`

    - #### clusterInstance

          public int clusterInstance(Instance instance)
                              throws java.lang.Exception

      Classifies a given instance.
      Specified by:
        `clusterInstance` in interface `Clusterer`
      Overrides:
        `clusterInstance` in class `AbstractClusterer`
      Parameters:
        `instance` - the instance to be assigned to a cluster
      Returns:
        the number of the assigned cluster as an interger if the class is enumerated, otherwise the predicted value
      Throws:
        `java.lang.Exception` - if instance could not be classified successfully

    - #### numberOfClusters

          public int numberOfClusters()

      Returns the number of clusters.
      Specified by:
        `numberOfClusters` in interface `Clusterer`
      Specified by:
        `numberOfClusters` in class `AbstractClusterer`
      Returns:
        the number of clusters

    - #### getTreeRoot

          public Cobweb.CNode getTreeRoot()

      Get the root of the tree.
      Returns:
        the root of the tree.

    - #### updateClusterer

          public void updateClusterer(Instance newInstance)
                               throws java.lang.Exception

      Adds an instance to the clusterer.
      Specified by:
        `updateClusterer` in interface `UpdateableClusterer`
      Parameters:
        `newInstance` - the instance to be added
      Throws:
        `java.lang.Exception` - if something goes wrong

    - #### addInstance

          @Deprecated
          public void addInstance(Instance newInstance)
                           throws java.lang.Exception

      Deprecated. updateClusterer(Instance) should be used instead
      Adds an instance to the Cobweb tree.
      Parameters:
        `newInstance` - the instance to be added
      Throws:
        `java.lang.Exception` - if something goes wrong
      See Also:
        `updateClusterer(Instance)`

    - #### listOptions

          public java.util.Enumeration<Option> listOptions()

      Returns an enumeration describing the available options.
      Specified by:
        `listOptions` in interface `OptionHandler`
      Overrides:
        `listOptions` in class `RandomizableClusterer`
      Returns:
        an enumeration of all the available options.

    - #### setOptions

          public void setOptions(java.lang.String[] options)
                          throws java.lang.Exception

      Parses a given list of options.

      Valid options are:

           -A <acuity>
            Acuity.
            (default=1.0)

           -C <cutoff>
            Cutoff.
            (default=0.002)

           -S <num>
            Random number seed.
            (default 42)

      Specified by:
        `setOptions` in interface `OptionHandler`
      Overrides:
        `setOptions` in class `RandomizableClusterer`
      Parameters:
        `options` - the list of options as an array of strings
      Throws:
        `java.lang.Exception` - if an option is not supported

    - #### acuityTipText

          public java.lang.String acuityTipText()

      Returns the tip text for this property
      Returns:
        tip text for this property suitable for displaying in the explorer/experimenter gui

    - #### setAcuity

          public void setAcuity(double a)

      set the acuity.
      Parameters:
        `a` - the acuity value

    - #### getAcuity

          public double getAcuity()

      get the acuity value
      Returns:
        the acuity

    - #### cutoffTipText

          public java.lang.String cutoffTipText()

      Returns the tip text for this property
      Returns:
        tip text for this property suitable for displaying in the explorer/experimenter gui

    - #### setCutoff

          public void setCutoff(double c)

      set the cutoff
      Parameters:
        `c` - the cutof

    - #### getCutoff

          public double getCutoff()

      get the cutoff
      Returns:
        the cutoff

    - #### saveInstanceDataTipText

          public java.lang.String saveInstanceDataTipText()

      Returns the tip text for this property
      Returns:
        tip text for this property suitable for displaying in the explorer/experimenter gui

    - #### getSaveInstanceData

          public boolean getSaveInstanceData()

      Get the value of saveInstances.
      Returns:
        Value of saveInstances.

    - #### setSaveInstanceData

          public void setSaveInstanceData(boolean newsaveInstances)

      Set the value of saveInstances.
      Parameters:
        `newsaveInstances` - Value to assign to saveInstances.

    - #### getOptions

          public java.lang.String[] getOptions()

      Gets the current settings of Cobweb.
      Specified by:
        `getOptions` in interface `OptionHandler`
      Overrides:
        `getOptions` in class `RandomizableClusterer`
      Returns:
        an array of strings suitable for passing to setOptions()

    - #### toString

          public java.lang.String toString()

      Returns a description of the clusterer as a string.
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        a string describing the clusterer.

    - #### graphType

          public int graphType()

      Returns the type of graphs this class represents
      Specified by:
        `graphType` in interface `Drawable`
      Returns:
        Drawable.TREE

    - #### graph

          public java.lang.String graph()
                                 throws java.lang.Exception

      Generates the graph string of the Cobweb tree
      Specified by:
        `graph` in interface `Drawable`
      Returns:
        a `String` value
      Throws:
        `java.lang.Exception` - if an error occurs

    - #### getRevision

          public java.lang.String getRevision()

      Returns the revision string.
      Specified by:
        `getRevision` in interface `RevisionHandler`
      Overrides:
        `getRevision` in class `AbstractClusterer`
      Returns:
        the revision

    - #### seedTipText

          public java.lang.String seedTipText()

      Returns the tip text for this property
      Overrides:
        `seedTipText` in class `RandomizableClusterer`
      Returns:
        tip text for this property suitable for displaying in the explorer/experimenter gui

    - #### main

          public static void main(java.lang.String[] argv)

      Main method.
      Parameters:
        `argv` - the commandline options