ARNNResult#
- class cultivars.univariate.mean_function.ARNNResult(*, endog, fittedvalues, resid, llf, nobs, n_params, order, sigma2, engine, engine_config, predictor)[source]#
A fitted neural autoregression.
The model \(y_t = f(y_{t-1}, \ldots, y_{t-p}) + \varepsilon_t\) with \(f\) a learned function and \(\varepsilon_t \sim N(0, \sigma^2)\), the variance concentrated out of a penalized least-squares fit. There is no coefficient vector; the record carries the fitted function as a callable, the fit statistics, and the engine that produced it, since with a plug-in backend the engine is part of the specification.
- Variables:
predictor – The learned conditional-mean map, callable through
predict().
Note
The inherited fields are
endog,fittedvalues,resid,llf,nobs,n_params,order,sigma2,engineandengine_config; the inherited propertiesr_squared,ssrandparameters_per_observationread them.fittedvaluesandresidare aligned with the lastnobs = len(endog) - orderobservations.llfis a concentrated Gaussian likelihood at a penalized fit, so the information criteria compare capacity within one engine configuration and not against a linear model;r_squaredis the headline number.See also
ARNN– the specification that produces this.TARNNResult– one learned function per regime.ARResult– the linear case, with coefficients and verdicts.NonlinearSSM– whatnonlinear_state_space()emits.
Example
A one-lag map \(0.8 \tanh(2 y_{t-1})\) recovered on a grid:
>>> import numpy as np >>> from cultivars.engine._core._matrices import _lag_matrix >>> rng = np.random.default_rng(0) >>> y = np.zeros(500) >>> for t in range(1, 500): ... y[t] = 0.8 * np.tanh(2.0 * y[t - 1]) + 0.3 * rng.standard_normal() >>> res = ARNN(y, order=1).fit() >>> res.nobs, res.n_learner_parameters, res.engine (499, 25, 'NumpyMLPEngine') >>> bool(np.allclose(res.predict(_lag_matrix(y, 1)), res.fittedvalues)) True >>> grid = np.array([[-1.0], [0.0], [1.0]]) >>> bool(np.max(np.abs(res.predict(grid) - 0.8 * np.tanh(2.0 * grid[:, 0]))) < 0.15) True
Attributes#
The trained network; use |
|
AIC, BIC, and HQIC derived from the likelihood and parameter count. |
|
Weights and biases in the single fitted network. |
|
Nominal learner parameters divided by the effective sample size. |
|
Share of the effective sample's variance the fitted mean explains. |
|
Sum of squared residuals over the effective sample. |
Methods#
|
Rank this result against others by an information criterion. |
|
Refuse the test: a network's weights are unidentified under a linear null. |
|
The learned mean as a noisily observed state space. |
|
Conditional means for a matrix of lagged levels. |
|
The estimation summary, renderable as text, HTML, or a dataframe. |
|
The aligned per-observation outputs as plain numpy arrays. |
|
The aligned per-observation outputs as a |
The aligned per-observation outputs as a |