multitask.factories.quantile_lgbm_forecaster_factory

multitask.factories.quantile_lgbm_forecaster_factory(
    config,
    *,
    quantiles=DEFAULT_QUANTILES,
    weight_func=None,
    target=None,
)

Return one quantile-regression LightGBM ForecasterRecursive per quantile.

Each forecaster uses LGBMRegressor(objective="quantile", alpha=q) and the same lag/rolling configuration as :func:default_lgbm_forecaster_factory, so a caller can fit the lower/median/upper heads independently and assemble a band with :func:predict_quantile_band. Deterministic given config.random_state; sf2-safe (LightGBM only, no torch/optuna). Refs hong16b, roma19a.

Parameters

Name Type Description Default
config Any Object satisfying the PipelineConfig protocol; reads random_state, lags_consider, window_size. required
quantiles Sequence[float] Quantile levels in the open interval (0, 1). Defaults to (0.1, 0.5, 0.9). DEFAULT_QUANTILES
weight_func Optional[Any] Optional per-sample weight function. None
target Optional[str] Accepted and ignored (parity with the default factory). None

Returns

Name Type Description
Dict[float, ForecasterRecursive] Dict[float, ForecasterRecursive]: Map from quantile level to a fresh,
Dict[float, ForecasterRecursive] unfitted forecaster, in ascending quantile order.

Raises

Name Type Description
ValueError If quantiles is empty, out of (0, 1), or has duplicates.

Examples

import types
from spotforecast2_safe.multitask.factories import (
    quantile_lgbm_forecaster_factory,
)

config = types.SimpleNamespace(
    random_state=42, lags_consider=[1, 2, 3], window_size=3
)
heads = quantile_lgbm_forecaster_factory(config, quantiles=[0.1, 0.5, 0.9])
print(sorted(heads))
print(heads[0.1].regressor.get_params()["objective"])
print(heads[0.1].regressor.get_params()["alpha"])
[0.1, 0.5, 0.9]
quantile
0.1
/home/runner/work/spotforecast2-safe/spotforecast2-safe/src/spotforecast2_safe/forecaster/base.py:476: FutureWarning: The `regressor` attribute is deprecated and will be removed in future versions. Use `estimator` instead.
  warnings.warn(