public class TSEvaluation extends Object
Constructor and Description |
---|
TSEvaluation(weka.core.Instances trainingData,
double testSplitSize)
Constructor.
|
TSEvaluation(weka.core.Instances trainingData,
weka.core.Instances testData)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
evaluateForecaster(TSForecaster forecaster,
boolean buildModel,
PrintStream... progress)
Evaluate a forecaster on training and/or test data.
|
void |
evaluateForecaster(TSForecaster forecaster,
PrintStream... progress)
Evaluate the supplied forecaster.
|
static void |
evaluateForecaster(TSForecaster forecaster,
String[] options)
Evaluate the supplied forecaster using the supplied command-line options.
|
boolean |
getEvaluateOnTestData()
Get whether evaluation is to be performed on the test data.
|
boolean |
getEvaluateOnTrainingData()
Get whether evaluation is to be performed on the training data
|
List<TSEvalModule> |
getEvaluationModules()
Get the evaluation modules in use
|
boolean |
getForecastFuture()
Get whether future forecasts beyond the end of the training and/or test
data will be generated.
|
ErrorModule |
getPredictionsForTestData(int stepNumber)
Get predictions for all targets for the specified step number on the test
data
|
ErrorModule |
getPredictionsForTrainingData(int stepNumber)
Get predictions for all targets for the specified step number on the
training data
|
boolean |
getPrimeForTestDataWithTestData()
Gets whether evaluation for the test data will begin by priming with the
first x instances from the test data and then forecasting from step x + 1.
|
int |
getPrimeWindowSize()
Get the size of the priming window - i.e.
|
weka.core.Instances |
getTestData()
Get the test data (if any)
|
weka.core.Instances |
getTrainingData()
Get the training data (if any)
|
JPanel |
graphFutureForecastOnTesting(GraphDriver driver,
TSForecaster forecaster,
List<String> targetNames)
Graph historical and future forecasted values using a graph driver for the
test.
|
JPanel |
graphFutureForecastOnTraining(GraphDriver driver,
TSForecaster forecaster,
List<String> targetNames)
Graph historical and future forecasted values using a graph driver for the
training data.
|
JPanel |
graphPredictionsForStepsOnTesting(GraphDriver driver,
TSForecaster forecaster,
String targetName,
List<Integer> stepsToPlot,
int instanceNumberOffset)
Graph predicted values at the given step-ahead levels for a single target
on the test data.
|
JPanel |
graphPredictionsForStepsOnTraining(GraphDriver driver,
TSForecaster forecaster,
String targetName,
List<Integer> stepsToPlot,
int instanceNumberOffset)
Graph predicted values at the given step-ahead levels for a single target
on the training data.
|
JPanel |
graphPredictionsForTargetsOnTesting(GraphDriver driver,
TSForecaster forecaster,
List<String> graphTargets,
int graphStepNum,
int primeWindowSize)
Graph predicted values at the given step-ahead level for the supplied
targets on the test data.
|
JPanel |
graphPredictionsForTargetsOnTraining(GraphDriver driver,
TSForecaster forecaster,
List<String> graphTargets,
int graphStepNum,
int instanceNumberOffset)
Graph predicted values at the given step-ahead level for the supplied
targets on the training data.
|
String |
printFutureTestForecast(TSForecaster forecaster)
Print the target values from the test data followed by the future forecast
from the end of the test data.
|
String |
printFutureTrainingForecast(TSForecaster forecaster)
Print the forecasted values (for all targets) beyond the end of the
training data
|
String |
printPredictionsForTestData(String title,
String targetName,
int stepAhead)
Print the predictions for a given target at a given step-ahead level on the
training data.
|
String |
printPredictionsForTestData(String title,
String targetName,
int stepAhead,
int instanceNumberOffset)
Print the predictions for a given target at a given step-ahead level from a
given offset on the training data.
|
String |
printPredictionsForTrainingData(String title,
String targetName,
int stepAhead)
Print the predictions for a given target at a given step-ahead level on the
training data.
|
String |
printPredictionsForTrainingData(String title,
String targetName,
int stepAhead,
int instanceNumberOffset)
Print the predictions for a given target at a given step-ahead level from a
given offset on the training data.
|
void |
setEvaluateOnTestData(boolean evalOnTest)
Set whether to perform evaluation on the training data
|
void |
setEvaluateOnTrainingData(boolean evalOnTraining)
Set whether to perform evaluation on the training data
|
void |
setEvaluationModules(String evalModNames)
Set the evaluation modules to use/
|
void |
setForecastFuture(boolean future)
Set whether we should generate a future forecast beyond the end of the
training and/or test data.
|
void |
setHorizon(int horizon)
Set the horizon - i.e.
|
void |
setPrimeForTestDataWithTestData(boolean p)
Set whether evaluation for test data should begin by priming with the first
x test data instances and then forecasting from step x + 1.
|
void |
setPrimeWindowSize(int primeSize)
Set the size of the priming window - i.e.
|
void |
setRebuildModelAfterEachTestForecastStep(boolean r)
Set whether the forecasting model should be rebuilt after each forecasting
step on the test data using both the training data and test data up to the
current instance.
|
void |
setTestData(weka.core.Instances testData)
Set the test data to use
|
void |
setTrainingData(weka.core.Instances train)
Set the training data to use
|
String |
toSummaryString()
Generates a String containing the results of evaluating the forecaster.
|
public TSEvaluation(weka.core.Instances trainingData, double testSplitSize) throws Exception
trainingData
- the training datatestSplitSize
- the number or percentage of instances to hold out from
the end of the training data to be test data.Exception
- if a problem occurs.public void setTrainingData(weka.core.Instances train)
train
- the training data to usepublic void setTestData(weka.core.Instances testData)
testData
- the test data to usepublic weka.core.Instances getTrainingData()
public weka.core.Instances getTestData()
public void setEvaluateOnTrainingData(boolean evalOnTraining)
evalOnTraining
- true if evaluation is to be performed on the training
datapublic boolean getEvaluateOnTrainingData()
public void setEvaluateOnTestData(boolean evalOnTest)
evalOnTest
- true if evalution is to be performed on the training datapublic boolean getEvaluateOnTestData()
public void setHorizon(int horizon)
horizon
- the number of steps to forecast into the futurepublic void setPrimeWindowSize(int primeSize)
primeSize
- the number of instances to prime withpublic int getPrimeWindowSize()
public void setPrimeForTestDataWithTestData(boolean p)
p
- true if we should start evaluation of the test data by priming
with the first instances from the test data.public boolean getPrimeForTestDataWithTestData()
public void setRebuildModelAfterEachTestForecastStep(boolean r)
r
- true if the forecasting model should be rebuilt after each
forecasting step on the test data to take into account all data up
to the current point in timepublic void setForecastFuture(boolean future)
future
- true if future forecasts beyond the end of training/test data
should be generated.public boolean getForecastFuture()
public void setEvaluationModules(String evalModNames) throws Exception
evalModNames
- a comma-separated list of evaluation module names.Exception
- if there are unknown evaluation modules requested.public List<TSEvalModule> getEvaluationModules()
public ErrorModule getPredictionsForTrainingData(int stepNumber) throws Exception
stepNumber
- number of the step into the future to return predictions
forException
- if there are no predictions available for the training
datapublic ErrorModule getPredictionsForTestData(int stepNumber) throws Exception
stepNumber
- number of the step into the future to return predictions
forException
- if there are no predictions available for the test datapublic void evaluateForecaster(TSForecaster forecaster, PrintStream... progress) throws Exception
forecaster
- the forecaster to evaluateException
- if something goes wrong during evaluationpublic void evaluateForecaster(TSForecaster forecaster, boolean buildModel, PrintStream... progress) throws Exception
forecaster
- the forecaster to evaluatebuildModel
- true if the model is to be built (given that there is a
training data set to build it with)Exception
- if something goes wrong during evaluationpublic static void evaluateForecaster(TSForecaster forecaster, String[] options) throws Exception
forecaster
- the forecaster to evaluateoptions
- an array of command-line optionsException
- if a problem occurs during evaluationpublic String printFutureTestForecast(TSForecaster forecaster) throws Exception
forecaster
- the forecaster in useException
- if something goes wrong.public String printFutureTrainingForecast(TSForecaster forecaster) throws Exception
forecaster
- the forecasterException
public JPanel graphFutureForecastOnTraining(GraphDriver driver, TSForecaster forecaster, List<String> targetNames) throws Exception
driver
- the graph driver to graph withforecaster
- the forecaster in usetargetNames
- the names of the targets to graphException
- if a problem occurs during graphingpublic JPanel graphFutureForecastOnTesting(GraphDriver driver, TSForecaster forecaster, List<String> targetNames) throws Exception
driver
- the graph driver to graph withforecaster
- the forecaster in usetargetNames
- the names of the targets to graphException
- if a problem occurs during graphingpublic JPanel graphPredictionsForStepsOnTraining(GraphDriver driver, TSForecaster forecaster, String targetName, List<Integer> stepsToPlot, int instanceNumberOffset) throws Exception
driver
- the graph driver to graph withforecaster
- the forecaster in usetargetName
- the target to plotstepsToPlot
- a list of steps at which to plot the predicted target
values - e.g. 3,4,5 would plot 3-step-ahead, 4-step-ahead and
5-step-ahead predictionsException
- if a problem occurs during graphingpublic JPanel graphPredictionsForStepsOnTesting(GraphDriver driver, TSForecaster forecaster, String targetName, List<Integer> stepsToPlot, int instanceNumberOffset) throws Exception
driver
- the graph driver to graph withforecaster
- the forecaster in usetargetName
- the target to plotstepsToPlot
- a list of steps at which to plot the predicted target
values - e.g. 3,4,5 would plot 3-step-ahead, 4-step-ahead and
5-step-ahead predictionsException
- if a problem occurs during graphingpublic JPanel graphPredictionsForTargetsOnTraining(GraphDriver driver, TSForecaster forecaster, List<String> graphTargets, int graphStepNum, int instanceNumberOffset) throws Exception
driver
- the graph driver to graph withforecaster
- the forecaster in usegraphTargets
- a list of targets to plotgraphStepNum
- the step at which to plot the targets - e.g. 4 would
result in a graph of the 4-step-ahead predictions for the targetsException
- if a problem occurs during graphingpublic JPanel graphPredictionsForTargetsOnTesting(GraphDriver driver, TSForecaster forecaster, List<String> graphTargets, int graphStepNum, int primeWindowSize) throws Exception
driver
- the graph driver to graph withforecaster
- the forecaster in usegraphTargets
- a list of targets to plotgraphStepNum
- the step at which to plot the targets - e.g. 4 would
result in a graph of the 4-step-ahead predictions for the targetsException
- if a problem occurs during graphingpublic String printPredictionsForTrainingData(String title, String targetName, int stepAhead) throws Exception
title
- a title for the outputtargetName
- the name of the target to print predictions forstepAhead
- the step-ahead level - e.g. 3 would print the 3-step-ahead
predictionsException
- if the predictions can't be printed for some reason.public String printPredictionsForTrainingData(String title, String targetName, int stepAhead, int instanceNumberOffset) throws Exception
title
- a title for the outputtargetName
- the name of the target to print predictions forstepAhead
- the step-ahead level - e.g. 3 would print the 3-step-ahead
predictionsinstanceNumberOffset
- the offset from the start of the training data
from which to print actual and predicted valuesException
- if the predictions can't be printed for some reason.public String printPredictionsForTestData(String title, String targetName, int stepAhead) throws Exception
title
- a title for the outputtargetName
- the name of the target to print predictions forstepAhead
- the step-ahead level - e.g. 3 would print the 3-step-ahead
predictionsException
- if the predictions can't be printed for some reason.public String printPredictionsForTestData(String title, String targetName, int stepAhead, int instanceNumberOffset) throws Exception
title
- a title for the outputtargetName
- the name of the target to print predictions forstepAhead
- the step-ahead level - e.g. 3 would print the 3-step-ahead
predictionsinstanceNumberOffset
- the offset from the start of the training data
from which to print actual and predicted valuesException
- if the predictions can't be printed for some reason.Copyright © 2019 University of Waikato, Hamilton, NZ. All Rights Reserved.