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] Fix ARCH._check_predict_proba
#5349
#5384
Conversation
I've updated this PR with code along the lines suggested. I will turn on tests for all forecasters so we can see what happens. |
Ok, I'm confused now - nothing else seems to fail. Any explanations? |
After debugging for a while,
I think it's my bad, there is no bug in
Hope it makes some sense now. |
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 see, so the issue was after all isolated to uarch - makes sense. Lets merge this as a fix then.
_check_predict_proba
#5349 ARCH._check_predict_proba
#5349
Related to #5349 (issue), #5384 (PR). > After debugging for a while, > > 1. Firstly, the function `_check_predict_proba` is only testing for `y_train` generated from `_make_data(n_columns=n_columns)`. If the forecaster is univariate, then the `y_train` generated would always have column name `None` of type `str`. The `_check_predict_proba` checks whether the `_predict_proba` is changing `None` to `0` internally. Since every forecaster's `_predict_proba` doing it, all forecasters passed. > 2. Actually `ARCH` should fail this test, because `_predict_proba` function is deleted in this PR. But, the `type(y_train.name)` is `str` (`'None'`), not `None`. Therefore, `None` case is skipped and checks whether `(pred_cols == y_train.name).all()` which is `None` of `str` equals `None` of `str` so, `ARCH` also passed. > > I think it's my bad, there is no bug in `_check_predict_proba` as it is not designed to check whether column names are preserved. Changes should only be in `ARCH`'s `_predict_proba` like below: > > 1. If the column name is `None` of type `None`/`str`, do `pred_dist.name = pd.Index([0])`. > 2. Otherwise, just return output of `Super()._predict_proba()` as it is, i.e., column names are preserved by default. I think there was some ambiguity in my explanation for #5349 (issue) in #5384 (PR), but what I meant was exactly the changes in this PR.
Reference Issues/PRs
Fixes #5349
What does this implement/fix? Explain your changes.
Changes a if (check) condition in
_check_predict_proba
function ofsktime/forecasting/tests/test_all_forecasters.py
to preserve column name in univariate forecaster predictions.Upon fixing this issue,
ARCH
doesn't require function_predict_proba
asBaseForecaster
's_predict_proba
is sufficient. Hence, removed that function.What should a reviewer concentrate their feedback on?
A few tests are expecting name to be preserved even if it is
None
, here. Thats why I didn't handle theNone
case separately. If the expected column name is0
when original name isNone
, below code may be appropriate as recommended by @yarnabrina.Additional context
Any changes in this test will affect existing univariate probabilistic forecasters only such as
NaiveForecaster
.PR checklist
For all contributions