类 BallTree

所有已实现的接口:
Serializable, AdditionalMeasureProducer, OptionHandler, RevisionHandler, TechnicalInformationHandler

public class BallTree extends NearestNeighbourSearch implements TechnicalInformationHandler
Class implementing the BallTree/Metric Tree algorithm for nearest neighbour search.
The connection to dataset is only a reference. For the tree structure the indexes are stored in an array.
See the implementing classes of different construction methods of the trees for details on its construction.

For more information see also:

Stephen M. Omohundro (1989). Five Balltree Construction Algorithms.

Jeffrey K. Uhlmann (1991). Satisfying general proximity/similarity queries with metric trees. Information Processing Letters. 40(4):175-179.

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}
 }
 
 @article{Uhlmann1991,
    author = {Jeffrey K. Uhlmann},
    journal = {Information Processing Letters},
    month = {November},
    number = {4},
    pages = {175-179},
    title = {Satisfying general proximity/similarity queries with metric trees},
    volume = {40},
    year = {1991}
 }
 

Valid options are:

 -C <classname and options>
  The construction method to employ. Either TopDown or BottomUp
  (default: weka.core.TopDownConstructor)
版本:
$Revision: 1.2 $
作者:
Ashraf M. Kibriya (amk14[at-the-rate]cs[dot]waikato[dot]ac[dot]nz)
另请参阅:
  • 构造器详细资料

    • BallTree

      public BallTree()
      Creates a new instance of BallTree.
    • BallTree

      public BallTree(Instances insts)
      Creates a new instance of BallTree. It also builds the tree on supplied set of Instances.
      参数:
      insts - The instances/points on which the BallTree should be built on.
  • 方法详细资料

    • globalInfo

      public String globalInfo()
      Returns a string describing this nearest neighbour search algorithm.
      覆盖:
      globalInfo 在类中 NearestNeighbourSearch
      返回:
      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.
      指定者:
      getTechnicalInformation 在接口中 TechnicalInformationHandler
      返回:
      the technical information about this class
    • kNearestNeighbours

      public Instances kNearestNeighbours(Instance target, int k) throws Exception
      Returns k nearest instances in the current neighbourhood to the supplied instance. >k instances can be returned if there is more than one instance at the kth boundary (i.e. if there are more than 1 instance with the same distance as the kth nearest neighbour).
      指定者:
      kNearestNeighbours 在类中 NearestNeighbourSearch
      参数:
      target - The instance to find the k nearest neighbours for.
      k - The number of nearest neighbours to find.
      返回:
      The k nearest neighbours of the given target instance (>k nearest neighbours, if there are more instances that have same distance as the kth nearest neighbour).
      抛出:
      Exception - If the neighbours could not be found.
    • nearestNeighbour

      public Instance nearestNeighbour(Instance target) throws Exception
      Returns the nearest instance in the current neighbourhood to the supplied instance.
      指定者:
      nearestNeighbour 在类中 NearestNeighbourSearch
      参数:
      target - The instance to find the nearest neighbour for.
      返回:
      The nearest neighbour of the given target instance.
      抛出:
      Exception - if the nearest neighbour could not be found.
    • getDistances

      public double[] getDistances() throws Exception
      Returns the distances of the k nearest neighbours. The kNearestNeighbours or nearestNeighbour must always be called before calling this function. If this function is called before calling either the kNearestNeighbours or the nearestNeighbour, then it throws an exception. If, however, any one of the two functions is called at any point in the past, then no exception is thrown and the distances of NN(s) from the training set for the last supplied target instance (to either one of the nearestNeighbour functions) is/are returned.
      指定者:
      getDistances 在类中 NearestNeighbourSearch
      返回:
      array containing the distances of the nearestNeighbours. The length and ordering of the array is the same as that of the instances returned by nearestNeighbour functions.
      抛出:
      Exception - if called before calling kNearestNeighbours or nearestNeighbours.
    • update

      public void update(Instance ins) throws Exception
      Adds one instance to the BallTree. This involves creating/updating the structure to reflect the newly added training instance
      指定者:
      update 在类中 NearestNeighbourSearch
      参数:
      ins - The instance to be added. Usually the newly added instance in the training set.
      抛出:
      Exception - If the instance cannot be added to the tree.
    • addInstanceInfo

      public void addInstanceInfo(Instance ins)
      Adds the given instance's info. This implementation updates the attributes' range datastructures of EuclideanDistance class.
      覆盖:
      addInstanceInfo 在类中 NearestNeighbourSearch
      参数:
      ins - The instance to add the information of. Usually this is the test instance supplied to update the range of attributes in the distance function.
    • setInstances

      public void setInstances(Instances insts) throws Exception
      Builds the BallTree based on the given set of instances.
      覆盖:
      setInstances 在类中 NearestNeighbourSearch
      参数:
      insts - The insts for which the BallTree is to be built.
      抛出:
      Exception - If some error occurs while building the BallTree
    • ballTreeConstructorTipText

      public String ballTreeConstructorTipText()
      Returns the tip text for this property.
      返回:
      tip text for this property suitable for displaying in the explorer/experimenter gui
    • getBallTreeConstructor

      public BallTreeConstructor getBallTreeConstructor()
      Returns the BallTreeConstructor currently in use.
      返回:
      The BallTreeConstructor currently in use.
    • setBallTreeConstructor

      public void setBallTreeConstructor(BallTreeConstructor constructor)
      Sets the BallTreeConstructor for building the BallTree (default TopDownConstructor).
      参数:
      constructor - The new BallTreeConstructor.
    • measureTreeSize

      public double measureTreeSize()
      Returns the size of the tree.
      返回:
      the size of the tree
    • measureNumLeaves

      public double measureNumLeaves()
      Returns the number of leaves.
      返回:
      the number of leaves
    • measureMaxDepth

      public double measureMaxDepth()
      Returns the depth of the tree.
      返回:
      the number of rules
    • enumerateMeasures

      public Enumeration enumerateMeasures()
      Returns an enumeration of the additional measure names.
      指定者:
      enumerateMeasures 在接口中 AdditionalMeasureProducer
      覆盖:
      enumerateMeasures 在类中 NearestNeighbourSearch
      返回:
      an enumeration of the measure names
    • getMeasure

      public double getMeasure(String additionalMeasureName)
      Returns the value of the named measure.
      指定者:
      getMeasure 在接口中 AdditionalMeasureProducer
      覆盖:
      getMeasure 在类中 NearestNeighbourSearch
      参数:
      additionalMeasureName - the name of the measure to query for its value.
      返回:
      the value of the named measure.
      抛出:
      IllegalArgumentException - if the named measure is not supported.
    • setMeasurePerformance

      public void setMeasurePerformance(boolean measurePerformance)
      Sets whether to calculate the performance statistics or not.
      覆盖:
      setMeasurePerformance 在类中 NearestNeighbourSearch
      参数:
      measurePerformance - This should be true if performance statistics are to be calculated.
    • listOptions

      public Enumeration listOptions()
      Returns an enumeration describing the available options.
      指定者:
      listOptions 在接口中 OptionHandler
      覆盖:
      listOptions 在类中 NearestNeighbourSearch
      返回:
      an enumeration of all the available options.
    • setOptions

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

       -C <classname and options>
        The construction method to employ. Either TopDown or BottomUp
        (default: weka.core.TopDownConstructor)
      指定者:
      setOptions 在接口中 OptionHandler
      覆盖:
      setOptions 在类中 NearestNeighbourSearch
      参数:
      options - the list of options as an array of strings
      抛出:
      Exception - if an option is not supported
    • getOptions

      public String[] getOptions()
      Gets the current settings of KDtree.
      指定者:
      getOptions 在接口中 OptionHandler
      覆盖:
      getOptions 在类中 NearestNeighbourSearch
      返回:
      an array of strings suitable for passing to setOptions
    • getRevision

      public String getRevision()
      Returns the revision string.
      指定者:
      getRevision 在接口中 RevisionHandler
      返回:
      the revision