public class FilteredNeighbourSearch extends NearestNeighbourSearch implements CapabilitiesHandler
-F The filter to use. (default: weka.filters.AllFilter)
-S The search method to use. (default: weka.core.neighboursearch.LinearNNSearch)
Options specific to filter weka.filters.AllFilter:
-output-debug-info If set, filter is run in debug mode and may output additional info to the console
-do-not-check-capabilities If set, filter capabilities are not checked before filter is built (use with caution).
Options specific to search method weka.core.neighboursearch.LinearNNSearch:
-S Skip identical instances (distances equal to zero).
-A <classname and options> Distance function to use. (default: weka.core.EuclideanDistance)
-P Calculate performance statistics.
Constructor and Description |
---|
FilteredNeighbourSearch() |
Modifier and Type | Method and Description |
---|---|
void |
addInstanceInfo(Instance ins)
Updates the instance info in the underlying search method, once the
instance has been filtered.
|
java.lang.String |
filterTipText()
Returns the tip text for this property
|
Capabilities |
getCapabilities()
Returns default capabilities of the classifier.
|
double[] |
getDistances()
Returns the distances for the nearest neighbours in the FILTERED space
|
Filter |
getFilter()
Gets the filter used.
|
java.lang.String[] |
getOptions()
Gets the current settings.
|
java.lang.String |
getRevision()
Returns the revision string
|
NearestNeighbourSearch |
getSearchMethod()
Gets the search method used.
|
java.lang.String |
globalInfo()
Returns a string describing this object.
|
Instances |
kNearestNeighbours(Instance target,
int k)
Returns the nearest neighbours for the given instance based on distance
measured in the filtered space.
|
java.util.Enumeration<Option> |
listOptions()
Returns an enumeration describing the available options.
|
Instance |
nearestNeighbour(Instance target)
Returns the nearest neighbour for the given instance based on distance
measured in the filtered space.
|
java.lang.String |
searchMethodTipText()
Returns the tip text for this property
|
void |
setFilter(Filter filter)
Sets the filter
|
void |
setInstances(Instances data)
Sets the instances to build the filtering model from.
|
void |
setOptions(java.lang.String[] options)
Parses a given list of options.
|
void |
setSearchMethod(NearestNeighbourSearch search)
Sets the search method
|
void |
update(Instance ins)
Updates ranges based on the given instance, once it has been filtered.
|
combSort11, distanceFunctionTipText, enumerateMeasures, getDistanceFunction, getInstances, getMeasure, getMeasurePerformance, getPerformanceStats, measurePerformanceTipText, quickSort, setDistanceFunction, setMeasurePerformance
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
makeCopy
public Capabilities getCapabilities()
getCapabilities
in interface CapabilitiesHandler
Capabilities
public void setInstances(Instances data)
setInstances
in class NearestNeighbourSearch
insts
- the Instances objectpublic java.lang.String globalInfo()
globalInfo
in class NearestNeighbourSearch
public java.lang.String filterTipText()
public void setFilter(Filter filter)
filter
- the filter with all options set.public Filter getFilter()
public java.lang.String searchMethodTipText()
public void setSearchMethod(NearestNeighbourSearch search)
searchMethod
- the search method with all options set.public NearestNeighbourSearch getSearchMethod()
public java.util.Enumeration<Option> listOptions()
listOptions
in interface OptionHandler
listOptions
in class NearestNeighbourSearch
public java.lang.String[] getOptions()
getOptions
in interface OptionHandler
getOptions
in class NearestNeighbourSearch
public void setOptions(java.lang.String[] options) throws java.lang.Exception
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 getRevision()
getRevision
in interface RevisionHandler
RevisionHandler.getRevision()
public Instance nearestNeighbour(Instance target) throws java.lang.Exception
nearestNeighbour
in class NearestNeighbourSearch
target
- the instance for which to find the nearest neighbourjava.lang.Exception
- if the nearest neighbour could not be found.NearestNeighbourSearch.nearestNeighbour(weka.core.Instance)
public Instances kNearestNeighbours(Instance target, int k) throws java.lang.Exception
kNearestNeighbours
in class NearestNeighbourSearch
target
- the instance for which to find the nearest neighbourk
- the number of nearest neighbours to returnjava.lang.Exception
- if the neighbours could not be found.NearestNeighbourSearch.kNearestNeighbours(weka.core.Instance,
int)
public double[] getDistances() throws java.lang.Exception
getDistances
in class NearestNeighbourSearch
java.lang.Exception
- if called before calling kNearestNeighbours or
nearestNeighbours.NearestNeighbourSearch.getDistances()
public void update(Instance ins) throws java.lang.Exception
update
in class NearestNeighbourSearch
ins
- the instance to addjava.lang.Exception
- if updating failsNearestNeighbourSearch.update(weka.core.Instance)
public void addInstanceInfo(Instance ins)
addInstanceInfo
in class NearestNeighbourSearch
ins
- The instance to add the information of.