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.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 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 void
defineOptions()
Adds options to the internal list of options.protected SpreadSheet
doFilter(SpreadSheet data)
Performs the actual filtering of the spreadsheet.protected SpreadSheet
doTrain(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(SpreadSheet data)
Converts the spreadsheet into an Instances object.protected 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 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:
globalInfo
in interfaceGlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractOptionHandler
- 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 interfaceOptionHandler
- Overrides:
defineOptions
in 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:
getQuickInfo
in interfaceQuickInfoSupporter
- Overrides:
getQuickInfo
in 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:
doTrain
in 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:
doFilter
in classAbstractSpreadSheetFilter
- Parameters:
data
- the spreadsheet to filter- Returns:
- the filtered spreadsheet
- Throws:
Exception
- if filtering fails
-
-