@KFStep(name="TimeSeriesForecasting",
category="TimeSeries",
toolTipText="Encapsulates a time series forecasting model and uses it to produce forecasts given incoming historical data. Forecaster can optionally be rebuilt using the incoming data before a forecast is generated.",
iconPath="weka/gui/knowledgeflow/icons/DefaultClassifier.gif")
public class TimeSeriesForecasting
extends weka.knowledgeflow.steps.BaseStep
Constructor and Description |
---|
TimeSeriesForecasting() |
Modifier and Type | Method and Description |
---|---|
static String |
encodeForecasterToBase64(WekaForecaster model,
weka.core.Instances header)
Encode the model and header into a base 64 string.
|
String |
getArtificialTimeStartOffset()
Get the offset, from the value associated with the last training instance,
for the artificial time stamp.
|
String |
getCustomEditorForStep()
Get the fully qualified name of the GUI editor for this step
|
String |
getEncodedForecaster()
Gets the base 64 encoded forecaster
|
File |
getFilename()
Get the filename to load from.
|
WekaForecaster |
getForecaster()
Get the forecaster.
|
static List<Object> |
getForecaster(String base64encoded)
Decodes and returns a forecasting model (list containing the forecaster and
Instances object containing the structure of the data used to train the
forecaster) from a base 64 string.
|
List<String> |
getIncomingConnectionTypes() |
String |
getNumStepsToForecast()
Get the number of time steps to forecast beyond the end of the incoming
priming data.
|
List<String> |
getOutgoingConnectionTypes() |
boolean |
getRebuildForecaster()
Get whether the forecaster will be rebuilt/re-estimated on the incoming
data.
|
File |
getSaveFilename()
Get the name of the file to save the forecasting model to if the user has
opted to rebuild the forecaster using the incoming data.
|
static boolean |
isEmpty(String aString)
Utility method to check if a String is null or empty ("").
|
void |
processIncoming(weka.knowledgeflow.Data data) |
void |
setArtificialTimeStartOffset(String art)
Set the offset, from the value associated with the last training instance,
for the artificial time stamp.
|
void |
setEncodedForecaster(String encodedForecaster)
Set the base 64 encoded forecaster.
|
void |
setFilename(File filename)
Set the filename to load from.
|
void |
setNumStepsToForecast(String n)
Set the number of time steps to forecast beyond the end of the incoming
priming data.
|
void |
setRebuildForecaster(boolean rebuild)
Set whether the forecaster should be rebuilt/re-estimated on the incoming
data.
|
void |
setSaveFilename(File fileName)
Set the name of the file to save the forecasting model out to if the user
has opted to rebuild the forecaster using the incoming data.
|
void |
stepInit() |
environmentSubstitute, getDefaultSettings, getInteractiveViewers, getInteractiveViewersImpls, getName, getStepManager, globalInfo, isResourceIntensive, isStopRequested, outputStructureForConnectionType, setName, setStepIsResourceIntensive, setStepManager, setStepMustRunSingleThreaded, start, stepMustRunSingleThreaded, stop
@ProgrammaticProperty public void setEncodedForecaster(String encodedForecaster)
encodedForecaster
- a base 64 encoded Listpublic String getEncodedForecaster()
@OptionMetadata(displayName="Number of steps to forecast", description="The number of steps to forecast beyond the end of the incoming priming data. This will be ignored if the forecaster is using overlay data, as the number of instances for which overlay data is present (and targets are missing) in the incoming data will determine how many forecasted values are produced", displayOrder=0) public void setNumStepsToForecast(String n)
n
- the number of steps to forecast.public String getNumStepsToForecast()
@OptionMetadata(displayName="Artificial time start offset", description="Set the offset, from the value associated with the last training instance, for the artificial timestamp. Has no effect if an artificial timestamp is not in use by the forecaster. If in use, this needs to be set so that the forecaster knows what timestamp value corresponds to the first requested forecast (i.e. it should be equal to the number of recent historical priming instances that occur after the last training instance in time", displayOrder=1) public void setArtificialTimeStartOffset(String art)
art
- the offset from the last artificial time value in the training
data for which the forecast is requested.public String getArtificialTimeStartOffset()
@FilePropertyMetadata(fileChooserDialogType=0, directoriesOnly=false) @ProgrammaticProperty @OptionMetadata(displayName="File to load forecaster from", description="File to load a forecaster from at runtime", displayOrder=2) public void setFilename(File filename)
filename
- the filename to load frompublic File getFilename()
@FilePropertyMetadata(fileChooserDialogType=1, directoriesOnly=false) @OptionMetadata(displayName="File to save forecaster to", description="File to save forecaster to (only applies when rebuilding forecaster)", displayOrder=4) public void setSaveFilename(File fileName)
fileName
- the file name to save to.public File getSaveFilename()
@OptionMetadata(displayName="Rebuild forecaster", description="Rebuild forecaster on incoming data", displayOrder=3) public void setRebuildForecaster(boolean rebuild)
rebuild
- true if the forecaster should be rebuilt using the incoming
datapublic boolean getRebuildForecaster()
public void stepInit() throws weka.core.WekaException
weka.core.WekaException
public void processIncoming(weka.knowledgeflow.Data data) throws weka.core.WekaException
processIncoming
in interface weka.knowledgeflow.steps.BaseStepExtender
processIncoming
in interface weka.knowledgeflow.steps.Step
processIncoming
in class weka.knowledgeflow.steps.BaseStep
weka.core.WekaException
public WekaForecaster getForecaster() throws Exception
Exception
- if there is a problem loading the forecasterpublic static List<Object> getForecaster(String base64encoded) throws Exception
base64encoded
- a ListException
- if there is a problem decodingpublic static String encodeForecasterToBase64(WekaForecaster model, weka.core.Instances header) throws Exception
model
- the forecasting model to encodeheader
- empty instances object containing just the structure of the
data used to train the forecasterException
- if a problem occurs.public static boolean isEmpty(String aString)
aString
- the String to check.public String getCustomEditorForStep()
getCustomEditorForStep
in interface weka.knowledgeflow.steps.Step
getCustomEditorForStep
in class weka.knowledgeflow.steps.BaseStep
Copyright © 2019 University of Waikato, Hamilton, NZ. All Rights Reserved.