| Type | Default | Details | |
|---|---|---|---|
| target_col | str | Name of the target variable column. | |
| season_period | Optional[int] | None | Seasonal period m. None selects the non-seasonal naïve method. When provided and the training series is shorter than m, forecast returns an array of NaN. |
| box_cox | Union[bool, float] | False | Whether to apply Box-Cox transformation to the target variable. If a float value is provided, it will be used as the lambda parameter for the Box-Cox transformation. If True, the lambda parameter will be estimated from the data. |
| box_cox_biasadj | bool | False | Bias adjustment when inverting the manual Box-Cox on forecasts. |
| Returns | None |
naive
def naive(
target_col:str, # Name of the target variable column.
season_period:Optional[int]=None, # Seasonal period ``m``. ``None`` selects the non-seasonal naïve method. When provided and the training series is shorter than ``m``, ``forecast`` returns an array of ``NaN``.
box_cox:Union[bool, float]=False, # Whether to apply Box-Cox transformation to the target variable. If a float value is provided, it will be used as the lambda parameter for the Box-Cox transformation. If True, the lambda parameter will be estimated from the data.
box_cox_biasadj:bool=False, # Bias adjustment when inverting the manual Box-Cox on forecasts.
)->None:
Naïve forecaster.
Two modes controlled by season_period:
- Non-seasonal (
season_period=None): every forecast step repeats the last observed value in the training series. - Seasonal (
season_period=m): forecast values are taken from the last complete season and cycled forward — i.e. stephis predicted byy[T - m + ((h-1) % m)], whereTis the last training index.
naive.fit
def fit(
df:pd.DataFrame, # Training DataFrame containing the target column.
)->None:
Store the values needed for naïve forecasting.
No statistical model is estimated. fit simply applies data_prep and records the training series so that forecast can replicate the correct naïve pattern.
| Type | Details | |
|---|---|---|
| df | pd.DataFrame | Training DataFrame containing the target column. |
| Returns | None |
naive.forecast
def forecast(
H:int, # Forecast horizon.
exog:Optional[pd.DataFrame]=None, # Accepted for API consistency with other models but silently ignored — naïve forecasts do not use exogenous variables.
)->np.ndarray: # Forecast values of length `H`.
Generate naïve forecasts.
| Type | Default | Details | |
|---|---|---|---|
| H | int | Forecast horizon. | |
| exog | Optional[pd.DataFrame] | None | Accepted for API consistency with other models but silently ignored — naïve forecasts do not use exogenous variables. |
| Returns | np.ndarray | Forecast values of length H. |
naive.cross_validate
def cross_validate(
df:pd.DataFrame, # Full dataset.
cv_split:int, # Number of CV folds.
test_size:int, # Test window size per fold.
metrics:List[Callable], # Metric functions (e.g. ``[MAE, RMSE]``) used to evaluate forecast accuracy across folds. Call ``.cv_summary()`` after cross-validation to retrieve the aggregated scores.
step_size:int=1, # Step size to advance the test window each fold.
h_split_point:Optional[int]=None, # Split the test window into two sub-horizons for separate short- and long-term evaluation.
)->Tuple[pd.DataFrame, pd.DataFrame]: # Summary DataFrame with mean metric scores across folds, and (optionally) a fold-level DataFrame with true vs. predicted values for each fold.
Run time-series cross-validation.
| Type | Default | Details | |
|---|---|---|---|
| df | pd.DataFrame | Full dataset. | |
| cv_split | int | Number of CV folds. | |
| test_size | int | Test window size per fold. | |
| metrics | List[Callable] | Metric functions (e.g. [MAE, RMSE]) used to evaluate forecast accuracy across folds. Call .cv_summary() after cross-validation to retrieve the aggregated scores. |
|
| step_size | int | 1 | Step size to advance the test window each fold. |
| h_split_point | Optional[int] | None | Split the test window into two sub-horizons for separate short- and long-term evaluation. |
| Returns | Tuple[pd.DataFrame, pd.DataFrame] | Summary DataFrame with mean metric scores across folds, and (optionally) a fold-level DataFrame with true vs. predicted values for each fold. |