pyhctsa.operations.model_fit.gp_local_prediction¶
-
pyhctsa.operations.model_fit.gp_local_prediction(y, cov_func=
'covSEiso_covNoise', num_train=20, num_test=5, num_preds=10, pmode='frombefore', random_seed=0, num_splits=8)¶ Gaussian Process time-series model for local prediction.
Fits a Gaussian Process model to a section of the time series and uses it to predict the subsequent datapoints, repeated at equally-spaced positions through the time series. The noise standard deviation of each fit is bounded below by 1% of that of its training data (see
_gp_learn_hyperp()). Windows whose training data are constant (standard deviation below 1e-8 of that of the series) cannot be standardized and are left out of every statistic.- Parameters:¶
- y : array-like¶
The input time series.
- cov_func : str or list¶
The covariance function, a gpml
covSum: the names of its components joined with underscores ('covSEiso_covNoise','covSEiso_covPeriodic_covNoise','covMaterniso3_covNoise','covRQiso_covNoise') or in the gpml form['covSum', ['covSEiso', 'covNoise']]. The only configuration hctsa instantiates is the default,'covSEiso_covNoise'(squared exponential plus noise).- num_train : int¶
The number of training samples (for each iteration). Default is 20.
- num_test : int¶
The number of testing samples (for each iteration). Default is 5.
- num_preds : int¶
The number of predictions to make. Default is 10.
- pmode : str¶
The prediction mode, one of:
'frombefore': predicts the following values of the time series by training on preceding values,'beforeafter': predicts the preceding time series values by training on the following values,'randomgap': predicts random values within a segment of time series by training on the other values in that segment,'spreadgap': as'randomgap', but with deterministic splits: the test sets are taken, in the evenly spread order ofpyhctsa.robust.bf_spread_perm(), from the list of allC(num_train + num_test, num_test)possible test sets (in lexicographic order), a different one for each fit (cycling through the list when there are more fits than test sets). The outputs do not depend on a seed.
Default is
'frombefore'.- random_seed : int, 'default', 'none' or None, optional¶
The seed of the random splits of the
'randomgap'mode, as hctsa’sBF_RandomSeed: a number,'default'orNonefor seed 0, or'none'for a seed drawn from NumPy’s global state. One block of uniforms from the portable generator (pyhctsa.robust.bf_random()) gives each window its own split (the ranks of its column), so the splits are hctsa’s. Default is 0.- num_splits : int, optional¶
For
'randomgap'and'spreadgap', the number of different splits made of each window; each split is fitted and predicted as a window of its own, so the outputs summarizenum_preds * num_splitsfits. Default is 8.
- Returns:¶
Summaries of the quality of the predictions made, the mean and spread of the obtained hyperparameter values, and the marginal likelihoods. Each window is first standardized using its training data. The error bars are 95% error bars (twice the predictive standard deviation), so the outputs ending in
_stdare in units of these.meanabs,maxabs,minabs: mean, maximum and minimum over all predicted points of the absolute prediction error,meanabs_std,maxabs_std,minabs_std: the same, in units of the error bar,meanabs_run,maxabs_run,minabs_run: mean, maximum and minimum over windows of the mean absolute error in a window,meanabs_std_run,maxabs_std_run,minabs_std_run: the same, in units of the error bar,q90abs_run,q90abs_std_run: the 90th percentile (Hazen definition,_nan_quantile()) over windows of the mean absolute error in a window, without and with each error in units of the error bar,q10abs_run: the 10th percentile over windows of the mean absolute error in a window,low25abs_std_run: the mean over the lowest quarter of the windows (theceil(n/4)smallest of thenvalues) of the mean absolute error in a window, in units of the error bar (these three summarize the tails robustly: the maximum and minimum over windows are each set by a single fit),maxerrbar,meanerrbar,minerrbar: maximum, mean and minimum error-bar half-width over all predicted points,high25errbar: the mean of the largest quarter of these error bars,meanlogh1, …,stdlogh1, …: mean and standard deviation across windows of each log hyperparameter,maxnlml,minnlml,stdnlml: maximum, minimum and standard deviation across windows of the negative log marginal likelihood on the window’s training data, divided by the number of training points,q90nlml: the 90th percentile of the same across windows.
For
'randomgap'and'spreadgap', each split counts as a window.All values are NaN if hyperparameters cannot be learned, or if the training data of every window are constant.
- Return type:¶
dict