类 LinearNNSearch
java.lang.Object
weka.core.neighboursearch.NearestNeighbourSearch
weka.core.neighboursearch.LinearNNSearch
Class implementing the brute force search algorithm for nearest neighbour search.
Valid options are:
-S Skip identical instances (distances equal to zero).
- 版本:
- $Revision: 1.2 $
- 作者:
- Ashraf M. Kibriya (amk14[at-the-rate]cs[dot]waikato[dot]ac[dot]nz)
- 另请参阅:
-
构造器概要
构造器构造器说明Constructor.LinearNNSearch
(Instances insts) Constructor that uses the supplied set of instances. -
方法概要
修饰符和类型方法说明void
addInstanceInfo
(Instance ins) Adds the given instance info.double[]
Returns the distances of the k nearest neighbours.String[]
Gets the current settings.Returns the revision string.boolean
Gets whether if identical instances are skipped from the neighbourhood.Returns a string describing this nearest neighbour search algorithm.kNearestNeighbours
(Instance target, int kNN) Returns k nearest instances in the current neighbourhood to the supplied instance.Returns an enumeration describing the available options.nearestNeighbour
(Instance target) Returns the nearest instance in the current neighbourhood to the supplied instance.void
setInstances
(Instances insts) Sets the instances comprising the current neighbourhood.void
setOptions
(String[] options) Parses a given list of options.void
setSkipIdentical
(boolean skip) Sets the property to skip identical instances (with distance zero from the target) from the set of neighbours returned.Returns the tip text for this property.void
Updates the LinearNNSearch to cater for the new added instance.从类继承的方法 weka.core.neighboursearch.NearestNeighbourSearch
combSort11, distanceFunctionTipText, enumerateMeasures, getDistanceFunction, getInstances, getMeasure, getMeasurePerformance, getPerformanceStats, measurePerformanceTipText, quickSort, setDistanceFunction, setMeasurePerformance
-
构造器详细资料
-
LinearNNSearch
public LinearNNSearch()Constructor. Needs setInstances(Instances) to be called before the class is usable. -
LinearNNSearch
Constructor that uses the supplied set of instances.- 参数:
insts
- the instances to use
-
-
方法详细资料
-
globalInfo
Returns a string describing this nearest neighbour search algorithm.- 覆盖:
globalInfo
在类中NearestNeighbourSearch
- 返回:
- a description of the algorithm for displaying in the explorer/experimenter gui
-
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:-S Skip identical instances (distances equal to zero).
- 指定者:
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.- 指定者:
getOptions
在接口中OptionHandler
- 覆盖:
getOptions
在类中NearestNeighbourSearch
- 返回:
- an array of strings suitable for passing to setOptions()
-
skipIdenticalTipText
Returns the tip text for this property.- 返回:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setSkipIdentical
public void setSkipIdentical(boolean skip) Sets the property to skip identical instances (with distance zero from the target) from the set of neighbours returned.- 参数:
skip
- if true, identical intances are skipped
-
getSkipIdentical
public boolean getSkipIdentical()Gets whether if identical instances are skipped from the neighbourhood.- 返回:
- true if identical instances are skipped
-
nearestNeighbour
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 instance
- 抛出:
Exception
- if the nearest neighbour could not be found.
-
kNearestNeighbours
Returns k nearest instances in the current neighbourhood to the supplied instance.- 指定者:
kNearestNeighbours
在类中NearestNeighbourSearch
- 参数:
target
- The instance to find the k nearest neighbours for.kNN
- 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 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, if either of the nearestNeighbour functions are called at any point in the past then no exception is thrown and the distances of the training set from 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.
-
setInstances
Sets the instances comprising the current neighbourhood.- 覆盖:
setInstances
在类中NearestNeighbourSearch
- 参数:
insts
- The set of instances on which the nearest neighbour search is carried out. Usually this set is the training set.- 抛出:
Exception
- if setting of instances fails
-
update
Updates the LinearNNSearch to cater for the new added instance. This implementation only updates the ranges of the DistanceFunction class, since our set of instances is passed by reference and should already have the newly added instance.- 指定者:
update
在类中NearestNeighbourSearch
- 参数:
ins
- The instance to add. Usually this is the instance that is added to our neighbourhood i.e. the training instances.- 抛出:
Exception
- if the given instances are null
-
addInstanceInfo
Adds the given instance info. This implementation updates the range datastructures of the DistanceFunction 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.
-
getRevision
Returns the revision string.- 返回:
- the revision
-