2

针对我自己的数据完成功能工具“predict_next_purchase”演示。我创建了实体集,还创建了一个新的 pandas.dataframe,其中包含标签和时间。我已经到了使用 ft.dfs 进行深度特征合成的地步,并且得到了 RuntimeError: maximum recursion depth exceeded。下面是堆栈跟踪:

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)

堆栈跟踪:

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
4

1 回答 1

3

这里的问题是实体集中的周期性关系。目前,深度特征合成只能在两个实体之间存在唯一路径时才能创建特征。如果您有一个与其自身有关系的实体,您也会收到此错误。

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

于 2018-03-21T20:26:12.070 回答