weka.core.neighboursearch.balltrees

## Class TopDownConstructor

- java.lang.Object
- - weka.core.neighboursearch.balltrees.BallTreeConstructor
  - - weka.core.neighboursearch.balltrees.TopDownConstructor

- All Implemented Interfaces:
    java.io.Serializable, OptionHandler, RevisionHandler, TechnicalInformationHandler

      public class TopDownConstructor
      extends BallTreeConstructor
      implements TechnicalInformationHandler

  The class implementing the TopDown construction method of ball trees. It further uses one of a number of different splitting methods to split a ball while constructing the tree top down.
  For more information see also:
  Stephen M. Omohundro (1989). Five Balltree Construction Algorithms.

  BibTeX:

       @techreport{Omohundro1989,
          author = {Stephen M. Omohundro},
          institution = {International Computer Science Institute},
          month = {December},
          number = {TR-89-063},
          title = {Five Balltree Construction Algorithms},
          year = {1989}
       }

  Valid options are:

       -S <classname and options>
        Ball splitting algorithm to use.

  Version:
    $Revision: 10203 $
  Author:
    Ashraf M. Kibriya (amk14[at-the-rate]cs[dot]waikato[dot]ac[dot]nz)
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `TopDownConstructor()` Creates a new instance of TopDownConstructor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int[]` | `addInstance(BallNode node, Instance inst)` Adds an instance to the ball tree.
    `java.lang.String` | `ballSplitterTipText()` Returns the tip text for this property.
    `BallNode` | `buildTree()` Builds the ball tree top down.
    `BallSplitter` | `getBallSplitter()` Returns the BallSplitter algorithm set that would be used by the TopDown BallTree constructor.
    `java.lang.String[]` | `getOptions()` Gets the current settings of KDtree.
    `java.lang.String` | `getRevision()` Returns the revision string.
    `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.
    `java.lang.String` | `globalInfo()` Returns a string describing this nearest neighbour search algorithm.
    `java.util.Enumeration<Option>` | `listOptions()` Returns an enumeration describing the available options.
    `void` | `setBallSplitter(BallSplitter splitter)` Sets the ball splitting algorithm to be used by the TopDown constructor.
    `void` | `setOptions(java.lang.String[] options)` Parses a given list of options.

    - ### Methods inherited from class weka.core.neighboursearch.balltrees.BallTreeConstructor

      `containChildBallsTipText, getContainChildBalls, getMaxDepth, getMaxInstancesInLeaf, getMaxRelativeLeafRadius, getNumLeaves, getNumNodes, maxInstancesInLeafTipText, maxRelativeLeafRadiusTipText, setContainChildBalls, setEuclideanDistanceFunction, setInstanceList, setInstances, setMaxInstancesInLeaf, setMaxRelativeLeafRadius`

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

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

- - ### Constructor Detail

    - #### TopDownConstructor

          public TopDownConstructor()

      Creates a new instance of TopDownConstructor.

  - ### Method Detail

    - #### globalInfo

          public java.lang.String globalInfo()

      Returns a string describing this nearest neighbour search algorithm.
      Returns:
        a description of the algorithm 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

    - #### buildTree

          public BallNode buildTree()
                             throws java.lang.Exception

      Builds the ball tree top down.
      Specified by:
        `buildTree` in class `BallTreeConstructor`
      Returns:
        The root node of the tree.
      Throws:
        `java.lang.Exception` - If there is problem building the tree.

    - #### addInstance

          public int[] addInstance(BallNode node,
                          Instance inst)
                            throws java.lang.Exception

      Adds an instance to the ball tree.
      Specified by:
        `addInstance` in class `BallTreeConstructor`
      Parameters:
        `node` - The root node of the tree.
        `inst` - The instance to add to the tree.
      Returns:
        The new master index array after adding the instance.
      Throws:
        `java.lang.Exception` - If there is some problem adding the given instance to the tree.

    - #### ballSplitterTipText

          public java.lang.String ballSplitterTipText()

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

    - #### getBallSplitter

          public BallSplitter getBallSplitter()

      Returns the BallSplitter algorithm set that would be used by the TopDown BallTree constructor.
      Returns:
        The BallSplitter currently in use.

    - #### setBallSplitter

          public void setBallSplitter(BallSplitter splitter)

      Sets the ball splitting algorithm to be used by the TopDown constructor.
      Parameters:
        `splitter` - The BallSplitter to use.

    - #### listOptions

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

      Returns an enumeration describing the available options.
      Specified by:
        `listOptions` in interface `OptionHandler`
      Overrides:
        `listOptions` in class `BallTreeConstructor`
      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:

           -S <classname and options>
            Ball splitting algorithm to use.

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

    - #### getOptions

          public java.lang.String[] getOptions()

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

    - #### getRevision

          public java.lang.String getRevision()

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