TimeSeriesSRC.pmodel
- class TimeSeriesSRC.pmodel(xtype, na=[0, 1], nb=[], nc=[], nd=[], nf=[], delay=[], diff=[0], per=[], upre=[], ypre=[], ypost=[], eFcn='estimlm', indexFcn='pmodmse', initFcn='initrand')[source]
Bases:
objectPrediction model for discrete-time ARMA / ARX / ARMAX / BJTF / regression.
Stores the polynomial orders, delay, differencing specification, and parameter arrays for one of the five supported model structures. After construction the object is passed to
estimate()to fit the parameters, and topredict()to generate one-step-ahead predictions.- Parameters:
xtype ({'arma', 'arx', 'armax', 'bjtf', 'regr'}) –
Model structure.
'arma'— ARMA(nc, nd) noise model, no external input.'arx'— ARX(na, nb) model with direct input feed-through.'armax'— ARMAX(na, nb, nc) model.'bjtf'— Box–Jenkins transfer-function model.'regr'— Static regression (no dynamics in the output).
na (int or list of int, optional) – Order of the \(A(q)\) (autoregressive) polynomial. Default
[0, 1].nb (list of int, optional) – Orders of the \(B(q)\) (input numerator) polynomials; one entry per input channel. Default
[].nc (int or list of int, optional) – Order(s) of the \(C(q)\) (noise numerator) polynomial(s). Default
[].nd (list of int, optional) – Order(s) of the \(D(q)\) (noise denominator) polynomial(s). Default
[].nf (list of int, optional) – Order(s) of the \(F(q)\) polynomial(s) — BJTF only. Default
[].delay (list of int, optional) – Pure input delay \(k\) for each input channel. Default
[].diff (list of int, optional) – Differencing orders;
diff[0]is the regular order anddiff[i](i > 0) is the seasonal order at periodper[i-1]. Default[0].per (list of int, optional) – Seasonal periods; must have one fewer element than
diff. Default[].upre (list of str, optional) – Names of pre-processing functions to apply to each input channel (e.g.
['log']). Default[].ypre (list of str, optional) – Names of pre-processing functions to apply to the output before estimation (e.g.
['log']). Default[].ypost (list of str, optional) – Names of post-processing functions to apply to the output after simulation (e.g.
['exp']). Default[].eFcn (str, optional) – Estimation function identifier. Only
'estimlm'(Levenberg–Marquardt) is currently supported. Default'estimlm'.indexFcn (str, optional) – Performance-index function used during estimation. Default
'pmodmse'.initFcn ({'initrand', 'initrandn', 'initzero'}, optional) – Parameter initialisation strategy. Default
'initrand'.
- a, b, c, d, f
Estimated polynomial coefficient vectors after calling
estimate().- Type:
list of ndarray
- estimParams
Levenberg–Marquardt hyper-parameters (epochs, goal, learning-rate schedule, etc.).
- Type:
Examples
Build a BJTF(1,1,1,1) model with one input and one output:
>>> from TimeSeriesSRC.Model.model import pmodel >>> pm = pmodel('bjtf', nb=[1], nc=[1], nd=[1], nf=[1], delay=[0]) >>> print(pm)
Build an ARX(2, [1]) model:
>>> pm = pmodel('arx', na=2, nb=[1], delay=[1])
See also
estimateFit the model parameters to data.
func_selpmodGrid search over candidate model structures.
func_pmodsimSimulate the model output.
- __init__(xtype, na=[0, 1], nb=[], nc=[], nd=[], nf=[], delay=[], diff=[0], per=[], upre=[], ypre=[], ypost=[], eFcn='estimlm', indexFcn='pmodmse', initFcn='initrand')[source]
Methods
__init__(xtype[, na, nb, nc, nd, nf, delay, ...])getGH()getGHarx()getGHdf()getmX()getmXarx()init()initrand()initzero()newarma()newarmax()newarx()newbjtf()newregr()predarma([y])predarmax(y[, u])predarx(y[, u])predbjtf(y[, u])preddfarma(y)preddfbjtf(y, u)PREDICT Compute one-step predictions for the Box and Jenkins Transfer Function model.
predict(y[, u])predictdf(y[, u])predregr(y[, u])PREDICT Compute one-step predictions for regression model.
set_data(y[, u])setmX(X)setmXarma(X)setmXarmax(X)setmXarx(X)setmXbjtf(X)setmXregr(X)- predregr(y, u=array([], shape=(1, 0), dtype=float64))[source]
PREDICT Compute one-step predictions for regression model.
- Parameters:
y
u
- Returns: