hanaml.IntermittentForecast.Rd
This function is a wrapper for PAL Intermittent Time Series Forecast (ITSF), which is a new forecast strategy for products with intermittent demand.
hanaml.IntermittentForecast(
data,
key,
endog = NULL,
p = NULL,
q = NULL,
forecast.num = NULL,
optimizer = NULL,
method = NULL,
grid.size = NULL,
optimize.step = NULL,
accuracy.measure = NULL,
ignore.zero = NULL,
expost.flag = NULL,
thread.ratio = NULL,
penalty = NULL
)
DataFrame
Data that contains the time-series analysis.
character
Specifies the ID (representing time-order) column of data
.
character, optional
Specifies name of the column for intermittent demand values.
Defaults to the 1st non-key column of data
.
integer/numeric, optional
The smoothing parameter for demand, where:
-1 : optimizing this parameter automatically
positive integers : the specified value for smoothing, cannot exceed length of time-series for analysis.
The specified value cannot exceed the length of time-series for analysis.
Defaults to -1.
integer/numeric, optional
The smoothing parameter for the time-intervals between intermittent demands, where:
-1 : optimizing this parameter automatically
non-negative integers : the specified value for smoothing, cannot exceed
the value of parameter p
.
Defaults to -1.
integer/numeric, optional
Number of values to forecast.
Defaults to 1.
c("simulated_annealing", "lbfgsb_default", "lbfgsb_grid"), optional
Specifies the optimization algorithm for automatically identifying
parameters p
and q
:
"simulated_annealing" : Simulated annealing method(a probabilistic technique for approximating the global optimum of a given function).
"lbfgsb_default" : Bounded Limited-memory Broyden-Fletcher-Goldfarb-Shanno(LBFGSB)
method with parameters p
and q
initialized by default scheme.
"lbfgsb_grid" : LBFGSB method, with parameter p
and q
initialized by grid search.
Defaults to "simulated_annealing".
character, optional
Specifies the method(or mode) for the output:
"sporadic" : Use the sporadic method.
"constant" : Use the constant method.
Defaults to "constant".
integer/numeric, optional
Specifying the number of steps from the start point to the length
of data for grid search.
Only valid for when optimizer
is set as "lbfgsb_grid".
Defaults to 20.
numeric, optional
Specifying minimum step for each iteration of LBFGSB method.
Defaults to 0.001.
character, optional
The criterion used for optimization, valid options include:
"mse", "rmse", "mae", "mape", "smape" and "mase".
Defaults to 'mse'.
NOTE: Specify a measure name if you want the corresponding measure
value to be reflected in the output statistics.
logical, optional
FALSE : Uses zero values in the input dataset when calculating 'mape'.
TRUE : Ignores zero values in the input dataset when calculating 'mape'.
Only valid when accuracy.measure
is "mape".
Defaults to FALSE.
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.
numeric, optional
Specify the ratio of available threads for performing ITSF:
0 : single thread.
0~1 : percentage.
Defaults to 0.
numeric, optional
Penalty weight applied to the cost function to avoid over-fitting.
1.6 for sporadic mode.
0.4 for constant mode.
A list of two DataFrames.
forecasts: DataFrame that stores the forecast values.
stats: DataFrame that stores the related statistics.
Difference to constant weight of the Croston's method:
ITSF provides a exponential weight to estimate, which means the closer the data, the greater the weight.
ITSF does not need the initial value of non-zero demands and time interval between non-zero demands.
Time-series data for intermittent forecast:
> data
ID RAWDATA
1 0 0.0
2 1 1.0
3 2 4.0
4 3 0.0
5 4 0.0
6 5 0.0
7 6 5.0
8 7 3.0
9 8 0.0
10 9 0.0
11 10 0.0
Apply intermittent forecast to the given time-series data:
> res <- hanaml.IntermittentForecast(data = data,
key = "ID",
p = 3,
forecast.num = 3,
optimizer = "lbfgsb_grid",
grid.size = 20,
optimize.step = 0.011,
expost.flag = FALSE,
accuracy.measure = "mse",
ignore.zero = FALSE,
thread.ratio = 0.5)
Check the ouput DataFrames:
> res$forecasts
ID RAWDATA
1 12 2.831169
2 13 2.831169
3 14 2.831169
> res$stats
STAT_NAME STAT_VALUE
1 MSE 10.650383
2 LAST_DEMAND 3.892857
3 LAST_INTERVAL 0.000000
4 OPT_P 3.000000
5 OPT_Q 0.000000
6 OPT_STATE 0.000000