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.

SeasonalNaive

chronax.models.seasonal_naive.SeasonalNaive · inherits BaseForecaster

A method similar to the naive, but uses the last known observation of the same period (e.g. the same month of the previous year) in order to capture seasonal variations.

__init__(self, season_length: int, alias: str = 'SeasonalNaive', prediction_intervals: Optional[ConformalIntervals] = None) -> None

Seasonal naive model.

Parameter Type Default Description
season_length int - Number of observations per unit of time. Ex: 24 Hourly data.
alias str "SeasonalNaive" Custom name of the model.
prediction_intervals Optional[ConformalIntervals] None Information to compute conformal prediction intervals. By default, the model will compute the native prediction intervals.

fit(self, y: jnp.ndarray, X: Optional[jnp.ndarray] = None) -> Self

Fit the SeasonalNaive model.

Parameters:

Parameter Type Default Description
y jnp.ndarray - Clean time series of shape (t, ).
X Optional[jnp.ndarray] None Optional exogenous of shape (t, n_x).

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

predict(self, h: int, X: Optional[jnp.ndarray] = None, level: Optional[List[int]] = None) -> Dict[str, jnp.ndarray]

Predict with fitted SeasonalNaive.

Parameters:

Parameter Type Default Description
h int - Forecast horizon.
X Optional[jnp.ndarray] None Optional exogenous of shape (h, n_x).
level Optional[List[int]] 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: Optional[List[int]] = None) -> Dict[str, jnp.ndarray]

Access fitted SeasonalNaive in-sample predictions.

Parameters:

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

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

forecast(self, y: jnp.ndarray, h: int, X: Optional[jnp.ndarray] = None, X_future: Optional[jnp.ndarray] = None, level: Optional[List[int]] = None, fitted: bool = False) -> Dict[str, jnp.ndarray]

Memory Efficient SeasonalNaive 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
y jnp.ndarray - Clean time series of shape (n, ).
h int - Forecast horizon.
X Optional[jnp.ndarray] None Optional in-sample exogenous of shape (t, n_x).
X_future Optional[jnp.ndarray] None Optional exogenous of shape (h, n_x).
level Optional[List[int]] None Confidence levels (0-100) for prediction intervals.
fitted bool False Whether or not to return in-sample predictions.

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

forward(self, y: jnp.ndarray, h: int, X: Optional[jnp.ndarray] = None, X_future: Optional[jnp.ndarray] = None, level: Optional[List[int]] = None, fitted: bool = False) -> Dict[str, jnp.ndarray]

Apply the fitted model to a new or updated series.

Parameters:

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

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