Examples
These examples demonstrate how to use the VAR2 operator.
The following example demonstrates multivariate prediction of IBM stock prices and trading volumes:
use com.teracloud.streams.timeseries.modeling::VAR2;
composite Main
{
graph
stream<list<float64> inp> StockInp = FileSource()
{
param
file: "stockInp.csv"; // read stock data
format: csv;
initDelay: 1.0f;
}
stream<list<float64> predictions> varOut = VAR2(stockIp)
{
param
inputTimeSeries:inp; //time series to be predicted
initSamples:12u; // use 12 early data to train the model
updateTime:6u; //update the model every 6 samples
output
varOut: predictions=predictedTimeSeries(); // get prediction value for all time series component
}
() as FlSnk=FileSink(varOut)
{
param
file:"Decomposition.dat";
}
}
The following graphs illustrate the actual and predicted stock prices and trade volumes for a sample time series:

