Package adams.data.conversion
Class SpreadSheetBinarize
-
- All Implemented Interfaces:
AdditionalInformationHandler,CleanUpHandler,Destroyable,GlobalInfoSupporter,LoggingLevelHandler,LoggingSupporter,OptionHandler,QuickInfoSupporter,ShallowCopySupporter<AbstractConversion>,SizeOfHandler,Stoppable,Conversion,Serializable
public class SpreadSheetBinarize extends AbstractSpreadSheetConversion
Binarizes the non-numeric columns in the selected column range by creating a new column for each of the labels.
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-columns <adams.data.spreadsheet.SpreadSheetColumnRange> (property: columns) The range of columns to binarize. default: first-last example: A range is a comma-separated list of single 1-based indices or sub-ranges of indices ('start-end'); 'inv(...)' inverts the range '...'; column names (case-sensitive) as well as the following placeholders can be used: first, second, third, last_2, last_1, last-binarize-type <NUMERIC|BOOLEAN|LABELS> (property: binarizeType) The type of binarization to perform. default: NUMERIC
-label-positive <java.lang.String> (property: labelPositive) The positive label (ie 1s) in case of LABELS. default: yes
-label-negative <java.lang.String> (property: labelNegative) The negative label (ie 0s) in case of LABELS. default: no
- Version:
- $Revision: 8614 $
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSpreadSheetBinarize.BinarizeTypeHow to binarize the data.
-
Field Summary
Fields Modifier and Type Field Description protected SpreadSheetBinarize.BinarizeTypem_BinarizeTypehow to binarize.protected SpreadSheetColumnRangem_Columnsthe columns to merge.protected Stringm_LabelNegativethe negative label.protected Stringm_LabelPositivethe positive label.static StringSEPARATORthe separator to use between column name and label.-
Fields inherited from class adams.data.conversion.AbstractConversion
m_Input, m_Output, m_Owner, m_Stopped
-
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 SpreadSheetBinarize()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringbinarizeTypeTipText()Returns the tip text for this property.StringcolumnsTipText()Returns the tip text for this property.protected SpreadSheetconvert(SpreadSheet input)Returns a string describing the object.voiddefineOptions()Adds options to the internal list of options.SpreadSheetBinarize.BinarizeTypegetBinarizeType()Returns how to binarize the data.SpreadSheetColumnRangegetColumns()Returns the range of columns to merge.StringgetLabelNegative()Returns the negative label (for 0s) in case ofSpreadSheetBinarize.BinarizeType.LABELS.StringgetLabelPositive()Returns the positive label (for 1s) in case ofSpreadSheetBinarize.BinarizeType.LABELS.StringgetQuickInfo()Returns a quick info about the object, which can be displayed in the GUI.StringglobalInfo()Returns a string describing the object.StringlabelNegativeTipText()Returns the tip text for this property.StringlabelPositiveTipText()Returns the tip text for this property.voidsetBinarizeType(SpreadSheetBinarize.BinarizeType value)Sets how to binarize the data.voidsetColumns(SpreadSheetColumnRange value)Sets the range of columns to merge.voidsetLabelNegative(String value)Sets the negative label (for 0s) in case ofSpreadSheetBinarize.BinarizeType.LABELS.voidsetLabelPositive(String value)Sets the positive label (for 1s) in case ofSpreadSheetBinarize.BinarizeType.LABELS.-
Methods inherited from class adams.data.conversion.AbstractSpreadSheetConversion
accepts, doConvert, generates
-
Methods inherited from class adams.data.conversion.AbstractConversion
checkData, cleanUp, convert, getAdditionalInformation, getInput, getInput, getOutput, getOutput, getOwner, reset, setInput, setOwner, shallowCopy, shallowCopy, stopExecution
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, 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
-
-
-
-
Field Detail
-
SEPARATOR
public static final String SEPARATOR
the separator to use between column name and label.- See Also:
- Constant Field Values
-
m_Columns
protected SpreadSheetColumnRange m_Columns
the columns to merge.
-
m_BinarizeType
protected SpreadSheetBinarize.BinarizeType m_BinarizeType
how to binarize.
-
m_LabelPositive
protected String m_LabelPositive
the positive label.
-
m_LabelNegative
protected String m_LabelNegative
the negative label.
-
-
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
-
setColumns
public void setColumns(SpreadSheetColumnRange value)
Sets the range of columns to merge.- Parameters:
value- the range
-
getColumns
public SpreadSheetColumnRange getColumns()
Returns the range of columns to merge.- Returns:
- true range
-
columnsTipText
public String columnsTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setBinarizeType
public void setBinarizeType(SpreadSheetBinarize.BinarizeType value)
Sets how to binarize the data.- Parameters:
value- the type
-
getBinarizeType
public SpreadSheetBinarize.BinarizeType getBinarizeType()
Returns how to binarize the data.- Returns:
- the type
-
binarizeTypeTipText
public String binarizeTypeTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setLabelPositive
public void setLabelPositive(String value)
Sets the positive label (for 1s) in case ofSpreadSheetBinarize.BinarizeType.LABELS.- Parameters:
value- the label
-
getLabelPositive
public String getLabelPositive()
Returns the positive label (for 1s) in case ofSpreadSheetBinarize.BinarizeType.LABELS.- Returns:
- the label
-
labelPositiveTipText
public String labelPositiveTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setLabelNegative
public void setLabelNegative(String value)
Sets the negative label (for 0s) in case ofSpreadSheetBinarize.BinarizeType.LABELS.- Parameters:
value- the label
-
getLabelNegative
public String getLabelNegative()
Returns the negative label (for 0s) in case ofSpreadSheetBinarize.BinarizeType.LABELS.- Returns:
- the label
-
labelNegativeTipText
public String labelNegativeTipText()
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 classAbstractConversion- Returns:
- null if no info available, otherwise short string
-
convert
protected SpreadSheet convert(SpreadSheet input) throws Exception
Returns a string describing the object.- Specified by:
convertin classAbstractSpreadSheetConversion- Parameters:
input- the incoming spreadsheet- Returns:
- a description suitable for displaying in the gui
- Throws:
Exception- if conversion fails for some reason
-
-