Skip to content

Expanding Window Cross-Validation for Time Series? #1365

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Cajeux1999 opened this issue Mar 31, 2025 · 2 comments
Open

Expanding Window Cross-Validation for Time Series? #1365

Cajeux1999 opened this issue Mar 31, 2025 · 2 comments

Comments

@Cajeux1999
Copy link

Does TPOT supports Cross-Validation for Time Series using an Expanding Window, as shown below?

I am thinking on how that could be done, but i still haven't found a solution yet.

Image

@perib
Copy link
Contributor

perib commented Mar 31, 2025

It's not built in, but TPOT now supports custom objective functions and cv splitters.

Two options:

  1. (simplest) you pass in an sklearn cv splitter that does this strategy (sklearn.model_selection.BaseCrossValidator) to the 'cv' parameter. I think 'cv=sklearn.model_selection.TimeSeriesSplit(n_splits=10)' should be what you are looking for.

You can define a custom function that takes in a model, and returns the expanded window cross validation score. Then pass that function into 'other_objective_functions'. Make sure to also set 'other_objective_functions_weights'

See tutorial 1 here for an example:

https://github.com/EpistasisLab/tpot/blob/main/Tutorial/1_Using_TPOT.ipynb

@Cajeux1999
Copy link
Author

Hi Pedro,

I have used TPOT for an article submitted to a local conference, applied to time-series forecasting. Results were very good.

I can upload an example notebook on TPOT applied to time series, applied in a expanding window setup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants