| Type | Default | Details | |
|---|---|---|---|
| target_col | str | Name of the target variable column. | |
| trend | Optional[str] | None | Trend component type. |
| damped_trend | bool | False | Whether to damp the trend. Only meaningful when trend is not None. |
| seasonal | Optional[str] | None | Seasonal component type. |
| seasonal_periods | Optional[int] | None | Number of periods in a complete seasonal cycle — e.g. 12 for monthly data with an annual cycle. Required when seasonal is not None. |
| initialization_method | Optional[str] | estimated | How to initialise the recursions. When "known" is chosen, initial_level (and initial_trend / initial_seasonal where applicable) must also be provided. |
| initial_level | Optional[float] | None | Initial level value. Required when initialization_method=“known”. | | initial_trend | Optional[float] | None | Initial trend value. Required wheninitialization_method="known" and the model has a trend component. |
| initial_seasonal | Optional[list] | None | Initial seasonal factors (length seasonal_periods or seasonal_periods - 1). Required when initialization_method="known" and the model is seasonal. |
| bounds | Optional[dict] | None | Parameter bounds passed to ExponentialSmoothing, e.g. {"smoothing_level": (0, 1)}. |
| dates | NoneType | None | Datetime index for the series. Inferred automatically when endog is a Pandas object with a DatetimeIndex. |
| freq | Optional[str] | None | Frequency of the time series (e.g. "M", "D"). Optional when dates is provided. |
| missing | str | none | How to handle NaN values in the input series. |
| optimized | bool | True | Estimate smoothing parameters by maximising the log-likelihood. |
| smoothing_level | Optional[float] | None | Fixed alpha value. When set, this value is used directly and not optimised. |
| smoothing_trend | Optional[float] | None | Fixed beta value. Only used when the model has a trend component. |
| smoothing_seasonal | Optional[float] | None | Fixed gamma value. Only used when the model is seasonal. |
| damping_trend | Optional[float] | None | Fixed phi (damping) value. Only used when damped_trend=True. |
| remove_bias | bool | False | Remove bias from forecast values by enforcing that the mean residual is zero. |
| start_params | NoneType | None | Starting parameter values for the optimiser. |
| method | Optional[str] | None | Optimisation method — one of "L-BFGS-B" (default), "TNC", "SLSQP", "Powell", "trust-constr", "basinhopping" (alias "bh"), or "least_squares" (alias "ls"). |
| minimize_kwargs | Optional[dict] | None | Extra keyword arguments forwarded to the chosen SciPy minimiser. |
| use_brute | bool | True | Search for good starting values with a brute-force grid search before running the main optimiser. |
| 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. |
| fit_kwargs | Optional[dict] | None | Any additional keyword arguments forwarded verbatim to ExponentialSmoothing.fit. |
| Returns | None | Fitted model object with a forecast method for making predictions and properties for information criteria scores (AIC, BIC, etc.) |
ets
def ets(
target_col:str, # Name of the target variable column.
trend:Optional[str]=None, # Trend component type.
damped_trend:bool=False, # Whether to damp the trend. Only meaningful when ``trend`` is not `None`.
seasonal:Optional[str]=None, # Seasonal component type.
seasonal_periods:Optional[int]=None, # Number of periods in a complete seasonal cycle — e.g. 12 for monthly data with an annual cycle. Required when ``seasonal`` is not ``None``.
initialization_method:Optional[str]='estimated', # How to initialise the recursions. When `"known"` is chosen, `initial_level` (and `initial_trend` / `initial_seasonal` where applicable) must also be provided.
initial_level:Optional[float]=None, # Initial level value. Required when `initialization_method=`"known"`.
initial_trend:Optional[float]=None, # Initial trend value. Required when `initialization_method=`"known"` and the model has a trend component.
initial_seasonal:Optional[list]=None, # Initial seasonal factors (length `seasonal_periods` or ``seasonal_periods - 1``). Required when ``initialization_method="known"`` and the model is seasonal.
bounds:Optional[dict]=None, # Parameter bounds passed to ``ExponentialSmoothing``, e.g. `{"smoothing_level": (0, 1)}`.
dates:NoneType=None, # Datetime index for the series. Inferred automatically when `endog` is a Pandas object with a `DatetimeIndex`.
freq:Optional[str]=None, # Frequency of the time series (e.g. ``"M"``, ``"D"``). Optional when `dates` is provided.
missing:str='none', # How to handle ``NaN`` values in the input series.
optimized:bool=True, # Estimate smoothing parameters by maximising the log-likelihood.
smoothing_level:Optional[float]=None, # Fixed alpha value. When set, this value is used directly and not optimised.
smoothing_trend:Optional[float]=None, # Fixed beta value. Only used when the model has a trend component.
smoothing_seasonal:Optional[float]=None, # Fixed gamma value. Only used when the model is seasonal.
damping_trend:Optional[float]=None, # Fixed phi (damping) value. Only used when ``damped_trend=True``.
remove_bias:bool=False, # Remove bias from forecast values by enforcing that the mean residual is zero.
start_params:NoneType=None, # Starting parameter values for the optimiser.
method:Optional[str]=None, # Optimisation method — one of `"L-BFGS-B"` (default), `"TNC"`, `"SLSQP"`, `"Powell"`, `"trust-constr"`, `"basinhopping"` (alias `"bh"`), or `"least_squares"` (alias `"ls"`).
minimize_kwargs:Optional[dict]=None, # Extra keyword arguments forwarded to the chosen SciPy minimiser.
use_brute:bool=True, # Search for good starting values with a brute-force grid search before running the main optimiser.
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.
fit_kwargs:Optional[dict]=None, # Any additional keyword arguments forwarded verbatim to `ExponentialSmoothing.fit`.
)->None: # Fitted model object with a ``forecast`` method for making predictions and properties for information criteria scores (AIC, BIC, etc.)
Holt-Winters Exponential Smoothing forecaster.
A thin wrapper around statsmodels.tsa.holtwinters.ExponentialSmoothing.
ets.fit
def fit(
df:pd.DataFrame, # Training DataFrame containing the target column
)->None:
Fit ExponentialSmoothing to the training data.
| Type | Details | |
|---|---|---|
| df | pd.DataFrame | Training DataFrame containing the target column |
| Returns | None |
ets.forecast
def forecast(
H:int, # Forecast horizon.
exog:Optional[pd.DataFrame]=None, # Accepted for API consistency with other models but silently ignored — ETS forecasts do not use exogenous variables.
)->np.ndarray: # Forecast values of length `H`.
Multi-step forecast.
| Type | Default | Details | |
|---|---|---|---|
| H | int | Forecast horizon. | |
| exog | Optional[pd.DataFrame] | None | Accepted for API consistency with other models but silently ignored — ETS forecasts do not use exogenous variables. |
| Returns | np.ndarray | Forecast values of length H. |
ets.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. |