|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.core.neighboursearch.NearestNeighbourSearch
public abstract class NearestNeighbourSearch
Abstract class for nearest neighbour search. All algorithms (classes) that do nearest neighbour search should extend this class.
Constructor Summary | |
---|---|
NearestNeighbourSearch()
Constructor. |
|
NearestNeighbourSearch(Instances insts)
Constructor. |
Method Summary | |
---|---|
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. |
java.lang.String |
distanceFunctionTipText()
Returns the tip text for this property. |
java.util.Enumeration |
enumerateMeasures()
Returns an enumeration of the additional measure names. |
DistanceFunction |
getDistanceFunction()
returns the distance function currently in use. |
abstract double[] |
getDistances()
Returns the distances of the k nearest neighbours. |
Instances |
getInstances()
returns the instances currently set. |
double |
getMeasure(java.lang.String additionalMeasureName)
Returns the value of the named measure. |
boolean |
getMeasurePerformance()
Gets whether performance statistics are being calculated or not. |
java.lang.String[] |
getOptions()
Gets the current settings. |
PerformanceStats |
getPerformanceStats()
Gets the class object that contains the performance statistics of the search method. |
java.lang.String |
globalInfo()
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. |
java.util.Enumeration |
listOptions()
Returns an enumeration describing the available options. |
java.lang.String |
measurePerformanceTipText()
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 |
setDistanceFunction(DistanceFunction df)
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(java.lang.String[] options)
Parses a given list of options. |
abstract void |
update(Instance ins)
Updates the NearNeighbourSearch algorithm for the new added instance. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface weka.core.RevisionHandler |
---|
getRevision |
Constructor Detail |
---|
public NearestNeighbourSearch()
public NearestNeighbourSearch(Instances insts)
insts
- The set of instances that constitute the neighbourhood.Method Detail |
---|
public java.lang.String globalInfo()
public java.util.Enumeration listOptions()
listOptions
in interface OptionHandler
public void setOptions(java.lang.String[] options) throws java.lang.Exception
setOptions
in interface OptionHandler
options
- the list of options as an array of strings
java.lang.Exception
- if an option is not supportedpublic java.lang.String[] getOptions()
getOptions
in interface OptionHandler
public java.lang.String distanceFunctionTipText()
public DistanceFunction getDistanceFunction()
public void setDistanceFunction(DistanceFunction df) throws java.lang.Exception
df
- the new distance function to use
java.lang.Exception
- if instances cannot be processedpublic java.lang.String measurePerformanceTipText()
public boolean getMeasurePerformance()
public void setMeasurePerformance(boolean measurePerformance)
measurePerformance
- if true then the performance is calculatedpublic abstract Instance nearestNeighbour(Instance target) throws java.lang.Exception
target
- The instance to find the nearest neighbour for.
java.lang.Exception
- if the nearest neighbour could not be found.public abstract Instances kNearestNeighbours(Instance target, int k) throws java.lang.Exception
target
- The instance to find the k nearest neighbours for.k
- The number of nearest neighbours to find.
java.lang.Exception
- if the neighbours could not be found.public abstract double[] getDistances() throws java.lang.Exception
java.lang.Exception
- if called before calling kNearestNeighbours
or nearestNeighbours.public abstract void update(Instance ins) throws java.lang.Exception
ins
- the instance to add
java.lang.Exception
- if updating failspublic void addInstanceInfo(Instance ins)
ins
- the instance to add the information frompublic void setInstances(Instances insts) throws java.lang.Exception
insts
- the instances to use
java.lang.Exception
- if setting failspublic Instances getInstances()
public PerformanceStats getPerformanceStats()
public java.util.Enumeration enumerateMeasures()
enumerateMeasures
in interface AdditionalMeasureProducer
public double getMeasure(java.lang.String additionalMeasureName)
getMeasure
in interface AdditionalMeasureProducer
additionalMeasureName
- the name of the measure to query for
its value
java.lang.IllegalArgumentException
- if the named measure is not supportedpublic static void combSort11(double[] arrayToSort, int[] linkedArray)
arrayToSort
- The array sorting should be based on.linkedArray
- The array that should have the same ordering as
arrayToSort.public static void quickSort(double[] arrayToSort, double[] linkedArray, int left, int right)
arrayToSort
- the array to sortlinkedArray
- the linked arrayleft
- the first index of the subsetright
- the last index of the subset
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |