weka.classifiers.timeseries
Class WekaForecaster

java.lang.Object
  extended by weka.classifiers.timeseries.AbstractForecaster
      extended by weka.classifiers.timeseries.WekaForecaster
All Implemented Interfaces:
java.io.Serializable, TSForecaster, TSLagUser, CommandlineRunnable, OptionHandler

public class WekaForecaster
extends AbstractForecaster
implements TSLagUser, OptionHandler, java.io.Serializable

See Also:
Serialized Form

Constructor Summary
WekaForecaster()
           
 
Method Summary
 void buildForecaster(Instances insts, java.io.PrintStream... progress)
          Builds a new forecasting model using the supplied training data.
 java.util.List<java.util.List<NumericPrediction>> forecast(int numSteps, java.io.PrintStream... progress)
          Produce a forecast for the target field(s).
 boolean getAddAMIndicator()
           
 boolean getAddDayOfWeek()
           
 boolean getAddMonthOfYear()
           
 boolean getAddQuarterOfYear()
           
 boolean getAddWeekendIndicator()
           
 java.lang.String getAlgorithmName()
          Provides a short name that describes the underlying algorithm in some way.
 Classifier getBaseForecaster()
           
 int getCalculateConfLimitsForForecasts()
           
 double getConfidenceLevel()
           
 java.lang.String[] getOptions()
          Gets the current settings of this Forecaster.
 java.lang.String getPrimaryPeriodicFieldName()
           
 java.lang.String getTimeStampField()
           
 TSLagMaker getTSLagMaker()
          Get the TSLagMaker that we are using.
 java.util.Enumeration<Option> listOptions()
          Returns an enumeration describing the available options.
static void main(java.lang.String[] args)
           
 void primeForecaster(Instances insts)
          Supply the (potentially) trained model with enough historical data, up to and including the current time point, in order to produce a forecast.
 void primeForecasterIncremental(Instance inst)
           
 void reset()
          Reset this forecaster so that it is ready to construct a new model.
 void setAddAMIndicator(boolean am)
           
 void setAddDayOfWeek(boolean d)
           
 void setAddMonthOfYear(boolean m)
           
 void setAddQuarterOfYear(boolean q)
           
 void setAddWeekendIndicator(boolean w)
           
 void setBaseForecaster(Classifier f)
           
 void setCalculateConfLimitsForForecasts(int steps)
           
 void setConfidenceLevel(double confLevel)
           
 void setFieldsToForecast(java.lang.String fieldsToForecast)
          Set the names of the fields/attributes in the data to forecast.
 void setOptions(java.lang.String[] options)
           
 void setPrimaryPeriodicFieldName(java.lang.String p)
           
 void setTimeStampField(java.lang.String name)
           
 void setTSLagMaker(TSLagMaker lagMaker)
          Set the TSLagMaker to use.
 java.lang.String toString()
           
 
Methods inherited from class weka.classifiers.timeseries.AbstractForecaster
getFieldsToForecast, makeCopy, run, runForecaster, stringToList
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WekaForecaster

public WekaForecaster()
Method Detail

getAlgorithmName

public java.lang.String getAlgorithmName()
Description copied from interface: TSForecaster
Provides a short name that describes the underlying algorithm in some way.

Specified by:
getAlgorithmName in interface TSForecaster
Returns:
a short description of this forecaster.

setTSLagMaker

public void setTSLagMaker(TSLagMaker lagMaker)
Description copied from interface: TSLagUser
Set the TSLagMaker to use.

Specified by:
setTSLagMaker in interface TSLagUser
Parameters:
lagMaker - the TSLagMaker to use.

getTSLagMaker

public TSLagMaker getTSLagMaker()
Description copied from interface: TSLagUser
Get the TSLagMaker that we are using.

Specified by:
getTSLagMaker in interface TSLagUser
Returns:
the TSLagMaker that we are using.

listOptions

public java.util.Enumeration<Option> listOptions()
Returns an enumeration describing the available options.

Specified by:
listOptions in interface OptionHandler
Returns:
an enumeration of all the available options.

setOptions

public void setOptions(java.lang.String[] options)
                throws java.lang.Exception
Specified by:
setOptions in interface OptionHandler
Throws:
java.lang.Exception

getOptions

public java.lang.String[] getOptions()
Gets the current settings of this Forecaster.

Specified by:
getOptions in interface OptionHandler
Returns:
an array of strings suitable for passing to setOptions

