类 MiddleOutConstructor

java.lang.Object
weka.core.neighboursearch.balltrees.BallTreeConstructor
weka.core.neighboursearch.balltrees.MiddleOutConstructor
所有已实现的接口:
Serializable, OptionHandler, Randomizable, RevisionHandler, TechnicalInformationHandler

public class MiddleOutConstructor extends BallTreeConstructor implements Randomizable, TechnicalInformationHandler
The class that builds a BallTree middle out.

For more information see also:

Andrew W. Moore: The Anchors Hierarchy: Using the Triangle Inequality to Survive High Dimensional Data. In: UAI '00: Proceedings of the 16th Conference on Uncertainty in Artificial Intelligence, San Francisco, CA, USA, 397-405, 2000.

Ashraf Masood Kibriya (2007). Fast Algorithms for Nearest Neighbour Search. Hamilton, New Zealand.

BibTeX:

 @inproceedings{Moore2000,
    address = {San Francisco, CA, USA},
    author = {Andrew W. Moore},
    booktitle = {UAI '00: Proceedings of the 16th Conference on Uncertainty in Artificial Intelligence},
    pages = {397-405},
    publisher = {Morgan Kaufmann Publishers Inc.},
    title = {The Anchors Hierarchy: Using the Triangle Inequality to Survive High Dimensional Data},
    year = {2000}
 }
 
 @mastersthesis{Kibriya2007,
    address = {Hamilton, New Zealand},
    author = {Ashraf Masood Kibriya},
    school = {Department of Computer Science, School of Computing and Mathematical Sciences, University of Waikato},
    title = {Fast Algorithms for Nearest Neighbour Search},
    year = {2007}
 }
 

Valid options are:

 -S <num>
  The seed for the random number generator used
  in selecting random anchor.
 (default: 1)
 -R
  Use randomly chosen initial anchors.
版本:
$Revision: 1.3 $
作者:
Ashraf M. Kibriya (amk14[at-the-rate]cs[dot]waikato[dot]ac[dot]nz)
另请参阅:
  • 构造器概要

    构造器
    构造器
    说明
    Creates a new instance of MiddleOutConstructor.
  • 方法概要

    修饰符和类型
    方法
    说明
    int[]
    Adds an instance to the tree.
    Builds a ball tree middle out.
    calcPivot(weka.core.neighboursearch.balltrees.MiddleOutConstructor.MyIdxList list1, weka.core.neighboursearch.balltrees.MiddleOutConstructor.MyIdxList list2, Instances insts)
    Calculates the centroid pivot of a node based on the list of points that it contains (tbe two lists of its children are provided).
    calcPivot(weka.core.neighboursearch.balltrees.MiddleOutConstructor.TempNode node1, weka.core.neighboursearch.balltrees.MiddleOutConstructor.TempNode node2, Instances insts)
    /** Calculates the centroid pivot of a node based on its two child nodes (if merging two nodes).
    double
    calcRadius(weka.core.neighboursearch.balltrees.MiddleOutConstructor.MyIdxList list1, weka.core.neighboursearch.balltrees.MiddleOutConstructor.MyIdxList list2, Instance pivot, Instances insts)
    Calculates the radius of a node based on the list of points that it contains (the two lists of its children are provided).
    double
    calcRadius(weka.core.neighboursearch.balltrees.MiddleOutConstructor.TempNode n1, weka.core.neighboursearch.balltrees.MiddleOutConstructor.TempNode n2)
    Calculates the radius of a node based on its two child nodes (if merging two nodes).
    void
    checkIndicesList(weka.core.neighboursearch.balltrees.MiddleOutConstructor.MyIdxList list, int startidx, int endidx)
    Checks whether if the points in an index list are in some specified of the master index array.
    Gets the current settings of this BallTree MiddleOutConstructor.
    Returns the revision string.
    int
    Returns the seed for random number generator.
    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.
    Returns a string describing this nearest neighbour search algorithm.
    Returns the tip text for this property.
    boolean
    Gets whether if the initial anchor is chosen randomly.
    Returns an enumeration describing the available options.
    printInsts(int startIdx, int endIdx)
    For printing indices in some given portion of the master index array.
    printList(weka.core.neighboursearch.balltrees.MiddleOutConstructor.MyIdxList points)
    For printing indices in a given point list.
    Returns the tip text for this property.
    void
    setInitialAnchorRandom(boolean randomInitialAnchor)
    Sets whether if the initial anchor is chosen randomly.
    void
    setInstanceList(int[] instList)
    Sets the master index array that points to instances in m_Instances, so that only this array is manipulated, and m_Instances is left untouched.
    void
    Sets the instances on which the tree is to be built.
    void
    setInterAnchorDistances(Vector anchors, weka.core.neighboursearch.balltrees.MiddleOutConstructor.TempNode newAnchor, Vector anchorDistances)
    Sets the distances of a supplied new anchor to all the rest of the previous anchor points.
    void
    Sets the maximum number of instances allowed in a leaf.
    void
    setOptions(String[] options)
    Parses a given list of options.
    void
    setPoints(weka.core.neighboursearch.balltrees.MiddleOutConstructor.TempNode node, int startIdx, int endIdx, int[] indices)
    Sets the points of an anchor node.
    void
    setSeed(int seed)
    Sets the seed for random number generator (that is used for selecting the first anchor point randomly).
    boolean
    stealPoints(weka.core.neighboursearch.balltrees.MiddleOutConstructor.TempNode newAnchor, Vector anchors, Vector anchorDistances)
    Removes points from old anchors that are nearer to the given new anchor and adds them to the list of points of the new anchor.

    从类继承的方法 java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 构造器详细资料

    • MiddleOutConstructor

      public MiddleOutConstructor()
      Creates a new instance of MiddleOutConstructor.
  • 方法详细资料

    • globalInfo

      public String globalInfo()
      Returns a string describing this nearest neighbour search algorithm.
      返回:
      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
    • buildTree

      public BallNode buildTree() throws Exception
      Builds a ball tree middle out.
      指定者:
      buildTree 在类中 BallTreeConstructor
      返回:
      The root node of the tree.
      抛出:
      Exception - If there is problem building the tree.
    • setPoints

      public void setPoints(weka.core.neighboursearch.balltrees.MiddleOutConstructor.TempNode node, int startIdx, int endIdx, int[] indices)
      Sets the points of an anchor node. It takes the indices of points from the given portion of an index array and stores those indices, together with their distances to the given anchor node, in the point index list of the anchor node.
      参数:
      node - The node in which the points are needed to be set.
      startIdx - The start of the portion in the given index array (the master index array).
      endIdx - The end of the portion in the given index array.
      indices - The index array.
    • setInterAnchorDistances

      public void setInterAnchorDistances(Vector anchors, weka.core.neighboursearch.balltrees.MiddleOutConstructor.TempNode newAnchor, Vector anchorDistances) throws Exception
      Sets the distances of a supplied new anchor to all the rest of the previous anchor points.
      参数:
      anchors - The old anchor points.
      newAnchor - The new anchor point.
      anchorDistances - The vector to store the distances of newAnchor to each of the old anchors.
      抛出:
      Exception - If there is some problem in calculating the distances.
    • stealPoints

      public boolean stealPoints(weka.core.neighboursearch.balltrees.MiddleOutConstructor.TempNode newAnchor, Vector anchors, Vector anchorDistances)
      Removes points from old anchors that are nearer to the given new anchor and adds them to the list of points of the new anchor.
      参数:
      newAnchor - The new anchor.
      anchors - The old anchors.
      anchorDistances - The distances of new anchor to each of the old anchors.
      返回:
      true if any points are removed from the old anchors
    • calcPivot

      public Instance calcPivot(weka.core.neighboursearch.balltrees.MiddleOutConstructor.TempNode node1, weka.core.neighboursearch.balltrees.MiddleOutConstructor.TempNode node2, Instances insts)
      /** Calculates the centroid pivot of a node based on its two child nodes (if merging two nodes).
      参数:
      node1 - The first child.
      node2 - The second child.
      insts - The set of instances on which the tree is being built (as dataset header information is required).
      返回:
      The centroid pivot of a node.
    • calcPivot

      public Instance calcPivot(weka.core.neighboursearch.balltrees.MiddleOutConstructor.MyIdxList list1, weka.core.neighboursearch.balltrees.MiddleOutConstructor.MyIdxList list2, Instances insts)
      Calculates the centroid pivot of a node based on the list of points that it contains (tbe two lists of its children are provided).
      参数:
      list1 - The point index list of first child.
      list2 - The point index list of second child.
      insts - The insts object on which the tree is being built (for header information).
      返回:
      The centroid pivot of the node.
    • calcRadius

      public double calcRadius(weka.core.neighboursearch.balltrees.MiddleOutConstructor.TempNode n1, weka.core.neighboursearch.balltrees.MiddleOutConstructor.TempNode n2)
      Calculates the radius of a node based on its two child nodes (if merging two nodes).
      参数:
      n1 - The first child of the node.
      n2 - The second child of the node.
      返回:
      The radius of the node.
      抛出:
      Exception
    • calcRadius

      public double calcRadius(weka.core.neighboursearch.balltrees.MiddleOutConstructor.MyIdxList list1, weka.core.neighboursearch.balltrees.MiddleOutConstructor.MyIdxList list2, Instance pivot, Instances insts)
      Calculates the radius of a node based on the list of points that it contains (the two lists of its children are provided).
      参数:
      list1 - The point index list of first child.
      list2 - The point index list of second child.
      pivot - The centre/pivot of the node.
      insts - The instances on which the tree is being built (for header info).
      返回:
      The radius of the node.
    • addInstance

      public int[] addInstance(BallNode node, Instance inst) throws Exception
      Adds an instance to the tree. This implementation of MiddleOutConstructor doesn't support addition of instances to already built tree, hence it always throws an exception.
      指定者:
      addInstance 在类中 BallTreeConstructor
      参数:
      node - The root of the tree to which the instance is to be added.
      inst - The instance to add to the tree.
      返回:
      The updated master index array after adding the instance.
      抛出:
      Exception - Always as this implementation of MiddleOutConstructor doesn't support addition of instances after batch construction of the tree.
    • setMaxInstancesInLeaf

      public void setMaxInstancesInLeaf(int num) throws Exception
      Sets the maximum number of instances allowed in a leaf.
      覆盖:
      setMaxInstancesInLeaf 在类中 BallTreeConstructor
      参数:
      num - The maximum number of instances allowed in a leaf.
      抛出:
      Exception - If the num is < 2, as the method cannot work for < 2 instances.
    • setInstances

      public void setInstances(Instances insts)
      Sets the instances on which the tree is to be built.
      覆盖:
      setInstances 在类中 BallTreeConstructor
      参数:
      inst - The instances on which to build the ball tree.
    • setInstanceList

      public void setInstanceList(int[] instList)
      Sets the master index array that points to instances in m_Instances, so that only this array is manipulated, and m_Instances is left untouched.
      覆盖:
      setInstanceList 在类中 BallTreeConstructor
      参数:
      instList - The master index array.
    • initialAnchorRandomTipText

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

      public boolean isInitialAnchorRandom()
      Gets whether if the initial anchor is chosen randomly.
      返回:
      true if the initial anchor is a random one.
    • setInitialAnchorRandom

      public void setInitialAnchorRandom(boolean randomInitialAnchor)
      Sets whether if the initial anchor is chosen randomly. If not then if it is the furthest point from the mean/centroid.
      参数:
      randomInitialAnchor - Should be true if the first anchor is to be chosen randomly.
    • seedTipText

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

      public int getSeed()
      Returns the seed for random number generator.
      指定者:
      getSeed 在接口中 Randomizable
      返回:
      The random number seed.
    • setSeed

      public void setSeed(int seed)
      Sets the seed for random number generator (that is used for selecting the first anchor point randomly).
      指定者:
      setSeed 在接口中 Randomizable
      参数:
      seed - The seed.
    • listOptions

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

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

       -S <num>
        The seed for the random number generator used
        in selecting random anchor.
       (default: 1)
       -R
        Use randomly chosen initial anchors.
      指定者:
      setOptions 在接口中 OptionHandler
      覆盖:
      setOptions 在类中 BallTreeConstructor
      参数:
      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 this BallTree MiddleOutConstructor.
      指定者:
      getOptions 在接口中 OptionHandler
      覆盖:
      getOptions 在类中 BallTreeConstructor
      返回:
      an array of strings suitable for passing to setOptions
    • checkIndicesList

      public void checkIndicesList(weka.core.neighboursearch.balltrees.MiddleOutConstructor.MyIdxList list, int startidx, int endidx) throws Exception
      Checks whether if the points in an index list are in some specified of the master index array.
      参数:
      list - The point list.
      startidx - The start of the portion in master index array.
      endidx - The end of the portion in master index array.
      抛出:
      Exception - If some point in the point list is not in the specified portion of master index array.
    • printInsts

      public String printInsts(int startIdx, int endIdx)
      For printing indices in some given portion of the master index array.
      参数:
      startIdx - The start of the portion in master index array.
      endIdx - The end of the portion in master index array.
      返回:
      The string containing the indices in specified portion of the master index array.
    • printList

      public String printList(weka.core.neighboursearch.balltrees.MiddleOutConstructor.MyIdxList points)
      For printing indices in a given point list.
      参数:
      points - The point list.
      返回:
      String containing indices of the points in the point list.
    • getRevision

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