pyhctsa.operations.pre_process.preproc_model_fit¶
-
pyhctsa.operations.pre_process.preproc_model_fit(y, model=
'ar', order=2, random_seed=None)¶ How the error of an AR model changes after preprocessing the series.
Fits an autoregressive (AR) model to the time series and to a set of preprocessed versions of it, and returns the in-sample root-mean-square (RMS) one-step prediction error for each preprocessed version as a ratio of the RMS prediction error for the original series. Every version is z-scored before the model is fitted. The AR model is fitted by forward-backward least squares.
Only one representative of each family of preprocessings (from hctsa’s
PP_PreProcess) is fitted, as the other candidates were found to correlate at r >= 0.95 with one of these:d1: incremental differencing (first differences)d2: second differencesp1_20: a straight line removed in each of 20 equal segments (piece-wise linear detrending)p2_5: a quadratic removed in each of 5 equal segments (piece-wise quadratic detrending)rmgd: the values replaced by Gaussian values of the same rank (rank mapping to a Gaussian distribution)
- Parameters:¶
- y : array-like¶
The input time series.
- model : str, optional¶
The time-series model to fit to the transformed series (currently
'ar'is the only option).- order : int, optional¶
The order of the AR model to fit. Default is 2.
- random_seed : int, 'default', 'none' or None, optional¶
The seed of the random draws used by
rmgd(hctsa’sBF_RandomSeed): an integer,'default'orNonefor seed 0, or'none'for a seed drawn from NumPy’s global random state. The draws come from the portable generatorpyhctsa.robust.bf_random(), so they are hctsa’s for the same seed.
- Returns:¶
The ratios of the RMS prediction error of the AR model for the preprocessed series to that for the original series:
stderat_d1,stderat_d2,stderat_p1_20,stderat_p2_5,stderat_rmgd. A ratio above 1 means the preprocessing left the series harder to predict, as when it removes a trend or slow dynamics that the model had been exploiting.- Return type:¶
dict