Skip to content

Implement tests on inference scenarios for transforms #1094

Merged
merged 15 commits into from
Feb 20, 2023

Conversation

Mr-Geekman
Copy link
Contributor

@Mr-Geekman Mr-Geekman commented Feb 3, 2023

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?

Proposed Changes

Look at #1077.

Closing issues

Closes #1077.

@Mr-Geekman Mr-Geekman self-assigned this Feb 3, 2023
@github-actions
Copy link

github-actions bot commented Feb 3, 2023

@github-actions github-actions bot temporarily deployed to pull request February 3, 2023 07:40 Inactive
@codecov-commenter
Copy link

codecov-commenter commented Feb 3, 2023

Codecov Report

❗ No coverage uploaded for pull request base (inference-v2.1@ccfff31). Click here to learn what that means.
The diff coverage is n/a.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@                Coverage Diff                @@
##             inference-v2.1    #1094   +/-   ##
=================================================
  Coverage                  ?   86.85%           
=================================================
  Files                     ?      164           
  Lines                     ?     8944           
  Branches                  ?        0           
=================================================
  Hits                      ?     7768           
  Misses                    ?     1176           
  Partials                  ?        0           

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

(YeoJohnsonTransform(in_column="target", mode="macro", inplace=False), "regular_ts"),
(YeoJohnsonTransform(in_column="target", mode="macro", inplace=True), "regular_ts"),
# missing_values
# TODO: not working without out column
Copy link
Collaborator

Choose a reason for hiding this comment

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

???

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If I don't set out_column then this test fails with error.

transformed_subset_future_df = transformed_subset_future_ts.to_pandas()
assert_frame_equal(transformed_subset_future_df, transformed_future_df.loc[:, pd.IndexSlice[segments, :]])

@pytest.mark.parametrize(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we have the same parametrization here as in the previous group here? May be we can share the parametrization somehow(i.e. https://stackoverflow.com/questions/51739589/how-to-share-parametrized-arguments-across-multiple-test-functions)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't really think it is a good idea for now, because set of transforms, that works fine is different for each test. May be we can extract only some core, but it looks somewhat artifical.

),
# feature_selection
(FilterFeaturesTransform(exclude=["year"]), "ts_with_exog", {"remove": {"year"}}),
# TODO: this should remove only 2 features
Copy link
Collaborator

Choose a reason for hiding this comment

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

May be add link to the issue here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is not issue yet about it.

ts, transform, train_segments=["segment_1", "segment_2"], expected_changes={}
)

@to_be_fixed(raises=Exception)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we actually fix all these transforms?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

At least we can make them fail in understandable way.

ts, transform, train_segments=["segment_1", "segment_2"], expected_changes=expected_changes
)

@to_be_fixed(raises=NotImplementedError, match="Per-segment transforms can't work on new segments")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why this test is separate from the others?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because it in to_be_fixed section. This can be done in theory, but we fail this test.
For instance, for decomposition transforms we can't do it in theory because we fit separate model for each segment.

(MedianOutliersTransform(in_column="target"), "ts_with_outliers", {}),
(PredictionIntervalOutliersTransform(in_column="target", model=ProphetModel), "ts_with_outliers", {}),
# math
# TODO: error should be understandable, not like now
Copy link
Collaborator

Choose a reason for hiding this comment

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

???

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 fails we very vague error and it is not really clear what happenned. I think may be we should raise some error that can be understood by the user.

self._test_transform_future_without_target(ts, transform, expected_changes=expected_changes)


# TODO: нам ведь еще и тесты на inverse-transform нужны по идее
Copy link
Collaborator

Choose a reason for hiding this comment

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

???

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will delete this line.

@github-actions github-actions bot temporarily deployed to pull request February 8, 2023 14:08 Inactive
@github-actions github-actions bot temporarily deployed to pull request February 14, 2023 15:24 Inactive
This was referenced Mar 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants