-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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] in BaseForecaster
, move check for capability:insample
to _check_fh
boilerplate
#6593
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
c15876b
in sample check in _check_fh
XinyuWuu b8a20ea
check in sample error handle
XinyuWuu 6576d70
add cutoff to _check_fh
XinyuWuu 06b41eb
Merge branch 'main' into in_sample_check
XinyuWuu 2e1a18e
remove in sample check in predict_residuals
XinyuWuu 5278153
docstring
XinyuWuu b0e6df8
pred_int
XinyuWuu 015c340
regex match in neuralforecast
XinyuWuu 8f99f8a
with pytest.raises
XinyuWuu 46a1620
remove passing cutoff
XinyuWuu bd08df7
remove private error raise
XinyuWuu fa2d976
move _check_fh in update_predict_single
XinyuWuu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -227,8 +227,13 @@ def test_predict_time_index( | |
|
||
# if estimator cannot forecast in-sample and fh is in-sample, terminate | ||
# if the tag correctly states this, we consider this fine as per contract | ||
# todo: check that estimator raises error message when fitting instead | ||
# check that estimator raises error message when fitting | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
if not fh_is_oos and not estimator_instance.get_tag("capability:insample"): | ||
with pytest.raises( | ||
NotImplementedError, | ||
match="can not perform in-sample prediction", | ||
): | ||
estimator_instance.fit(y_train, fh=fh) | ||
return None | ||
|
||
estimator_instance.fit(y_train, fh=fh) | ||
|
@@ -245,10 +250,16 @@ def test_predict_time_index( | |
|
||
# if cannot forecast in-sample probabilistically, and fh is in-sample, terminate | ||
# if the tag correctly states this, we consider this fine as per contract | ||
# todo: check that estimator raises error message when fitting instead | ||
# check that estimator raises error message when fitting | ||
if not fh_is_oos: | ||
if not estimator_instance.get_tag("capability:pred_int:insample"): | ||
return None | ||
if estimator_instance.get_tag("capability:pred_int"): | ||
with pytest.raises( | ||
NotImplementedError, | ||
match="can not perform in-sample prediction", | ||
): | ||
estimator_instance.predict_interval() | ||
return None | ||
|
||
if estimator_instance.get_tag("capability:pred_int"): | ||
y_pred_int = estimator_instance.predict_interval() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are these conditions all needed?
E.g., is there an example in which we do know
fh
but do not know the cutoff?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was not sure so I put them all. I tested it without cutoff, it worked. cutoff is removed now.