pyhctsa.operations.model_fit.exp_smoothing

pyhctsa.operations.model_fit.exp_smoothing(x, n_train=None, alpha='best')

Exponential smoothing time-series prediction model.

Fits an exponential smoothing model to the time series using a training set to fit the optimal smoothing parameter, alpha, and then applies the result to predict the rest of the time series. The residual statistics are computed on the held-out samples only (those after the first n_train), and nan is returned if fewer than 50 samples remain after the training set.

The model is simple exponential smoothing (level l_t = a x_t + (1 - a) l_{t-1}, forecast of x[t] equal to l_{t-1}), initialized at the mean of the first 10 samples. With alpha='best', alpha is the value in [0.01, 1] with the lowest RMS one-step error on the training set (a grid of step 0.01 refined by golden-section search, _exp_smooth_best_alpha()).

The residuals (prediction minus data) are summarized with the 'full' level of residual_analysis().

References

Parameters:
x : array-like

The input time series.

n_train : int or float, optional

The number of samples to use for training. Can be an integer or a proportion of the time-series length. Default is None.

alpha : str or float, optional

The exponential smoothing parameter. If 'best', the function optimizes alpha on the training set. Default is 'best'.

Returns:

Dictionary including the fitted alpha (alphamin, with the quadratic-fit outputs slope05_1, p1_1 and cup_1) and the 15 'full' statistics on the residuals from the prediction phase: meane, meanabs, stde, maxonstd, ac1, ac2, ac3, propbth, taurat, sws, swm, ftbth, normksstat, popt and minsbc.

Return type:

dict