Skip to content

Conversation

@Omswastik-11
Copy link

@Omswastik-11 Omswastik-11 commented Nov 20, 2025

Summary

This PR adds a full integration with skforecast, allowing Hyperactive to optimize hyperparameters of skforecast forecasting models using any of its optimization algorithms.

Implementation Details

SkforecastExperiment (skforecast_forecasting.py)

  • Inherits from BaseExperiment.
  • Uses skforecast.model_selection.backtesting_forecaster inside _evaluate() to perform time-series cross-validation for each parameter set.
  • clones the forecaster and applies new parameters with set_params() before every evaluation.

SkforecastOptCV (skforecast_opt_cv.py)

  • sklearn-style estimator (inherits from BaseEstimator).

  • Works with ForecasterRecursive and other compatible skforecast forecasters.

  • fit():

    • Builds a SkforecastExperiment with user settings (steps, initial_train_size, metric, etc.).
    • runs Hyperactive’s optimizer to search for the best hyperparameters.
    • refits the best forecaster on all available data.
  • predict():

    • delegates to best_forecaster_.predict() for easy forecasting after optimization.

Configuration

  • added skforecast as an optional dependency in pyproject.toml under the integrations extra.

Verification

  • added skforecast_example.py showing a HillClimbing search with ForecasterRecursive + RandomForestRegressor.
  • added unit tests to verify parameter handling, experiment execution, and integration flow.

Closes

Fixes #199

@Omswastik-11 Omswastik-11 changed the title ENH] Add skforecast integration for time series hyperparameter tuning [ENH] Add skforecast integration for time series hyperparameter tuning Nov 20, 2025
@fkiraly fkiraly added enhancement New feature or request module:integrations Integrations for applying optimization to other libraries labels Nov 22, 2025
Copy link
Collaborator

@fkiraly fkiraly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, great!

  • please improve docstrings, see above, and also include defaults
  • please add get_test_params with sensible settings to test the experiment and the forecaster
  • please fix code quality issues, use pre-commit

@fkiraly fkiraly changed the title [ENH] Add skforecast integration for time series hyperparameter tuning [ENH] skforecast integration for time series hyperparameter tuning Nov 22, 2025
@Omswastik-11 Omswastik-11 requested a review from fkiraly November 22, 2025 17:07
@Omswastik-11
Copy link
Author

Omswastik-11 commented Nov 22, 2025

Hi @fkiraly !!
Modified the docs string. As you suggested .

added get_test_params() verified all the tests .

tested the pre-commit on changed files
image

kindly verify this.

Copy link
Collaborator

@fkiraly fkiraly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the tests to run, you need to add skforecast to the python environment - I would add it to sktime-integration in pyproject.toml, that might be easiest.

@Omswastik-11 Omswastik-11 requested a review from fkiraly November 23, 2025 08:51
@Omswastik-11
Copy link
Author

Omswastik-11 commented Nov 23, 2025

Hi @fkiraly !! commited the changes as you suggested

  1. added skforecast to sktime-integration
  2. https://github.com/SimonBlanke/Hyperactive/actions/runs/19598614085/job/56149302140?pr=208
    Modified CI to avoid disk storage issue in CI build
  3. cheked SkforecastExperiment against all tests
image

@JoaquinAmatRodrigo
Copy link

Hi,
I’ve taken a look at the code related to skforecast, and it looks good. Thanks for the work, @Omswastik-11!

@Omswastik-11
Copy link
Author

Hi @JoaquinAmatRodrigo !!!
Thanks 👍.
Can you trigger the workflow to see if it works perfectly ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request module:integrations Integrations for applying optimization to other libraries

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ENH] skforecast integration

3 participants