ARNNResult.predict#

ARNNResult.predict(features)[source]#

Conditional means for a matrix of lagged levels.

Parameters:

features (NDArray[double]) – Shape (n, order), columns ordered [y_{t-1}, ..., y_{t-order}] to match how the learner was trained. Passing them in the other order will not raise – the widths match – it will silently return nonsense, so build the matrix with lag_matrix() rather than by hand.

Return type:

NDArray[double]

Returns:

An array of length n.

Raises:

DimensionError – If the feature matrix is not two-dimensional or its width does not match order.

Example

>>> import numpy as np
>>> rng = np.random.default_rng(0)
>>> res = ARNN(rng.standard_normal(200), order=2).fit()
>>> res.predict(np.zeros((4, 2))).shape
(4,)
>>> res.predict(np.zeros((4, 3)))
Traceback (most recent call last):
    ...
cultivars.exceptions.DimensionError: features must have shape (n, 2); got (4, 3).