hanaml.AutoExponentialSmoothing {hana.ml.r}R Documentation

AutoExponentialSmoothing

Description

hanaml.AutoExpSmoothing is a R wrapper for PAL Auto Exp Smoothing algorithm.

Usage

hanaml.AutoExponentialSmoothing(conn.context,
                                data,
                                key = NULL,
                                endog = NULL,
                                model.selection = NULL,
                                forecast.model.name = NULL,
                                optimizer.time.budget = NULL,
                                max.iter = NULL,
                                optimizer.random.seed = NULL,
                                thread.ratio = NULL,
                                alpha = NULL,
                                beta = NULL,
                                gamma = NULL,
                                phi = NULL,
                                forecast.num = NULL,
                                seasonal.period = NULL,
                                seasonal = NULL,
                                initial.method = NULL,
                                training.ratio = NULL,
                                damped = NULL,
                                accuracy.measure = NULL,
                                seasonality.criterion = NULL,
                                trend.test.method = NULL,
                                trend.test.alpha = NULL,
                                alpha.min = NULL,
                                beta.min = NULL,
                                gamma.min = NULL,
                                phi.min = NULL,
                                alpha.max = NULL,
                                beta.max = NULL,
                                gamma.max = NULL,
                                phi.max = NULL,
                                prediction.confidence.1 = NULL,
                                prediction.confidence.2 = NULL,
                                level.start = NULL,
                                trend.start = NULL,
                                season.start = NULL)

Arguments

conn.context

ConnectionContext
The connection to the SAP HANA system.

data

DataFrame
DataFrame containing the data.

key

character, optional
Name of the ID column.
Defaults to the first column.

endog

character, optional
The endogenous variable, i.e. time series.
Defaults to the first non-ID column.

model.selection

logical, optional
- TRUE: the algorithm will select the best model among Single/Double/Triple/ Damped Double/Damped Triple Exponential Smoothing models.
- FALSE: the algorithm will not perform the model selection.
If forecast.model.name is set, the model defined by forecast.model.name will be used. Defaults to FALSE.

forecast.model.name

character, optional
Name of the statistical model used for calculating the forecast. - 'SESM': Single Exponential Smoothing
- 'DESM': Double Exponential Smoothing
- 'TESM': Triple Exponential Smoothing
This parameter must be set unless model.selection is set to TRUE.

optimizer.time.budget

integer, optional
Time budget for Nelder-Mead optimization process. The time unit is second and the value should be larger than zero.
Defaults to 1.

max.iter

integer, optional
Maximum number of iterations for simulated annealing. Defaults to 100.

optimizer.random.seed

integer, optional
Random seed for simulated annealing. The value should be larger than zero.
Defaults to system time.

thread.ratio

double, optional
Controls the proportion of available threads to use. The ratio of available threads. - 0: single thread.
- 0 ~ 1: percentage.
- Others: heuristically determined.
Defaults to 1.0.

alpha

double, optional
Weight for smoothing. Value range: 0 < alpha < 1.
Default value is computed automatically.

beta

double, optional
Weight for the trend component. Value range: 0 <= beta < 1.
If it is not set, the optimized value will be computed automatically. Only valid when the model is set by user or identified by the algorithm as a DESM/TESM. Value 0 is allowed under TESM model only.
Defaults value is computed automatically.

gamma

double, optional
Weight for the seasonal component. Value range: 0 < gamma < 1.
Only valid when the model is set by user or identified by the algorithm as TESM. Default value is computed automatically.

phi

double, optional
Value of the damped smoothing constant phi (0 < phi < 1).
Only valid when the model is set by user or identified by the algorithm as a damped model.
Default value is computed automatically.

forecast.num

integer, optional
Number of values to be forecast.
Defaults to 0.

seasonal.period

integer, optional
Length of a seasonal.period (L > 1).
For example, the seasonal.period of quarterly data is 4, and the seasonal.period of monthly data is 12.
Only valid when the model is set by user or identified by the algorithm as a TESM.
Default value is computed automatically.

seasonal

integer, optional
- 0: Multiplicative triple exponential smoothing.
- 1: Additive triple exponential smoothing.
Only valid when the model is set by user or identified by the algorithm as a TESM.
If model.selection is set to TRUE, the default value will be computed automatically.
Otherwise, the default value is 0.

initial.method

integer, optional
Initialization method for the trend and seasonal components.
Refer to Triple Exponential Smoothing for detailed information on initialization method.
Only valid when the model is set by user or identified by the algorithm as a TESM. When seasonal is set to 1, the default value of initial.method is 1;
When seasonal is set to 0, the default value of initial.method is 0.

training.ratio

double, optional
The ratio of training data to the whole time series.
Assuming the size of time series is N, and the training ratio is r, the first (N*r) time series is used to train, whereas only the latter N*(1-r) one is used to test. If this parameter is set to 0.0 or 1.0, or the resulting training data (N*r) is less than 1 or equal to the size of time series, no train-and-test procedure is carried out.
Defaults to 1.0.

