类 CoverTree
java.lang.Object
weka.core.neighboursearch.NearestNeighbourSearch
weka.core.neighboursearch.CoverTree
- 所有已实现的接口:
Serializable
,AdditionalMeasureProducer
,OptionHandler
,RevisionHandler
,TechnicalInformationHandler
Class implementing the CoverTree datastructure.
The class is very much a translation of the c source code made available by the authors.
For more information and original source code see:
Alina Beygelzimer, Sham Kakade, John Langford: Cover trees for nearest neighbor. In: ICML'06: Proceedings of the 23rd international conference on Machine learning, New York, NY, USA, 97-104, 2006. BibTeX:
The class is very much a translation of the c source code made available by the authors.
For more information and original source code see:
Alina Beygelzimer, Sham Kakade, John Langford: Cover trees for nearest neighbor. In: ICML'06: Proceedings of the 23rd international conference on Machine learning, New York, NY, USA, 97-104, 2006. BibTeX:
@inproceedings{Beygelzimer2006, address = {New York, NY, USA}, author = {Alina Beygelzimer and Sham Kakade and John Langford}, booktitle = {ICML'06: Proceedings of the 23rd international conference on Machine learning}, pages = {97-104}, publisher = {ACM Press}, title = {Cover trees for nearest neighbor}, year = {2006}, location = {Pittsburgh, Pennsylvania}, HTTP = {http://hunch.net/\~jl/projects/cover_tree/cover_tree.html} }Valid options are:
-B <value> Set base of the expansion constant (default = 1.3).
- 版本:
- $Revision: 1.4 $
- 作者:
- Alina Beygelzimer (original C++ code), Sham Kakade (original C++ code), John Langford (original C++ code), Ashraf M. Kibriya (amk14[at-the-rate]cs[dot]waikato[dot]ac[dot]nz) (Java port)
- 另请参阅:
-
嵌套类概要
嵌套类 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明void
addInstanceInfo
(Instance ins) Adds the given instance info.Returns the tip text for this property.Returns an enumeration of the additional measure names.double
getBase()
Returns the base in use for expansion constant.double[]
Returns the distances of the (k)-NN(s) found earlier by kNearestNeighbours()/nearestNeighbour().double
getMeasure
(String additionalMeasureName) Returns the value of the named measure.String[]
Gets the current settings of KDtree.Returns the revision string.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.kNearestNeighbours
(Instance target, int k) Returns k-NNs of a given target instance, from among the previously supplied training instances (supplied through setInstances method) P.S.: May return more than k-NNs if more one instances have the same distance to the target as the kth NN.Returns an enumeration describing the available options.static void
Method for testing the class from command line.double
Returns the depth of the tree.double
Returns the number of leaves.double
Returns the size of the tree.nearestNeighbour
(Instance target) Returns the NN instance of a given target instance, from among the previously supplied training instances.void
setBase
(double b) Sets the base to use for expansion constant.void
Sets the distance function to use for nearest neighbour search.void
setInstances
(Instances instances) Builds the Cover Tree on the given set of instances.void
setOptions
(String[] options) Parses a given list of options.void
Adds an instance to the cover tree.从类继承的方法 weka.core.neighboursearch.NearestNeighbourSearch
combSort11, distanceFunctionTipText, getDistanceFunction, getInstances, getMeasurePerformance, getPerformanceStats, measurePerformanceTipText, quickSort, setMeasurePerformance
-
构造器详细资料
-
CoverTree
public CoverTree()default constructor.
-
-
方法详细资料
-
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
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
-
listOptions
Returns an enumeration describing the available options.- 指定者:
listOptions
在接口中OptionHandler
- 覆盖:
listOptions
在类中NearestNeighbourSearch
- 返回:
- an enumeration of all the available options.
-
setOptions
Parses a given list of options. Valid options are:-B <value> Set base of the expansion constant (default = 1.3).
- 指定者:
setOptions
在接口中OptionHandler
- 覆盖:
setOptions
在类中NearestNeighbourSearch
- 参数:
options
- the list of options as an array of strings- 抛出:
Exception
- if an option is not supported
-
getOptions
Gets the current settings of KDtree.- 指定者:
getOptions
在接口中OptionHandler
- 覆盖:
getOptions
在类中NearestNeighbourSearch
- 返回:
- an array of strings suitable for passing to setOptions
-
kNearestNeighbours
Returns k-NNs of a given target instance, from among the previously supplied training instances (supplied through setInstances method) P.S.: May return more than k-NNs if more one instances have the same distance to the target as the kth NN.- 指定者:
kNearestNeighbours
在类中NearestNeighbourSearch
- 参数:
target
- The instance for which k-NNs are required.k
- The number of k-NNs to find.- 返回:
- The k-NN instances of the given target instance.
- 抛出:
Exception
- If there is some problem find the k-NNs.
-
nearestNeighbour
Returns the NN instance of a given target instance, from among the previously supplied training instances.- 指定者:
nearestNeighbour
在类中NearestNeighbourSearch
- 参数:
target
- The instance for which NN is required.- 返回:
- The NN instance of the target instance.
- 抛出:
Exception
- If there is some problem finding the nearest neighbour.
-
getDistances
Returns the distances of the (k)-NN(s) found earlier by kNearestNeighbours()/nearestNeighbour().- 指定者:
getDistances
在类中NearestNeighbourSearch
- 返回:
- The distances (in the same order) of the k-NNs.
- 抛出:
Exception
- If the tree hasn't been built (by calling setInstances()), or none of kNearestNeighbours() or nearestNeighbour() has been called before.
-
setInstances
Builds the Cover Tree on the given set of instances.- 覆盖:
setInstances
在类中NearestNeighbourSearch
- 参数:
instances
- The insts on which the Cover Tree is to be built.- 抛出:
Exception
- If some error occurs while building the Cover Tree
-
update
Adds an instance to the cover tree. P.S.: The current version doesn't allow addition of instances after batch construction.- 指定者:
update
在类中NearestNeighbourSearch
- 参数:
ins
- The instance to add.- 抛出:
Exception
- Alway throws this, as current implementation doesn't allow addition of instances after building.
-
addInstanceInfo
Adds the given instance info. This implementation updates only the range datastructures of the EuclideanDistance. Nothing is required to be updated in the built Cover Tree.- 覆盖:
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.
-
setDistanceFunction
Sets the distance function to use for nearest neighbour search. Currently only EuclideanDistance is supported.- 覆盖:
setDistanceFunction
在类中NearestNeighbourSearch
- 参数:
df
- the distance function to use- 抛出:
Exception
- if not EuclideanDistance
-
baseTipText
Returns the tip text for this property.- 返回:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getBase
public double getBase()Returns the base in use for expansion constant.- 返回:
- base currently in use.
-
setBase
public void setBase(double b) Sets the base to use for expansion constant. The 2 in 2^i in the paper.- 参数:
b
- the new base;
-
measureTreeSize
public double measureTreeSize()Returns the size of the tree. (number of internal nodes + number of leaves)- 返回:
- 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
Returns an enumeration of the additional measure names.- 指定者:
enumerateMeasures
在接口中AdditionalMeasureProducer
- 覆盖:
enumerateMeasures
在类中NearestNeighbourSearch
- 返回:
- an enumeration of the measure names
-
getMeasure
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
-
getRevision
Returns the revision string.- 指定者:
getRevision
在接口中RevisionHandler
- 返回:
- the revision
-
main
Method for testing the class from command line.- 参数:
args
- The supplied command line arguments.
-