7.9 Exponential Smoothing Model

The ore.odmESM class uses the in-database Exponential Smoothing Model (ESM) algorithm to create a clustering model.

Exponential Smoothing Methods have been widely used in forecasting for over half a century. It has applications at the strategic, tactical, and operation level. For example, at a strategic level, forecasting is used for projecting return on investment, growth and the effect of innovations. At a tactical level, forecasting is used for projecting costs, inventory requirements, and customer satisfaction. At an operational level, forecasting is used for setting targets and predicting quality and conformance with standards.

In its simplest form, Exponential Smoothing is a moving average method with a single parameter which models an exponentially decreasing effect of past levels on future values. With a variety of extensions, Exponential Smoothing covers a broader class of models than other well-known approaches, such as the Box-Jenkins auto-regressive integrated moving average (ARIMA) approach. The in-database Exponential Smoothing algorithm uses a state of the art state space method that incorporates a single source of error (SSOE) assumption which provides theoretical and performance advantages.

Multiple time series is a convenience operation for constructing input to a time series regression. Multiple time series builds multiple time series models with a common time interval for use as input to a time series regression. One of the time series models is identified as the target time series of interest. For more information about Multiple Time Series Models, see Oracle Machine Learning for SQL Concepts Guide.

The behavior of Exponential Smoothing is modified such that it searches for an acceptable time series model automatically. If you do not specify a model type (EXSM_MODEL), the default behavior is for the algorithm to automatically determine the model type. For more information, see Oracle Machine Learning for SQL Concepts Guide.

Settings for an ESM model

The following table lists settings that apply to ESM models.

Table 7-8 ESM Model Settings

Setting Name Setting Value Description
EXSM_MODEL

One of {EXSM_SIMPLE, EXSM_SIMPLE_MULT, EXSM_HOLT, EXSM_HOLT_DMP, EXSM_MUL_TRND, EXSM_MULTRD_DMP, EXSM_SEAS_ADD, EXSM_SEAS_MUL, EXSM_HW, EXSM_HW_DMP, EXSM_HW_ADDSEA, EXSM_DHW_ADDSEA, EXSM_HWMT, EXSM_HWMT_DMP}

This setting specifies the model.

EXSM_SIMPLE: Simple exponential smoothing model is applied.

EXSM_SIMPLE_MULT: Simple exponential smoothing model with multiplicative error is applied.

EXSM_HOLT: Holt linear exponential smoothing model is applied.

EXSM_HOLT_DMP: Holt linear exponential smoothing model with damped trend is applied.

EXSM_MUL_TRND: Exponential smoothing model with multiplicative trend is applied.

EXSM_MULTRD_DMP: Exponential smoothing model with multiplicative damped trend is applied.

EXSM_SEAS_ADD: Exponential smoothing with additive seasonality, but no trend, is applied.

EXSM_SEAS_MUL:Exponential smoothing with multiplicative seasonality, but no trend, is applied.

EXSM_HW: Holt-Winters triple exponential smoothing model, additive trend, multiplicative seasonality is applied.

EXSM_HW_DMP: Holt-Winters multiplicative exponential smoothing model with damped trend, additive trend, multiplicative seasonality is applied.

EXSM_HW_ADDSEA: Holt-Winters additive exponential smoothing model, additive trend, additive seasonality is applied.

EXSM_DHW_ADDSEA: Holt-Winters additive exponential smoothing model with damped trend, additive trend, additive seasonality is applied.

EXSM_HWMT: Holt-Winters multiplicative exponential smoothing model with multiplicative trend, multiplicative trend, multiplicative seasonality is applied.

EXSM_HWMT_DMP: Holt-Winters multiplicative exponential smoothing model with damped multiplicative trend, multiplicative trend, multiplicative seasonality is applied.

The default value is EXSM_SIMPLE.

EXSM_SEASONALITY

X > 1

This setting specifies a positive integer value as the length of seasonal cycle. The value specified must be larger than 1. For example, setting value 4 means that every group of four observations forms a seasonal cycle.

This setting is only applicable and must be provided for models with seasonality, otherwise the model throws an error.

When EXSM_INTERVAL is not set, this setting applies to the original input time series. When EXSM_INTERVAL is set, this setting applies to the accumulated time series.

EXSM_INTERVAL

