I'm using featuretools
dfs
function to generate my feature_matrix using time-related aggregation primitives such as TimeSince
(https://docs.featuretools.com/api_reference.html#deep-feature-synthesis)
feature_matrix, feature_defs = ft.dfs(entityset=es,
target_entity="users",
max_depth=2,
agg_primitives=["sum", "max", "min",
"mean", "median", "count",
"avg_time_between"],
trans_primitives=["day", "year", "month", "weekday",
"time_since_previous", "time_since",
],
cutoff_time=cutoff_times,
cutoff_time_in_index=True)
How do I pass the [unit] params to the trans_primitives
argument to change the time unit to minutes, hours, etc.?
To pass parameters to an aggregation or transform primitive, you can create an instance of the primitive with the parameters. This is how to pass the unit
parameter to the TimeSince
primitive.
from featuretools.primitives import TimeSince
ft.dfs(
...
trans_primitives=[TimeSince(unit='hours')]
)