manager.multitask.PredictTask

manager.multitask.PredictTask(
    dataframe=None,
    data_test=None,
    data_frame_name='default',
    cache_home=None,
    agg_weights=None,
    index_name='DateTime',
    number_folds=10,
    predict_size=24,
    bounds=None,
    contamination=0.03,
    imputation_method='weighted',
    use_exogenous_features=True,
    n_trials_optuna=15,
    n_trials_spotoptim=10,
    n_initial_spotoptim=5,
    auto_save_models=True,
    train_days=365 * 2,
    val_days=7 * 2,
    log_level=logging.INFO,
    verbose=False,
    **config_overrides,
)

Task 5 — Predict-only using previously saved models.

Loads fitted forecasters that were persisted by a prior LazyTask, OptunaTask, or SpotOptimTask run and produces predictions for all configured targets. No training or tuning is performed.

If no saved models exist in the cache directory the run method raises RuntimeError with an informative message.

Examples

from spotforecast2.manager.multitask import PredictTask

task = PredictTask(data_frame_name="demo10", predict_size=24)
print(f"Task: {task.TASK}")
print(f"Predict size: {task.config.predict_size}")
Task: predict
Predict size: 24

Methods

Name Description
run Run prediction using previously saved models.

run

manager.multitask.PredictTask.run(
    show=True,
    task_name=None,
    max_age_days=None,
    **kwargs,
)

Run prediction using previously saved models.

Parameters

Name Type Description Default
show bool If True, display prediction figures. True
task_name Optional[str] Restrict model loading to a specific source task ("lazy", "optuna", or "spotoptim"). None loads the most recent model regardless of source. None
max_age_days Optional[float] Maximum age in days for saved models. Models older than this are ignored. None accepts any age. None

Returns

Name Type Description
Dict[str, Any] Aggregated prediction package. Per-target packages are stored
Dict[str, Any] on self.results["predict"].

Raises

Name Type Description
RuntimeError If no saved models are found in the cache directory, or if a target has no matching model.