One of {EXSM_INTERVAL_YEAR, EXSM_INTERVAL_QTR, EXSM_INTERVAL_MONTH,EXSM_INTERVAL_WEEK, EXSM_INTERVAL_DAY, EXSM_INTERVAL_HOUR, EXSM_INTERVAL_MIN,EXSM_INTERVAL_SEC}

This setting only applies and must be provided when the time column (case_id column) has datetime type. It specifies the spacing interval of the accumulated equally spaced time series.

The model throws an error if the time column of input table is of datetime type and setting EXSM_INTERVAL is not provided.

The model throws an error if the time column of input table is of oracle number type and setting EXSM_INTERVAL is provided.

EXSM_ACCUMULATE

One of {EXSM_ACCU_TOTAL, EXSM_ACCU_STD, EXSM_ACCU_MAX, EXSM_ACCU_MIN, EXSM_ACCU_AVG, EXSM_ACCU_MEDIAN, EXSM_ACCU_COUNT}

This setting only applies and must be provided when the time column has datetime type. It specifies how to generate the value of the accumulated time series from the input time series.

EXSM_SETMISSING

One of {EXSM_MISS_MIN, EXSM_MISS_MAX, EXSM_MISS_AVG, EXSM_MISS_MEDIAN, EXSM_MISS_LAST, EXSM_MISS_FIRST, EXSM_MISS_PREV, EXSM_MISS_NEXT, EXSM_MISS_AUTO}.

This setting specifies how to handle missing values, which may come from input data and/or the accumulation process of time series. You can specify either a number or an option. If a number is specified, all the missing values are set to that number.

EXSM_MISS_MIN: Replaces missing value with minimum of the accumulated time series.

EXSM_MISS_MAX: Replaces missing value with maximum of the accumulated time series.

EXSM_MISS_AVG: Replaces missing value with average of the accumulated time series.

EXSM_MISS_MEDIAN: Replaces missing value with median of the accumulated time series.

EXSM_MISS_LAST: Replaces missing value with last non-missing value of the accumulated time series.

EXSM_MISS_FIRST: Replaces missing value with first non-missing value of the accumulated time series.

EXSM_MISS_PREV:Replaces missing value with the previous non-missing value of the accumulated time series.

EXSM_MISS_NEXT:Replaces missing value with the next non-missing value of the accumulated time series.

EXSM_MISS_AUTO:EXSM model treats the input data as an irregular (non-uniformly spaced) time series.

If this setting is not provided, EXSM_MISS_AUTO is the default value. In such a case, the model treats the input time series as irregular time series, viewing missing values as gaps.

EXSM_PREDICTION_STEP

An integer in the range 0 < X <= 30.

Default value: 1.

This setting specifies how many steps ahead the predictions are to be made.

If it is not set, the default value is 1: the model gives one-step-ahead prediction. A value greater than 30 results in an error.

EXSM_CONFIDENCE_LEVEL

A number in the range 0 < X < 1.

This setting specifies the desired confidence level for prediction.

The lower and upper bounds of the specified confidence interval is reported. If this setting is not specified, the default confidence level is 0.95.

EXSM_OPT_CRITERION

One of {EXSM_OPT_CRIT_LIK, EXSM_OPT_CRIT_MSE, EXSM_OPT_CRIT_AMSE, EXSM_OPT_CRIT_SIG, EXSM_OPT_CRIT_MAE}.

This setting specifies the desired optimization criterion. The optimization criterion is useful as a diagnostic for comparing models' fit to the same data.

EXSM_OPT_CRIT_LIK: Minus twice the log-likelihood of a model.

EXSM_OPT_CRIT_MSE: Mean square error of a model.

EXSM_OPT_CRIT_AMSE: Average mean square error over user-specified time window.

EXSM_OPT_CRIT_SIG: Model's standard deviation of residuals.

EXSM_OPT_CRIT_MAE: Mean absolute error of a model.

The default value is EXSM_OPT_CRIT_LIK.

EXSM_NMSE

x >= 0

This setting specifies the length of the window used in computing the error metric average mean square error (AMSE).

EXSM_SERIES_LIST

Note:

Available only in Oracle Database 23ai.

Comma delimited list of time series columns

This setting allows you to forecast up to twenty predictor series in addition to the target series.

