OnlineARIMA
- class hana_ml.algorithms.pal.tsa.online_algorithms.OnlineARIMA(order=None, learning_rate=None, epsilon=None, output_fitted=True, random_state=None, random_initialization=None)
Online Autoregressive Integrated Moving Average ARIMA(p, d, q) model.
- Parameters:
- order(p, d, m), tuple of int, optional
p: value of the auto regression order.
d: value of the differentiation order.
m: extended order needed to transform all moving-averaging term to AR term.
Defaults to (1, 0, 0).
- learning_ratefloat, optional
Learning rate. Must be greater than zero.
Calculated according to order(p, d, m).
- epsilonfloat, optional
Convergence criterion.
Calculated according to learning_rate, p and m in the order.
- output_fittedbool, optional
Output fitted result and residuals if True. Defaults to True.
- random_stateint, optional
Specifies the seed for random number generator.
0: use the current time (in second) as seed
Others: use the specified value as seed.
Default to 0.
- random_initializationbool, optional
Whether randomly generate initial state
False: set all to zero
True: use random values
Defaults to False.
- Attributes:
- model_DataFrame
Model content.
- fitted_DateFrame
Fitted values and residuals.
Methods
partial_fit
(data[, key, endog])Generates ARIMA models with given orders.
predict
([forecast_length, allow_new_index])Makes time series forecast based on the estimated online ARIMA model.
set_conn
(connection_context)Set connection context for OnlineARIMA instance.
- set_conn(connection_context)
Set connection context for OnlineARIMA instance.
- Parameters:
- connection_contextConnectionContext
The connection to the SAP HANA system.
- Returns:
- None.
- partial_fit(data, key=None, endog=None, **kwargs)
Generates ARIMA models with given orders.
- Parameters:
- dataDataFrame
DataFrame containing the data.
- keystr, optional
The timestamp column of data. The type of key column is int.
Defaults to the first column of data if the index column of data is not provided. Otherwise, defaults to the index column of data.
- endogstr, optional
The endogenous variable, i.e. time series.
Defaults to the first non-key column of data if not provided.
- **kwargskeyword arguments, optional
The value of
learning_rate
andepsilon
could be reset in the model.For example, assume we have a OnlineARIMA object oa and we want to reset the value of
learning_rate
in the new training, then we can run>>> oa.partial_fit(new_data, learning_rate=0.02)
- Returns:
- A fitted object of class "OnlineARIMA".
- predict(forecast_length=None, allow_new_index=False)
Makes time series forecast based on the estimated online ARIMA model.
- Parameters:
- forecast_lengthint, optional
Forecast horizon, i.e. number of future points to forecast.
Defaults to 1.
- allow_new_indexbool, optional
Indicates whether a new index column is allowed in the result.
True: return the result with new integer or timestamp index column.
False: return the result with index column starting from 0.
Defaults to False.
- Returns:
- DataFrame
Prediction result, i.e. forecasted values within specified horizon, structured as follows:
1st column : timestamp
2nd column : forecast value
- property fit_hdbprocedure
Returns the generated hdbprocedure for fit.
- property predict_hdbprocedure
Returns the generated hdbprocedure for predict.
Inherited Methods from PALBase
Besides those methods mentioned above, the OnlineARIMA class also inherits methods from PALBase class, please refer to PAL Base for more details.