|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectweka.core.neighboursearch.NearestNeighbourSearch
weka.core.neighboursearch.NewNNSearch
public class NewNNSearch
Class implementing the brute force search algorithm for nearest neighbour search.
Valid options are:-S Skip identical instances (distances equal to zero).
| Nested Class Summary | |
|---|---|
class |
NewNNSearch.InstanceNode
|
| Nested classes/interfaces inherited from class weka.core.neighboursearch.NearestNeighbourSearch |
|---|
weka.core.neighboursearch.NearestNeighbourSearch.MyHeap, weka.core.neighboursearch.NearestNeighbourSearch.MyHeapElement, weka.core.neighboursearch.NearestNeighbourSearch.NeighborList, weka.core.neighboursearch.NearestNeighbourSearch.NeighborNode |
| Field Summary | |
|---|---|
protected double[] |
m_Distances
Array holding the distances of the nearest neighbours. |
protected SortedList<NewNNSearch.InstanceNode> |
m_neighbours
|
protected boolean |
m_SkipIdentical
Whether to skip instances from the neighbours that are identical to the query instance. |
| Fields inherited from class weka.core.neighboursearch.NearestNeighbourSearch |
|---|
m_DistanceFunction, m_Instances, m_kNN, m_MeasurePerformance, m_Stats |
| Constructor Summary | |
|---|---|
NewNNSearch()
Constructor. |
|
NewNNSearch(weka.core.Instances insts)
Constructor that uses the supplied set of instances. |
|
| Method Summary | |
|---|---|
void |
addInstanceInfo(weka.core.Instance ins)
Adds the given instance info. |
double[] |
getDistances()
Returns the distances of the k nearest neighbours. |
String[] |
getOptions()
Gets the current settings. |
String |
getRevision()
Returns the revision string. |
boolean |
getSkipIdentical()
Gets whether if identical instances are skipped from the neighbourhood. |
String |
globalInfo()
Returns a string describing this nearest neighbour search algorithm. |
weka.core.Instances |
kNearestNeighbours(weka.core.Instance target,
int kNN)
Returns k nearest instances in the current neighbourhood to the supplied instance. |
Enumeration |
listOptions()
Returns an enumeration describing the available options. |
weka.core.Instance |
nearestNeighbour(weka.core.Instance target)
Returns the nearest instance in the current neighbourhood to the supplied instance. |
void |
setInstances(weka.core.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. |
String |
skipIdenticalTipText()
Returns the tip text for this property. |
void |
update(weka.core.Instance ins)
Updates the LinearNNSearch to cater for the new added instance. |
| Methods inherited from class weka.core.neighboursearch.NearestNeighbourSearch |
|---|
combSort11, distanceFunctionTipText, enumerateMeasures, getDistanceFunction, getInstances, getMeasure, getMeasurePerformance, getPerformanceStats, measurePerformanceTipText, partition, quickSort, setDistanceFunction, setMeasurePerformance |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected double[] m_Distances
protected boolean m_SkipIdentical
protected SortedList<NewNNSearch.InstanceNode> m_neighbours
| Constructor Detail |
|---|
public NewNNSearch()
public NewNNSearch(weka.core.Instances insts)
insts - the instances to use| Method Detail |
|---|
public String globalInfo()
globalInfo in class weka.core.neighboursearch.NearestNeighbourSearchpublic Enumeration listOptions()
listOptions in interface weka.core.OptionHandlerlistOptions in class weka.core.neighboursearch.NearestNeighbourSearch
public void setOptions(String[] options)
throws Exception
-S Skip identical instances (distances equal to zero).
setOptions in interface weka.core.OptionHandlersetOptions in class weka.core.neighboursearch.NearestNeighbourSearchoptions - the list of options as an array of strings
Exception - if an option is not supportedpublic String[] getOptions()
getOptions in interface weka.core.OptionHandlergetOptions in class weka.core.neighboursearch.NearestNeighbourSearchpublic String skipIdenticalTipText()
public void setSkipIdentical(boolean skip)
skip - if true, identical intances are skippedpublic boolean getSkipIdentical()
public weka.core.Instance nearestNeighbour(weka.core.Instance target)
throws Exception
nearestNeighbour in class weka.core.neighboursearch.NearestNeighbourSearchtarget - The instance to find the nearest neighbour for.
Exception - if the nearest neighbour could not be found.
public weka.core.Instances kNearestNeighbours(weka.core.Instance target,
int kNN)
throws Exception
kNearestNeighbours in class weka.core.neighboursearch.NearestNeighbourSearchtarget - The instance to find the k nearest neighbours for.kNN - The number of nearest neighbours to find.
Exception - if the neighbours could not be found.
public double[] getDistances()
throws Exception
getDistances in class weka.core.neighboursearch.NearestNeighbourSearchException - if called before calling kNearestNeighbours
or nearestNeighbours.
public void setInstances(weka.core.Instances insts)
throws Exception
setInstances in class weka.core.neighboursearch.NearestNeighbourSearchinsts - 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
public void update(weka.core.Instance ins)
throws Exception
update in class weka.core.neighboursearch.NearestNeighbourSearchins - 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 nullpublic void addInstanceInfo(weka.core.Instance ins)
addInstanceInfo in class weka.core.neighboursearch.NearestNeighbourSearchins - The instance to add the information of. Usually this is
the test instance supplied to update the range of
attributes in the distance function.public String getRevision()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||