排除实体的 FeatureTools GroupBy 问题
FeatureTools GroupBy issue excluding entities
这个问题是 post 的后续问题:
我可以解决第一部分的疑问,但之后又出现了另一个。
我有以下 Featuretools 实体集:
我想得到 groupby_trans_primitives
:Diff
和 TimeSincePrevious
(天),但只在录音实体中,不包括其他实体:'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>]
如有任何帮助,我将不胜感激!谢谢!
primitive_options
忽略将在下一版本的功能工具中修复的实体实际上存在一个错误,但现在您可以通过保留这些原始选项并添加 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
的情况下工作
这个问题是 post 的后续问题:
我可以解决第一部分的疑问,但之后又出现了另一个。
我有以下 Featuretools 实体集:
我想得到 groupby_trans_primitives
:Diff
和 TimeSincePrevious
(天),但只在录音实体中,不包括其他实体:'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>]
如有任何帮助,我将不胜感激!谢谢!
primitive_options
忽略将在下一版本的功能工具中修复的实体实际上存在一个错误,但现在您可以通过保留这些原始选项并添加 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