Class SavitzkyGolay
-
- All Implemented Interfaces:
Destroyable,GlobalInfoSupporter,LoggingLevelHandler,LoggingSupporter,OptionHandler,SizeOfHandler,TechnicalInformationHandler,CapabilitiesHandler,BatchFilter,ColumnSubsetFilter,Filter,StreamFilter,Serializable
public class SavitzkyGolay extends AbstractColumnSubsetStreamFilter implements TechnicalInformationHandler
A filter that applies Savitzky-Golay smoothing.
For more information see:
A. Savitzky, Marcel J.E. Golay (1964). Smoothing and Differentiation of Data by Simplified Least Squares Procedures. Analytical Chemistry. 36:1627-1639.
William H. Press, Saul A. Teukolsky, William T. Vetterling, Brian P. Flannery (1992). Savitzky-Golay Smoothing Filters.
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-column-subset <RANGE|REGEXP> (property: columnSubset) Defines how to determine the columns to use for filtering. default: RANGE
-col-range <adams.data.spreadsheet.SpreadSheetColumnRange> (property: colRange) The range of columns to use in the filtering process. 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; numeric indices can be enforced by preceding them with '#' (eg '#12'); column names can be surrounded by double quotes.-col-regexp <adams.core.base.BaseRegExp> (property: colRegExp) The regular expression to use on the column names to determine whether to use a column for filtering. default: .* more: https://docs.oracle.com/javase/tutorial/essential/regex/ https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html
-drop-other-columns <boolean> (property: dropOtherColumns) If enabled, other columns that aren't used for filtering get removed from the output; does not affect any class columns. default: false
-polynomial <int> (property: polynomialOrder) The polynomial order to use, must be at least 2. default: 2 minimum: 2
-derivative <int> (property: derivativeOrder) The order of the derivative to use, >= 0. default: 1 minimum: 0
-left <int> (property: numPointsLeft) The number of points left of a data point, >= 0. default: 3 minimum: 0
-right <int> (property: numPointsRight) The number of points right of a data point, >= 0. default: 3 minimum: 0
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected double[]m_Coefficientsthe calculated coefficients.protected intm_DerivativeOrderthe order of the derivative.protected intm_NumPointsLeftthe number of points to the left of a data point.protected intm_NumPointsRightthe number of points to the right of a data point.protected intm_PolynomialOrderthe polynomial order.-
Fields inherited from class adams.ml.preprocessing.AbstractColumnSubsetFilter
m_ClassColumns, m_ColRange, m_ColRegExp, m_ColumnSubset, m_DataColumns, m_DropOtherColumns, m_OtherColumns
-
Fields inherited from class adams.ml.preprocessing.AbstractFilter
m_Initialized, m_OutputFormat
-
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 SavitzkyGolay()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddefineOptions()Adds options to the internal list of options.StringderivativeOrderTipText()Returns the tip text for this property.protected RowdoFilter(Row data)Filters the dataset row coming through.protected voiddoInitFilter(Row data)Filter-specific initialization.CapabilitiesgetCapabilities()Returns the capabilities.intgetDerivativeOrder()Returns the order of the derivative.intgetNumPointsLeft()Returns the number of points to the left of a data point.intgetNumPointsRight()Returns the number of points to the right of a data point.intgetPolynomialOrder()Returns the polynominal order.TechnicalInformationgetTechnicalInformation()Returns an instance of a TechnicalInformation object, containing detailed information about the technical background of this class, e.g., paper reference or book this class is based on.StringglobalInfo()Returns a string describing the object.protected voidinitialize()Initializes the members.protected DatasetinitOutputFormat(Row data)Initializes the output format.StringnumPointsLeftTipText()Returns the tip text for this property.StringnumPointsRightTipText()Returns the tip text for this property.StringpolynomialOrderTipText()Returns the tip text for this property.voidresetCoefficients()Resets the coefficients.voidsetDerivativeOrder(int value)Sets the order of the derivative.voidsetNumPointsLeft(int value)Sets the number of points to the left of a data point.voidsetNumPointsRight(int value)Sets the number of points to the right of a data point.voidsetPolynomialOrder(int value)Sets the polynomial order.-
Methods inherited from class adams.ml.preprocessing.AbstractColumnSubsetStreamFilter
filter, filter, initFilter, postInitFilter, preInitFilter
-
Methods inherited from class adams.ml.preprocessing.AbstractColumnSubsetFilter
colRangeTipText, colRegExpTipText, columnSubsetTipText, dropOtherColumnsTipText, getColRange, getColRegExp, getColumnSubset, getDropOtherColumns, initColumns, reset, setColRange, setColRegExp, setColumnSubset, setDropOtherColumns
-
Methods inherited from class adams.ml.preprocessing.AbstractFilter
appendData, appendHeader, getOutputFormat, isInitialized
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, 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.ml.preprocessing.ColumnSubsetFilter
getOutputFormat, isInitialized
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
m_PolynomialOrder
protected int m_PolynomialOrder
the polynomial order.
-
m_DerivativeOrder
protected int m_DerivativeOrder
the order of the derivative.
-
m_NumPointsLeft
protected int m_NumPointsLeft
the number of points to the left of a data point.
-
m_NumPointsRight
protected int m_NumPointsRight
the number of points to the right of a data point.
-
m_Coefficients
protected double[] m_Coefficients
the calculated coefficients.
-
-
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
-
getTechnicalInformation
public TechnicalInformation getTechnicalInformation()
Returns an instance of a TechnicalInformation object, containing detailed information about the technical background of this class, e.g., paper reference or book this class is based on.- Specified by:
getTechnicalInformationin interfaceTechnicalInformationHandler- Returns:
- the technical information about this class
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initializein classAbstractOptionHandler
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractColumnSubsetFilter
-
resetCoefficients
public void resetCoefficients()
Resets the coefficients.
-
setPolynomialOrder
public void setPolynomialOrder(int value)
Sets the polynomial order.- Parameters:
value- the order
-
getPolynomialOrder
public int getPolynomialOrder()
Returns the polynominal order.- Returns:
- the order
-
polynomialOrderTipText
public String polynomialOrderTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setDerivativeOrder
public void setDerivativeOrder(int value)
Sets the order of the derivative.- Parameters:
value- the order
-
getDerivativeOrder
public int getDerivativeOrder()
Returns the order of the derivative.- Returns:
- the order
-
derivativeOrderTipText
public String derivativeOrderTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setNumPointsLeft
public void setNumPointsLeft(int value)
Sets the number of points to the left of a data point.- Parameters:
value- the number of points
-
getNumPointsLeft
public int getNumPointsLeft()
Returns the number of points to the left of a data point.- Returns:
- the number of points
-
numPointsLeftTipText
public String numPointsLeftTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setNumPointsRight
public void setNumPointsRight(int value)
Sets the number of points to the right of a data point.- Parameters:
value- the number of points
-
getNumPointsRight
public int getNumPointsRight()
Returns the number of points to the right of a data point.- Returns:
- the number of points
-
numPointsRightTipText
public String numPointsRightTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getCapabilities
public Capabilities getCapabilities()
Returns the capabilities.- Specified by:
getCapabilitiesin interfaceCapabilitiesHandler- Specified by:
getCapabilitiesin interfaceFilter- Returns:
- the capabilities
-
doInitFilter
protected void doInitFilter(Row data) throws Exception
Filter-specific initialization.- Specified by:
doInitFilterin classAbstractColumnSubsetStreamFilter- Parameters:
data- the data to initialize with- Throws:
Exception- if initialization fails
-
initOutputFormat
protected Dataset initOutputFormat(Row data) throws Exception
Initializes the output format.- Specified by:
initOutputFormatin classAbstractColumnSubsetStreamFilter- Parameters:
data- the output format- Throws:
Exception- if initialization fails
-
-