Class LinearRegressionBased

  • All Implemented Interfaces:
    adams.core.CleanUpHandler, adams.core.Destroyable, adams.core.GlobalInfoSupporter, adams.core.logging.LoggingLevelHandler, adams.core.logging.LoggingSupporter, adams.core.option.OptionHandler, adams.core.ShallowCopySupporter<adams.data.baseline.AbstractBaselineCorrection>, adams.core.SizeOfHandler, Serializable, Comparable

    public class LinearRegressionBased
    extends adams.data.baseline.AbstractLinearRegressionBased<Spectrum>
    A simple linear regression based baseline correction scheme.
    Fits a line through the data using linear regression and then removes this line from the data to correct the baseline.

    Valid options are:

    -D (property: debug)
        If set to true, scheme may output additional info to the console.
     
    -ridge <double> (property: ridge)
        The ridge parameter for linear regression.
        default: 1.0E-8
     
    Version:
    $Revision: 2242 $
    Author:
    dale (dale at cs dot waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class adams.data.baseline.AbstractBaselineCorrection

        adams.data.baseline.AbstractBaselineCorrection.BaselineCorrectionJob<T extends adams.data.container.DataContainer>
    • Field Summary

      • Fields inherited from class adams.data.baseline.AbstractLinearRegressionBased

        m_GenerateLine, m_Ridge
      • Fields inherited from class adams.core.option.AbstractOptionHandler

        m_OptionManager
      • Fields inherited from class adams.core.logging.LoggingObject

        m_Logger, m_LoggingIsEnabled, m_LoggingLevel
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected Spectrum correctData​(Spectrum data, double[] coeff)
      Corrects the data with the given coefficients.
      protected Spectrum generateLine​(Spectrum data, double[] coeff)
      Generates fake data for the plotting the line.
      protected weka.core.Instances getInstances​(Spectrum data)
      Returns the dataset for linear regression.
      • Methods inherited from class adams.data.baseline.AbstractLinearRegressionBased

        defineOptions, generateLineTipText, getGenerateLine, getRidge, globalInfo, processData, ridgeTipText, setGenerateLine, setRidge
      • Methods inherited from class adams.data.baseline.AbstractBaselineCorrection

        checkData, cleanUp, compareTo, correct, doCorrect, equals, forCommandLine, reset, shallowCopy, shallowCopy
      • 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 interface adams.core.logging.LoggingLevelHandler

        getLoggingLevel
    • Constructor Detail

      • LinearRegressionBased

        public LinearRegressionBased()
    • Method Detail

      • getInstances

        protected weka.core.Instances getInstances​(Spectrum data)
        Returns the dataset for linear regression.
        Specified by:
        getInstances in class adams.data.baseline.AbstractLinearRegressionBased<Spectrum>
        Parameters:
        data - the original data
        Returns:
        the data
      • correctData

        protected Spectrum correctData​(Spectrum data,
                                       double[] coeff)
        Corrects the data with the given coefficients.
        Specified by:
        correctData in class adams.data.baseline.AbstractLinearRegressionBased<Spectrum>
        Parameters:
        data - the original data
        coeff - the coefficients to use for correcting the data, the last element is the offset
        Returns:
        the baseline corrected data
      • generateLine

        protected Spectrum generateLine​(Spectrum data,
                                        double[] coeff)
        Generates fake data for the plotting the line.
        Specified by:
        generateLine in class adams.data.baseline.AbstractLinearRegressionBased<Spectrum>
        Parameters:
        data - the original data
        coeff - the coefficients to use for generating the line data, the last element is the offset
        Returns:
        the fake data for the line