public class BallTree extends NearestNeighbourSearch implements TechnicalInformationHandler
@techreport{Omohundro1989, author = {Stephen M. Omohundro}, institution = {International Computer Science Institute}, month = {December}, number = {TR-89-063}, title = {Five Balltree Construction Algorithms}, year = {1989} } @article{Uhlmann1991, author = {Jeffrey K. Uhlmann}, journal = {Information Processing Letters}, month = {November}, number = {4}, pages = {175-179}, title = {Satisfying general proximity/similarity queries with metric trees}, volume = {40}, year = {1991} }Valid options are:
-C <classname and options> The construction method to employ. Either TopDown or BottomUp (default: weka.core.TopDownConstructor)
Constructor and Description |
---|
BallTree()
Creates a new instance of BallTree.
|
BallTree(Instances insts)
Creates a new instance of BallTree.
|
Modifier and Type | Method and Description |
---|---|
void |
addInstanceInfo(Instance ins)
Adds the given instance's info.
|
java.lang.String |
ballTreeConstructorTipText()
Returns the tip text for this property.
|
java.util.Enumeration<java.lang.String> |
enumerateMeasures()
Returns an enumeration of the additional measure names.
|
BallTreeConstructor |
getBallTreeConstructor()
Returns the BallTreeConstructor currently in use.
|
double[] |
getDistances()
Returns the distances of the k nearest neighbours.
|
double |
getMeasure(java.lang.String additionalMeasureName)
Returns the value of the named measure.
|
java.lang.String[] |
getOptions()
Gets the current settings of KDtree.
|
java.lang.String |
getRevision()
Returns the revision string.
|
TechnicalInformation |
getTechnicalInformation()
Returns an instance of a TechnicalInformation object, containing detailed
information about the technical background of this class, e.g., paper
reference or book this class is based on.
|
java.lang.String |
globalInfo()
Returns a string describing this nearest neighbour search algorithm.
|
Instances |
kNearestNeighbours(Instance target,
int k)
Returns k nearest instances in the current neighbourhood to the supplied
instance.
|
java.util.Enumeration<Option> |
listOptions()
Returns an enumeration describing the available options.
|
double |
measureMaxDepth()
Returns the depth of the tree.
|
double |
measureNumLeaves()
Returns the number of leaves.
|
double |
measureTreeSize()
Returns the size of the tree.
|
Instance |
nearestNeighbour(Instance target)
Returns the nearest instance in the current neighbourhood to the supplied
instance.
|
void |
setBallTreeConstructor(BallTreeConstructor constructor)
Sets the BallTreeConstructor for building the BallTree
(default TopDownConstructor).
|
void |
setInstances(Instances insts)
Builds the BallTree based on the given set of 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.
|
void |
update(Instance ins)
Adds one instance to the BallTree.
|
combSort11, distanceFunctionTipText, getDistanceFunction, getInstances, getMeasurePerformance, getPerformanceStats, measurePerformanceTipText, quickSort, setDistanceFunction
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
makeCopy
public BallTree()
public BallTree(Instances insts)
insts
- The instances/points on which the BallTree
should be built on.public java.lang.String globalInfo()
globalInfo
in class NearestNeighbourSearch
public TechnicalInformation getTechnicalInformation()
getTechnicalInformation
in interface TechnicalInformationHandler
public Instances kNearestNeighbours(Instance target, int k) throws java.lang.Exception
kNearestNeighbours
in class NearestNeighbourSearch
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 Instance nearestNeighbour(Instance target) throws java.lang.Exception
nearestNeighbour
in class NearestNeighbourSearch
target
- The instance to find the nearest neighbour for.java.lang.Exception
- if the nearest neighbour could not be found.public double[] getDistances() throws java.lang.Exception
getDistances
in class NearestNeighbourSearch
java.lang.Exception
- if called before calling kNearestNeighbours
or nearestNeighbours.public void update(Instance ins) throws java.lang.Exception
update
in class NearestNeighbourSearch
ins
- The instance to be added. Usually the newly added instance in the
training set.java.lang.Exception
- If the instance cannot be added to the tree.public void addInstanceInfo(Instance ins)
addInstanceInfo
in class 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.public void setInstances(Instances insts) throws java.lang.Exception
setInstances
in class NearestNeighbourSearch
insts
- The insts for which the BallTree is to be
built.java.lang.Exception
- If some error occurs while
building the BallTreepublic java.lang.String ballTreeConstructorTipText()
public BallTreeConstructor getBallTreeConstructor()
public void setBallTreeConstructor(BallTreeConstructor constructor)
constructor
- The new BallTreeConstructor.public double measureTreeSize()
public double measureNumLeaves()
public double measureMaxDepth()
public java.util.Enumeration<java.lang.String> enumerateMeasures()
enumerateMeasures
in interface AdditionalMeasureProducer
enumerateMeasures
in class NearestNeighbourSearch
public double getMeasure(java.lang.String additionalMeasureName)
getMeasure
in interface AdditionalMeasureProducer
getMeasure
in class NearestNeighbourSearch
additionalMeasureName
- the name of the measure to query for
its value.java.lang.IllegalArgumentException
- if the named measure is not supported.public void setMeasurePerformance(boolean measurePerformance)
setMeasurePerformance
in class NearestNeighbourSearch
measurePerformance
- This should be true if performance
statistics are to be calculated.public java.util.Enumeration<Option> listOptions()
listOptions
in interface OptionHandler
listOptions
in class NearestNeighbourSearch
public void setOptions(java.lang.String[] options) throws java.lang.Exception
-C <classname and options> The construction method to employ. Either TopDown or BottomUp (default: weka.core.TopDownConstructor)
setOptions
in interface OptionHandler
setOptions
in class NearestNeighbourSearch
options
- the list of options as an array of stringsjava.lang.Exception
- if an option is not supportedpublic java.lang.String[] getOptions()
getOptions
in interface OptionHandler
getOptions
in class NearestNeighbourSearch
public java.lang.String getRevision()
getRevision
in interface RevisionHandler