Skip to content

fix: Add date_series as TimeGapSplit parameter and deprecate date_serie#784

Open
RedZapdos123 wants to merge 2 commits into
koaning:mainfrom
RedZapdos123:fix/timegapsplit-date-series-alias-761
Open

fix: Add date_series as TimeGapSplit parameter and deprecate date_serie#784
RedZapdos123 wants to merge 2 commits into
koaning:mainfrom
RedZapdos123:fix/timegapsplit-date-series-alias-761

Conversation

@RedZapdos123
Copy link
Copy Markdown

@RedZapdos123 RedZapdos123 commented Apr 16, 2026

Description:

Issue #761 reported a typo in the TimeGapSplit constructor argument name, where date_serie was used instead of date_series.

This PR adds a backward compatible fix:

  • Supports the correct argument name date_series
  • Keeps support for the legacy name date_serie
  • Validates that exactly one of date_series or date_serie is provided
  • Keeps internal compatibility by aliasing date_serie to date_series
  • Updates TimeGapSplit docs examples to use date_series

It also adds regression tests that cover:

  • date_series works correctly
  • Passing both date_series and date_serie raises a clear ValueError

Closes #761.

Validation:

  • ruff check sklego/model_selection.py tests/test_model_selection/test_timegapsplit.py
  • pytest -q tests/test_model_selection/test_timegapsplit.py
  • pytest -q

Note: pytest -q reports one unrelated pre-existing failure in tests/test_meta/test_grouped_predictor.py::test_custom_shrinkage. (See #785 )

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • My code follows the style guidelines (ruff)
  • I have commented my code, particularly in hard to understand areas
  • I have made corresponding changes to the documentation (also to the readme.md)
  • I have added tests that prove my fix is effective or that my feature works
  • I have added tests to check whether the new feature adheres to the sklearn convention
  • New and existing unit tests pass locally with my changes

The validation screenshots of the tests run, locally on WSL:

image Screenshot 2026-04-16 223559

Keep backward compatibility by accepting both date_series and date_serie while enforcing that only one is provided.\n\nAlso add regression tests for alias behavior and conflict validation, and update docs examples to use date_series.\n\nCloses koaning#761.

Signed-off-by: Mridankan Mandal <xerontitan90@gmail.com>
@RedZapdos123
Copy link
Copy Markdown
Author

@FBruzzesi I request a review for this PR (bug fix).

Copy link
Copy Markdown
Collaborator

@FBruzzesi FBruzzesi left a comment

Choose a reason for hiding this comment

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

Hey @RedZapdos123 👋🏼 thanks for your contribution. I added a couple of comments/suggestions to hopefully have more insightful messages for users

Comment thread sklego/model_selection.py Outdated
Comment thread sklego/model_selection.py Outdated
Comment thread sklego/model_selection.py Outdated
Reorder constructor/doc parameters so date_series is canonical and date_serie is legacy-last.\n\nUse structural pattern matching for (date_series, date_serie) handling, including clearer errors and DeprecationWarning on legacy-only usage.\n\nUpdate TimeGapSplit tests for warning/error paths and canonical keyword usage.

Signed-off-by: Mridankan Mandal <xerontitan90@gmail.com>
@FBruzzesi FBruzzesi changed the title fix: support date_series alias in TimeGapSplit fix: Add date_series as TimeGapSplit parameter and deprecate date_serie Apr 19, 2026
Copy link
Copy Markdown
Collaborator

@FBruzzesi FBruzzesi left a comment

Choose a reason for hiding this comment

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

Thanks @RedZapdos123 for the contribution and quick adjustment! It's a +1 from me 😉

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

Successfully merging this pull request may close these issues.

[BUG] Typo in method parameter

3 participants