将参数传递给 featuretools 中的聚合原语
Pass parameters to aggregation primitives in featuretools
我正在使用 featuretools
dfs
函数生成我的 feature_matrix 使用与时间相关的聚合基元,例如 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)
如何将 [unit] 参数传递给 trans_primitives
参数以将时间单位更改为分钟、小时等?
要将参数传递给聚合或转换基元,您可以使用参数创建基元的实例。这是将 unit
参数传递给 TimeSince
原语的方法。
from featuretools.primitives import TimeSince
ft.dfs(
...
trans_primitives=[TimeSince(unit='hours')]
)
我正在使用 featuretools
dfs
函数生成我的 feature_matrix 使用与时间相关的聚合基元,例如 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)
如何将 [unit] 参数传递给 trans_primitives
参数以将时间单位更改为分钟、小时等?
要将参数传递给聚合或转换基元,您可以使用参数创建基元的实例。这是将 unit
参数传递给 TimeSince
原语的方法。
from featuretools.primitives import TimeSince
ft.dfs(
...
trans_primitives=[TimeSince(unit='hours')]
)