pyhctsa.operations.nonlinearity.nlpe¶
-
pyhctsa.operations.nonlinearity.nlpe(y, de=
3, tau=1, max_n=5000, theiler_win=('ac', 1))¶ Normalized drop-one-out constant interpolation nonlinear prediction error.
Computes the nlpe of Small [1] for a time-delay embedded time series, using an independent (clean-room) implementation of the drop-one-out nearest-neighbor predictor (
pyhctsa.operations._nlpe._nn_prediction_residuals()). The value following each embedded state is predicted by the value that followed its nearest neighbor, with neighbors within a Theiler window in time excluded from the search.Modifications by Joshua B. Moore for incorporating into pyhctsa.
References
- Parameters:¶
- y : array-like¶
Input time series (should be z-scored).
- de : int, str or list, optional¶
The embedding dimension: an integer, or
['fnn', threshold]('fnn'for a threshold of 0.05) to set it by TISEAN’s false nearest neighbors, at mostfloor(2 log10 N)for theNsamples analyzed (after themax_ncrop): the smaller of that limit and the smallest dimension not ruled out byfnn()(dimensions 1 to 10, a Theiler window of one autocorrelation time, an escape factor of 5), i.e. the first dimension at which the fraction of false neighbors is below the threshold on at leastceil(3 / threshold)points, or at which too few points found a neighbor to decide, or else one more than the largest dimension TISEAN computed (11 when all ten were computed); that dimension is a lower bound unless the fraction fell below the threshold. The limit is the largest dimension the data can resolve: in more dimensions typical points have no neighbor within a tenth of the diameter of the set (Eckmann & Ruelle 1992, doi:10.1016/0167-2789(92)90023-g; see_max_embedding_dim). Default is 3.- tau : int or str, optional¶
The time-delay: an integer, or a rule understood by
pyhctsa.utils.get_tau().'ac'is the first zero-crossing of the autocorrelation function,'ac1e'the (floored) first 1/e crossing of the autocorrelation function, and'mi'the smaller of the first minimum of the (Kraskov) automutual information and the 1/e time. Default is 1.- max_n : int or 'full', optional¶
The maximum length of the time series on which to compute the nlpe (the first
max_nsamples are used), or'full'to use the whole series (memory use grows quadratically with length). The time delay, the Theiler window and an'fnn'embedding dimension are all computed from the cropped series, and so is the limit on an'fnn'dimension. Default is 5000.- theiler_win=
('ac', 1)¶ The Theiler window (see
pyhctsa.utils.theiler_window()), computed on the (cropped) series: a number of samples, or['ac', k]forktimes the first zero-crossing of the autocorrelation function. Default is['ac', 1].
- Returns:¶
Measures of the mean error of the nonlinear predictor (
msqerr), and the'full'residual analysis (pyhctsa.operations.model_fit.residual_analysis(): correlation, Gaussianity, etc. of the residuals, andtauratrelative to the series used, i.e. after anymax_ncrop). Returns NaN if the delay or Theiler window cannot be set, or the series is too short.- Return type:¶
dict
Notes
Only states that have at least one neighbour outside the Theiler window are predicted; the others are left out of the residuals (which then skip those time points). NaN is returned if fewer than 10 states, or fewer than half of all states, can be predicted (see
pyhctsa.operations._nlpe._nn_prediction_residuals()).