Class AccumulatedLWLWeights
- java.lang.Object
-
- weka.filters.Filter
-
- weka.filters.SimpleFilter
-
- weka.filters.SimpleBatchFilter
-
- weka.filters.unsupervised.instance.AccumulatedLWLWeights
-
- All Implemented Interfaces:
Serializable,weka.core.CapabilitiesHandler,weka.core.CapabilitiesIgnorer,weka.core.CommandlineRunnable,weka.core.OptionHandler,weka.core.RevisionHandler,weka.core.WeightedInstancesHandler,weka.filters.UnsupervisedFilter
public class AccumulatedLWLWeights extends weka.filters.SimpleBatchFilter implements weka.filters.UnsupervisedFilter, weka.core.WeightedInstancesHandlerGenerates an LWL-like dataset for each instance of the data from the first batch and accumulate these weights. Once accumulated, the weights get normalized to be within the range of [0;1] and the output dataset accordingly adjusted.
Valid options are:-A The nearest neighbour search algorithm to use (default: weka.core.neighboursearch.LinearNNSearch).
-K <number of neighbours> Set the number of neighbours used to set the kernel bandwidth. (default all)
-U <number of weighting method> Set the weighting kernel shape to use. 0=Linear, 1=Epanechnikov, 2=Tricube, 3=Inverse, 4=Gaussian. (default 0 = Linear)
-no-update Suppresses the update of the nearest neighbor search (nns) algorithm with the data that is to be classified. (default: nns gets updated).
-row-finder-enabled Whether to use a row finder to limit the instances for which to determine the LWL neighborhoods for. (default off)
-row-finder <classname + options> The row finder scheme to use for limiting the instances to determine the LWL neighborhoods for. (default: adams.data.weka.rowfinder.NullFinder)
-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).
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected intm_kNNThe number of neighbours used to select the kernel bandwidth.protected weka.core.neighboursearch.NearestNeighbourSearchm_NNSearchThe nearest neighbour search algorithm to use.protected booleanm_NoUpdatewhether to suppress the update of the nearest-neighbor search algorithm when making predictions.protected RowFinderm_RowFinderthe row finder to use if enabled.protected booleanm_RowFinderEnabledwhether to use the row finder.protected intm_WeightKernelThe weighting kernel method currently selected.
-
Constructor Summary
Constructors Constructor Description AccumulatedLWLWeights()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected weka.core.InstancesdetermineOutputFormat(weka.core.Instances inputFormat)Determines the output format based on the input format and returns this.weka.core.CapabilitiesgetCapabilities()Returns the Capabilities of this filter.intgetKNN()Gets the number of neighbours used for kernel bandwidth setting.weka.core.neighboursearch.NearestNeighbourSearchgetNearestNeighbourSearchAlgorithm()Returns the current nearestNeighbourSearch algorithm in use.booleangetNoUpdate()Returns whether to suppress the update of the nearest-neighbor search algorithm when making predictions.String[]getOptions()Gets the current settings of the classifier.StringgetRevision()Returns the revision string.RowFindergetRowFinder()Returns the row finder scheme.booleangetRowFinderEnabled()Returns whether to use the row finder.intgetWeightingKernel()Gets the kernel weighting method to use.StringglobalInfo()Returns a string describing this classifier.StringKNNTipText()Returns the tip text for this property.Enumeration<weka.core.Option>listOptions()Returns an enumeration describing the available options.static voidmain(String[] args)Main method for testing this class.StringnearestNeighbourSearchAlgorithmTipText()Returns the tip text for this property.StringnoUpdateTipText()Returns the tip text for this property.protected weka.core.Instancesprocess(weka.core.Instances instances)Processes the given data (may change the provided dataset) and returns the modified version.StringrowFinderEnabledTipText()Returns the tip text for this property.StringrowFinderTipText()Returns the tip text for this property.voidsetKNN(int knn)Sets the number of neighbours used for kernel bandwidth setting.voidsetNearestNeighbourSearchAlgorithm(weka.core.neighboursearch.NearestNeighbourSearch nearestNeighbourSearchAlgorithm)Sets the nearestNeighbourSearch algorithm to be used for finding nearest neighbour(s).voidsetNoUpdate(boolean value)Sets whether to suppress updating the nearest-neighbor search algorithm when making predictions.voidsetOptions(String[] options)Parses a given list of options.voidsetRowFinder(RowFinder value)Sets the row finder scheme.voidsetRowFinderEnabled(boolean value)Sets whether to use the row finder.voidsetWeightingKernel(int kernel)Sets the kernel weighting method to use.StringweightingKernelTipText()Returns the tip text for this property.-
Methods inherited from class weka.filters.SimpleBatchFilter
allowAccessToFullInputFormat, batchFinished, hasImmediateOutputFormat, input
-
Methods inherited from class weka.filters.Filter
batchFilterFile, bufferInput, copyValues, copyValues, debugTipText, doNotCheckCapabilitiesTipText, filterFile, flushInput, getCapabilities, getDebug, getDoNotCheckCapabilities, getInputFormat, getOutputFormat, initInputLocators, initOutputLocators, inputFormatPeek, isFirstBatchDone, isNewBatch, isOutputFormatDefined, makeCopies, makeCopy, mayRemoveInstanceAfterFirstBatchDone, numPendingOutput, output, outputFormatPeek, outputPeek, postExecution, preExecution, push, push, resetQueue, run, runFilter, setDebug, setDoNotCheckCapabilities, setOutputFormat, testInputFormat, toString, useFilter, wekaStaticWrapper
-
-
-
-
Field Detail
-
m_kNN
protected int m_kNN
The number of neighbours used to select the kernel bandwidth.
-
m_WeightKernel
protected int m_WeightKernel
The weighting kernel method currently selected.
-
m_NNSearch
protected weka.core.neighboursearch.NearestNeighbourSearch m_NNSearch
The nearest neighbour search algorithm to use. (Default: weka.core.neighboursearch.LinearNNSearch)
-
m_NoUpdate
protected boolean m_NoUpdate
whether to suppress the update of the nearest-neighbor search algorithm when making predictions.
-
m_RowFinderEnabled
protected boolean m_RowFinderEnabled
whether to use the row finder.
-
m_RowFinder
protected RowFinder m_RowFinder
the row finder to use if enabled.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing this classifier.- Specified by:
globalInfoin classweka.filters.SimpleFilter- Returns:
- a description of the classifier suitable for displaying in the explorer/experimenter gui
-
listOptions
public Enumeration<weka.core.Option> listOptions()
Returns an enumeration describing the available options.- Specified by:
listOptionsin interfaceweka.core.OptionHandler- Overrides:
listOptionsin classweka.filters.Filter- Returns:
- an enumeration of all the available options.
-
setOptions
public void setOptions(String[] options) throws Exception
Parses a given list of options.- Specified by:
setOptionsin interfaceweka.core.OptionHandler- Overrides:
setOptionsin classweka.filters.Filter- Parameters:
options- the list of options as an array of strings- Throws:
Exception- if an option is not supported
-
getOptions
public String[] getOptions()
Gets the current settings of the classifier.- Specified by:
getOptionsin interfaceweka.core.OptionHandler- Overrides:
getOptionsin classweka.filters.Filter- Returns:
- an array of strings suitable for passing to setOptions
-
setKNN
public void setKNN(int knn)
Sets the number of neighbours used for kernel bandwidth setting. The bandwidth is taken as the distance to the kth neighbour.- Parameters:
knn- the number of neighbours included inside the kernel bandwidth, or 0 to specify using all neighbors.
-
getKNN
public int getKNN()
Gets the number of neighbours used for kernel bandwidth setting. The bandwidth is taken as the distance to the kth neighbour.- Returns:
- the number of neighbours included inside the kernel bandwidth, or 0 for all neighbours
-
KNNTipText
public String KNNTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setWeightingKernel
public void setWeightingKernel(int kernel)
Sets the kernel weighting method to use. Must be one of LINEAR, EPANECHNIKOV, TRICUBE, INVERSE, GAUSS or CONSTANT, other values are ignored.- Parameters:
kernel- the new kernel method to use. Must be one of LINEAR, EPANECHNIKOV, TRICUBE, INVERSE, GAUSS or CONSTANT.
-
getWeightingKernel
public int getWeightingKernel()
Gets the kernel weighting method to use.- Returns:
- the new kernel method to use. Will be one of LINEAR, EPANECHNIKOV, TRICUBE, INVERSE, GAUSS or CONSTANT.
-
weightingKernelTipText
public String weightingKernelTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setNearestNeighbourSearchAlgorithm
public void setNearestNeighbourSearchAlgorithm(weka.core.neighboursearch.NearestNeighbourSearch nearestNeighbourSearchAlgorithm)
Sets the nearestNeighbourSearch algorithm to be used for finding nearest neighbour(s).- Parameters:
nearestNeighbourSearchAlgorithm- - The NearestNeighbourSearch class.
-
getNearestNeighbourSearchAlgorithm
public weka.core.neighboursearch.NearestNeighbourSearch getNearestNeighbourSearchAlgorithm()
Returns the current nearestNeighbourSearch algorithm in use.- Returns:
- the NearestNeighbourSearch algorithm currently in use.
-
nearestNeighbourSearchAlgorithmTipText
public String nearestNeighbourSearchAlgorithmTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setNoUpdate
public void setNoUpdate(boolean value)
Sets whether to suppress updating the nearest-neighbor search algorithm when making predictions.- Parameters:
value- if true then no update happens.
-
getNoUpdate
public boolean getNoUpdate()
Returns whether to suppress the update of the nearest-neighbor search algorithm when making predictions.- Returns:
- true if the update is suppressed
-
noUpdateTipText
public String noUpdateTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setRowFinderEnabled
public void setRowFinderEnabled(boolean value)
Sets whether to use the row finder.- Parameters:
value- true if to use the row finder
-
getRowFinderEnabled
public boolean getRowFinderEnabled()
Returns whether to use the row finder.- Returns:
- true if to use the row finder
-
rowFinderEnabledTipText
public String rowFinderEnabledTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setRowFinder
public void setRowFinder(RowFinder value)
Sets the row finder scheme.- Parameters:
value- the row finder scheme
-
getRowFinder
public RowFinder getRowFinder()
Returns the row finder scheme.- Returns:
- the row finder
-
rowFinderTipText
public String rowFinderTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getCapabilities
public weka.core.Capabilities getCapabilities()
Returns the Capabilities of this filter.- Specified by:
getCapabilitiesin interfaceweka.core.CapabilitiesHandler- Overrides:
getCapabilitiesin classweka.filters.Filter- Returns:
- the capabilities of this object
- See Also:
Capabilities
-
determineOutputFormat
protected weka.core.Instances determineOutputFormat(weka.core.Instances inputFormat) throws ExceptionDetermines the output format based on the input format and returns this.- Specified by:
determineOutputFormatin classweka.filters.SimpleFilter- Parameters:
inputFormat- the input format to base the output format on- Returns:
- the output format
- Throws:
Exception- in case the determination goes wrong
-
process
protected weka.core.Instances process(weka.core.Instances instances) throws ExceptionProcesses the given data (may change the provided dataset) and returns the modified version. This method is called in batchFinished().- Specified by:
processin classweka.filters.SimpleFilter- Parameters:
instances- the data to process- Returns:
- the modified data
- Throws:
Exception- in case the processing goes wrong
-
getRevision
public String getRevision()
Returns the revision string.- Specified by:
getRevisionin interfaceweka.core.RevisionHandler- Overrides:
getRevisionin classweka.filters.Filter- Returns:
- the revision
-
main
public static void main(String[] args)
Main method for testing this class.- Parameters:
args- should contain arguments to the filter: use -h for help
-
-