Skip to content
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

[ENH] Allow pd.Timedelta values in ForecastingHorizon #2333

Merged
merged 27 commits into from Apr 4, 2022
Merged

[ENH] Allow pd.Timedelta values in ForecastingHorizon #2333

merged 27 commits into from Apr 4, 2022

Conversation

khrapovs
Copy link
Contributor

@khrapovs khrapovs commented Mar 28, 2022

Reference Issues/PRs

One more contribution to #1737.

What does this implement/fix? Explain your changes.

In this PR I added TEST_FHS_TIMEDELTA test cases to sktime.forecasting.base.tests.test_fh.test_fh. In order to pass the tests two changes were required in ForecastingHorizon itself: in sktime.forecasting.base._fh.ForecastingHorizon._is_in_sample and in sktime.forecasting.base._fh.ForecastingHorizon._is_out_of_sample. Both methods perform comparison with zero which in case of pd.Timdelta values should actually be pd.Timedelta(0).

Note that sktime.forecasting.base._fh.ForecastingHorizon.to_indexer returns None in the new timedelta case. I have no idea what this method should return in this case. Any suggestions are very much welcome.

In addition, I have silenced the pre-commit error from (described here: #2338) by using # noqa: B019 next to the @lru_cache decorator.

Does your contribution introduce a new dependency? If yes, which one?

No

What should a reviewer concentrate their feedback on?

Any other comments?

PR checklist

For all contributions
  • I've added myself to the list of contributors.
  • Optionally, I've updated sktime's CODEOWNERS to receive notifications about future changes to these files.
  • I've added unit tests and made sure they pass locally.
  • The PR title starts with either [ENH], [DOC] or [BUG] indicating wether the PR topic is related to enhancement, documentation or bug

@khrapovs
Copy link
Contributor Author

@fkiraly @aiwalter Would you mind taking a look?

@fkiraly fkiraly merged commit 2ec3327 into sktime:main Apr 4, 2022
@khrapovs khrapovs deleted the 1737-khrapovs-test-timedelta-forecasting-horizon branch April 5, 2022 06:51
srggrs added a commit to Gridsight/sktime that referenced this pull request Apr 6, 2022
* upstream/main:
  [DOC] Added docstring examples to load data functions (sktime#2393)
  [ENH] Capability inference for transformer and classifier pipelines (sktime#2367)
  [ENH] Proba metric grid search integration (sktime#2234)
  [ENH] Faster classifier example parameters (sktime#2378)
  [ENH] Get rid of `pd.Int64Index` (sktime#2390)
  [ENH] Allow `pd.Timedelta` values in `ForecastingHorizon` (sktime#2333)
  [ENH] Partially replace `pd.Int64Index` with `pd.Index` (sktime#2339)
  relax name rules for multiindex (sktime#2384)
@lmmentel lmmentel added the enhancement Adding new functionality label Apr 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Adding new functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants