Package adams.data.featureconverter
Class FixedNumFeatures
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,SizeOfHandler
,Serializable
public class FixedNumFeatures extends AbstractMetaFeatureConverter
Meta-feature-converter that ensures that the generated output has a fixed number of data points.
In case of filler type FIRST, the data gets inserted at the start, as opposed to at the end when using LAST.
NUMERIC/STRING/BOOLEAN use the appropriate filler value that the user specified.
The MISSING_* types just add a missing value of the appropriate data type.
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-converter <adams.data.featureconverter.AbstractFeatureConverter> (property: converter) The base feature converter to use and trim to size or extend. default: adams.data.featureconverter.TextualFeatureConverter
-num-features <int> (property: numFeatures) The number of features to ensure, either trim or fill to satisfy. default: 1 minimum: 1
-header-template <java.lang.String> (property: headerTemplate) The template for filling in the header; '#' is 1-based index for filled in value, '$' is 1-based, absolute column index; Using a header definition of 'Att-1,Att-2,Att-3' with a size of 5 will give you: 'Filler-#' -> 'Att -1,Att-2,Att-3,Filler-1,Fillter-2', 'Filler-$' -> 'Att-1,Att-2,Att-3,Filler -4,Filler-5' default: Filler-#
-filler-type <MISSING_NUMERIC|MISSING_STRING|MISSING_BOOLEAN|NUMERIC|STRING|BOOLEAN|FIRST|LAST> (property: fillerType) The type of filler to use. default: MISSING_NUMERIC
-filler-numeric <double> (property: fillerNumeric) The value for a numeric filler. default: 0.0
-filler-string <java.lang.String> (property: fillerString) The value for a string filler. default:
-filler-boolean <boolean> (property: fillerBoolean) The value for a boolean filler. default: false
- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FixedNumFeatures.FillerType
Enumeration on how to fill in values if base converter generates too little data points.
-
Field Summary
Fields Modifier and Type Field Description protected boolean
m_FillerBoolean
the boolean filler.protected double
m_FillerNumeric
the numeric filler.protected String
m_FillerString
the string filler.protected FixedNumFeatures.FillerType
m_FillerType
the filler type.protected String
m_HeaderTemplate
the template to use in the header for missing values.protected int
m_NumFeatures
the number of features to guarantee.-
Fields inherited from class adams.data.featureconverter.AbstractMetaFeatureConverter
m_Converter
-
Fields inherited from class adams.data.featureconverter.AbstractFeatureConverter
m_Dataset, m_Header, m_HeaderDefinition
-
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 FixedNumFeatures()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
converterTipText()
Returns the tip text for this property.void
defineOptions()
Adds options to the internal list of options.protected Object
doGenerateHeader(HeaderDefinition header)
Performs the actual generation of the header data structure using the supplied header definition.protected Object
doGenerateRow(List data)
Performs the actual generation of a row from the raw data.String
fillerBooleanTipText()
Returns the tip text for this property.String
fillerNumericTipText()
Returns the tip text for this property.String
fillerStringTipText()
Returns the tip text for this property.String
fillerTypeTipText()
Returns the tip text for this property.Object
generateRow(List data)
Generates a row from the raw data.Class
getDatasetFormat()
Returns the class of the dataset that the converter generates.protected AbstractFeatureConverter
getDefaultConverter()
Returns the default converter to use.boolean
getFillerBoolean()
Returns the value to use for a boolean filler.double
getFillerNumeric()
Returns the value to use for a numeric filler.String
getFillerString()
Returns the value to use for a string filler.FixedNumFeatures.FillerType
getFillerType()
Returns the type of filler to use.String
getHeaderTemplate()
Returns the template to use for filling in the header.int
getNumFeatures()
Returns the number of features to guarantee.String
getQuickInfo()
Returns a quick info about the object, which can be displayed in the GUI.Class
getRowFormat()
Returns the class of the row that the converter generates.String
globalInfo()
Returns a string describing the object.String
headerTemplateTipText()
Returns the tip text for this property.String
numFeaturesTipText()
Returns the tip text for this property.void
setFillerBoolean(boolean value)
Sets the value to use for a boolean filler.void
setFillerNumeric(double value)
Sets the value to use for a numeric filler.void
setFillerString(String value)
Sets the value to use for a string filler.void
setFillerType(FixedNumFeatures.FillerType value)
Sets the type of filler to use.void
setHeaderTemplate(String value)
Sets the template to use for filling in the header.void
setNumFeatures(int value)
Sets the number of features to guarantee.-
Methods inherited from class adams.data.featureconverter.AbstractMetaFeatureConverter
getConverter, setConverter
-
Methods inherited from class adams.data.featureconverter.AbstractFeatureConverter
datasetTipText, generateHeader, getDataset, getHeader, getHeaderDefinition, isInitialized, reset, setDataset
-
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
-
m_NumFeatures
protected int m_NumFeatures
the number of features to guarantee.
-
m_HeaderTemplate
protected String m_HeaderTemplate
the template to use in the header for missing values.
-
m_FillerType
protected FixedNumFeatures.FillerType m_FillerType
the filler type.
-
m_FillerNumeric
protected double m_FillerNumeric
the numeric filler.
-
m_FillerString
protected String m_FillerString
the string filler.
-
m_FillerBoolean
protected boolean m_FillerBoolean
the boolean filler.
-
-
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 classAbstractMetaFeatureConverter
-
getDefaultConverter
protected AbstractFeatureConverter getDefaultConverter()
Returns the default converter to use.- Specified by:
getDefaultConverter
in classAbstractMetaFeatureConverter
- Returns:
- the converter
-
setNumFeatures
public void setNumFeatures(int value)
Sets the number of features to guarantee.- Parameters:
value
- the number of features
-
getNumFeatures
public int getNumFeatures()
Returns the number of features to guarantee.- Returns:
- the number of features
-
numFeaturesTipText
public String numFeaturesTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setHeaderTemplate
public void setHeaderTemplate(String value)
Sets the template to use for filling in the header.- Parameters:
value
- the template
-
getHeaderTemplate
public String getHeaderTemplate()
Returns the template to use for filling in the header.- Returns:
- the template
-
headerTemplateTipText
public String headerTemplateTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setFillerType
public void setFillerType(FixedNumFeatures.FillerType value)
Sets the type of filler to use.- Parameters:
value
- the type
-
getFillerType
public FixedNumFeatures.FillerType getFillerType()
Returns the type of filler to use.- Returns:
- the type
-
fillerTypeTipText
public String fillerTypeTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setFillerNumeric
public void setFillerNumeric(double value)
Sets the value to use for a numeric filler.- Parameters:
value
- the value
-
getFillerNumeric
public double getFillerNumeric()
Returns the value to use for a numeric filler.- Returns:
- the value
-
fillerNumericTipText
public String fillerNumericTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setFillerString
public void setFillerString(String value)
Sets the value to use for a string filler.- Parameters:
value
- the value
-
getFillerString
public String getFillerString()
Returns the value to use for a string filler.- Returns:
- the value
-
fillerStringTipText
public String fillerStringTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setFillerBoolean
public void setFillerBoolean(boolean value)
Sets the value to use for a boolean filler.- Parameters:
value
- the value
-
getFillerBoolean
public boolean getFillerBoolean()
Returns the value to use for a boolean filler.- Returns:
- the value
-
fillerBooleanTipText
public String fillerBooleanTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
converterTipText
public String converterTipText()
Returns the tip text for this property.- Specified by:
converterTipText
in classAbstractMetaFeatureConverter
- 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 classAbstractMetaFeatureConverter
- Returns:
- null if no info available, otherwise short string
-
getDatasetFormat
public Class getDatasetFormat()
Returns the class of the dataset that the converter generates.- Specified by:
getDatasetFormat
in classAbstractFeatureConverter
- Returns:
- the format
-
getRowFormat
public Class getRowFormat()
Returns the class of the row that the converter generates.- Specified by:
getRowFormat
in classAbstractFeatureConverter
- Returns:
- the format
-
doGenerateHeader
protected Object doGenerateHeader(HeaderDefinition header)
Performs the actual generation of the header data structure using the supplied header definition.- Specified by:
doGenerateHeader
in classAbstractFeatureConverter
- Parameters:
header
- the header definition- Returns:
- the dataset structure
-
doGenerateRow
protected Object doGenerateRow(List data)
Performs the actual generation of a row from the raw data.- Specified by:
doGenerateRow
in classAbstractFeatureConverter
- Parameters:
data
- the data of the row, elements can be null (= missing)- Returns:
- the dataset structure
-
generateRow
public Object generateRow(List data)
Generates a row from the raw data.- Overrides:
generateRow
in classAbstractFeatureConverter
- Parameters:
data
- the data of the row, elements can be null (= missing)- Returns:
- the dataset structure
- See Also:
#generateHeader(List, List)
-
-