Intermittent Time Series Forecast (ITSF) is a forecasting strategy used for products with intermittent demand. The ITSF model uses a formula to calculate the forecast based on the demand data. The forecast equation takes into account parameters such as the time interval between non-zero demands and the average size of non-zero demands. The ITSF method supports two algorithm types: constant mode and sporadic mode. In constant mode, the forecast is based on the average demand between two non-zero demands. In sporadic mode, the forecast predicts the demand at the non-zero demand time. The ITSF method differs from the Croston method in that it provides exponential weight to estimate and does not require the initial values of non-zero demands and time intervals.
------

SET SCHEMA DM_PAL;
DROP TABLE PAL_ITSF_DATA_TBL;
CREATE COLUMN TABLE PAL_ITSF_DATA_TBL (
"ID" INT,
"RAWDATA" DOUBLE
);
INSERT INTO PAL_ITSF_DATA_TBL VALUES (0, 0.0);
INSERT INTO PAL_ITSF_DATA_TBL VALUES (1, 1.0);
INSERT INTO PAL_ITSF_DATA_TBL VALUES (2, 4.0);
INSERT INTO PAL_ITSF_DATA_TBL VALUES (3, 0.0);
INSERT INTO PAL_ITSF_DATA_TBL VALUES (4, 0.0);
INSERT INTO PAL_ITSF_DATA_TBL VALUES (5, 0.0);
INSERT INTO PAL_ITSF_DATA_TBL VALUES (6, 5.0);
INSERT INTO PAL_ITSF_DATA_TBL VALUES (7, 3.0);
INSERT INTO PAL_ITSF_DATA_TBL VALUES (8, 0.0);
INSERT INTO PAL_ITSF_DATA_TBL VALUES (9, 0.0);
INSERT INTO PAL_ITSF_DATA_TBL VALUES (10, 0.0);
DROP TABLE #PAL_PARAMETER_TBL;
CREATE LOCAL TEMPORARY COLUMN TABLE #PAL_PARAMETER_TBL (
"PARAM_NAME" VARCHAR (256),
"INT_VALUE" INTEGER,
"DOUBLE_VALUE" DOUBLE,
"STRING_VALUE" VARCHAR (1000)
);
INSERT INTO #PAL_PARAMETER_TBL VALUES ('P', -1, NULL, NULL);
INSERT INTO #PAL_PARAMETER_TBL VALUES ('Q', -1, NULL, NULL);
INSERT INTO #PAL_PARAMETER_TBL VALUES ('FORECAST_NUM',3, NULL,NULL);
INSERT INTO #PAL_PARAMETER_TBL VALUES('MEASURE_NAME',NULL,NULL,'MSE');
INSERT INTO #PAL_PARAMETER_TBL VALUES('THREAD_RATIO', NULL, 0.5, NULL);
INSERT INTO #PAL_PARAMETER_TBL VALUES('EXPOST_FLAG', 0, NULL, NULL);
INSERT INTO #PAL_PARAMETER_TBL VALUES('IGNORE_ZERO', 0, NULL, NULL);
INSERT INTO #PAL_PARAMETER_TBL VALUES('METHOD', 1, NULL, NULL);
INSERT INTO #PAL_PARAMETER_TBL VALUES('BRUTE_STEP', 11, NULL, NULL);
CALL "_SYS_AFL"."PAL_ITSF"(PAL_ITSF_DATA_TBL, #PAL_PARAMETER_TBL, ?, ?);
