import warningsfrom spotforecast2_safe.splitter.utils_common import OneStepAheadValidationWarningwith warnings.catch_warnings(record=True) as caught: warnings.simplefilter("always") warnings.warn("This is a one-step-ahead validation warning.", OneStepAheadValidationWarning, )assertlen(caught) ==1assertissubclass(caught[0].category, OneStepAheadValidationWarning)print(str(caught[0].message))
This is a one-step-ahead validation warning.
You can suppress this warning using: warnings.simplefilter('ignore', category=OneStepAheadValidationWarning)
Lists of lags to try. If list, each element must be an int, list, np.ndarray, or range. If dict, the keys are used as labels in the results DataFrame, and the values are the lags to try. Defaults to None.
A tuple containing: - lags_grid (dict): Dictionary with lags configuration for each iteration. - lags_label (str): Label for lags representation in the results object.
Select the optimal number of jobs to use in the backtesting process. This selection is based on heuristics and is not guaranteed to be optimal.
The number of jobs is chosen as follows:
If refit is an integer, then n_jobs = 1. This is because parallelization doesn’t work with intermittent refit.
If forecaster is ‘ForecasterRecursive’ and estimator is a linear estimator, then n_jobs = 1.
If forecaster is ‘ForecasterRecursive’ and estimator is not a linear estimator then n_jobs = cpu_count() - 1.
If forecaster is ‘ForecasterDirect’ or ‘ForecasterDirectMultiVariate’ and refit = True, then n_jobs = cpu_count() - 1.
If forecaster is ‘ForecasterDirect’ or ‘ForecasterDirectMultiVariate’ and refit = False, then n_jobs = 1.
If forecaster is ‘ForecasterRecursiveMultiSeries’, then n_jobs = cpu_count() - 1.
If forecaster is ‘ForecasterStats’ or ‘ForecasterEquivalentDate’, then n_jobs = 1.
If estimator is a LGBMRegressor(n_jobs=1), then n_jobs = cpu_count() - 1.
If estimator is a LGBMRegressor with internal n_jobs != 1, then n_jobs = 1. This is because lightgbm is highly optimized for gradient boosting and parallelizes operations at a very fine-grained level, making additional parallelization unnecessary and potentially harmful due to resource contention.