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: object

Prediction 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 to predict() 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 and diff[i] (i > 0) is the seasonal order at period per[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:

Parameters

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

estimate

Fit the model parameters to data.

func_selpmod

Grid search over candidate model structures.

func_pmodsim

Simulate 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()

getGHarma()

getGHarmax()

getGHarx()

getGHbjtf()

getGHdf()

getGHdfarma()

getGHdfbjtf()

getmX()

getmXarma()

getmXarmax()

getmXarx()

getmXbjtf()

getmXregr()

init()

initrand()

initrandn()

initzero()

new_model()

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)

set_data(y, u=array([], shape=(1, 0), dtype=float64))[source]
new_model()[source]
newregr()[source]
newbjtf()[source]
newarx()[source]
newarmax()[source]
newarma()[source]
init()[source]
initzero()[source]
initrandn()[source]
initrand()[source]
getmX()[source]
getmXregr()[source]
getmXbjtf()[source]
getmXarx()[source]
getmXarmax()[source]
getmXarma()[source]
setmX(X)[source]
setmXregr(X)[source]
setmXbjtf(X)[source]
setmXarx(X)[source]
setmXarmax(X)[source]
setmXarma(X)[source]
predict(y, u=[])[source]
predregr(y, u=array([], shape=(1, 0), dtype=float64))[source]

PREDICT Compute one-step predictions for regression model.

Parameters:
  • y

  • u

Returns:

predbjtf(y, u=[])[source]
predarx(y, u=array([], shape=(1, 0), dtype=float64))[source]
predarmax(y, u=[[]])[source]
predarma(y=[])[source]
predictdf(y, u=[[]])[source]
preddfbjtf(y, u)[source]

PREDICT Compute one-step predictions for the Box and Jenkins Transfer Function model. :param y: :param u: :return:

preddfarma(y)[source]
getGHdf()[source]
getGHdfbjtf()[source]
getGHdfarma()[source]
getGH()[source]
getGHbjtf()[source]
getGHarx()[source]
getGHarmax()[source]
getGHarma()[source]