TimeSeriesSRC.estimate
- TimeSeriesSRC.estimate(pmod, y, u=array([], dtype=float64), show_plot=True, show_output=True)[source]
Estimate prediction-model parameters using the Levenberg–Marquardt algorithm.
Pre-processes
y(and optionallyu) according to the transforms and differencing orders stored inpmod, then calls the LM estimator (func_estimlm()) and returns the fitted model together with the full training record.- Parameters:
pmod (pmodel) – Prediction model object created by
pmodel. Its parameter arrays (a,b,c,d,f) are updated in-place during estimation.y (array-like, shape (1, N)) – Output (response) time series. Should be zero-mean (or near zero-mean) after applying the differencing specified in
pmod.diff.u (array-like, shape (n_inputs, N), optional) – Input time series matrix. Omit for purely ARMA models. Default is an empty array.
show_plot (bool, optional) – Display the live training-performance (MSE vs epoch) plot. Default
True.show_output (bool, optional) – Print per-epoch training summary to stdout. Default
True.
- Returns:
pmod (pmodel) – The fitted model with updated parameter arrays.
trec (dict) – Training record. Key
'index'holds the per-epoch MSE vector;'epoch'holds the number of completed epochs.stat (dict) – Final-epoch summary statistics (MSE, gradient norm, Jacobian condition number).
Examples
>>> import numpy as np >>> from TimeSeriesSRC.Model.model import pmodel >>> from TimeSeriesSRC.Model.estimate import estimate >>> y = np.array([-0.19, 0.52, -3.50, 3.01, -3.04, 1.59]).reshape(1, -1) >>> u = np.array([-0.43, -1.67, 0.13, 0.29, -1.15, 1.19]).reshape(1, -1) >>> pm = pmodel('bjtf', nb=[1], nc=[1], nd=[1], nf=[1], delay=[0]) >>> pm.estimParams.epochs = 5 >>> pm, trec, stat = estimate(pm, y, u, show_plot=False, show_output=False)
See also
pmodelPrediction model object with polynomial-order specification.
func_selpmodAutomated grid search over candidate model structures.
func_pmodmseCompute mean-squared prediction error for a fitted model.