Operator VAR
SPL standard and specialized toolkits > com.ibm.streams.timeseries 3.1.0 > com.ibm.streams.timeseries.modeling > VAR
DEPRECATED: The com.ibm.streams.timeseries.modeling.VAR operator is deprecated and is replaced by the com.ibm.streams.timeseries.modeling.VAR2 operator. The deprecated operator might be removed in a future release.
The VAR operator tracks data movement and predicts the next expected time series by using a multivariate autoregressive model. The VAR operator can also perform Granger Causality test on predicted time series. The VAR operator can be used for short-term prediction, anomaly detection, and diagnostics (determining the which time series components are responsible for a particular outcome).
The VAR operator uses correlation to determine the movement of data points in the input time series and predict the next expected time series. The VAR operator is multivariate operator and expects a vector time series that is represented as a list. It takes a vector time series as input (a list of variables that share the same timestamp) and produces a vector time series as outputs. The operator uses early data to train the model as specified by using the initSamples parameter. The operator can be updated at run time by using the updateTime parameter. The VAR operator supports an optional control port that can used to control the behavior of the operator at run time.
Behavior in a consistent region
- The operator is not supported in a consistent region. A warning occurs when you compile your streams processing application.
- The operator cannot be the start of a consistent region. An error occurs when you compile your streams processing application.
Exceptions
The VAR operator throws an exception in the following case:
- The value of the initSamples parameter is 0.
- Examples
- These examples demonstrate how to use the VAR operator.
Summary
- Ports
- This operator has 2 input ports and 2 output ports.
- Windowing
- This operator does not accept any windowing configurations.
- Parameters
- This operator supports 9 parameters.
Required: inputTimeSeries
Optional: initSamples, updateTime, inputTimestamp, order, partitionBy, controlSignal, inputCoefficient, retrainingConfig
- Metrics
- This operator does not report any metrics.
Properties
- Implementation
- C++
- Threading
- Always - Operator always provides a single threaded execution context.
- Ports (0)
This port consumes data for training and scoring against the model. The inputTimeSeries parameter specifies the name of the attribute on this port that contains the time series data. The accepted data types are float64 and list<float64>.
- Properties
-
- Optional: false
- ControlPort: false
- TupleMutationAllowed: false
- WindowingMode: NonWindowed
- WindowPunctuationInputMode: Oblivious
- Ports (1)
This port accepts control signals to control the behavior of the operator. The controlSignal parameter specifies the name of the attribute on this port that contains the control signal type. The inputCoefficient parameter specifies the attribute name on this port that contains the new input coefficents. The retrainingConfig parameter specifies the attribute name on this port that contains the configuration values used for retraining the model.
- Properties
-
- Optional: true
- ControlPort: true
- TupleMutationAllowed: false
- WindowingMode: NonWindowed
- WindowPunctuationInputMode: Oblivious
- Assignments
- This operator allows any SPL expression of the correct type to be assigned to output attributes.
- Output Functions
-
- VAR_COF
-
- <any T> T predictedTimeSeries()
-
Returns the values of predicted time series data either as vector time series (list<float64>) or univariate time series (float64), depending on the input time series format.
- <any T> T predictedTimestamp()
-
Returns the predicted timestamp values. An output timestamp is produced only if the input timestamp is regular. Otherwise, a timestamp object with a value of 0 is returned, and a message is logged.
- <any T> T AsIs (T v)
-
The default function for output attributes. By default, this function assigns the output attribute to the value of the input attribute with the same name.
- Getcoeff
-
- map<uint32,map<uint32,list<float64> > > coefficients()
-
Submits a tuple that contains the VAR coefficients. This port submits a tuple each time a Monitor signal is consumed on the input control port. The coefficients() output function is used to assign the value of the coefficients to an attribute.
- <any T> T AsIs(T v)
-
The default function for output attributes. By default, this function assigns the output attribute to the value of the input attribute with the same name.
- map<uint32, list<uint32>> getGrangerCausality()
-
Returns Granger causality test results as a map. The key is the index of a focus time series (as represented in the input list) and the values are the set of indices of time series that has Granger-causal relationship with that key
- Ports (0)
-
This port submits a tuple that contains the next predicted value. This port submits a tuple each time a prediction is made. Custom output functions are used to specify the value of the output tuple attributes. The output tuple attributes whose assignments are not specified are assigned from input attributes.
- Properties
-
- Optional: false
- TupleMutationAllowed: false
- WindowPunctuationOutputMode: Preserving
- Ports (1)
-
This port submits a tuple that contains the coefficients that are used by the filter. This port submits a tuple each time a Monitor signal is consumed on the input control port. The coefficients() output function is used to assign the value of the coefficients to an attribute. The expected type of the attribute is map<uint32,map<uint32,list<float64>>>.
- Properties
-
- Optional: true
- TupleMutationAllowed: false
- WindowPunctuationOutputMode: Preserving
- inputTimeSeries
Specifies the name of the attribute that contains the time series data in the input tuple. The supported data types are float64 and list<float64>.
- Properties
-
- Type
- Cardinality: 1
- Optional: false
- ExpressionMode: Expression
- initSamples
Specifies the number of input time series values that are used to initialize the model. This value must be greater than 0.
- Properties
-
- Type: uint32
- Cardinality: 1
- Optional: true
- ExpressionMode: AttributeFree
- updateTime
Specifies the frequency at which the model is updated. For example, if the parameter value is 10u, each time 10 input time series are processed, the model is updated. If this parameter is not specified, the model can only be updated using the TSSignal.Retrain control signal.
- Properties
-
- Type: uint32
- Cardinality: 1
- Optional: true
- ExpressionMode: Expression
- inputTimestamp
Specifies the name of the attribute in the input stream that contains the timestamp values. The supported data types are uint64 and timestamp. If the data type is uint64, the parameter value represents the number of nanoseconds since UNIX epoch.
- Properties
-
- Type
- Cardinality: 1
- Optional: true
- ExpressionMode: Expression
- order
Specifies the order of the multivariate autoregressive model. The default value is 1u.
- Properties
-
- Type: uint32
- Cardinality: 1
- Optional: true
- ExpressionMode: Expression
- partitionBy
Specifies the name of the attribute that contains the key values that are associated with the time series values in the input tuple.
- Properties
-
- Type: rstring
- Optional: true
- ExpressionMode: Expression
- PortScope: 0, 1
- controlSignal
Specifies the name of the attribute in the control port, which holds the control signal. The supported control signals are: TSSignal.Retrain, TSSignal.Monitor, TSSignal.Load, TSSignal.Suspend, TSSignal.Resume.
- Properties
-
- Type: enum{Monitor,Load,Retrain,RetrainAll,Suspend,Resume,UpdateParamsAll}
- Cardinality: 1
- Optional: true
- ExpressionMode: Expression
- PortScope: 1
- inputCoefficient
Specifies the name of the attribute in the control port, which ingests the coefficients that are used for loading the model. If this parameter is not specified, by default, the inputCoefficient attribute is used. If the default attribute or the inputCoefficient parameter is not provided, the operator throws an exception. If the attribute or the parameter value does not contain valid coefficients, the load operation fails and the operator logs a warning message for each failed operation. The operator continues to predict values by using the older coefficients.
- Properties
-
- Type: map<uint32,map<uint32,list<float64>>>
- Cardinality: 1
- Optional: true
- ExpressionMode: Expression
- PortScope: 1
- retrainingConfig
Specifies the name of the attribute in the control port, which ingests the configurations that are used for retraining the model. If this parameter is not specified, by default, the retrainingConfig attribute is used. If the default attribute or the retrainingConfig parameter is not provided, the operator throws an exception. If the attribute or the parameter does not contain valid configurations, the retrain operation fails and the operator logs a warning message for each failed operation. The operator continues to predict values by using the older configuration.
- Properties
-
- Type: map<rstring,uint32>
- Cardinality: 1
- Optional: true
- ExpressionMode: Expression
- PortScope: 1
- VAR
-
stream<${schema}> ${outputStream} = VAR(${inputStream}) { param inputTimeSeries: ${timeSeriesExpression}; output ${outputStream}: ${outputExpression}; }
- No description for library.
- Library Name: tsatapi
- Library Path: ../../../impl/lib
- Include Path: ../../../impl/include