首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Featuretools dfs运行时错误

Featuretools dfs运行时错误
EN

Stack Overflow用户
提问于 2018-03-21 22:21:31
回答 1查看 187关注 0票数 2

使用功能工具"predict_next_purchase“演示我自己的数据。我已经创建了实体集,并且还创建了一个由标签和时间组成的新pandas.dataframe。我正在使用ft.dfs进行深度特征合成,并且得到了一个RuntimeError:超过了最大递归深度。下面是堆栈跟踪:

代码语言:javascript
复制
feature_matrix, features = ft.dfs(target_entity='projects', 
                              cutoff_time=labels.reset_index().loc[:,['jobnumber','time']],
                              training_window=inst_defn['training_window'],
                              entityset=es,
                              verbose=True)

堆栈跟踪:

代码语言:javascript
复制
Building features: 0it [00:00, ?it/s]
RuntimeError: maximum recursion depth exceeded
RuntimeErrorTraceback (most recent call last)
<ipython-input-743-f05fc567dd1b> in <module>()
      3                                   training_window=inst_defn['training_window'],
      4                                   entityset=es,
----> 5                                   verbose=True)
/Users/nbernini/OneDrive/PSC/venv/ml20/lib/python2.7/site-packages/featuretools/synthesis/dfs.pyc in dfs(entities, relationships, entityset, target_entity, cutoff_time, instance_ids, agg_primitives, trans_primitives, allowed_paths, max_depth, ignore_entities, ignore_variables, seed_features, drop_contains, drop_exact, where_primitives, max_features, cutoff_time_in_index, save_progress, features_only, training_window, approximate, verbose)
    164                                       seed_features=seed_features)
    165 
--> 166     features = dfs_object.build_features(verbose=verbose)
    167 
    168     if features_only:
/Users/nbernini/OneDrive/PSC/venv/ml20/lib/python2.7/site-packages/featuretools/synthesis/deep_feature_synthesis.pyc in build_features(self, variable_types, verbose)
    227         self.where_clauses = defaultdict(set)
    228         self._run_dfs(self.es[self.target_entity_id], [],
--> 229                       all_features, max_depth=self.max_depth)
    230 
    231         new_features = list(all_features[self.target_entity_id].values())
/Users/nbernini/OneDrive/PSC/venv/ml20/lib/python2.7/site-packages/featuretools/synthesis/deep_feature_synthesis.pyc in _run_dfs(self, entity, entity_path, all_features, max_depth)
    353                           entity_path=list(entity_path),
    354                           all_features=all_features,
--> 355                           max_depth=new_max_depth)
    356 
    357         """
/Users/nbernini/OneDrive/PSC/venv/ml20/lib/python2.7/site-packages/featuretools/synthesis/deep_feature_synthesis.pyc in _run_dfs(self, entity, entity_path, all_features, max_depth)
    338                              if self._apply_traversal_filters(entity, self.es[b_id],
    339                                                               entity_path,
--> 340                                                               forward=False) and
    341                              b_id not in self.ignore_entities]
    342         for b_entity_id in backward_entities:
/Users/nbernini/OneDrive/PSC/venv/ml20/lib/python2.7/site-packages/featuretools/synthesis/deep_feature_synthesis.pyc in _apply_traversal_filters(self, parent_entity, child_entity, entity_path, forward)
    429                               child_entity=child_entity,
    430                               target_entity_id=self.target_entity_id,
--> 431                               entity_path=entity_path, forward=forward):
    432                 return False
    433 
/Users/nbernini/OneDrive/PSC/venv/ml20/lib/python2.7/site-packages/featuretools/synthesis/dfs_filters.pyc in is_valid(self, feature, entity, target_entity_id, child_feature, child_entity, entity_path, forward, where)
     53 
     54         if type(feature) != list:
---> 55             return func(*args)
     56 
     57         else:
/Users/nbernini/OneDrive/PSC/venv/ml20/lib/python2.7/site-packages/featuretools/synthesis/dfs_filters.pyc in apply_filter(self, parent_entity, child_entity, target_entity_id, entity_path, forward)
     76             if (parent_entity.id == target_entity_id or
     77                     es.find_backward_path(parent_entity.id,
---> 78                                           target_entity_id) is None):
     79                 return True
     80             path = es.find_backward_path(parent_entity.id, child_entity.id)
/Users/nbernini/OneDrive/PSC/venv/ml20/lib/python2.7/site-packages/featuretools/entityset/base_entityset.pyc in find_backward_path(self, start_entity_id, goal_entity_id)
    308             is returned if no path exists.
    309         """
--> 310         forward_path = self.find_forward_path(goal_entity_id, start_entity_id)
    311         if forward_path is not None:
    312             return forward_path[::-1]
/Users/nbernini/OneDrive/PSC/venv/ml20/lib/python2.7/site-packages/featuretools/entityset/base_entityset.pyc in find_forward_path(self, start_entity_id, goal_entity_id)
    287 
    288         for r in self.get_forward_relationships(start_entity_id):
--> 289             new_path = self.find_forward_path(r.parent_entity.id, goal_entity_id)
    290             if new_path is not None:
    291                 return [r] + new_path
... last 1 frames repeated, from the frame below ...
/Users/nbernini/OneDrive/PSC/venv/ml20/lib/python2.7/site-packages/featuretools/entityset/base_entityset.pyc in find_forward_path(self, start_entity_id, goal_entity_id)
    287 
    288         for r in self.get_forward_relationships(start_entity_id):
--> 289             new_path = self.find_forward_path(r.parent_entity.id, goal_entity_id)
    290             if new_path is not None:
    291                 return [r] + new_path
RuntimeError: maximum recursion depth exceeded
EN

回答 1

Stack Overflow用户

发布于 2018-03-22 04:26:12

这里的问题是实体集中的循环关系。目前,深度特征合成只能在两个实体之间存在唯一路径时创建特征。如果你有一个实体和它自己有关系,你也会得到这个错误。

Featuretools的未来版本将为此用例提供更好的支持。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49408840

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档