首页 > 解决方案 > 您如何搜索特定功能?

问题描述

最后,当我尝试使用 featuretools 时,我正在寻找我所期待的特定功能。当您拥有 > 30 个功能时,查找该功能会非常耗时。

feature_names 对象(dfs 方法的第二个返回对象)是否有搜索某些文本模式(正则表达式)的方法?

feature_names 是“featuretools.feature_base.feature_base.IdentityFeature”的列表

Post Scriptum:在 API 的 featuretools 文档中没有描述返回对象

标签: featuretools

解决方案


深度特征合成返回特征对象。如果您调用FeatureBase.get_name()其中一个对象,它将以字符串形式返回名称。您可以使用它来实现您想要的任何选择逻辑。例如,这里是列出名称中的所有特征对象的amount代码

import featuretools as ft

es = ft.demo.load_mock_customer(return_entityset=True)

fl = ft.dfs(target_entity="customers", entityset=es, features_only=True)

keep = []

for feature in fl:
    if "amount" in feature.get_name():
        keep.append(feature)   

推荐阅读