Documentation of 'net.sourceforge.openforecast.models.AbstractTimeBasedModel' Java class
AbstractTimeBasedModel
net.sourceforge.openforecast.models

Class AbstractTimeBasedModel

  • All Implemented Interfaces:
    ForecastingModel
    Direct Known Subclasses:
    DoubleExponentialSmoothingModel, SimpleExponentialSmoothingModel, TripleExponentialSmoothingModel, WeightedMovingAverageModel


    public abstract class AbstractTimeBasedModel
    extends AbstractForecastingModel
    A time based forecasting model is the base class that implements much of the common code for models based on a time series. In particular, it was designed to support the needs of the Weighted Moving Average, as well as the Single, Double and Triple Exponential Smoothing models.

    These models have an advantage over other forecasting models in that they smooth out peaks and troughs (or valleys) in a set of observations. However, they also have several disadvantages. In particular these models do not produce an actual equation. Therefore, they often are not all that useful as medium-long range forecasting tools. They can only reliably be used to forecast a few periods into the future.

    Since:
    0.4
    • Constructor Detail

      • AbstractTimeBasedModel

        public AbstractTimeBasedModel()
        Constructs a new time based forecasting model. For a valid model to be constructed, you should call init and pass in a data set containing a series of data points. The data set should also have the time variable initialized to the independent time variable name.
      • AbstractTimeBasedModel

        public AbstractTimeBasedModel(java.lang.String timeVariable)
        Deprecated. As of 0.4, replaced by AbstractTimeBasedModel(java.lang.String).
        Constructs a new time based forecasting model, using the named variable as the independent (time) variable.
        Parameters:
        timeVariable - the name of the independent variable to use as the time variable in this model.
    • Method Detail

      • init

        public void init(DataSet dataSet)
        Used to initialize the time based model. This method must be called before any other method in the class. Since the time based model does not derive any equation for forecasting, this method uses the input DataSet to calculate forecast values for all values of the independent time variable within the initial data set.
        Parameters:
        dataSet - a data set of observations that can be used to initialize the forecasting parameters of the forecasting model.
      • forecast

        public double forecast(DataPoint dataPoint)
                        throws java.lang.IllegalArgumentException
        Using the current model parameters (initialized in init), apply the forecast model to the given data point. The data point must have a valid value for the independent variable. Upon return, the value of the dependent variable will be updated with the forecast value computed for that data point.
        Parameters:
        dataPoint - the data point for which a forecast value (for the dependent variable) is required.
        Returns:
        the same data point passed in but with the dependent value updated to contain the new forecast value.
        Throws:
        ModelNotInitializedException - if forecast is called before the model has been initialized with a call to init.
        java.lang.IllegalArgumentException - if the forecast period specified by the dataPoint is invalid with respect to the historical data provided.
      • getTimeVariable

        public java.lang.String getTimeVariable()
        Returns the name of the independent variable representing the time value used by this model.
        Returns:
        the name of the independent variable representing the time value.
      • getMinimumTimeValue

        public double getMinimumTimeValue()
        Returns the minimum value of the independent time variable currently forecast by this model.
        Returns:
        the minimum value of the independent time variable.
      • getMaximumTimeValue

        public double getMaximumTimeValue()
        Returns the maximum value of the independent time variable currently forecast by this model.
        Returns:
        the maximum value of the independent time variable.
      • getIndependentVariable

        public java.lang.String getIndependentVariable()
        Returns the independent variable - or the time variable - used in this model.
        Returns:
        the independent variable in this model.
      • getForecastType

        public java.lang.String getForecastType()
        Returns a one or two word name of this type of forecasting model. Keep this short. A longer description should be implemented in the toString method.
        Returns:
        a string representation of the type of forecasting model implemented.
      • toString

        public java.lang.String toString()
        This should be overridden to provide a textual description of the current forecasting model including, where possible, any derived parameters used.
        Specified by:
        toString in interface ForecastingModel
        Overrides:
        toString in class java.lang.Object
        Returns:
        a string representation of the current forecast model, and its parameters.

DataMelt 3.0 © DataMelt by jWork.ORG

Ads help maintain this website.