Esc
Ask AIAnswers may be inaccurate; check the linked pages.Esc
Ask anything about these docs, like how to get started or what a function does.

Naive

chronax.models.Naive ยท inherits BaseForecaster

The naive class implements statsforecast's naive forecasting model, in which any forecast is equal to the previously observed value. This JAX implementation provides complete compatibility with statsforecast's Naive class, including: fit(), predict(), predict_in_sample(), forecast(), forward().

Class Attributes:

Attribute Type Description
alias str "Naive"
conformal_params ConformalIntervals \| None Parameters for conformal prediction intervals.
model_ dict Dict containing fitted parameters (last_y, sigma, fitted values).

__init__(self, alias='Naive', conformal_params=None)

Initializes the Naive forecaster.

Parameter Type Default Description
alias str "Naive" (undocumented)
conformal_params ConformalIntervals \| None None (undocumented)

fit(self, y, X=None) -> Self

Trains the model and stores parameters.

Parameters:

Parameter Type Default Description
y jnp.ndarray - (undocumented)
X jnp.ndarray \| None None (undocumented)

Returns: Self (the fitted forecaster; sets self.model_).

predict(self, h, X=None, level=None) -> dict

Predict with fitted Naive.

Parameters:

Parameter Type Default Description
h int - Forecast horizon.
X jnp.ndarray \| None None Optional exogenous of shape (h, n_x).
level list[int] \| None None Confidence levels (0-100) for prediction intervals.

Returns: dict (Dictionary with entries mean for point predictions and level_* for probabilistic predictions.)

predict_in_sample(self, level=None) -> dict

Access fitted Naive insample predictions.

Parameters:

Parameter Type Default Description
level list[int] \| None None Confidence levels (0-100) for prediction intervals.

Returns: dict (Dictionary with entries fitted for point predictions.)

forecast(self, h, y, X=None, X_future=None, level=None, fitted=False) -> dict

Memory Efficient Naive predictions.

This method avoids memory burden due from object storage. It is analogous to fit_predict without storing information. It assumes you know the forecast horizon in advance.

Parameters:

Parameter Type Default Description
h int - Forecast horizon.
y jnp.ndarray - Clean time series of shape (n,).
X jnp.ndarray \| None None Optional insample exogenous of shape (t, n_x).
X_future jnp.ndarray \| None None Optional exogenous of shape (h, n_x).
level list[int] \| None None Confidence levels (0-100) for prediction intervals.
fitted bool False Whether or not to return insample predictions.

Returns: dict (Dictionary with entries mean for point predictions and level_* for probabilistic predictions.)

forward(self, h, y, X=None, X_future=None, level=None, fitted=False) -> dict

Apply fitted model to an new/updated series.

Parameters:

Parameter Type Default Description
h int - Forecast horizon.
y jnp.ndarray - Clean time series of shape (n,).
X jnp.ndarray \| None None Optional insample exogenous of shape (t, n_x).
X_future jnp.ndarray \| None None Optional exogenous of shape (h, n_x).
level list[int] \| None None Confidence levels (0-100) for prediction intervals.
fitted bool False Whether or not to return insample predictions.

Returns: dict (Dictionary with entries mean for point predictions and level_* for probabilistic predictions.)