The column names in EXSM_SERIES_LIST are enclosed in single quotes. It is important to note that the list is enclosed in single quotes, not the individual column names. For example:

INSERT INTO <settings_table_name VALUES(dbms_data_mining.exsm_series_list,  ‘<column1>,<column2>,<column3>,<column4>’);

For the prefix DM$ to be added to the build and scoring data sets, column names must be less than 125 characters long.

EXSM_INITVL_OPTIMIZE

Note:

Available only in Oracle Database 23ai.

EXSM_INITVL_OPTIMIZE_ENABLE

EXSM_INITVL_OPTIMIZE_DISABLE

The setting EXSM_INITVL_OPTIMIZE determines whether initial values are optimized during model build. The default value is EXSM_INITVL_OPTIMIZE_ENABLE.

Note:

EXSM_INITVL_OPTIMIZE can only be set to EXSM_INITVL_OPTIMIZE_DISABLE if the user has set EXSM_MODEL to EXSM_HW or EXSM_HW_ADDSEA. If EXSM_MODEL is set to another model type or is not specified, error 40213 (conflicting settings) is thrown and the model is not built.

Example 7-8 Using the ore.odmESM Function

This example pushes the data frame iris: to a temporary database table IRIS and creates Exponential Smoothing model.

# Turn off row ordering warnings.

options(ore.warn.order=FALSE)

# Data setup

set.seed(7654)
N <- 100
dat <- data.frame(ID=1:N, VAL=runif(N))

# Create the a temporary OML4R proxy object DAT.

DAT <- ore.push(dat)

# Create an ESM regression model object. Fit the ESM model according to the data and setting parameters.

esm.mod  <- ore.odmESM(VAL ~ ., DAT,
    odm.settings = list(case_id_column_name = "ID",
                        exsm_prediction_step = 4))
    
esm.mod
summary(esm.mod)

Listing for This Example

Call: ore.odmESM(formula = VAL ~ ., data = DAT, odm.settings = list(case_id_column_name = "ID", exsm_prediction_step = 4))
Settings:                                                 
                                                               value 
         confidence.level                                        .95 
         model                                                 imple 
         nmse                                                      3
         optimization.crit                              opt.crit.lik
         prediction.step                                           4
         setmissing                                        miss.auto
         odms.details                                    odms.enable
         odms.missing.value.treatment        odms.missing.value.auto
         odms.sampling                         odms.sampling.disable
         prep.auto                                                ON
Call: ore.odmESM(formula = VAL ~ ., data = DAT, odm.settings = list(case_id_column_name = "ID", exsm_prediction_step = 4))
Settings:
                                                      value
       confidence.level                                 .95 
       model                                         simple
       nmse                                               3
       optimization.crit                       opt.crit.lik
       prediction.step                                    4
       setmissing                                 miss.auto
       odms.details                             odms.enable
       odms.missing.value.treatment odms.missing.value.auto
       odms.sampling                  odms.sampling.disable
       prep.auto                                         ON 
Predictions:
      CASE_ID      VALUE PREDICTION        LOWER   UPPER
  1         1 0.68847989  0.5414108         NA      NA
  2         2 0.63346191  0.5414255         NA      NA 
  3         3 0.34073466  0.5414347         NA      NA
  4         4 0.41106593  0.5414146         NA      NA 
  5         5 0.17601063  0.5414016         NA      NA
  6         6 0.82879446  0.5413650         NA      NA
  7         7 0.23504359  0.5413938         NA      NA
  8         8 0.14222260  0.5413631         NA      NA 
  9         9 0.76561760  0.5413232         NA      NA 
  10       10 0.90813842  0.5413457         NA      NA 
  11       11 0.59706210  0.5413823         NA      NA 
  12       12 0.44463468  0.5413879         NA      NA 
  13       13 0.95294541  0.5413782         NA      NA 
  14       14 0.58209937  0.5414194         NA      NA
  15       15 0.62295773  0.5414235         NA      NA
  16       16 0.59711650  0.5414316         NA      NA
  17       17 0.41131782  0.5414372         NA      NA
  18       18 0.79952871  0.5414242         NA      NA
  19       19 0.12635680  0.5414500         NA      NA
  20       20 0.04773946  0.5414085         NA      NA