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

[BUG] Modified VAR code to allow predict_quantiles of 0.5 (fixes #4742) #6441

Merged
merged 6 commits into from
May 25, 2024

Conversation

meraldoantonio
Copy link
Contributor

Reference Issues/PRs

Fixes #4742

What does this implement/fix? Explain your changes.

Previously, VAR produced an error when predicting quantiles with an alpha of 0.5. This issue arose because alpha was converted to a coverage of 1.0 in _base, which was then reconverted to an alpha ("internal alpha") of 1.0 inside VAR's _predict_interval. An internal alpha of 1.0 is outside the acceptable range (0.0 to 1.0 exclusive) for statsmodels VAR.

This change hackily coerces an internal alpha of 1.0 to 0.99999 to avoid this error.

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

No

What should a reviewer concentrate their feedback on?

The hacky nature of this change

Did you add any tests for the change?

No

PR checklist

For all contributions
  • [X ] I've added myself to the list of contributors with any new badges I've earned :-)
    How to: add yourself to the all-contributors file in the sktime root directory (not the CONTRIBUTORS.md). Common badges: code - fixing a bug, or adding code logic. doc - writing or improving documentation or docstrings. bug - reporting or diagnosing a bug (get this plus code if you also fixed the bug in the PR).maintenance - CI, test framework, release.
    See here for full badge reference
  • Optionally, for added estimators: I've added myself and possibly to the maintainers tag - do this if you want to become the owner or maintainer of an estimator you added.
    See here for further details on the algorithm maintainer role.
  • [ X] The PR title starts with either [ENH], [MNT], [DOC], or [BUG]. [BUG] - bugfix, [MNT] - CI, test framework, [ENH] - adding or improving code, [DOC] - writing or improving documentation or docstrings.

sktime/forecasting/var.py Outdated Show resolved Hide resolved
.all-contributorsrc Outdated Show resolved Hide resolved
sktime/regression/deep_learning/cnn.py Outdated Show resolved Hide resolved
Comment on lines +248 to +250
# A hacky way to coerce error-inducing alpha==1 into its approximant
if alpha >= 0.99999:
alpha = 0.99999
Copy link
Collaborator

Choose a reason for hiding this comment

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

Thoughts: can/should we document this hack for users, and if so, where?

Copy link
Collaborator

Choose a reason for hiding this comment

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

docstring?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think docstring modifications in these file do not get shown in read the docs. These are private methods (starting with _), and what all gets shown is only those of the base class.

Please let me know if this a misunderstanding.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I mean, the class docstring, that gets overridden.

@yarnabrina yarnabrina requested a review from fkiraly May 18, 2024 15:03
@@ -2649,7 +2649,8 @@
"avatar_url": "https://avatars.githubusercontent.com/u/37468543?v=4",
"profile": "https://github.com/meraldoantonio",
"contributions": [
"doc"
"doc",
"bug"
Copy link
Collaborator

Choose a reason for hiding this comment

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

"bug" is for diagnosing or reporting bugs, but not bugfixes. Bugfixes fall under the "code" badge, so you can add both.

Copy link
Collaborator

@yarnabrina yarnabrina left a comment

Choose a reason for hiding this comment

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

Approved in principle, but following two changes are strongly recommended:

  1. modification of the class docstring mentioning this hack, perhaps in the Notes section. See the discussion with @fkiraly above.
  2. addition of a test case, where you can reuse the bug report provided in the linked issue

@fkiraly
Copy link
Collaborator

fkiraly commented May 25, 2024

Merging for release. Since not blocking, the updates to docstring can be made in separate PR.

@fkiraly fkiraly merged commit 28ea8b5 into sktime:main May 25, 2024
54 checks passed
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] VAR cannot predict quantiles when alpha is 0.5
3 participants