类 NearestNeighbourSearch
java.lang.Object
weka.core.neighboursearch.NearestNeighbourSearch
- 直接已知子类:
BallTree
,CoverTree
,KDTree
,LinearNNSearch
public abstract class NearestNeighbourSearch
extends Object
implements Serializable, OptionHandler, AdditionalMeasureProducer, RevisionHandler
Abstract class for nearest neighbour search. All algorithms (classes) that
do nearest neighbour search should extend this class.
- 版本:
- $Revision: 1.2 $
- 作者:
- Ashraf M. Kibriya (amk14[at-the-rate]cs[dot]waikato[dot]ac[dot]nz)
- 另请参阅:
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明void
addInstanceInfo
(Instance ins) Adds information from the given instance without modifying the datastructure a lot.static void
combSort11
(double[] arrayToSort, int[] linkedArray) sorts the two given arrays.Returns the tip text for this property.Returns an enumeration of the additional measure names.returns the distance function currently in use.abstract double[]
Returns the distances of the k nearest neighbours.returns the instances currently set.double
getMeasure
(String additionalMeasureName) Returns the value of the named measure.boolean
Gets whether performance statistics are being calculated or not.String[]
Gets the current settings.Gets the class object that contains the performance statistics of the search method.Returns a string describing this nearest neighbour search algorithm.abstract Instances
kNearestNeighbours
(Instance target, int k) Returns k nearest instances in the current neighbourhood to the supplied instance.Returns an enumeration describing the available options.Returns the tip text for this property.abstract Instance
nearestNeighbour
(Instance target) Returns the nearest instance in the current neighbourhood to the supplied instance.static void
quickSort
(double[] arrayToSort, double[] linkedArray, int left, int right) performs quicksort.void
sets the distance function to use for nearest neighbour search.void
setInstances
(Instances insts) Sets the instances.void
setMeasurePerformance
(boolean measurePerformance) Sets whether to calculate the performance statistics or not.void
setOptions
(String[] options) Parses a given list of options.abstract void
Updates the NearNeighbourSearch algorithm for the new added instance.从接口继承的方法 weka.core.RevisionHandler
getRevision
-
构造器详细资料
-
NearestNeighbourSearch
public NearestNeighbourSearch()Constructor. -
NearestNeighbourSearch
Constructor.- 参数:
insts
- The set of instances that constitute the neighbourhood.
-
-
方法详细资料
-
globalInfo
Returns a string describing this nearest neighbour search algorithm.- 返回:
- a description of the algorithm for displaying in the explorer/experimenter gui
-
listOptions
Returns an enumeration describing the available options.- 指定者:
listOptions
在接口中OptionHandler
- 返回:
- an enumeration of all the available options.
-
setOptions
Parses a given list of options. Valid options are:- 指定者:
setOptions
在接口中OptionHandler
- 参数:
options
- the list of options as an array of strings- 抛出:
Exception
- if an option is not supported
-
getOptions
Gets the current settings.- 指定者:
getOptions
在接口中OptionHandler
- 返回:
- an array of strings suitable for passing to setOptions()
-
distanceFunctionTipText
Returns the tip text for this property.- 返回:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getDistanceFunction
returns the distance function currently in use.- 返回:
- the distance function
-
setDistanceFunction
sets the distance function to use for nearest neighbour search.- 参数:
df
- the new distance function to use- 抛出:
Exception
- if instances cannot be processed
-
measurePerformanceTipText
Returns the tip text for this property.- 返回:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getMeasurePerformance
public boolean getMeasurePerformance()Gets whether performance statistics are being calculated or not.- 返回:
- true if the measure performance is calculated
-
setMeasurePerformance
public void setMeasurePerformance(boolean measurePerformance) Sets whether to calculate the performance statistics or not.- 参数:
measurePerformance
- if true then the performance is calculated
-
nearestNeighbour
Returns the nearest instance in the current neighbourhood to the supplied instance.- 参数:
target
- The instance to find the nearest neighbour for.- 返回:
- the nearest neighbor
- 抛出:
Exception
- if the nearest neighbour could not be found.
-
kNearestNeighbours
Returns k nearest instances in the current neighbourhood to the supplied instance.- 参数:
target
- The instance to find the k nearest neighbours for.k
- The number of nearest neighbours to find.- 返回:
- the k nearest neighbors
- 抛出:
Exception
- if the neighbours could not be found.
-
getDistances
Returns the distances of the k nearest neighbours. The kNearestNeighbours or nearestNeighbour needs to be called first for this to work.- 返回:
- the distances
- 抛出:
Exception
- if called before calling kNearestNeighbours or nearestNeighbours.
-
update
Updates the NearNeighbourSearch algorithm for the new added instance. P.S.: The method assumes the instance has already been added to the m_Instances object by the caller.- 参数:
ins
- the instance to add- 抛出:
Exception
- if updating fails
-
addInstanceInfo
Adds information from the given instance without modifying the datastructure a lot.- 参数:
ins
- the instance to add the information from
-
setInstances
Sets the instances.- 参数:
insts
- the instances to use- 抛出:
Exception
- if setting fails
-
getInstances
returns the instances currently set.- 返回:
- the current instances
-
getPerformanceStats
Gets the class object that contains the performance statistics of the search method.- 返回:
- the performance statistics
-
enumerateMeasures
Returns an enumeration of the additional measure names.- 指定者:
enumerateMeasures
在接口中AdditionalMeasureProducer
- 返回:
- an enumeration of the measure names
-
getMeasure
Returns the value of the named measure.- 指定者:
getMeasure
在接口中AdditionalMeasureProducer
- 参数:
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
-
combSort11
public static void combSort11(double[] arrayToSort, int[] linkedArray) sorts the two given arrays.- 参数:
arrayToSort
- The array sorting should be based on.linkedArray
- The array that should have the same ordering as arrayToSort.
-
quickSort
public static void quickSort(double[] arrayToSort, double[] linkedArray, int left, int right) performs quicksort.- 参数:
arrayToSort
- the array to sortlinkedArray
- the linked arrayleft
- the first index of the subsetright
- the last index of the subset
-