public class ENN.LinearNNSearchENN
extends weka.core.neighboursearch.NearestNeighbourSearch
| Constructor and Description |
|---|
ENN.LinearNNSearchENN()
Constructor.
|
ENN.LinearNNSearchENN(weka.core.Instances insts)
Constructor that uses the supplied set of
instances.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addInstanceInfo(weka.core.Instance ins)
Adds the given instance info.
|
double[] |
getDistances()
Returns the distances of the k nearest neighbours.
|
weka.core.Instance[] |
getNearestInstances()
Returns the indexes of the k nearest neighbours.
|
java.lang.String[] |
getOptions()
Gets the current settings.
|
java.lang.String |
getRevision()
Returns the revision string.
|
boolean |
getSkipDifferentClass()
Gets whether to skip instancies from the neighbours that are of different class
|
boolean |
getSkipIdentical()
Gets whether if identical instances are skipped from the neighbourhood.
|
java.lang.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.
|
java.util.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(java.lang.String[] options)
Parses a given list of options.
|
void |
setSkipDifferentClass(boolean skip)
Sets the property whether to skip instancies from the neighbours
that are of different class
|
void |
setSkipIdentical(boolean skip)
Sets the property to skip identical instances (with distance zero from
the target) from the set of neighbours returned.
|
java.lang.String |
skipDifferentClassTipText()
Returns the tip text for this property.
|
java.lang.String |
skipIdenticalTipText()
Returns the tip text for this property.
|
void |
update(weka.core.Instance ins)
Updates the LinearNNSearchENN to cater for the new added instance.
|
combSort11, distanceFunctionTipText, enumerateMeasures, getDistanceFunction, getInstances, getMeasure, getMeasurePerformance, getPerformanceStats, measurePerformanceTipText, quickSort, setDistanceFunction, setMeasurePerformancepublic ENN.LinearNNSearchENN()
public ENN.LinearNNSearchENN(weka.core.Instances insts)
insts - the instances to usepublic java.lang.String globalInfo()
globalInfo in class weka.core.neighboursearch.NearestNeighbourSearchpublic java.util.Enumeration listOptions()
listOptions in interface weka.core.OptionHandlerlistOptions in class weka.core.neighboursearch.NearestNeighbourSearchpublic void setOptions(java.lang.String[] options)
throws java.lang.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 stringsjava.lang.Exception - if an option is not supportedpublic java.lang.String[] getOptions()
getOptions in interface weka.core.OptionHandlergetOptions in class weka.core.neighboursearch.NearestNeighbourSearchpublic java.lang.String skipIdenticalTipText()
public void setSkipIdentical(boolean skip)
skip - if true, identical intances are skippedpublic boolean getSkipIdentical()
public java.lang.String skipDifferentClassTipText()
public void setSkipDifferentClass(boolean skip)
skip - if true, identical intances are skippedpublic boolean getSkipDifferentClass()
public weka.core.Instance nearestNeighbour(weka.core.Instance target)
throws java.lang.Exception
nearestNeighbour in class weka.core.neighboursearch.NearestNeighbourSearchtarget - The instance to find the nearest neighbour for.java.lang.Exception - if the nearest neighbour could not be found.public weka.core.Instances kNearestNeighbours(weka.core.Instance target,
int kNN)
throws java.lang.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.java.lang.Exception - if the neighbours could not be found.public double[] getDistances()
throws java.lang.Exception
getDistances in class weka.core.neighboursearch.NearestNeighbourSearchjava.lang.Exception - if called before calling kNearestNeighbours
or nearestNeighbours.public weka.core.Instance[] getNearestInstances()
throws java.lang.Exception
java.lang.Exception - if called before calling kNearestNeighbours
or nearestNeighbours.public void setInstances(weka.core.Instances insts)
throws java.lang.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.java.lang.Exception - if setting of instances failspublic void update(weka.core.Instance ins)
throws java.lang.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.java.lang.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 java.lang.String getRevision()
weka.core.RevisionHandler