【问题标题】:How to get trans_primitives of highest entity in featuretools?如何在特征工具中获取最高实体的 trans_primitives?
【发布时间】:2021-05-04 07:35:59
【问题描述】:

在特征工具中的经典模拟客户数据集示例中,如果我必须派生 transactions entity 的 month, day, year 等 transactions entity 属性的 trans_primitives。我该怎么做?

import featuretools as ft
es = ft.demo.load_mock_customer(return_entityset=True)
feature_matrix, feature_defs = ft.dfs(entityset=es, target_entity=???, agg_primitives=["count"], trans_primitives=["month"], max_depth=1)

在这种情况下,目标实体应该是什么?

【问题讨论】:

    标签: python feature-engineering featuretools


    【解决方案1】:

    感谢您的提问!您可以通过在 DFS 中将目标实体设置为 transactions 来从事务时间获取这些功能。您还想指定要应用的转换原语。让我知道这是否有帮助。

    feature_matrix, feature_defs = ft.dfs(
        entityset=es,
        target_entity='transactions',
        agg_primitives=[],
        trans_primitives=['day', 'month', 'year'],
        max_depth=1,
    )
    
    feature_matrix.head().filter(regex='time')
    
                    DAY(transaction_time)  MONTH(transaction_time)  YEAR(transaction_time)
    transaction_id
    298                                 1                        1                    2014
    2                                   1                        1                    2014
    308                                 1                        1                    2014
    116                                 1                        1                    2014
    371                                 1                        1                    2014
    

    【讨论】:

      猜你喜欢
      • 2019-01-30
      • 2021-03-01
      • 2019-02-22
      • 2020-11-29
      • 2022-10-07
      • 2016-02-14
      • 2023-03-13
      • 2019-08-13
      相关资源
      最近更新 更多