Package adams.data.spreadsheet.filter
Class WekaFilter
-
- All Implemented Interfaces:
Destroyable,GlobalInfoSupporter,LoggingLevelHandler,LoggingSupporter,OptionHandler,QuickInfoSupporter,SizeOfHandler,SpreadSheetFilter,TrainableSpreadSheetFilter,Serializable
public class WekaFilter extends 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.Filterm_ActualFilterthe actual filter in use.protected weka.filters.Filterm_Filterthe filter to use.protected intm_MaxLabelsthe threshold for number of labels before an attribute gets switched toAttribute.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 voiddefineOptions()Adds options to the internal list of options.protected SpreadSheetdoFilter(SpreadSheet data)Performs the actual filtering of the spreadsheet.protected SpreadSheetdoTrain(SpreadSheet data)Performs the actual retraining on the spreadsheet.StringfilterTipText()Returns the tip text for this property.weka.filters.FiltergetFilter()Returns the filter in use.intgetMaxLabels()Returns the name of the global actor in use.StringgetQuickInfo()Returns a quick info about the object, which can be displayed in the GUI.StringglobalInfo()Returns a string describing the object.StringmaxLabelsTipText()Returns the tip text for this property.voidsetFilter(weka.filters.Filter value)Sets the filter to use.voidsetMaxLabels(int value)Sets the maximum number of labels a nominal attribute can have.protected weka.core.InstancestoInstances(SpreadSheet data)Converts the spreadsheet into an Instances object.protected SpreadSheettoSpreadSheet(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 class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfoin interfaceGlobalInfoSupporter- Specified by:
globalInfoin classAbstractOptionHandler- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractOptionHandler
-
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:
getQuickInfoin interfaceQuickInfoSupporter- Overrides:
getQuickInfoin classAbstractSpreadSheetFilter- Returns:
- null if no info available, otherwise short string
-
toInstances
protected weka.core.Instances toInstances(SpreadSheet data)
Converts the spreadsheet into an Instances object.- Parameters:
data- the spreadsheet to convert- Returns:
- the Instances
-
toSpreadSheet
protected SpreadSheet toSpreadSheet(weka.core.Instances data)
Converts the Instances into a SpreadSheet object.- Parameters:
data- the Instances to convert- Returns:
- the SpreadSheet
-
doTrain
protected SpreadSheet doTrain(SpreadSheet data) throws Exception
Performs the actual retraining on the spreadsheet.- Specified by:
doTrainin classAbstractTrainableSpreadSheetFilter- Parameters:
data- the spreadsheet to train with and filter- Returns:
- the filtered spreadsheet
- Throws:
Exception- if filtering fails
-
doFilter
protected SpreadSheet doFilter(SpreadSheet data) throws Exception
Performs the actual filtering of the spreadsheet.- Specified by:
doFilterin classAbstractSpreadSheetFilter- Parameters:
data- the spreadsheet to filter- Returns:
- the filtered spreadsheet
- Throws:
Exception- if filtering fails
-
-