damped

logical, optional
For Double ExponentialSmoothing DESM:
- FALSE: Uses the Holt's linear method.
- TRUE: Uses the additive damped trend Holt's linear method.
For Triple Exponential Smoothing TESM:
- FALSE: Uses the Holt Winter method.
- TRUE: Uses the additive damped seasonal Holt Winter method.
If model.selection is set to TRUE, the default value will be computed automatically. Otherwise, the default value is FALSE.

accuracy.measure

list('mse', 'mape'), optional
The criterion used for the optimization. Defaults to 'mse'.

seasonality.criterion

double, optional
The criterion of the auto-correlation coefficient for accepting seasonality, in the range of (0, 1). The larger it is, the less probable a time series is regarded to be seasonal.Only valid when forecast.model.name is 'TESM' or model.selection is set to TRUE, and seasonal.period is not defined.
Defaults to 0.5.

trend.test.method

integer, optional
- 1: MK test
- 2: Difference-sign test
Only valid when model.selection is set to TRUE.
Defaults to 1.

trend.test.alpha

double, optional
Tolerance probability for trend test. The value range is (0, 0.5).
Only valid when model.selection is set to TRUE.
Defaults to 0.05.

alpha.min

double, optional
Sets the minimum value of alpha.
Only valid when alpha is not defined.
Defaults to 0.0000000001.

beta.min

double, optional
Sets the minimum value of beta.
Only valid when beta is not defined.
Defaults to 0.0000000001.

gamma.min

double, optional
Sets the minimum value of gamma.
Only valid when gamma is not defined.
Defaults to 0.0000000001.

phi.min

double, optional
Sets the minimum value of phi. Only valid when phi is not defined.
Defaults to 0.0000000001.

alpha.max

double, optional
Sets the maximum value of alpha.
Only valid when alpha is not defined.
Defaults to 1.0.

beta.max

double, optional
Sets the maximum value of beta.
Only valid when beta is not defined.
Defaults to 1.0.

gamma.max

double, optional
Sets the maximum value of gamma.
Only valid when gamma is not defined.
Defaults to 1.0.

phi.max

double, optional
Sets the maximum value of phi.
Only valid when phi is not defined.
Defaults to 1.0.

prediction.confidence.1

double, optional
Prediction confidence for interval 1. Only valid when the upper and lower columns are provided in the result table.
Defaults to 0.8.

prediction.confidence.2

double, optional
Prediction confidence for interval 2. Only valid when the upper and lower columns are provided in the result table.
Defaults to 0.95.

level.start

double, optional
The initial value for level component S.
If this value is not provided, it will be calculated in the way as described in Triple Exponential Smoothing.
Notice that level.start cannot be zero. If it is set to zero, 0.0000000001 will be used instead.

trend.start

double, optional
The initial value for trend component B.
If this value is not provided, it will be calculated in the way as described in Triple Exponential Smoothing.
No default value.

season.start

tuple, optional
A list of initial values for seasonal component C. Two values must be provided for each cycle: - Cycle ID: An int which represents which cycle the initial value is used for.
- Initial value: A double precision number which represents the initial value for the corresponding cycle.
For example: To give the initial value 0.5 to the 3rd cycle, insert list of tuple [(3,5)] into the parameter table.
No default value.

Details

Auto exponential smoothing (previously named forecast smoothing) is used to calculate optimal parameters of a set of smoothing functions in PAL, including Single Exponential Smoothing, Double Exponential Smoothing, and Triple Exponential Smoothing.

Value

Return a list of two DataFrame:

Examples

## Not run: 
Input DataFrame data:
> data$Collect()
     ID RAWDATA
1   1     362
2   2     385
3   3     432
4   4     341
......
22 22     725
23 23     854
24 24     661

aesm <- hanaml.AutoExponentialSmoothing(conn.context = conn,
                                        data = data,
                                        forecast.model.name = 'TESM',
                                        alpha=0.4,
                                        gamma=0.4,
                                        forecast.num=3,
                                        seasonal=0,
                                        initial.method=1,
                                        training.ratio = 0.75)
Output:
> aesm[[2]]$Collect()
                 STAT_NAME        STAT_VALUE
1                      MSE  467.811415778471
2     NUMBER_OF_ITERATIONS               110
3  SA_NUMBER_OF_ITERATIONS               100
4  NM_NUMBER_OF_ITERATIONS                10
5        NM_EXECUTION_TIME          0.000171
6             SA_STOP_COND     MAX_ITERATION
7             NM_STOP_COND  ERROR_DIFFERENCE
8                    ALPHA               0.4
9                     BETA               0.4
10                   GAMMA               0.4
11                   CYCLE                 4
12      NUMBER_OF_TRAINING                18
13       NUMBER_OF_TESTING                 6
14                TEST_MSE 6353.632907713298

## End(Not run)

[Package hana.ml.r version 1.0.8 Index]