python - 在featuretools中使用cutoff_times进行预测

标签 python machine-learning prediction featuretools feature-engineering

我正在构建一个模型来预测用户是否会根据他/她的阅读历史记录等(事件)购买订阅。我正在使用 featuretools ( https://www.featuretools.com/ ) 来自动化特征工程,这就是它变得棘手的地方:

考虑到以下情况,我应该如何决定训练数据的截止时间/窗口:

  • 培训窗口应该多长,如 1 个月、6 个月等?
  • 鉴于订阅前和订阅后的用户事件可能不同,我应该根据当前订阅者的订阅时间截断他们的数据(防止泄漏)。但是我什么时候应该停止对非订阅者的订阅呢?
feature_matrix, feature_defs = ft.dfs(entityset=es,
                                     target_entity="users",
                                     max_depth=2,
                                     agg_primitives=["sum", "std", "max", "min", "mean", "median", "count", "percent_true", "num_unique", "mode", 
                                                     "avg_time_between"],
                                     trans_primitives=["day", "year", "month", "weekday", "time_since_previous", "time_since", "is_weekend"],
                                     cutoff_time=cutoff_times,
                                     cutoff_time_in_index=True,
                                     training_window=ft.Timedelta(180,"d"),
                                     n_jobs=8, verbose=True)

最佳答案

如何决定训练数据的截止时间取决于以下因素:

How long should the training window be 1 month, 6 months, etc?

我认为您可以尝试不同的训练窗口大小,看看哪种模型可以提供更好的结果。

Given that user activity may be different pre and post subscription, I should cutoff data for current subscribers based on when they subscribed (prevent leakage). But when I should I cutoff for non-subscribers?

我认为您可以随机选择它们,或者在代表您将来何时对这些订阅者使用该模型的时间选择它们。

我们的开源库 Compose是构建此标签流程的理想选择。如果您在 Compose 中定义预测问题,它将根据您定义预测问题的方式自动选择负例。它还具有参数化预测窗口,可让您在特定时间生成标签。让我知道这是否有帮助。

关于python - 在featuretools中使用cutoff_times进行预测,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58538399/

相关文章:

machine-learning - 如何获得随机森林算法对自变量使用的最终方程来预测因变量?

javascript - 图表的预测时间建模

python - 在 Azure DevOps 管道中找不到 Pytest

python - 非交互式访问谷歌云存储

python - 如何使用 "pip install"运行单元测试?

machine-learning - 机器学习中训练数据的标记可能不是 100% 准确

python - 计算python中点的导数

c++ - 使用 OpenCV 的 Kmeans 聚类中的马哈拉诺比斯距离

python - sklearn 逻辑回归 - 使用外部测试数据的自定义输入进行预测

c++ - 有没有办法在 C++ 中预先声明嵌套类?