Package adams.data.timeseries
Class FixedNumFeatures
-
- All Implemented Interfaces:
CleanUpHandler
,Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,ShallowCopySupporter<AbstractTimeseriesFeatureGenerator>
,SizeOfHandler
,Serializable
,Comparable
public class FixedNumFeatures extends AbstractMetaTimeseriesFeatureGenerator
Meta-feature-generator 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.SpreadSheetFeatureConverter -data-row-type adams.data.spreadsheet.DenseDataRow -spreadsheet-type adams.data.spreadsheet.SpreadSheet
-field <adams.data.report.Field> [-field ...] (property: fields) The fields to add to the output. default:
-notes <adams.core.base.BaseString> [-notes ...] (property: notes) The notes to add as attributes to the generated data, eg 'PROCESS INFORMATION' . default:
-generator <adams.data.timeseries.AbstractTimeseriesFeatureGenerator> (property: generator) The base generator to use. default: adams.data.timeseries.Values -converter \"adams.data.featureconverter.SpreadSheetFeatureConverter -data-row-type adams.data.spreadsheet.DenseDataRow -spreadsheet-type adams.data.spreadsheet.SpreadSheet\"
-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.timeseries.AbstractMetaTimeseriesFeatureGenerator
m_Generator
-
Fields inherited from class adams.data.timeseries.AbstractTimeseriesFeatureGenerator
m_Converter, m_Fields, m_Notes
-
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.HeaderDefinition
createHeader(Timeseries timeseries)
Creates the header from a template timeseries.void
defineOptions()
Adds options to the internal list of options.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.List<Object>[]
generateRows(Timeseries timeseries)
Performs the actual feature genration.Class
getDatasetFormat()
Returns the class of the dataset that the converter generates.protected AbstractTimeseriesFeatureGenerator
getDefaultGenerator()
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.timeseries.AbstractMetaTimeseriesFeatureGenerator
generatorTipText, getGenerator, setGenerator
-
Methods inherited from class adams.data.timeseries.AbstractTimeseriesFeatureGenerator
checkData, cleanUp, compareTo, destroy, equals, fieldsTipText, generate, getConverter, getFields, getNotes, notesTipText, postProcessHeader, postProcessRow, postProcessRows, reset, setConverter, setFields, setNotes, shallowCopy, shallowCopy
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, 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, 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 classAbstractMetaTimeseriesFeatureGenerator
-
getDefaultGenerator
protected AbstractTimeseriesFeatureGenerator getDefaultGenerator()
Returns the default converter to use.- Specified by:
getDefaultGenerator
in classAbstractMetaTimeseriesFeatureGenerator
- 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.- Overrides:
converterTipText
in classAbstractTimeseriesFeatureGenerator<Timeseries>
- 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 classAbstractMetaTimeseriesFeatureGenerator
- Returns:
- null if no info available, otherwise short string
-
getDatasetFormat
public Class getDatasetFormat()
Returns the class of the dataset that the converter generates.- Overrides:
getDatasetFormat
in classAbstractTimeseriesFeatureGenerator<Timeseries>
- Returns:
- the format
-
getRowFormat
public Class getRowFormat()
Returns the class of the row that the converter generates.- Overrides:
getRowFormat
in classAbstractTimeseriesFeatureGenerator<Timeseries>
- Returns:
- the format
-
createHeader
public HeaderDefinition createHeader(Timeseries timeseries)
Creates the header from a template timeseries.- Specified by:
createHeader
in classAbstractTimeseriesFeatureGenerator<Timeseries>
- Parameters:
timeseries
- the timeseries to act as a template- Returns:
- the generated header
-
generateRows
public List<Object>[] generateRows(Timeseries timeseries)
Performs the actual feature genration.- Specified by:
generateRows
in classAbstractTimeseriesFeatureGenerator<Timeseries>
- Parameters:
timeseries
- the timeseries to process- Returns:
- the generated features
-
-