Operator ARIMA2

Primitive operator image not displayed. Problem loading file: ../../image/tk$com.teracloud.streams.timeseries/op$com.teracloud.streams.timeseries.modeling$ARIMA2.svg

The ARIMA2 operator implements the autoregressive integrated moving average (ARIMA) modeling algorithm. It is a widely used algorithm for time series forecasting. It can be used for short-term or long-term forecasting.

The autoregressive integrated moving average algorithm consists of an autoregressive (AR) component, an integrator (I) component and moving average (MA) component. The operator initializes in real-time, based on the operator parameter values. You can specify some constraint on the model explicitly as parameter values, or let the operator estimate the model from early data by specifying only initsamples.

ARIMA2 is univariate operator and can ingest univariate and vector time series. The operator accepts time series in the following format:

  • A univariate time series as a tuple<float64>.
  • A vector time series as a tuple<list<float64>>.

The ARIMA2 operator provides two ways of getting the forecasted time series values and timestamp values. It can forecast a value at a single point in a future or it can provide a range of forecasts up to a point in time in the future.

Behavior in a consistent region

  • The operator cannot be the start of a consistent region. An error occurs when you compile your streams processing application.

Exceptions

The ARIMA operator throws an exception in the following cases:

  • The initSamples parameter value is 0.
Examples

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 10 parameters.

Required: initSamples, inputTimeSeries

Optional: AROrder, MAOrder, controlPartitionBy, controlSignal, inputTimestamp, partitionBy, stepAhead, updateParams

Metrics
This operator does not report any metrics.

Properties

Implementation
C++
Threading
Never - Operator never provides a single threaded execution context.

Input Ports

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

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 controlPartitionBy parameter specifies the name of the attribute that represents the partitioning key for the control port. The updateParams parameter specifies the attribute name on this port that contains the new stepAhead and initSamples values. that are used for retraining the model.

Properties

Output Ports

Assignments
This operator allows any SPL expression of the correct type to be assigned to output attributes.
Output Functions
ARIMAOutput
<any T> T forecastedTimeSeriesStep()

This function returns the forecasted time series value at step n, where n is the same as the stepAhead parameter value. The return type for this function can be either float64 or list<float64>, depending on the type of the attribute specified by the inputTimeSeries parameter. For example, if the inputTimeSeries parameter specifies an attribute whose type is float64, the return type is float64. Likewise, if the inputTimeSeries parameter specifies an attribute whose type is list<float64>, the return type is list<float64>.

<any T> list<T> forecastedAllTimeSeriesSteps()

This function returns a list of forecasted time series values from step 1 to step n, where n is the same as the stepAhead parameter. The return type for this function can be either list<float64> or list<list<float64>>, depending on the type of the attribute specified by the inputTimeSeries parameter. For example, if the inputTimeSeries parameter specifies an attribute whose type is float64, the return type is list<float64>. Likewise, if the inputTimeSeries parameter specifies an attribute whose type is list<float64>, the return type is list<list<float64>>.

<any T> T forecastedTimestamp()

This function returns the forecasted timestamp value at step n, where n is the same as the stepAhead parameter value. The return type for this function can be either SPL::timestamp or uint64, depending on the type of the attribute that is specified by the inputTimestamp parameter.

<any T> list<T> forecastedAllTimestamps()

This function returns a list of forecasted timestamp values from step 1 to step n, where n is the same as the stepAhead parameter. The return type for this function can be either list<timestamp> or list<uint64>, depending on the type of the attribute specified by the inputTimestamp parameter.

<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.

ARIMAMonitorOutput
map<rstring, list<list<float64> > > getCoefficients()

<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.

Ports (0)

This port submits a tuple that contains the forecasted value for the timeseries. This port submits a tuple each time a forecast is calculated. 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

Ports (1)

Properties

Parameters

Required: initSamples, inputTimeSeries

Optional: AROrder, MAOrder, controlPartitionBy, controlSignal, inputTimestamp, partitionBy, stepAhead, updateParams

AROrder

This parameter of type uint32 specifies the order that the autoregressive model uses to make the prediction. The default value is 0u.

Properties

MAOrder

This parameter of type uint32 specifies the order that the moving average model uses to make the prediction. The default value is 1u. This parameter is valid only when initSamples parameter is specified.

Properties

controlPartitionBy

Specifies the name of the attribute that contains the key values that are associated with the time series values in the input tuple on the control port.

Properties

controlSignal

Specifies an attribute expression that specifies the name of the attribute in the control port, which holds the control signal. The supported control signals are: TSSignal.Retrain, TSSignal.RetrainAll, TSSignal.UpdateParamsAll.

Properties

initSamples

The parameter of type uint32 triggers the autoregressive parameter estimation mode. This parameter value specifies the number of input time series values to be used for the initialization of model.

Properties

inputTimeSeries

Specifies the name of the attribute that contains the time series data in the input stream. The supported data types are float64 and list<float64>.

Properties

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, then the parameter value represents the number of nanoseconds since UNIX epoch.

Properties

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

stepAhead

Specifies the forecast horizon in the sample. The default value is 1u. The parameter value specifies the future time series value to be predicted. If the value is 1u, then the algorithm predicts the next time series value. If the value is 2u, then the algorithm predicts the time series value two steps ahead.

Properties

updateParams

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. The supported type is map<rstring,uint32>.

Properties

Code Templates

ARIMA2

stream<${schema}> ${outputStream} = ARIMA2(${inputStream}) 
{
	param
		inputTimeSeries:		${timeSeriesExpression};
		initSamples: 		${initSamplesExpression};
		stepAhead: 		${stepAheadExpression};

	output
		${outputStream}: ${outputExpression};
}
      

Libraries

No description for library.
Library Name: watfore
Library Path: ../../../impl/lib/
Include Path: ../../../impl/include/
No description for library.
Library Name: utils
Library Path: ../../../impl/lib/
Include Path: ../../../impl/include/
No description for library.
Library Name: tstimelag
Library Path: ../../../impl/lib/
Include Path: ../../../impl/include/