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

Projects
None yet
2 participants
@kmax12
Member

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

This comment has been minimized.

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

This comment has been minimized.

@rwedge

rwedge Nov 27, 2018

Contributor

Should we also test the Direct Feature case

This comment has been minimized.

@kmax12

kmax12 Nov 27, 2018

Member

sure. added

kmax12 added some commits Nov 27, 2018

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

This comment has been minimized.

@rwedge

rwedge Nov 27, 2018

Contributor

Should we move this import up to the top?

This comment has been minimized.

@kmax12

kmax12 Nov 27, 2018

Member

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.

This comment has been minimized.

@rwedge

rwedge Nov 27, 2018

Contributor

makes sense

@rwedge

rwedge approved these changes Nov 27, 2018

Looks good

@kmax12 kmax12 merged commit 5afb594 into master Nov 27, 2018

3 checks passed

codecov/patch 100% of diff hit (target 95.22%)
Details
codecov/project 95.22% (+<.01%) compared to 68db361
Details
license/cla Contributor License Agreement is signed.
Details

@rwedge rwedge referenced this pull request Nov 29, 2018

Merged

v0.4.1 #329

@kmax12 kmax12 deleted the id-return-type branch Dec 1, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment