In order to do this, you have to import the primitive in a slightly different way. Instead of using the shortcut way to choose a primitive with a list of strings, you have to import the primitive object and pass that into the dfs
or calculate_feature_matrix
function:
#Shortcut method
feature_matrix, feature_defs = ft.dfs(
entityset=es,
target_entity="customers",
agg_primitives=["time_since_last", "std", "skew"],
trans_primitives=[])
#method that allows initialization of variables
from featuretools.primitives import TimeSinceLast
time_since_last = TimeSinceLast(unit = "hours")
feature_matrix, feature_defs = ft.dfs(
entityset=es,
target_entity="customers",
agg_primitives=[time_since_last, "std", "skew"],
trans_primitives=[])
The key points are:
- import the specific feature you want to customize/change the behavior of
- define the feature, and put that definition in the list of primitives you are including (can be listed along with other strings).