Default hyperparameter search spaces and per-task constants.
A neutral module imported by spotforecast2.multitask.strategies, the user-facing shim modules spotforecast2.multitask.optuna / spotforecast2.multitask.spotoptim, and spotforecast2.models’s ForecasterRecursiveModelFull.tune. Keeping the defaults here means no shim has to import a strategy back, and no strategy class has to import a shim — eliminating the cyclic-import warning CodeQL raised against the lazy-import workaround.
This module is the single canonical home for:
LAGS_CONSIDER / WINDOW_FEATURES (constants).
default_optuna_search_space / default_spotoptim_search_space (used by OptunaStrategy / SpotOptimStrategy in the multitask pipeline).
search_space_lgbm / search_space_xgb / SEARCH_SPACES (used by ForecasterRecursiveModelFull.tune).
Estimator hyperparameters use the estimator__ prefix so that ForecasterRecursive.set_params(**sample) forwards them to the wrapped LGBMRegressor instead of silently setting attributes on the wrapper. lags is consumed separately via set_lags and therefore stays bare.
This is the space OptunaStrategy uses when no search_space is given. Consumers that tune a non-LightGBM estimator pass their own space instead.
/Users/bartz/workspace/spotforecast2/src/spotforecast2/multitask/search_spaces.py:92: UserWarning: Choices for a categorical distribution should be a tuple of None, bool, int, float and str for persistent storage but contains [1, 2, 24] which is of type list.
"lags": trial.suggest_categorical(
/Users/bartz/workspace/spotforecast2/src/spotforecast2/multitask/search_spaces.py:92: UserWarning: Choices for a categorical distribution should be a tuple of None, bool, int, float and str for persistent storage but contains [1, 2, 24, 48] which is of type list.
"lags": trial.suggest_categorical(
/Users/bartz/workspace/spotforecast2/src/spotforecast2/multitask/search_spaces.py:92: UserWarning: Choices for a categorical distribution should be a tuple of None, bool, int, float and str for persistent storage but contains [1, 2, 23, 24, 47, 48] which is of type list.
"lags": trial.suggest_categorical(
Estimator hyperparameters carry the estimator__ prefix; see the docstring of default_optuna_search_space for the rationale. This is the space SpotOptimStrategy uses when no search_space is given; consumers that widen the bounds or tune another estimator start from a copy of it.
Consumed by ForecasterRecursiveModelFull.tune via the SEARCH_SPACES registry below. Estimator keys use the estimator__ prefix; see default_optuna_search_space for the rationale.
The space is deliberately bootstrap_type-agnostic: it omits subsample / colsample (valid only for specific CatBoost bootstrap types) to avoid invalid-combination errors, and instead tunes CatBoost’s native depth / l2_leaf_reg / random_strength / bagging_temperature levers.
Consumed by ForecasterRecursiveModelFull.tune via the SEARCH_SPACES registry below. Estimator keys use the estimator__ prefix; see default_optuna_search_space for the rationale.
Consumed by ForecasterRecursiveModelFull.tune via the SEARCH_SPACES registry below. Estimator keys use the estimator__ prefix; see default_optuna_search_space for the rationale.