1

When using Featuretools is it possible to skip the target feature? For example, consider the iris dataset

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'])

The generated feature_matrixcontains useless features such as sepal_width + species. How can I remove them?

1 Answers1

2

You can use ignore_variables in DFS to ignore the target feature.

feature_matrix, feature_defs = ft.dfs(
    entityset=es,
    target_entity='data',
    trans_primitives=['add_numeric', 'multiply_numeric'],
    ignore_variables={'data': ['species']},
)
Jeff Hernandez
  • 2,063
  • 16
  • 20