gov.sandia.cognition.learning.algorithm
Class TimeSeriesPredictionLearner<InputType,OutputType,EvaluatorType extends Evaluator<? super InputType,? extends OutputType>>

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.learning.algorithm.TimeSeriesPredictionLearner<InputType,OutputType,EvaluatorType>
Type Parameters:
InputType - Type of inputs to the prediction engine.
OutputType - Type of outputs to predict from the prediction engine.
EvaluatorType - Type of evaluator produced by the learning algorithm.
All Implemented Interfaces:
BatchLearner<Collection<? extends InputOutputPair<? extends InputType,OutputType>>,EvaluatorType>, SupervisedBatchLearner<InputType,OutputType,EvaluatorType>, CloneableSerializable, Serializable, Cloneable

public class TimeSeriesPredictionLearner<InputType,OutputType,EvaluatorType extends Evaluator<? super InputType,? extends OutputType>>
extends AbstractCloneableSerializable
implements SupervisedBatchLearner<InputType,OutputType,EvaluatorType>

A learner used to predict the future of a sequence of data by wrapping another learner and created a future-aligned data set.

Since:
3.0
Author:
Kevin R. Dixon
See Also:
Serialized Form

Field Summary
static int DEFAULT_PREDICTION_HORIZON
          Default prediction horizon, 1.
 
Constructor Summary
TimeSeriesPredictionLearner()
          Default constructor
TimeSeriesPredictionLearner(int predictionHorizon)
          Creates a new instance of TimeSeriesPredictionLearner
TimeSeriesPredictionLearner(int predictionHorizon, SupervisedBatchLearner<InputType,OutputType,EvaluatorType> supervisedLearner)
          Creates a new instance of TimeSeriesPredictionLearner
 
Method Summary
static
<InputType,OutputType>
ArrayList<InputOutputPair<InputType,OutputType>>
createPredictionDataset(int predictionHorizon, Collection<? extends InputOutputPair<? extends InputType,OutputType>> data)
          Creates a dataset that can be used to predict the future by "predictionHorizon" samples.
 int getPredictionHorizon()
          Getter for predictionHorizon
 SupervisedBatchLearner<InputType,OutputType,EvaluatorType> getSupervisedLearner()
          Getter for supervisedLearner
 EvaluatorType learn(Collection<? extends InputOutputPair<? extends InputType,OutputType>> data)
          The learn method creates an object of ResultType using data of type DataType, using some form of "learning" algorithm.
 void setPredictionHorizon(int predictionHorizon)
          Setter for predictionHorizon
 void setSupervisedLearner(SupervisedBatchLearner<InputType,OutputType,EvaluatorType> supervisedLearner)
          Setter for supervisedLearner
 
Methods inherited from class gov.sandia.cognition.util.AbstractCloneableSerializable
clone
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gov.sandia.cognition.util.CloneableSerializable
clone
 

Field Detail

DEFAULT_PREDICTION_HORIZON

public static final int DEFAULT_PREDICTION_HORIZON
Default prediction horizon, 1.

See Also:
Constant Field Values
Constructor Detail

TimeSeriesPredictionLearner

public TimeSeriesPredictionLearner()
Default constructor


TimeSeriesPredictionLearner

public TimeSeriesPredictionLearner(int predictionHorizon)
Creates a new instance of TimeSeriesPredictionLearner

Parameters:
predictionHorizon - Number of samples into the future to predict.

TimeSeriesPredictionLearner

public TimeSeriesPredictionLearner(int predictionHorizon,
                                   SupervisedBatchLearner<InputType,OutputType,EvaluatorType> supervisedLearner)
Creates a new instance of TimeSeriesPredictionLearner

Parameters:
predictionHorizon - Number of samples into the future to predict.
supervisedLearner - Learning algorithm that does the heavy lifting.
Method Detail

getPredictionHorizon

public int getPredictionHorizon()
Getter for predictionHorizon

Returns:
Number of samples into the future to predict.

setPredictionHorizon

public void setPredictionHorizon(int predictionHorizon)
Setter for predictionHorizon

Parameters:
predictionHorizon - Number of samples into the future to predict.

getSupervisedLearner

public SupervisedBatchLearner<InputType,OutputType,EvaluatorType> getSupervisedLearner()
Getter for supervisedLearner

Returns:
Learning algorithm that does the heavy lifting.

setSupervisedLearner

public void setSupervisedLearner(SupervisedBatchLearner<InputType,OutputType,EvaluatorType> supervisedLearner)
Setter for supervisedLearner

Parameters:
supervisedLearner - Learning algorithm that does the heavy lifting.

learn

public EvaluatorType learn(Collection<? extends InputOutputPair<? extends InputType,OutputType>> data)
Description copied from interface: BatchLearner
The learn method creates an object of ResultType using data of type DataType, using some form of "learning" algorithm.

Specified by:
learn in interface BatchLearner<Collection<? extends InputOutputPair<? extends InputType,OutputType>>,EvaluatorType extends Evaluator<? super InputType,? extends OutputType>>
Parameters:
data - The data that the learning algorithm will use to create an object of ResultType.
Returns:
The object that is created based on the given data using the learning algorithm.

createPredictionDataset

public static <InputType,OutputType> ArrayList<InputOutputPair<InputType,OutputType>> createPredictionDataset(int predictionHorizon,
                                                                                                              Collection<? extends InputOutputPair<? extends InputType,OutputType>> data)
Creates a dataset that can be used to predict the future by "predictionHorizon" samples. This is done by lagging the inputs to align with those into the future. Thus, the resulting Collection will have a size of "predictionHorizon" shorter than the given "data".

Type Parameters:
InputType - Type of inputs to the prediction engine.
OutputType - Type of outputs to predict from the prediction engine.
Parameters:
predictionHorizon - Number of samples into the future to predict.
data - Data to align for predicting into the future.
Returns:
Dataset, aligned to predict into the future, that is "predictionHorizon" samples shorter than the given "data".