manager.models.forecaster_recursive_xgb_full

manager.models.forecaster_recursive_xgb_full

XGBoost forecaster with real Bayesian tuning and SHAP.

This module provides :class:ForecasterRecursiveXGBFull, which combines the XGBoost forecaster from spotforecast2-safe with Bayesian hyperparameter optimisation (Optuna) and SHAP-based feature importance from :class:~spotforecast2.manager.models.ForecasterRecursiveModelFull.

Examples

>>> from spotforecast2.manager.models import ForecasterRecursiveXGBFull
>>> model = ForecasterRecursiveXGBFull(iteration=0)
>>> model.name
'xgb'
>>> model.forecaster is not None
True
>>> model.n_trials
10

Classes

Name Description
ForecasterRecursiveXGBFull XGBoost forecaster with real Bayesian tuning and SHAP.

ForecasterRecursiveXGBFull

manager.models.forecaster_recursive_xgb_full.ForecasterRecursiveXGBFull(
    iteration,
    lags=12,
    **kwargs,
)

XGBoost forecaster with real Bayesian tuning and SHAP.

Inherits the XGBoost forecaster initialisation from :class:~spotforecast2_safe.manager.models.forecaster_recursive_xgb.ForecasterRecursiveXGB (spotforecast2-safe) and adds the real :meth:tune and :meth:get_global_shap_feature_importance from :class:~spotforecast2.manager.models.ForecasterRecursiveModelFull.

The MRO ensures that :meth:tune and SHAP methods resolve from ForecasterRecursiveModelFull, while the XGBoost-specific __init__ (estimator wiring) comes from ForecasterRecursiveXGB.

Parameters

Name Type Description Default
iteration int Training iteration index (0-based). required
lags int Number of lag features to use. 12
**kwargs Any Forwarded to parent classes (e.g., n_trials, predict_size, train_size). {}

Examples

>>> from spotforecast2.manager.models import ForecasterRecursiveXGBFull
>>> model = ForecasterRecursiveXGBFull(iteration=0)
>>> model.name
'xgb'
>>> model.forecaster is not None
True
>>> model.n_trials
10
>>> model.iteration
0
from spotforecast2.manager.models import ForecasterRecursiveXGBFull
model = ForecasterRecursiveXGBFull(iteration=0)
print(f"Model name: {model.name}")
print(f"Trials: {model.n_trials}")
print(f"Has tune: {callable(model.tune)}")
print(f"Has SHAP: {callable(model.get_global_shap_feature_importance)}")
Model name: xgb
Trials: 10
Has tune: True
Has SHAP: True