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

Croston

Description

hanaml.Croston is a R wrapper for PAL Croston Exponential Smoothing algorithm.

Usage

hanaml.Croston (conn.context,
                data,
                key = NULL,
                endog = NULL,
                alpha = NULL,
                forecast.num = NULL,
                method = NULL,
                accuracy.measure = NULL,
                ignore.zero = NULL,
                expost.flag = 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.

alpha

double, optional
Value of the smoothing constant alpha (0 < alpha < 1).
Defaults to 0.1.

forecast.num

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

method

character, optional
- 'sporadic': Use the sporadic method.
- 'constant': Use the constant method.
Defaults to 'sporadic'.

accuracy.measure

character or list of characters, optional
Specifies measure name.

  • mpe: Mean percentage error.

  • mse: Mean squared error.

  • rmse: Root mean squared error.

  • et: Error total.

  • mad: Mean absolute deviation.

  • mase: Out-of-sample mean absolute scaled error.

  • wmape: Weighted mean absolute percentage error.

  • smape: Symmetric mean absolute percentage error.

  • mape: Mean absolute percentage error.

No default value.

ignore.zero

logical, optional
- FALSE: Uses zero values in the input dataset when calculating "mpe" or "mape".
- TRUE: Ignores zero values in the input dataset when calculating "mpe" or "mape".
Only valid when accuracy_measure is "mpe" or "mape".
Defaults to FALSE.

expost.flag

logical, optional
- FALSE: Does not output the expost forecast, and just outputs the forecast values.
- TRUE: Outputs the expost forecast and the forecast values.
Defaults to TRUE.

Details

The Croston method is a forecast strategy for products with intermittent demand.
The Croston method consists of two steps. First, separate exponential smoothing estimates are made of the average size of a demand. Second, the average interval between demands is calculated. This is then used in a form of the constant model to predict the future demand.

Value

Return a list of two DataFrame:

Examples

## Not run: 
Input DataFrame data:
> data$Collect()
     ID RAWDATA
  1   0       0
  2   1       1
  3   2       4
  4   3       0
  5   4       0
  6   5       0
  7   6       5
  8   7       3
  9   8       0
  10  9       0
  11 10       0

 cesm <- hanaml.Croston(conn.context = conn,
                         data = data,
                         alpha=0.1,
                         forecast.num=1,
                         method='sporadic',
                         accuracy.measure='mape')
Output:
> cesm[[2]]$Collect()
  STAT_NAME    STAT_VALUE
1      MAPE     0.2432182

## End(Not run)

[Package hana.ml.r version 1.0.8 Index]