scikit-learn / scikit-learn/scikit-learn

TimeSeriesSplit Needs a version that allows users to specify initial time

Open
#23,923 21 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

module:model_selection Needs Decision - Include Feature New Feature
Dominant language
Python
Stars
67.3k
Forks
27.4k
Avg merge
1d 15h
Merged PRs (30d)
58

Description

Describe the workflow you want to enable

I would like to add a new TimeSeriesSplit link called TimeSeriesRollingOriginSplit. In the current TimeSeriesSplit it is not possible for users to get an initial length.

I am happy to open a PR for this myself if it is approved.

Describe your proposed solution

This is the proposed new TimeSeriesRollingOriginSplit
class sklearn.model_selection.TimeSeriesRollingOriginSplit(initial = 5, test_size = 1, gap = 0)

initial: the initial number of samples to use. it is often common to start with a larger training period.

test_size: Used to set the test_size

gap: Number of samples to exclude from the end of each train set before the test set.

Describe alternatives you've considered, if relevant

I currently use TimeSeriesSplit in a loop, but exclude the initial splits until the train set is the size I want.

Additional context

Again. I am happy to contribute this feature.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with sklearn.model_selection.TimeSeriesSplit and its documented behavior, then compare it with the proposed initial, test_size, and gap parameters. Define the rolling-origin semantics and verify that the new splitter produces the requested initial training length, with corresponding documentation and coverage for its train/test indices.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.