DoubleExponentialSmoothing

class hana_ml.algorithms.pal.tsa.exponential_smoothing.DoubleExponentialSmoothing(alpha=None, beta=None, forecast_num=None, phi=None, damped=None, accuracy_measure=None, ignore_zero=None, expost_flag=None, prediction_confidence_1=None, prediction_confidence_2=None)

Double exponential smoothing is suitable to model the time series with trend but without seasonality. In the model there are two kinds of smoothed quantities: smoothed signal and smoothed trend.

Parameters
alphafloat, optional

Weight for smoothing. Value range: 0 < alpha < 1.

Defaults to 0.1.

betafloat, optional

Weight for the trend component. Value range: 0 < beta < 1.

Defaults to 0.1.

forecast_numint, optional

Number of values to be forecast.

Defaults to 0.

phifloat, optional

Value of the damped smoothing constant phi (0 < phi < 1).

Defaults to 0.1.

dampedbool, optional

Specifies whether or not to use damped trend method.

  • False: No, uses the Holt's linear trend method.

  • True: Yes, use damped trend method.

Defaults to False.

accuracy_measurestr or list of str, optional

The metric to quantify how well a model fits input data. Options: "mpe", "mse", "rmse", "et", "mad", "mase", "wmape", "smape", "mape".

No default value.

Note

Specify a measure name if you want the corresponding measure value to be reflected in the output statistics self.stats_.

ignore_zerobool, 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_flagbool, 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.

prediction_confidence_1float, 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_2float, optional

Prediction confidence for interval 2.

Only valid when the upper and lower columns are provided in the result table.

Defaults to 0.95.

Examples

Input Dataframe df for DoubleExponentialSmoothing:

>>> df.collect()
ID    RAW_DATA
 1       143.0
 2       152.0
 3       161.0
 4       139.0

21 223.0 22 242.0 23 239.0 24 266.0

Create a DoubleExponentialSmoothing instance:

>>> desm = DoubleExponentialSmoothing(alpha=0.501,
                                      beta=0.072,
                                      forecast_num=6,
                                      phi=None,
                                      damped=None,
                                      accuracy_measure='mse',
                                      ignore_zero=None,
                                      expost_flag=None,
                                      prediction_confidence_1=0.8,
                                      prediction_confidence_2=0.95)

Perform fit_predict on the given data:

>>> desm.fit_predict(data=df)

Output:

>>> desm.forecast_.collect().set_index('TIMESTAMP').head(3)
TIMESTAMP        VALUE   PI1_LOWER     PI1_UPPER    PI2_LOWER    PI2_UPPER
        2          152         NaN           NaN          NaN          NaN
        3          161         NaN           NaN          NaN          NaN
        4          170         NaN           NaN          NaN          NaN
>>> desm.stats_.collect()
   STAT_NAME       STAT_VALUE
0        MSE      274.8960228
Attributes
forecast_DataFrame

Forecast values.

stats_DataFrame

Statistics analysis content.

Methods

build_report()

Generate time series report.

fit_predict(data[, key, endog])

Fit and predict based on the given time series.

generate_html_report([filename])

Display function.

generate_notebook_iframe_report()

Display function.

fit_predict(data, key=None, endog=None)

Fit and predict based on the given time series.

Parameters
dataDataFrame

Input data. At least two columns, one is ID column, the other is raw data.

keystr, optional

The ID column.

Defaults to the first column of data if the index column of data is not provided. Otherwise, defaults to the index column of data.

endogstr, optional

The column of series to be fitted and predicted.

Defaults to the first non-ID column.

Returns
DataFrame

Forecast values.

build_report()

Generate time series report.

property fit_hdbprocedure

Returns the generated hdbprocedure for fit.

generate_html_report(filename=None)

Display function.

generate_notebook_iframe_report()

Display function.

property predict_hdbprocedure

Returns the generated hdbprocedure for predict.

Inherited Methods from PALBase

Besides those methods mentioned above, the DoubleExponentialSmoothing class also inherits methods from PALBase class, please refer to PAL Base for more details.