multitask.factories.default_lgbm_forecaster_factory

multitask.factories.default_lgbm_forecaster_factory(
    config,
    *,
    weight_func=None,
    target=None,
)

Return a fresh, unfitted LightGBM ForecasterRecursive.

Mirrors the construction previously inlined in BaseTask.create_forecaster. target is accepted (and ignored by this default) so that custom factories can specialise per target without a signature change.

Parameters

Name Type Description Default
config Any Any object satisfying the PipelineConfig protocol from spotforecast2_safe.multitask.base. Reads random_state, lags_consider, and window_size. required
weight_func Optional[Any] Optional per-sample weight function produced by the imputation step (apply_imputation). None
target Optional[str] Target column name. Ignored by this default factory; provided for the benefit of custom factories that need it. None

Returns

Name Type Description
ForecasterRecursive A new ForecasterRecursive ready to be fit.

Examples

import types
from spotforecast2_safe.multitask.factories import default_lgbm_forecaster_factory
from spotforecast2_safe.forecaster.recursive import ForecasterRecursive

# Build a minimal config-like object that satisfies the PipelineConfig
# protocol (random_state, lags_consider, window_size).
config = types.SimpleNamespace(
    random_state=42,
    lags_consider=[1, 2, 3],
    window_size=3,
)

forecaster = default_lgbm_forecaster_factory(config, target="power")
assert isinstance(forecaster, ForecasterRecursive)
assert list(forecaster.lags) == [1, 2, 3]
print(f"type: {type(forecaster).__name__}")
print(f"lags: {list(forecaster.lags)}")
type: ForecasterRecursive
lags: [np.int64(1), np.int64(2), np.int64(3)]