Python 如何使用Featuretools为没有即时要素的单个表格创建要素?

Python 如何使用Featuretools为没有即时要素的单个表格创建要素?,python,featuretools,Python,Featuretools,我使用了@willk的答案,但它弹出了一个错误。 请看这里的willk的答案。我不能在他的回答中发表评论,因为我没有足够的声誉超过50岁 所以我的问题是如何使下面的代码工作?或者,请提供一个解决方案,使用featuretools为单个表应用自动功能工程。以iris为例,不使用立即功能进行规范化,从现有表生成新表 from sklearn.datasets import load_iris import pandas as pd import featuretools as ft # Load

我使用了@willk的答案,但它弹出了一个错误。 请看这里的willk的答案。我不能在他的回答中发表评论,因为我没有足够的声誉超过50岁

所以我的问题是如何使下面的代码工作?或者,请提供一个解决方案,使用featuretools为单个表应用自动功能工程。以iris为例,不使用立即功能进行规范化,从现有表生成新表

from sklearn.datasets import load_iris
import pandas as pd 
import featuretools as ft

# Load data and put into dataframe
iris = load_iris()
df = pd.DataFrame(iris.data, columns = iris.feature_names)
df['species'] = iris.target
df['species'] = df['species'].map({0: 'setosa', 1: 'versicolor', 2: 'virginica'})

# Make an entityset and add the entity
es = ft.EntitySet(id = 'iris')
es.entity_from_dataframe(entity_id = 'data', dataframe = df, 
                     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', 'multiply'])
feature_matrix.head()

ValueError:“未知的转换基元添加”。,'调用ft.primitives.list_primitives以获取“可用原语列表”

featuretools的0.6.1版本更改了一些原语名称。应该为您运行以下代码

from sklearn.datasets import load_iris
import pandas as pd 
import featuretools as ft

# Load data and put into dataframe
iris = load_iris()
df = pd.DataFrame(iris.data, columns = iris.feature_names)
df['species'] = iris.target
df['species'] = df['species'].map({0: 'setosa', 1: 'versicolor', 2: 'virginica'})

# Make an entityset and add the entity
es = ft.EntitySet(id = 'iris')
es.entity_from_dataframe(entity_id = 'data', dataframe = df, 
                     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.head()