Skip to content

add ranks #268

Merged
merged 10 commits into from
Nov 15, 2021
Merged

add ranks #268

merged 10 commits into from
Nov 15, 2021

Conversation

Ama16
Copy link
Contributor

@Ama16 Ama16 commented Nov 10, 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

Related Issue

Closing issues

@codecov-commenter
Copy link

codecov-commenter commented Nov 10, 2021

Codecov Report

Merging #268 (42ef927) into master (471dabe) will increase coverage by 0.00%.
The diff coverage is 92.30%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #268   +/-   ##
=======================================
  Coverage   86.71%   86.72%           
=======================================
  Files          92       92           
  Lines        4479     4489   +10     
=======================================
+ Hits         3884     3893    +9     
- Misses        595      596    +1     
Impacted Files Coverage Δ
etna/analysis/feature_relevance/relevance.py 94.11% <92.30%> (-1.72%) ⬇️

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 471dabe...42ef927. Read the comment docs.

etna/analysis/feature_relevance/relevance.py Outdated Show resolved Hide resolved
etna/analysis/feature_relevance/relevance.py Outdated Show resolved Hide resolved
etna/analysis/feature_relevance/relevance.py Outdated Show resolved Hide resolved
etna/transforms/feature_importance.py Outdated Show resolved Hide resolved
assert rt(df=df, df_exog=df_exog, return_ranks=False, model=DecisionTreeRegressor()).shape == (2, 2)


def test_relevance_table_ranks(simple_df_relevance):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Better to make a fixture for the table with ranks and test the method in two cases of greater_is_better

@@ -73,7 +73,7 @@ def ts_with_regressors():
def test_mrmr_right_len(relevance_method, clustering_method, top_k, ts_with_regressors):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Better to use keyword arguments, fix it pls in this file

@@ -59,7 +71,9 @@ class ModelRelevanceTable(RelevanceTable):
def __init__(self):
super().__init__(greater_is_better=True)

def __call__(self, df: pd.DataFrame, df_exog: pd.DataFrame, **kwargs) -> pd.DataFrame:
def __call__(self, df: pd.DataFrame, df_exog: pd.DataFrame, return_ranks: bool, **kwargs) -> pd.DataFrame:
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't we add False as default value for return_ranks?

@@ -142,6 +142,7 @@ class MRMRFeatureSelectionTransform(Transform):
def __init__(
self,
relevance_method: RelevanceTable,
return_ranks: bool,
Copy link
Contributor

Choose a reason for hiding this comment

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

return_rank sounds like you are going to return smth like {regressor: rank} for chosen top_k, doesn't it? how about use_rank?
and maybe lets make it the last arg (at least after top_k arg)?

@julia-shenshina julia-shenshina merged commit 4b1a41c into master Nov 15, 2021
@iKintosh iKintosh deleted the ETNA-882 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.

4 participants