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

&benheid [BUG] allow alpha and coverage to be passed again via metrics to evaluate #5354

Merged
merged 5 commits into from Oct 5, 2023

Conversation

fkiraly
Copy link
Collaborator

@fkiraly fkiraly commented Oct 3, 2023

This PR ensures pre-existing syntax to pass alpha and coverage via metrics to evaluate works again, fixing #5336.

Not commenting here on whether the status quo is a good idea or not (I think it was cleaner to remove it, or is, in the long run), but such a change should not happen without deprecation.

FYI @hazrulakmal.

Question to the reviewers, especially @hazrulakmal: do we need to change the naming convention to something else to ensure we do not change the names - or their order - again, accidentally?

Depends on #5337, so this change should trigger the test that is failing on main.

@fkiraly fkiraly added bugfix Fixes a known bug or removes unintended behavior module:metrics&benchmarking metrics and benchmarking modules labels Oct 3, 2023
@benHeid
Copy link
Contributor

benHeid commented Oct 5, 2023

The reindexing in line 290 (not changed) is the problem. Since the indexes are named differently. See pandas documentation: https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.reindex.html

Thus, _get_column_order_and_datatype should return the same names as the DataFrame result have. Thus, it needs also to use the newly introduced for loop introduced in this PR.

This also requires some changes in the test, since accessing columns using df.col_name is not working anymore since the columns may be named as: test_PinballLoss_[0.1, 0.5, 0.9].

As an alternative, we could also try to rename all columns. However, this might lead to problems if multiple PinbalLosses are used in evaluate.

@fkiraly
Copy link
Collaborator Author

fkiraly commented Oct 5, 2023

I see. So we need to restore the expected column names at least until the deprecation has taken place.

For the same reason I asked @hazrulakmal to keep the old column names for now (not breaking anything for the user!), I think we need to keep them here as well.

More precisely, my preferred solution would be:

  • check whether in the current PR state, there are multiple columns relating to a loss.
  • If not, replace it with the name that does not contain alpha or coverage

If this happens before the reindex, that should solve the issue?

@fkiraly fkiraly mentioned this pull request Oct 5, 2023
6 tasks
@benHeid
Copy link
Contributor

benHeid commented Oct 5, 2023

I see. So we need to restore the expected column names at least until the deprecation has taken place.

Yes. The challenge might be to ensure that we restore it correctly. I.e., we need to have a mapping somewhere from old to new.

If this happens before the reindex, that should solve the issue?

yes.

Would you then also directly introduce a legacy parameter that enables to control the naming of the columns?

@benHeid
Copy link
Contributor

benHeid commented Oct 5, 2023

The fix is based on:

  • remembering a mapping from new names to old ones
  • introducing a flag to decide if old or new naming should be used!

I have not introduced a legacy parameter

@fkiraly
Copy link
Collaborator Author

fkiraly commented Oct 5, 2023

amazing. Very elegant. I would have written sth more painful.

@fkiraly
Copy link
Collaborator Author

fkiraly commented Oct 5, 2023

I approve your part, do but I cannot approve my own code...

Copy link
Contributor

@benHeid benHeid left a comment

Choose a reason for hiding this comment

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

Looks good to me now. However, the code is partly written by me. However, I can technically approve it. If you are fine with my changes and I am fine with yours, it should be okay I suppose..

@fkiraly
Copy link
Collaborator Author

fkiraly commented Oct 5, 2023

I'm fine with your changes, as said - that implies the four eyes principle is satisfied.

@fkiraly fkiraly changed the title [BUG] allow alpha and coverage to be passed again via metrics to evaluate &benheid [BUG] allow alpha and coverage to be passed again via metrics to evaluate Oct 5, 2023
@fkiraly fkiraly merged commit c552caf into main Oct 5, 2023
24 checks passed
@fkiraly fkiraly deleted the fix-interval-evaluate branch October 5, 2023 18:26
yarnabrina added a commit to yarnabrina/sktime-fork that referenced this pull request Oct 6, 2023
…in-ForecastX

* origin/main:
  [BUG] ensure `Catch22` parameter setting `n_jobs = -1` uses all cores (sktime#5361)
  [MNT] simplified CI - merge windows CI step with test matrix (sktime#5362)
  &benheid [BUG] allow `alpha` and `coverage` to be passed again via metrics to `evaluate` (sktime#5354)
  [ENH] Link `test_interval_wrappers.py` to changes in `evaluate` for conditional testing (sktime#5337)
  [ENH] Add a CurveFitForecaster based on scipy optimize_curve (sktime#5240)
  [ENH] in scitype check, replace base class register logic with type tag inspection (sktime#5288)
yarnabrina added a commit to yarnabrina/sktime-fork that referenced this pull request Oct 6, 2023
* origin/main:
  [BUG] ensure `Catch22` parameter setting `n_jobs = -1` uses all cores (sktime#5361)
  [MNT] simplified CI - merge windows CI step with test matrix (sktime#5362)
  &benheid [BUG] allow `alpha` and `coverage` to be passed again via metrics to `evaluate` (sktime#5354)
  [ENH] Link `test_interval_wrappers.py` to changes in `evaluate` for conditional testing (sktime#5337)
yarnabrina added a commit to yarnabrina/sktime-fork that referenced this pull request Oct 6, 2023
* origin/split-ci:
  Revert "added 3.12 in matrix"
  [BUG] ensure `Catch22` parameter setting `n_jobs = -1` uses all cores (sktime#5361)
  [MNT] simplified CI - merge windows CI step with test matrix (sktime#5362)
  &benheid [BUG] allow `alpha` and `coverage` to be passed again via metrics to `evaluate` (sktime#5354)
  [ENH] Link `test_interval_wrappers.py` to changes in `evaluate` for conditional testing (sktime#5337)
yarnabrina added a commit to yarnabrina/sktime-fork that referenced this pull request Oct 6, 2023
…recasting

* origin/split-ci:
  Revert "added 3.12 in matrix"
  [BUG] ensure `Catch22` parameter setting `n_jobs = -1` uses all cores (sktime#5361)
  [MNT] simplified CI - merge windows CI step with test matrix (sktime#5362)
  &benheid [BUG] allow `alpha` and `coverage` to be passed again via metrics to `evaluate` (sktime#5354)
  [ENH] Link `test_interval_wrappers.py` to changes in `evaluate` for conditional testing (sktime#5337)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix Fixes a known bug or removes unintended behavior module:metrics&benchmarking metrics and benchmarking modules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants