Skip to content

Add FilterFeaturesTransform #277

Merged
merged 12 commits into from Nov 17, 2021
Merged

Add FilterFeaturesTransform #277

merged 12 commits into from Nov 17, 2021

Conversation

Mr-Geekman
Copy link
Contributor

@Mr-Geekman Mr-Geekman commented Nov 12, 2021

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 #271.

Related Issue

#271.

Closing issues

Closes #271.

@Mr-Geekman Mr-Geekman added the enhancement New feature or request label Nov 12, 2021
@Mr-Geekman Mr-Geekman self-assigned this Nov 12, 2021
@codecov-commenter
Copy link

codecov-commenter commented Nov 12, 2021

Codecov Report

Merging #277 (b03b456) into master (a4df644) will increase coverage by 0.42%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #277      +/-   ##
==========================================
+ Coverage   87.21%   87.63%   +0.42%     
==========================================
  Files          94       95       +1     
  Lines        4653     4682      +29     
==========================================
+ Hits         4058     4103      +45     
+ Misses        595      579      -16     
Impacted Files Coverage Δ
etna/transforms/__init__.py 100.00% <100.00%> (ø)
etna/transforms/filter.py 100.00% <100.00%> (ø)
etna/libs/tsfresh/relevance.py 60.95% <0.00%> (+3.80%) ⬆️
etna/libs/tsfresh/significance_tests.py 31.88% <0.00%> (+13.04%) ⬆️
etna/libs/tsfresh/distribution.py 83.33% <0.00%> (+50.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 a4df644...b03b456. Read the comment docs.

def test_set_include_and_exclude():
"""Test that transform is not created with include and exclude."""
with pytest.raises(ValueError, match="There should be exactly one option set: include or exclude"):
_ = FilterFeaturesTransform()
Copy link
Contributor

Choose a reason for hiding this comment

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

Add exclude and include

transform = FilterFeaturesTransform(include=include)
ts_with_features.fit_transform([transform])
df_transformed = ts_with_features.df
expected_columns = set(ts_with_features.columns.get_level_values("feature"))
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not set(include) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

segments = ts_with_features.segments
for column in got_columns:
assert np.all(
df_transformed.loc[:, pd.IndexSlice[segments, column]]
Copy link
Contributor

Choose a reason for hiding this comment

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

df_transformed = ts_with_features.df , why you compare it?

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 was a bug earlier when values between columns mixed with each other, I wanted to unsure, it is not present 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 was a mistake, it will be fixed

"""Filters features in each segment of the dataframe."""

def __init__(self, include: Optional[Sequence[str]] = None, exclude: Optional[Sequence[str]] = None):
"""Create instance of LagTransform.
Copy link
Contributor

Choose a reason for hiding this comment

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

LagTransform??

Parameters
----------
df:
dataframe with data to fit label encoder.
Copy link
Contributor

Choose a reason for hiding this comment

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

label encoder?

Ama16
Ama16 previously approved these changes Nov 16, 2021
Ama16
Ama16 previously approved these changes Nov 17, 2021
@julia-shenshina julia-shenshina merged commit fa981ba into master Nov 17, 2021
@iKintosh iKintosh deleted the issue-271 branch November 18, 2021 15:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FilterFeaturesTransform
4 participants