此问题是此post的后续问题
我可以解决问题的第一部分,但在那之后,又出现了另一个问题。
我有以下Featuretools实体集:

我想要获取groupby_trans_primitives:Diff和TimeSincePrevious(days),但只在recordings实体中,不包括其他实体:'vendedores','produtos',cliente','produto_cliente'
我尝试了以下代码来排除这些实体,但没有成功:
from featuretools.primitives import TimeSincePrevious
time_since_previous = TimeSincePrevious(unit = "days")
fm, features = ft.dfs(entityset=es,
target_entity='recordings',
trans_primitives = [],
agg_primitives = [],
max_depth=2,
verbose=True,
groupby_trans_primitives=['Diff',time_since_previous],
primitive_options={'time_since_previous': {'ignore_groupby_entities': ['vendedores','produtos','cliente']}})因为代码返回了以下功能:
Built 38 features
Elapsed: 00:38 | Progress: 100%|██████████
[<Feature: CODIGO_CLIENTE>,
<Feature: NOME_VENDEDOR>,
<Feature: CODIGO_PRODUTO>,
<Feature: QUANTIDADE>,
<Feature: VALOR_TOTAL>,
<Feature: PRODUTO_CLIENTE>,
<Feature: DIFF(QUANTIDADE) by PRODUTO_CLIENTE>,
<Feature: DIFF(QUANTIDADE) by CODIGO_PRODUTO>,
<Feature: DIFF(QUANTIDADE) by NOME_VENDEDOR>,
<Feature: DIFF(QUANTIDADE) by CODIGO_CLIENTE>,
<Feature: DIFF(VALOR_TOTAL) by PRODUTO_CLIENTE>,
<Feature: DIFF(VALOR_TOTAL) by CODIGO_PRODUTO>,
<Feature: DIFF(VALOR_TOTAL) by NOME_VENDEDOR>,
<Feature: DIFF(VALOR_TOTAL) by CODIGO_CLIENTE>,
<Feature: TIME_SINCE_PREVIOUS(DATA_NOTA, unit=days) by PRODUTO_CLIENTE>,
<Feature: TIME_SINCE_PREVIOUS(DATA_NOTA, unit=days) by CODIGO_PRODUTO>,
<Feature: TIME_SINCE_PREVIOUS(DATA_NOTA, unit=days) by NOME_VENDEDOR>,
<Feature: TIME_SINCE_PREVIOUS(DATA_NOTA, unit=days) by CODIGO_CLIENTE>,
<Feature: cliente.CLASSIFICACAO>,
<Feature: cliente.REDE>,
<Feature: cliente.CIDADE>,
<Feature: cliente.UF>,
<Feature: TIME_SINCE_PREVIOUS(vendedores.first_recordings_time, unit=days) by PRODUTO_CLIENTE>,
<Feature: TIME_SINCE_PREVIOUS(vendedores.first_recordings_time, unit=days) by CODIGO_PRODUTO>,
<Feature: TIME_SINCE_PREVIOUS(vendedores.first_recordings_time, unit=days) by NOME_VENDEDOR>,
<Feature: TIME_SINCE_PREVIOUS(vendedores.first_recordings_time, unit=days) by CODIGO_CLIENTE>,
<Feature: TIME_SINCE_PREVIOUS(produto_cliente.first_recordings_time, unit=days) by PRODUTO_CLIENTE>,
<Feature: TIME_SINCE_PREVIOUS(produto_cliente.first_recordings_time, unit=days) by CODIGO_PRODUTO>,
<Feature: TIME_SINCE_PREVIOUS(produto_cliente.first_recordings_time, unit=days) by NOME_VENDEDOR>,
<Feature: TIME_SINCE_PREVIOUS(produto_cliente.first_recordings_time, unit=days) by CODIGO_CLIENTE>,
<Feature: TIME_SINCE_PREVIOUS(cliente.first_recordings_time, unit=days) by PRODUTO_CLIENTE>,
<Feature: TIME_SINCE_PREVIOUS(cliente.first_recordings_time, unit=days) by CODIGO_PRODUTO>,
<Feature: TIME_SINCE_PREVIOUS(cliente.first_recordings_time, unit=days) by NOME_VENDEDOR>,
<Feature: TIME_SINCE_PREVIOUS(cliente.first_recordings_time, unit=days) by CODIGO_CLIENTE>,
<Feature: TIME_SINCE_PREVIOUS(produtos.first_recordings_time, unit=days) by PRODUTO_CLIENTE>,
<Feature: TIME_SINCE_PREVIOUS(produtos.first_recordings_time, unit=days) by CODIGO_PRODUTO>,
<Feature: TIME_SINCE_PREVIOUS(produtos.first_recordings_time, unit=days) by NOME_VENDEDOR>,
<Feature: TIME_SINCE_PREVIOUS(produtos.first_recordings_time, unit=days) by CODIGO_CLIENTE>]我不知道为什么我的代码指定要创建以下功能来排除这些实体:
<Feature: TIME_SINCE_PREVIOUS(vendedores.first_recordings_time, unit=days) by PRODUTO_CLIENTE>,
<Feature: TIME_SINCE_PREVIOUS(vendedores.first_recordings_time, unit=days) by CODIGO_PRODUTO>,
<Feature: TIME_SINCE_PREVIOUS(vendedores.first_recordings_time, unit=days) by NOME_VENDEDOR>,
<Feature: TIME_SINCE_PREVIOUS(vendedores.first_recordings_time, unit=days) by CODIGO_CLIENTE>,
<Feature: TIME_SINCE_PREVIOUS(produto_cliente.first_recordings_time, unit=days) by PRODUTO_CLIENTE>,
<Feature: TIME_SINCE_PREVIOUS(produto_cliente.first_recordings_time, unit=days) by CODIGO_PRODUTO>,
<Feature: TIME_SINCE_PREVIOUS(produto_cliente.first_recordings_time, unit=days) by NOME_VENDEDOR>,
<Feature: TIME_SINCE_PREVIOUS(produto_cliente.first_recordings_time, unit=days) by CODIGO_CLIENTE>,
<Feature: TIME_SINCE_PREVIOUS(cliente.first_recordings_time, unit=days) by PRODUTO_CLIENTE>,
<Feature: TIME_SINCE_PREVIOUS(cliente.first_recordings_time, unit=days) by CODIGO_PRODUTO>,
<Feature: TIME_SINCE_PREVIOUS(cliente.first_recordings_time, unit=days) by NOME_VENDEDOR>,
<Feature: TIME_SINCE_PREVIOUS(cliente.first_recordings_time, unit=days) by CODIGO_CLIENTE>,
<Feature: TIME_SINCE_PREVIOUS(produtos.first_recordings_time, unit=days) by PRODUTO_CLIENTE>,
<Feature: TIME_SINCE_PREVIOUS(produtos.first_recordings_time, unit=days) by CODIGO_PRODUTO>,
<Feature: TIME_SINCE_PREVIOUS(produtos.first_recordings_time, unit=days) by NOME_VENDEDOR>,
<Feature: TIME_SINCE_PREVIOUS(produtos.first_recordings_time, unit=days) by CODIGO_CLIENTE>]我将非常感谢任何形式的帮助!谢谢!
发布于 2019-11-07 00:05:56
实际上,primitive_options忽略将在下一版本的featuretools中修复的实体存在一个错误,但现在您可以通过保留这些原始选项并添加drop_contains过滤器来过滤掉这些功能
fm, features = ft.dfs(entityset=es,
target_entity='recordings',
trans_primitives = [],
agg_primitives = [],
max_depth=2,
verbose=True,
groupby_trans_primitives=['Diff',time_since_previous],
drop_contains=["TIME_SINCE_PREVIOUS(produtos.", "TIME_SINCE_PREVIOUS(cliente.", "TIME_SINCE_PREVIOUS(produto_cliente.", "TIME_SINCE_PREVIOUS(vendedores."],
primitive_options={'time_since_previous': {'ignore_groupby_entities': ['vendedores','produtos','cliente']}})一旦下一个版本发布,我们将更新答案以在没有drop_contains的情况下工作
https://stackoverflow.com/questions/58715366
复制相似问题