Skip to content

Instantly share code, notes, and snippets.

@WillKoehrsen
Last active August 15, 2018 15:02
Show Gist options
  • Save WillKoehrsen/c9d3fc6b0713358632673d418a661a13 to your computer and use it in GitHub Desktop.
Save WillKoehrsen/c9d3fc6b0713358632673d418a661a13 to your computer and use it in GitHub Desktop.
def feature_matrix_from_entityset(es_dict, feature_defs):
"""Run deep feature synthesis from an entityset and feature definitions.
Saves feature matrix based on partition number."""
# Extract the entityset
es = es_dict['es']
# Calculate the feature matrix and save
feature_matrix = ft.calculate_feature_matrix(feature_definitions,
entityset=es,
n_jobs = 1,
verbose = 0,
chunk_size = es['app'].df.shape[0])
feature_matrix.to_csv('../input/fm/p%d_fm.csv' % es_dict['num'], index = True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment