Class WekaFilter

  • All Implemented Interfaces:
    adams.core.Destroyable, adams.core.GlobalInfoSupporter, adams.core.logging.LoggingLevelHandler, adams.core.logging.LoggingSupporter, adams.core.option.OptionHandler, adams.core.QuickInfoSupporter, adams.core.SizeOfHandler, adams.data.spreadsheet.filter.SpreadSheetFilter, adams.data.spreadsheet.filter.TrainableSpreadSheetFilter, Serializable

    public class WekaFilter
    extends adams.data.spreadsheet.filter.AbstractTrainableSpreadSheetFilter
    Applies a Weka filter to the data.
    Version:
    $Revision$
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected weka.filters.Filter m_ActualFilter
      the actual filter in use.
      protected weka.filters.Filter m_Filter
      the filter to use.
      protected int m_MaxLabels
      the threshold for number of labels before an attribute gets switched to Attribute.STRING.
      • Fields inherited from class adams.data.spreadsheet.filter.AbstractTrainableSpreadSheetFilter

        m_Trained
      • Fields inherited from class adams.core.option.AbstractOptionHandler

        m_OptionManager
      • Fields inherited from class adams.core.logging.LoggingObject

        m_Logger, m_LoggingIsEnabled, m_LoggingLevel
    • Constructor Summary

      Constructors 
      Constructor Description
      WekaFilter()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void defineOptions()
      Adds options to the internal list of options.
      protected adams.data.spreadsheet.SpreadSheet doFilter​(adams.data.spreadsheet.SpreadSheet data)
      Performs the actual filtering of the spreadsheet.
      protected adams.data.spreadsheet.SpreadSheet doTrain​(adams.data.spreadsheet.SpreadSheet data)
      Performs the actual retraining on the spreadsheet.
      String filterTipText()
      Returns the tip text for this property.
      weka.filters.Filter getFilter()
      Returns the filter in use.
      int getMaxLabels()
      Returns the name of the global actor in use.
      String getQuickInfo()
      Returns a quick info about the object, which can be displayed in the GUI.
      String globalInfo()
      Returns a string describing the object.
      String maxLabelsTipText()
      Returns the tip text for this property.
      void setFilter​(weka.filters.Filter value)
      Sets the filter to use.
      void setMaxLabels​(int value)
      Sets the maximum number of labels a nominal attribute can have.
      protected weka.core.Instances toInstances​(adams.data.spreadsheet.SpreadSheet data)
      Converts the spreadsheet into an Instances object.
      protected adams.data.spreadsheet.SpreadSheet toSpreadSheet​(weka.core.Instances data)
      Converts the Instances into a SpreadSheet object.
      • Methods inherited from class adams.data.spreadsheet.filter.AbstractTrainableSpreadSheetFilter

        checkTrain, filter, isTrained, resetFilter, train
      • Methods inherited from class adams.data.spreadsheet.filter.AbstractSpreadSheetFilter

        check
      • Methods inherited from class adams.core.option.AbstractOptionHandler

        cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
      • Methods inherited from class adams.core.logging.LoggingObject

        configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
      • Methods inherited from interface adams.core.logging.LoggingLevelHandler

        getLoggingLevel
    • Field Detail

      • m_Filter

        protected weka.filters.Filter m_Filter
        the filter to use.
      • m_ActualFilter

        protected weka.filters.Filter m_ActualFilter
        the actual filter in use.
      • m_MaxLabels

        protected int m_MaxLabels
        the threshold for number of labels before an attribute gets switched to Attribute.STRING.
    • Constructor Detail

      • WekaFilter

        public WekaFilter()
    • Method Detail

      • globalInfo

        public String globalInfo()
        Returns a string describing the object.
        Specified by:
        globalInfo in interface adams.core.GlobalInfoSupporter
        Specified by:
        globalInfo in class adams.core.option.AbstractOptionHandler
        Returns:
        a description suitable for displaying in the gui
      • defineOptions

        public void defineOptions()
        Adds options to the internal list of options.
        Specified by:
        defineOptions in interface adams.core.option.OptionHandler
        Overrides:
        defineOptions in class adams.core.option.AbstractOptionHandler
      • setFilter

        public void setFilter​(weka.filters.Filter value)
        Sets the filter to use.
        Parameters:
        value - the filter
      • getFilter

        public weka.filters.Filter getFilter()
        Returns the filter in use.
        Returns:
        the filter
      • filterTipText

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

        public void setMaxLabels​(int value)
        Sets the maximum number of labels a nominal attribute can have.
        Parameters:
        value - the maximum
      • getMaxLabels

        public int getMaxLabels()
        Returns the name of the global actor in use.
        Returns:
        the global name
      • maxLabelsTipText

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

        public String getQuickInfo()
        Returns a quick info about the object, which can be displayed in the GUI.
        Specified by:
        getQuickInfo in interface adams.core.QuickInfoSupporter
        Overrides:
        getQuickInfo in class adams.data.spreadsheet.filter.AbstractSpreadSheetFilter
        Returns:
        null if no info available, otherwise short string
      • toInstances

        protected weka.core.Instances toInstances​(adams.data.spreadsheet.SpreadSheet data)
        Converts the spreadsheet into an Instances object.
        Parameters:
        data - the spreadsheet to convert
        Returns:
        the Instances
      • toSpreadSheet

        protected adams.data.spreadsheet.SpreadSheet toSpreadSheet​(weka.core.Instances data)
        Converts the Instances into a SpreadSheet object.
        Parameters:
        data - the Instances to convert
        Returns:
        the SpreadSheet
      • doTrain

        protected adams.data.spreadsheet.SpreadSheet doTrain​(adams.data.spreadsheet.SpreadSheet data)
                                                      throws Exception
        Performs the actual retraining on the spreadsheet.
        Specified by:
        doTrain in class adams.data.spreadsheet.filter.AbstractTrainableSpreadSheetFilter
        Parameters:
        data - the spreadsheet to train with and filter
        Returns:
        the filtered spreadsheet
        Throws:
        Exception - if filtering fails
      • doFilter

        protected adams.data.spreadsheet.SpreadSheet doFilter​(adams.data.spreadsheet.SpreadSheet data)
                                                       throws Exception
        Performs the actual filtering of the spreadsheet.
        Specified by:
        doFilter in class adams.data.spreadsheet.filter.AbstractSpreadSheetFilter
        Parameters:
        data - the spreadsheet to filter
        Returns:
        the filtered spreadsheet
        Throws:
        Exception - if filtering fails