hanaml.UnifiedExponentialSmoothing.Rd
hanaml.UnifiedExponentialSmoothing is an R wrapper for SAP HANA PAL Unified Exponential Smoothing.
hanaml.UnifiedExponentialSmoothing(
data = NULL,
func = NULL,
key = NULL,
endog = NULL,
massive = FALSE,
group.key = NULL,
group.params = NULL,
...
)
DataFrame
DataFrame containting the data.
character
The name of a specified exponential smoothing algorithm.
Valid values are as follows:
"SESM" : Single Exponential Smoothing.
"DESM" : Double Exponential Smoothing.
"TESM" : Triple Exponential Smoothing.
"BESM" : Brown Exponential Smoothing.
"AESM" : Auto Exponential Smoothing.
character
Name of the ID column.
character, optional
The endogenous variable, i.e. time series.
Defaults to the first non-ID column.
logical, optional
Specifies whether or not to use massive mode.
For parameter setting in massive mode, you could use both
group.params (please see the example below) or the original parameters.
Using original parameters will apply for all groups. However, if you define some parameters of a group,
the value of all original parameter setting will be not applicable to such group.
msesm <- hanaml.UnifiedExponentialSmoothing(func = 'SESM',
data = data,
massive = TRUE,
group.key = 'GROUP_ID',
key = 'ID',
endog = 'RAWDATA',
adaptive.method=TRUE,
group.params = list(
'Group_2'=list(
'expost.flag'=FALSE)))
In this example, as 'expost.flag' is set in group.params for Group_2,
parameter setting of 'adaptive.method' is not applicable to Group_2.
Defaults to FALSE.
character, optional
The column of group key. The data type can be INT or NVARCHAR/VARCHAR.
If data type is INT, only parameters set in the group.params are valid.
This parameter is only valid when massive is TRUE.
Defaults to the first column of data if group.key is not provided.
list, optional
If massive mode is activated (massive = TRUE), the input data for exponential smoothing shall be divided into different
groups with different exponential smoothing parameters applied. group.params specifies the parameter
values of the chosen exponential smoothing algorithm func w.r.t. different groups in a list format,
where names of list corresponding to group.key while values should be a list for exponential smoothing algorithm
parameter value assignments.
For example, 'Group_1' and 'Group_2' are group ID:
msesm <- hanaml.UnifiedExponentialSmoothing(func = 'SESM',
data = data,
massive = TRUE,
group.key = 'GROUP_ID',
key = 'ID',
endog = 'RAWDATA',
group.params = list(
'Group_1'=list(
'adaptive.method'=FALSE,
'accuracy.measure'=list("mse", "mape"),
'alpha'=0.1,
'forecast.num'=12,
'expost.flag'=TRUE),
'Group_2'=list(
'adaptive.method'=TRUE,
'accuracy.measure'='MApe',
'alpha'=0.5,
'forecast.num'=12,
'expost.flag'=FALSE)))
Valid only when massive is TRUE. Defaults to NULL.
Specifies other parameters for a specific exponential smoothing function (not in massive mode).
Please see the documentation of corresponding functions for more details.hanaml.SingleExponentialSmoothing,
hanaml.DoubleExponentialSmoothing,
hanaml.TripleExponentialSmoothing,
hanaml.AutoExponentialSmoothing,
hanaml.BrownExponentialSmoothing
Returns a "hanaml.UnifiedExponentialSmoothing" object with the following attributes:
forecas DataFrame
Forecast values.
stats DataFrame
Statistics analysis content.
error.msg DataFrame
Error messages in the massive mode (massive=TRUE).
Case 1: hanaml.UnifiedExponentialSmoothing without massive mode:
Input DataFrame data:
> data$Collect()
ID RAWDATA
1 1 200.0
2 2 135.0
3 3 195.0
4 4 197.5
5 5 310.0
6 6 175.0
7 7 155.0
8 8 130.0
9 9 220.0
10 10 277.5
11 11 235.0
Create a "hanaml.UnifiedExponentialSmoothing" object sesm:
sesm <- hanaml.UnifiedExponentialSmoothing(func = "SESM",
data = data,
key = "ID",
endog = "RAWDATA",
accuracy.measure = list("mse","mpe"),
alpha = 0.1,
delta = NULL,
adaptive.method=NULL,
forecast.num = 12,
expost.flag = TRUE,
ignore.zero = NULL,
prediction.confidence.1 = 0.8,
prediction.confidence.2 = 0.95)
Output:
> sesm[[2]]$Collect()
STAT_NAME STAT_VALUE
1 MPE -0.05117142
2 MSE 3438.33212531
Case 2: hanaml.UnifiedExponentialSmoothing with massive mode:
Input DataFrame data:
> data$Collect()
GROUP_ID ID RAWDATA
1 Hello1 0 200.0
2 Hello1 1 135.0
3 Hello1 2 195.0
4 Hello1 3 197.5
5 Hello1 4 310.0
......
16 Hello2 5 0.0
17 Hello2 6 0.0
18 Hello2 7 0.0
19 Hello2 8 0.0
20 Hello2 9 0.0
21 Hello2 10 0.0
22 Hello2 11 0.0
Create a "hanaml.UnifiedExponentialSmoothing" object msesm:
msesm <- hanaml.UnifiedExponentialSmoothing(func = 'SESM',
data = data,
massive = TRUE,
group.key = 'GROUP_ID',
key = 'ID',
endog = 'RAWDATA',
group.params = list('Hello1'=list(
'adaptive.method'=FALSE,
'accuracy.measure'=list('mse', 'mape'),
'alpha'=0.1,
'forecast.num'=12,
'expost.flag'=TRUE),
'Hello2'=list(
'adaptive.method'=TRUE,
'accuracy.measure'='mape',
'alpha'=0.5,
'forecast.num'=12,
'expost.flag'=FALSE)))
Output:
> msesm$stats$Collect()
GROUP_ID STAT_NAME STAT_VALUE
1 Hello2 MAPE 0
2 Hello1 MAPE 0.2458362309905091
3 Hello1 MSE 3438.3321253085405
> msesm$forecast$Collect()
GROUP_ID TIMESTAMP VALUE PI1_LOWER PI1_UPPER PI2_LOWER PI2_UPPER REASON
1 Hello2 12 0.0000 0.0000 0.0000 0.00000 0.0000 <NA>
2 Hello2 13 0.0000 0.0000 0.0000 0.00000 0.0000 <NA>
3 Hello2 14 0.0000 0.0000 0.0000 0.00000 0.0000 <NA>
4 Hello2 15 0.0000 0.0000 0.0000 0.00000 0.0000 <NA>
......
33 Hello1 22 205.5561 122.8521 288.2602 79.07124 332.0410 <NA>
34 Hello1 23 205.5561 122.4770 288.6352 78.49761 332.6147 <NA>