Class SegmentedSavitzkyGolay
- java.lang.Object
-
- weka.filters.Filter
-
- weka.filters.SimpleFilter
-
- weka.filters.SimpleBatchFilter
-
- weka.filters.unsupervised.attribute.SegmentedSavitzkyGolay
-
- All Implemented Interfaces:
Serializable,weka.core.CapabilitiesHandler,weka.core.CapabilitiesIgnorer,weka.core.CommandlineRunnable,weka.core.OptionHandler,weka.core.RevisionHandler,weka.core.TechnicalInformationHandler,weka.filters.UnsupervisedFilter
public class SegmentedSavitzkyGolay extends weka.filters.SimpleBatchFilter implements weka.core.TechnicalInformationHandler, weka.filters.UnsupervisedFilterConfigures a weka.filters.unsupervised.attribute.PartitionedMultiFilter, using the supplied number of splits and the number of points to configure the weka.filters.unsupervised.attribute.SavitzkyGolay2 filter to apply to the subsets. BibTeX:@article{Savitzky1964, author = {A. Savitzky and Marcel J.E. Golay}, journal = {Analytical Chemistry}, pages = {1627-1639}, title = {Smoothing and Differentiation of Data by Simplified Least Squares Procedures}, volume = {36}, year = {1964}, HTTP = {http://dx.doi.org/10.1021/ac60214a047} } @inbook{Press1992, author = {William H. Press and Saul A. Teukolsky and William T. Vetterling and Brian P. Flannery}, chapter = {14.8}, edition = {Second}, pages = {650-655}, publisher = {Cambridge University Press}, series = {Numerical Recipes in C}, title = {Savitzky-Golay Smoothing Filters}, year = {1992}, PDF = {http://www.nrbook.com/a/bookcpdf/c14-8.pdf} }Valid options are:-num-points <list> The blank-separated list of number of points to use for the savitzky-golay window. (default: 3).
-polynomial <int> The polynomial order to use for savitzky-golay. (default: 2)
-derivative <int> The derivative order to use for savitzky-golay. (default: 1)
-exclude <expr> The regular expression for identifying attributes to exclude from the splits (default: ^(sample_id)$)
-U Flag for leaving unused attributes out of the output, by default these are included in the filter output.
-output-debug-info If set, filter is run in debug mode and may output additional info to the console
-do-not-check-capabilities If set, filter capabilities are not checked before filter is built (use with caution).
- Version:
- $Revision$
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_DERIVATIVE_ORDERthe default for the derivative order.static StringDEFAULT_EXCLUDEthe default for the exclude expression.static intDEFAULT_NUM_POINTSthe default for the number of points.static intDEFAULT_POLYNOMIAL_ORDERthe default for the polynomial order.protected intm_DerivativeOrderthe order of the derivative.protected adams.core.base.BaseRegExpm_Excludethe regular expression for attributes to exclude from the splits.protected weka.filters.unsupervised.attribute.PartitionedMultiFilter2m_Filterthe filter used internally.protected weka.core.Instancesm_FirstPassDatathe filtered data from the first pass.protected List<Integer>m_NumPointsthe blank-separated list of number of savgol points to use.protected intm_PolynomialOrderthe polynomial order.protected booleanm_RemoveUnusedWhether unused attributes are left out of the output.static StringPREFIX_AMPLITUDEthe prefix for a spectral attribute.
-
Constructor Summary
Constructors Constructor Description SegmentedSavitzkyGolay()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanallowAccessToFullInputFormat()StringderivativeOrderTipText()Returns the tip text for this property.protected weka.core.InstancesdetermineOutputFormat(weka.core.Instances inputFormat)Determines the output format based on the input format and returns this.StringexcludeTipText()Returns the tip text for this property.intgetDerivativeOrder()Returns the order of the derivative.adams.core.base.BaseRegExpgetExclude()Returns the regular expression that identifies attributes to be excluded from the splits.StringgetNumPoints()Returns the blank-separated list number of points to use for the savitzky-golay window (>= 1).String[]getOptions()Gets the current settings of the filter.intgetPolynomialOrder()Returns the polynominal order.booleangetRemoveUnused()Gets whether unused attributes (ones that are not covered by any of the ranges) are removed from the output.weka.core.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 this filter.EnumerationlistOptions()Returns an enumeration describing the available options.StringnumPointsTipText()Returns the tip text for this property.StringpolynomialOrderTipText()Returns the tip text for this property.protected weka.core.Instancesprocess(weka.core.Instances instances)Processes the given data (may change the provided dataset) and returns the modified version.StringremoveUnusedTipText()Returns the tip text for this property.protected voidreset()resets the filter, i.e., m_NewBatch to true and m_FirstBatchDone to false.voidsetDerivativeOrder(int value)Sets the order of the derivative.voidsetExclude(adams.core.base.BaseRegExp value)Sets the regular expression that identifies attributes to be excluded from the splits.voidsetNumPoints(String value)Sets the blank-separated list number of points to use for the savitzky-golay window (>= 1).voidsetOptions(String[] options)Parses a list of options for this object.voidsetPolynomialOrder(int value)Sets the polynomial order.voidsetRemoveUnused(boolean value)Sets whether unused attributes (ones that are not covered by any of the ranges) are removed from the output.-
Methods inherited from class weka.filters.SimpleBatchFilter
batchFinished, hasImmediateOutputFormat, input
-
Methods inherited from class weka.filters.Filter
batchFilterFile, bufferInput, copyValues, copyValues, debugTipText, doNotCheckCapabilitiesTipText, filterFile, flushInput, getCapabilities, getCapabilities, getDebug, getDoNotCheckCapabilities, getInputFormat, getOutputFormat, getRevision, initInputLocators, initOutputLocators, inputFormatPeek, isFirstBatchDone, isNewBatch, isOutputFormatDefined, main, makeCopies, makeCopy, mayRemoveInstanceAfterFirstBatchDone, numPendingOutput, output, outputFormatPeek, outputPeek, postExecution, preExecution, push, push, resetQueue, run, runFilter, setDebug, setDoNotCheckCapabilities, setOutputFormat, testInputFormat, toString, useFilter, wekaStaticWrapper
-
-
-
-
Field Detail
-
PREFIX_AMPLITUDE
public static final String PREFIX_AMPLITUDE
the prefix for a spectral attribute.- See Also:
- Constant Field Values
-
DEFAULT_NUM_POINTS
public static final int DEFAULT_NUM_POINTS
the default for the number of points.- See Also:
- Constant Field Values
-
DEFAULT_POLYNOMIAL_ORDER
public static final int DEFAULT_POLYNOMIAL_ORDER
the default for the polynomial order.- See Also:
- Constant Field Values
-
DEFAULT_DERIVATIVE_ORDER
public static final int DEFAULT_DERIVATIVE_ORDER
the default for the derivative order.- See Also:
- Constant Field Values
-
DEFAULT_EXCLUDE
public static final String DEFAULT_EXCLUDE
the default for the exclude expression.
-
m_NumPoints
protected List<Integer> m_NumPoints
the blank-separated list of number of savgol points to use.
-
m_PolynomialOrder
protected int m_PolynomialOrder
the polynomial order.
-
m_DerivativeOrder
protected int m_DerivativeOrder
the order of the derivative.
-
m_Exclude
protected adams.core.base.BaseRegExp m_Exclude
the regular expression for attributes to exclude from the splits.
-
m_RemoveUnused
protected boolean m_RemoveUnused
Whether unused attributes are left out of the output.
-
m_Filter
protected weka.filters.unsupervised.attribute.PartitionedMultiFilter2 m_Filter
the filter used internally.
-
m_FirstPassData
protected weka.core.Instances m_FirstPassData
the filtered data from the first pass.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing this filter.- Specified by:
globalInfoin classweka.filters.SimpleFilter- Returns:
- a description of the filter suitable for displaying in the explorer/experimenter gui
-
getTechnicalInformation
public weka.core.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 interfaceweka.core.TechnicalInformationHandler- Returns:
- the technical information about this class
-
listOptions
public Enumeration listOptions()
Returns an enumeration describing the available options.- Specified by:
listOptionsin interfaceweka.core.OptionHandler- Overrides:
listOptionsin classweka.filters.Filter- Returns:
- an enumeration of all the available options.
-
setOptions
public void setOptions(String[] options) throws Exception
Parses a list of options for this object. Also resets the state of the filter (this reset doesn't affect the options).
-
getOptions
public String[] getOptions()
Gets the current settings of the filter.- Specified by:
getOptionsin interfaceweka.core.OptionHandler- Overrides:
getOptionsin classweka.filters.Filter- Returns:
- an array of strings suitable for passing to setOptions
-
setNumPoints
public void setNumPoints(String value)
Sets the blank-separated list number of points to use for the savitzky-golay window (>= 1).- Parameters:
value- the number of points
-
getNumPoints
public String getNumPoints()
Returns the blank-separated list number of points to use for the savitzky-golay window (>= 1).- Returns:
- the number of points
-
numPointsTipText
public String numPointsTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
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.
-
setExclude
public void setExclude(adams.core.base.BaseRegExp value)
Sets the regular expression that identifies attributes to be excluded from the splits.- Parameters:
value- the expression
-
getExclude
public adams.core.base.BaseRegExp getExclude()
Returns the regular expression that identifies attributes to be excluded from the splits.- Returns:
- the expression
-
excludeTipText
public String excludeTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setRemoveUnused
public void setRemoveUnused(boolean value)
Sets whether unused attributes (ones that are not covered by any of the ranges) are removed from the output.- Parameters:
value- if true then the unused attributes get removed
-
getRemoveUnused
public boolean getRemoveUnused()
Gets whether unused attributes (ones that are not covered by any of the ranges) are removed from the output.- Returns:
- true if unused attributes are removed
-
removeUnusedTipText
public String removeUnusedTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
reset
protected void reset()
resets the filter, i.e., m_NewBatch to true and m_FirstBatchDone to false.- Overrides:
resetin classweka.filters.SimpleFilter
-
allowAccessToFullInputFormat
public boolean allowAccessToFullInputFormat()
- Overrides:
allowAccessToFullInputFormatin classweka.filters.SimpleBatchFilter
-
determineOutputFormat
protected weka.core.Instances determineOutputFormat(weka.core.Instances inputFormat) throws ExceptionDetermines the output format based on the input format and returns this. In case the output format cannot be returned immediately, i.e., immediateOutputFormat() returns false, then this method will be called from batchFinished().- Specified by:
determineOutputFormatin classweka.filters.SimpleFilter- Parameters:
inputFormat- the input format to base the output format on- Returns:
- the output format
- Throws:
Exception- in case the determination goes wrong
-
process
protected weka.core.Instances process(weka.core.Instances instances) throws ExceptionProcesses the given data (may change the provided dataset) and returns the modified version. This method is called in batchFinished().- Specified by:
processin classweka.filters.SimpleFilter- Parameters:
instances- the data to process- Returns:
- the modified data
- Throws:
Exception- in case the processing goes wrong
-
-