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

Handle return type when creating features from Id variables #318

Merged
merged 7 commits into from Nov 27, 2018

Conversation

kmax12
Copy link
Contributor

@kmax12 kmax12 commented Nov 14, 2018

When we create a feature from an Id variable, its return type should get converted to a Categorical because it is no longer an Id variable unless it is a direct feature.

This will remove features like CUM_SUM(SUM(order_products.total) by MODE(order_products.product_id))

Same as #266, but for Id variable types

@codecov
Copy link

codecov bot commented Nov 14, 2018

Codecov Report

Merging #318 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #318      +/-   ##
==========================================
+ Coverage   95.22%   95.22%   +<.01%     
==========================================
  Files          71       71              
  Lines        7681     7692      +11     
==========================================
+ Hits         7314     7325      +11     
  Misses        367      367
Impacted Files Coverage Δ
...tools/tests/primitive_tests/test_primitive_base.py 97.59% <100%> (+0.22%) ⬆️
featuretools/primitives/primitive_base.py 91.11% <100%> (+0.13%) ⬆️

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 68db361...7a0ea5d. Read the comment docs.


def test_return_type_inference_id(es_numeric):
mode = Mode(es_numeric["log"]["session_id"], es_numeric["customers"])
assert mode.variable_type == Categorical
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we also test the Direct Feature case

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure. added

@@ -100,12 +102,14 @@ def entity(self):
# P TODO: this should get refactored to return_type
@property
def variable_type(self):
from . import direct_feature
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we move this import up to the top?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

direct_feature imports this file, so we have to include this here to avoid the circular reference.

in #326, the directory structure changes things around and actually moves DirectFeature into this file, so we'll likely be able to update this when that PR gets merged in.

Copy link
Contributor

Choose a reason for hiding this comment

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

makes sense

Copy link
Contributor

@rwedge rwedge 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

@kmax12 kmax12 merged commit 5afb594 into master Nov 27, 2018
@rwedge rwedge mentioned this pull request Nov 29, 2018
@kmax12 kmax12 deleted the id-return-type branch December 1, 2018 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants