Class WekaNearestNeighborSearch

  • All Implemented Interfaces:
    AdditionalInformationHandler, CleanUpHandler, Destroyable, GlobalInfoSupporter, LoggingLevelHandler, LoggingSupporter, OptionHandler, QuickInfoSupporter, ShallowCopySupporter<Actor>, SizeOfHandler, Stoppable, StoppableWithFeedback, VariablesInspectionHandler, VariableChangeListener, StorageUser, Actor, ErrorHandler, InputConsumer, OutputProducer, VariableMonitor, Serializable, Comparable

    public class WekaNearestNeighborSearch
    extends AbstractTransformer
    implements StorageUser, VariableMonitor
    Outputs the specified number of nearest neighbors for the incoming Weka Instance.
    The data used for the nearest neighbor search is either obtained from storage.

    Input/output:
    - accepts:
       weka.core.Instance
    - generates:
       adams.flow.container.WekaNearestNeighborSearchContainer


    Container information:
    - adams.flow.container.WekaNearestNeighborSearchContainer: Instance, Neighborhood

    -logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel)
        The logging level for outputting errors and debugging output.
        default: WARNING
     
    -name <java.lang.String> (property: name)
        The name of the actor.
        default: WekaNearestNeighborSearch
     
    -annotation <adams.core.base.BaseAnnotation> (property: annotations)
        The annotations to attach to this actor.
        default: 
     
    -skip <boolean> (property: skip)
        If set to true, transformation is skipped and the input token is just forwarded 
        as it is.
        default: false
     
    -stop-flow-on-error <boolean> (property: stopFlowOnError)
        If set to true, the flow execution at this level gets stopped in case this 
        actor encounters an error; the error gets propagated; useful for critical 
        actors.
        default: false
     
    -silent <boolean> (property: silent)
        If enabled, then no errors are output in the console; Note: the enclosing 
        actor handler must have this enabled as well.
        default: false
     
    -search <weka.core.neighboursearch.NearestNeighbourSearch> (property: search)
        The search algorithm to use.
        default: weka.core.neighboursearch.LinearNNSearch -A \"weka.core.EuclideanDistance -R first-last\"
     
    -max-neighbors <int> (property: maxNeighbors)
        The maximum number of neighbors to find.
        default: 10
        minimum: 1
     
    -storage <adams.flow.control.StorageName> (property: storage)
        The storage item to obtain the data from.
        default: storage
     
    -var-name <adams.core.VariableName> (property: variableName)
        The variable to monitor.
        default: variable
     
    Version:
    $Revision$
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • BACKUP_SEARCH

        public static final String BACKUP_SEARCH
        the key for storing the current initialized state in the backup.
        See Also:
        Constant Field Values
      • m_Search

        protected weka.core.neighboursearch.NearestNeighbourSearch m_Search
        the neighboorhood search to use.
      • m_ActualSearch

        protected weka.core.neighboursearch.NearestNeighbourSearch m_ActualSearch
        the actual neighboorhood search in use.
      • m_MaxNeighbors

        protected int m_MaxNeighbors
        the maximum number of neighbors to return.
      • m_Storage

        protected StorageName m_Storage
        the storage item.
      • m_VariableName

        protected VariableName m_VariableName
        the variable to listen to.
    • Constructor Detail

      • WekaNearestNeighborSearch

        public WekaNearestNeighborSearch()
    • Method Detail

      • reset

        protected void reset()
        Resets the scheme.
        Overrides:
        reset in class AbstractActor
      • setSearch

        public void setSearch​(weka.core.neighboursearch.NearestNeighbourSearch value)
        Sets the search algorithm.
        Parameters:
        value - the algorithm
      • getSearch

        public weka.core.neighboursearch.NearestNeighbourSearch getSearch()
        Returns the search algorithm.
        Returns:
        the algorithm
      • searchTipText

        public String searchTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setMaxNeighbors

        public void setMaxNeighbors​(int value)
        Sets the maximum number of neighbors to find.
        Parameters:
        value - the maximum
      • getMaxNeighbors

        public int getMaxNeighbors()
        Returns the maximum number of neighbors to find.
        Returns:
        the maximum
      • maxNeighborsTipText

        public String maxNeighborsTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setStorage

        public void setStorage​(StorageName value)
        Sets the data storage item.
        Parameters:
        value - the storage item
      • getStorage

        public StorageName getStorage()
        Returns the data storage item.
        Returns:
        the storage item
      • storageTipText

        public String storageTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • variableNameTipText

        public String variableNameTipText()
        Returns the tip text for this property.
        Specified by:
        variableNameTipText in interface VariableMonitor
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • isUsingStorage

        public boolean isUsingStorage()
        Returns whether storage items are being used.
        Specified by:
        isUsingStorage in interface StorageUser
        Returns:
        true if storage items are used
      • accepts

        public Class[] accepts()
        Returns the class that the consumer accepts.
        Specified by:
        accepts in interface InputConsumer
        Returns:
        the Class of objects that can be processed
      • generates

        public Class[] generates()
        Returns the class of objects that it generates.
        Specified by:
        generates in interface OutputProducer
        Returns:
        the Class of the generated tokens
      • doExecute

        protected String doExecute()
        Executes the flow item.
        Specified by:
        doExecute in class AbstractActor
        Returns:
        null if everything is fine, otherwise error message