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] adds _predict_interval
in _StatsModelsAdapter
and inherits in other estimator to reduce code duplication
#4465
Conversation
* origin/enh-4301: pandas 2 compatibility changes fix name of test added author fixed pydocstyle D412 added test contibution added test cases added basic implementation added capability tag
1. all inheriting multivariate estimators must override `_predict_interval` 2. all inheriting univariate estimators need to override at least `_extract_conf_int`
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.
Overall, design-wise, looks good!
Left some minor comments.
Also, you already noted the fiddly task of finding out what happens downstream with the failures and Theta
.
Current failures:
This is the current status, and planning on how to handle these. Any comments/suggestions are very much welcome. (FYI: @fkiraly) |
I can see option 2 as well - that might be the cleaner option long term, as all However, this seems like scope creep and unclear effort, so I would go for the following strategy:
What do you think? |
A slightly more elaborate way would be, changing the test so it checks whether the functionality is there rather than an implementation. That would require a config option which turns off the error message and lets the method run. But I consider this scope creep for this PR, so out of scope. |
Agreed on out-of-scope point on both 1 and 2. Then, I'm thinking to skip the tag test for now, and mark as a TODO comment + GH issue to be addressed later (hopefully soon). Please let me know if that's not okay. Is it possible to redirect to parent's |
It's important to note the difference between "implemented" (appears at least once in the inheritance resolution order), and "overridden at least once" (appears at least twice). |
Not sure I'm certain on this. Say the adapt example you gave, basically my implementation of I'll give it a try tomorrow, but I've a feeling that |
Ahh, I see - what I meant, you check the |
As of now, definitely yes. But I suppose theoretically it's possible that in future one can inherit As of now, I believe I managed to handle the first issue using your suggestion of dispatch to other methods. As I guessed last night, I failed to take benefit of All tests on |
I would add it as an explicit exception in the test, i.e., pass the test if I would also recommend, let's open an issue to review the test, and test the tag against actual functionality (if called) rather than |
I assume this is ready to review and possibly merge? |
Yes, it's ready to review.
If it's complete and merged, will start on #4485 afterwards.
…On Fri, Apr 21, 2023, 18:38 Franz Király ***@***.***> wrote:
I assume this is ready to review and possibly merge?
—
Reply to this email directly, view it on GitHub
<#4465 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AJMCQBBFLPO5M7GU4BS3JODXCKBEHANCNFSM6AAAAAAW4ACTMI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
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.
Really great, thanks!
Seeing this, I would do the following:
- in the "returns" of the docstring of
_extract_conf_int
, be crystal clear what the implementation contract is. I.e. that it should return aDataFrame
with two columns"lower"
,"upper"
, in this order, and row index should be integer, relative to cutoff, and should contain the relative integer horizon offh
( and can be strictly larger) - I would implement the following default logic for
_extract_conf_int
: if there is a unique method ending in_int
and having argumentalpha
, use that
that is, I would suggest |
none blockers for now, but for consideration. Will merge tomorrow in this state if no change. |
Updated the docstring as suggested, please take a look. I'm not comfortable adding default method based on patterns, skipped it for now. Even if we add it, it's not going to be used in inherited classes unless someone specifically enabled the |
ok, makes sense. |
Reference Issues/PRs
Closes #4447. Depends on #4439 and #4452.
What does this implement/fix? Explain your changes.
The implementation of
_predict_interval
inAutoETS
,SARIMAX
andUnobservedComponents
were very similar. This PR helps to define these at a single place at base level which should help maintaining easier.Does your contribution introduce a new dependency? If yes, which one?
No.
What should a reviewer concentrate their feedback on?
All but
ThetaForecaster
implements_predict_interval
and hence that is failing the tests. However, the_predict_quantiles
ofThetaForecaster
just adds Gaussian quantiles to point predictions. If it is a proper way to do interval prediction, a specific exception can be made forThetaForecaster
in the base method. If not, subject to deprecation, can it be considered to remove interval support forThetaForecaster
?Did you add any tests for the change?
No.
Any other comments?
Observations on multivariate estimators as being discussed in #4447.
PR checklist
For all contributions
For new estimators