setFieldsToForecast

public void setFieldsToForecast(java.lang.String fieldsToForecast)
                         throws java.lang.Exception
Description copied from class: AbstractForecaster
Set the names of the fields/attributes in the data to forecast.

Specified by:
setFieldsToForecast in interface TSForecaster
Overrides:
setFieldsToForecast in class AbstractForecaster
Parameters:
fieldsToForecast - a list of names of fields to forecast
Throws:
java.lang.Exception - if a field(s) can't be found, or if multiple fields are specified and this forecaster can't predict multiple fields.

setTimeStampField

public void setTimeStampField(java.lang.String name)

getTimeStampField

public java.lang.String getTimeStampField()

setAddAMIndicator

public void setAddAMIndicator(boolean am)

getAddAMIndicator

public boolean getAddAMIndicator()

setAddDayOfWeek

public void setAddDayOfWeek(boolean d)

getAddDayOfWeek

public boolean getAddDayOfWeek()

setAddWeekendIndicator

public void setAddWeekendIndicator(boolean w)

getAddWeekendIndicator

public boolean getAddWeekendIndicator()

setAddMonthOfYear

public void setAddMonthOfYear(boolean m)

getAddMonthOfYear

public boolean getAddMonthOfYear()

setAddQuarterOfYear

public void setAddQuarterOfYear(boolean q)

getAddQuarterOfYear

public boolean getAddQuarterOfYear()

setPrimaryPeriodicFieldName

public void setPrimaryPeriodicFieldName(java.lang.String p)

getPrimaryPeriodicFieldName

public java.lang.String getPrimaryPeriodicFieldName()

setCalculateConfLimitsForForecasts

public void setCalculateConfLimitsForForecasts(int steps)

getCalculateConfLimitsForForecasts

public int getCalculateConfLimitsForForecasts()

setConfidenceLevel

public void setConfidenceLevel(double confLevel)

getConfidenceLevel

public double getConfidenceLevel()

setBaseForecaster

public void setBaseForecaster(Classifier f)

getBaseForecaster

public Classifier getBaseForecaster()

reset

public void reset()
Description copied from interface: TSForecaster
Reset this forecaster so that it is ready to construct a new model.

Specified by:
reset in interface TSForecaster

buildForecaster

public void buildForecaster(Instances insts,
                            java.io.PrintStream... progress)
                     throws java.lang.Exception
Description copied from class: AbstractForecaster
Builds a new forecasting model using the supplied training data. The instances in the data are assumed to be sorted in ascending order of time and equally spaced in time. Some methods may not need to implement this method and may instead do their work in the primeForecaster method.

Specified by:
buildForecaster in interface TSForecaster
Specified by:
buildForecaster in class AbstractForecaster
Parameters:
insts - the training instances.
progress - an optional varargs parameter supplying progress objects to report to
Throws:
java.lang.Exception - if the model can't be constructed for some reason.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

primeForecaster

public void primeForecaster(Instances insts)
                     throws java.lang.Exception
Description copied from class: AbstractForecaster
Supply the (potentially) trained model with enough historical data, up to and including the current time point, in order to produce a forecast. Instances are assumed to be sorted in ascending order of time and equally spaced in time.

Specified by:
primeForecaster in interface TSForecaster
Specified by:
primeForecaster in class AbstractForecaster
Parameters:
insts - the instances to prime the model with
Throws:
java.lang.Exception - if the model can't be primed for some reason.

primeForecasterIncremental

public void primeForecasterIncremental(Instance inst)
                                throws java.lang.Exception
Specified by:
primeForecasterIncremental in interface TSForecaster
Throws:
java.lang.Exception

forecast

public java.util.List<java.util.List<NumericPrediction>> forecast(int numSteps,
                                                                  java.io.PrintStream... progress)
                                                           throws java.lang.Exception
Description copied from class: AbstractForecaster
Produce a forecast for the target field(s). Assumes that the model has been built and/or primed so that a forecast can be generated.

Specified by:
forecast in interface TSForecaster
Specified by:
forecast in class AbstractForecaster
Parameters:
numSteps - number of forecasted values to produce for each target. E.g. a value of 5 would produce a prediction for t+1, t+2, ..., t+5.
progress - an optional varargs parameter supplying progress objects to report to
Returns:
a List of Lists (one for each step) of forecasted values for each target
Throws:
java.lang.Exception - if the forecast can't be produced for some reason.

main

public static void main(java.lang.String[] args)