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

Clean up DFS arguments #319

Merged
merged 5 commits into from Nov 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
35 changes: 14 additions & 21 deletions featuretools/synthesis/deep_feature_synthesis.py
Expand Up @@ -83,31 +83,25 @@ def __init__(self,
agg_primitives=None,
trans_primitives=None,
where_primitives=None,
max_depth=None,
max_hlevel=None,
max_features=None,
max_depth=2,
max_hlevel=2,
max_features=-1,
allowed_paths=None,
ignore_entities=None,
ignore_variables=None,
seed_features=None,
drop_contains=None,
drop_exact=None,
where_stacking_limit=1):

if max_depth is None:
max_depth = 2
elif max_depth == -1:
# need to change max_depth and max_hlevel to None because DFs terminates when <0
if max_depth == -1:
max_depth = None
self.max_depth = max_depth

if max_hlevel is None:
max_hlevel = 2
elif max_hlevel == -1:
if max_hlevel == -1:
max_hlevel = None
self.max_hlevel = max_hlevel

if max_features is None:
max_features = -1
self.max_features = max_features

self.allowed_paths = allowed_paths
Expand Down Expand Up @@ -144,9 +138,9 @@ def __init__(self,
raise ValueError("Unknown aggregation primitive {}. ".format(a),
"Call ft.primitives.list_primitives() to get",
" a list of available primitives")
self.agg_primitives.append(agg_prim_dict[a.lower()])
else:
self.agg_primitives.append(a)
a = agg_prim_dict[a.lower()]

self.agg_primitives.append(a)

if trans_primitives is None:
trans_primitives = [ftypes.Day, ftypes.Year, ftypes.Month,
Expand All @@ -160,9 +154,9 @@ def __init__(self,
raise ValueError("Unknown transform primitive {}. ".format(t),
"Call ft.primitives.list_primitives() to get",
" a list of available primitives")
self.trans_primitives.append(trans_prim_dict[t.lower()])
else:
self.trans_primitives.append(t)
t = trans_prim_dict[t.lower()]

self.trans_primitives.append(t)

if where_primitives is None:
where_primitives = [ftypes.Count]
Expand All @@ -174,10 +168,9 @@ def __init__(self,
raise ValueError("Unknown where primitive {}. ".format(p),
"Call ft.primitives.list_primitives() to get",
" a list of available primitives")
p = prim_obj

self.where_primitives.append(prim_obj)
else:
self.where_primitives.append(p)
self.where_primitives.append(p)

self.seed_features = seed_features or []
self.drop_exact = drop_exact or []
Expand Down
4 changes: 2 additions & 2 deletions featuretools/synthesis/dfs.py
Expand Up @@ -15,14 +15,14 @@ def dfs(entities=None,
agg_primitives=None,
trans_primitives=None,
allowed_paths=None,
max_depth=None,
max_depth=2,
ignore_entities=None,
ignore_variables=None,
seed_features=None,
drop_contains=None,
drop_exact=None,
where_primitives=None,
max_features=None,
max_features=-1,
cutoff_time_in_index=False,
save_progress=None,
features_only=False,
Expand Down