Skip to content

Remove unnecessary levels from multiindex columns to fix DifferencingTransform.inverse_transform #503

Merged
merged 4 commits into from
Feb 7, 2022

Conversation

Mr-Geekman
Copy link
Contributor

@Mr-Geekman Mr-Geekman commented Feb 4, 2022

IMPORTANT: Please do not create a Pull Request without creating an issue first.

Before submitting (must do checklist)

  • Did you read the contribution guide?
  • Did you update the docs? We use Numpy format for all the methods and classes.
  • Did you write any new necessary tests?
  • Did you update the CHANGELOG?

Type of Change

  • Examples / docs / tutorials / contributors update
  • Bug fix (non-breaking change which fixes an issue)
  • Improvement (non-breaking change which improves an existing feature)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Proposed Changes

Look #499.

Related Issue

#499.

Closing issues

Closes #499.

@Mr-Geekman Mr-Geekman added the bug Something isn't working label Feb 4, 2022
@Mr-Geekman Mr-Geekman self-assigned this Feb 4, 2022
@Mr-Geekman Mr-Geekman marked this pull request as ready for review February 4, 2022 16:18
@Mr-Geekman Mr-Geekman changed the title Add removing unnecessary levels from multiindex columns to fix DifferencingTransform Add removing unnecessary levels from multiindex columns to fix DifferencingTransform.inverse_transform Feb 4, 2022
@Mr-Geekman Mr-Geekman changed the title Add removing unnecessary levels from multiindex columns to fix DifferencingTransform.inverse_transform Remove unnecessary levels from multiindex columns to fix DifferencingTransform.inverse_transform Feb 4, 2022
@codecov-commenter
Copy link

codecov-commenter commented Feb 4, 2022

Codecov Report

Merging #503 (6d92d86) into master (cd37bbd) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #503   +/-   ##
=======================================
  Coverage   87.80%   87.80%           
=======================================
  Files         115      115           
  Lines        5454     5455    +1     
=======================================
+ Hits         4789     4790    +1     
  Misses        665      665           
Impacted Files Coverage Δ
etna/transforms/math/differencing.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cd37bbd...6d92d86. Read the comment docs.

@martins0n martins0n self-requested a review February 7, 2022 07:49
Copy link
Contributor

@martins0n martins0n left a comment

Choose a reason for hiding this comment

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

We should add test case

@@ -96,6 +96,8 @@ def fit(self, df: pd.DataFrame) -> "_SingleDifferencingTransform":

self._train_init_dict[current_segment] = cur_series[: self.period]
self._test_init_df = fit_df.iloc[-self.period :, :]
# make multiindex levels consistent
self._test_init_df.columns = self._test_init_df.columns.remove_unused_levels()
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we not use remove_unused_levels?

Is it the root cause?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is a solution to the problem. After creation of fit_df values for old columns remains in MultiIndex and it leads to errors during set_names.

Copy link
Contributor

@martins0n martins0n left a comment

Choose a reason for hiding this comment

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

👍

@martins0n martins0n merged commit d8ace91 into master Feb 7, 2022
@martins0n martins0n deleted the issue-499 branch February 7, 2022 15:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] DifferencingTransform inverse transform bug
3 participants