Naive
chronax.models.naive.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(): Trains the model and stores parameters - predict(): Makes forecasts using fitted model (stateful) with confidence intervals - predict_in_sample(): Returns fitted values from training with confidence intervals - forecast(): Stateless prediction (fit + predict in one step) with confidence intervals - forward(): Applies fitted model to new/updated time series Core computation is handled by _naive_core() which computes forecasts, fitted values, and residual statistics. Confidence Intervals: - Native intervals: Uses residual standard error with normal distribution assumption - Conformal intervals: Uses base_forecaster's conformal prediction methods when conformal_params is provided
__init__(self, alias: str = 'Naive', conformal_params: ConformalIntervals | None = None)
(Initializes the Naive forecaster.)
| Parameter | Type | Default | Description |
|---|---|---|---|
alias |
str |
"Naive" |
(undocumented) |
conformal_params |
ConformalIntervals \| None |
None |
(undocumented) |
fit(self, y: jnp.ndarray, X: jnp.ndarray | None = None) -> Self
Trains the model and stores 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: int, X: jnp.ndarray | None = None, level: list[int] | None = None) -> dict
Predict with fitted Naive.
| 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: list[int] | None = None) -> dict
Access fitted Naive insample predictions.
| 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: int, y: jnp.ndarray, X: jnp.ndarray | None = None, X_future: jnp.ndarray | None = None, level: list[int] | None = None, fitted: bool = 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.
| 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: int, y: jnp.ndarray, X: jnp.ndarray | None = None, X_future: jnp.ndarray | None = None, level: list[int] | None = None, fitted: bool = False) -> dict
Apply fitted model to an new/updated series.
| 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.)