hanaml.AdditiveModelForecast is a R wrapper
for SAP HANA PAL additive model forecast algorithm.
hanaml.AdditiveModelForecast(
data = NULL,
holiday = NULL,
growth = NULL,
logistic.growth.capacity = NULL,
seasonality.mode = NULL,
seasonality = NULL,
num.changepoints = NULL,
changepoint.range = NULL,
regressor = NULL,
changepoints = NULL,
yearly.seasonality = NULL,
weekly.seasonality = NULL,
daily.seasonality = NULL,
seasonality.prior.scale = NULL,
holiday.prior.scale = NULL,
changepoint.prior.scale = NULL,
categorical.variable = NULL
)
Arguments
| data |
DataFrame
Input data. The structure is as follows.
The first column: index (ID), timestamp.
The second column: raw data.
Other columns:: other regressors' data.
|
| holiday |
DataFrame
Input holiday data. The structure is as follows.
The first column: index (ID), timestamp.
The second column: name, varchar.
The third column:: lower window of holiday, int.
The last column:: upper window of holiday, int.
|
| growth |
{"linear", "logistic"}, optional
Specify a trend, which could be either linear or logistic.
Defaults to "linear".
|
| logistic.growth.capacity |
numeric, optional
Specify the carrying capacity for logistic growth.
|
| seasonality.mode |
{"additive", "multiplicative"}, optional
Mode for seasonality, either additive or muliplicative.
|
| seasonality |
character, optional
Add seasonality to model, is a json format, include NAME, PERIOD, FOURIER.ORDER, PRIOR.SCALE,MODE,\
for example: ' "NAME": "MONTHLY", "PERIOD":30, "FOURIER.ORDER":5 '.
|
| num.changepoints |
integer, optional
Number of potential changepoints.
Defaults to 25 if not provided.
|
| changepoint.range |
numeric, optional
Proportion of history in which trend changepoints will be estimated.
Defaults to 0.8.
|
| regressor |
character or list of characters, optional
Specify the regressor, include PRIOR.SCALE, STANDARDIZE, and MODE, which is json format.
For example, regressor = ' "NAME": "X1", "PRIOR_SCALE":4, "MODE": "additive" '.
Defaults to NULL.
|
| changepoints |
character or list of characters, optional
Specify a list of changepoints in the format of timestamp,
such as changepoints = list("2019-01-01 00:00:00", "2019-02-04 00:00:00").
Defaults to NULL.
|
| yearly.seasonality |
{"auto", "false", "true"}, optional
Specify whether or not to fit yearly seasonality.
"false" and "true" simply corresponds to their logical meaning, while "auto" means automatically determined from the input data.
Defaults to "auto".
|
| weekly.seasonality |
{"auto", "false", "true"}, optional
Specify whether or not to fit the weekly seasonality.
"auto" means automatically determined from input data.
Defaults to "auto".
|
| daily.seasonality |
{"auto", "false", "true"}, optional
Specify whether or not to fit the daily seasonality.
"auto" means automatically determined from input data.
Defaults to "auto".
|
| seasonality.prior.scale |
numeric, optional
Parameter modulating the strength of the seasonality model.
Defaults to 10 if not provided.
|
| holiday.prior.scale |
numeric, optional
Parameter modulating the strength of the holiday components model.
Defaults to 10 if not provided.
|
| changepoint.prior.scale |
numeric, optional
Parameter modulating the flexibility of the automatic changepoint selection.
Defaults to 0.05 if not provided.
|
| categorical.variable |
character or list/vector of characters, optional
Indicate which variables are treated as categorical. The default behavior is:
VALID only for variables of "INTEGER","VARCHAR" and "NVARCHAR" type, omitted otherwise.
No default value. |
Value
Returns an "AdditiveModelForecast" object with following values:
Details
Additive Model Forecast use a decomposable time series model
with three main components: trend, seasonality, and holidays or event.
Examples
Input DataFrame data:
> data$Collect()
TIMESTAMP Y
1 2007-12-11 -0.6361264
2 2007-12-12 3.0925087
3 2007-12-13 -0.7373356
4 2007-12-14 -3.1421910
Call the function:
> amf <- hanaml.AdditiveModelForecast(data = amf.df,
yearly.seasonality = "auto",
weekly.seasonality = "auto",
daily.seasonality = "auto")
Output:
> amf$model$Collect()
ROW_INDEX
1 0
MODEL_CONTENT
1 {"FLOOR":0.0,"GROWTH":"linear","SEASONALITY_MODE":"additive","beta":[[0.0]],"changepoints_t":[[0.3333333333333333,0.6666666666666666]],"delta":[[3.606905203289095e-10,2.161407465026720e-10]],"holidays_prior_scale":10.0,"k":-0.692426758115090,"m":0.04386341358443890,"sigma_obs":0.5074218980767474,"start":"2007-12-11 00:00:00.0000000","t_scale":259200.0,"y_scale":3.1421909830}\n
See also