【问题标题】:Featuretools: skip the target featureFeaturetools:跳过目标特征
【发布时间】:2020-08-09 23:49:15
【问题描述】:

使用Featuretools 时是否可以跳过目标功能?例如,考虑 iris 数据集

data = pd.read_csv('https://gist.githubusercontent.com/curran/a08a1080b88344b0c8a7/raw/639388c2cbc2120a14dcf466e85730eb8be498bb/iris.csv')
target = "species"
data[target] = data[target].map({'setosa':0, 'versicolor':1, 'virginica':2})
# Make an entityset and add the entity
es = ft.EntitySet(id='iris dataset')
es.entity_from_dataframe(entity_id='data', dataframe=data,
                         make_index=True, index='index')

# Run deep feature synthesis with transformation primitives
feature_matrix, feature_defs = ft.dfs(entityset=es, target_entity='data',
                                      trans_primitives=['add_numeric', 'multiply_numeric'])

生成的feature_matrix包含sepal_width + species等无用功能。如何删除它们?

【问题讨论】:

    标签: python machine-learning scikit-learn featuretools


    【解决方案1】:

    您可以在 DFS 中使用ignore_variables 来忽略目标特征。

    feature_matrix, feature_defs = ft.dfs(
        entityset=es,
        target_entity='data',
        trans_primitives=['add_numeric', 'multiply_numeric'],
        ignore_variables={'data': ['species']},
    )
    

    【讨论】:

      猜你喜欢
      • 2018-10-17
      • 1970-01-01
      • 2021-03-05
      • 2020-07-29
      • 2018-08-18
      • 2020-04-19
      • 1970-01-01
      • 2020-10-14
      • 2012-04-20
      相关资源
      最近更新 更多