摘要:记录工作中用到的featuretools的部分高级特性。

1、防止信息泄露

在调用dfs时,将主表的观测时间列连同id列作为cutoff_time,可以在构造特征时自动将子表中在cutoff_time之后的记录过滤掉,e.g.

features, feature_names = ft.dfs(
  entityset=es,
  target_entity='zhubiao',
  agg_primitives=[test_prim],
  cutoff_time=cutoff_time,
  primitive_options=selected_primitives_option,
  include_cutoff_time=True,
  max_depth=2,
  verbose=True)

与之相关的一个参数是include_cutoff_time,表示是否将恰好发生在cutoff_time时刻的数据包含在内。

2、实现更精确的time_since原语

将uses_calc_time置为True,可以自动将dfs传入的每个instance的cutoff_time传入聚合函数作为聚合函数的time参数,此时‘time'参数为聚合函数的保留参数,专门用于传入cutoff_time,不可再被赋值:

首先定义聚合函数,函数的参数包含一个time参数,但time参数无须传值,featuretools默认将该instance id的cutoff time传入,函数体内可正常使用该参数!这样在实现time_since原语时,只须要计算子表时间列与time参数之间的差值,再进行聚合即可。一个最小化demo如下:

def mean_(col, time):
  return time

只须在构建聚合原语时,将uses_calc_time置为True就可以了。

test_=make_agg_primitive(function=mean_,
  input_types=[Numeric],
  return_type=Numeric,
  base_of=(abs_,),
  uses_calc_time=True,
  number_output_features=1)

3、进度调回调功能

进度更新后的回调函数.。需要包含以下参数:

update: percentage change (float between 0 and 100) in progress since last call

progress_percent: percentage (float between 0 and 100) of total computation completed

time_elapsed: total time in seconds that has elapsed since start of call

最新文章

  1. Node6.9.2 —— Http官网笔记整理
  2. 边表+SPFA
  3. 使用mybatis完成通用dao和通用service
  4. 李洪强iOS开之【零基础学习iOS开发】【02-C语言】04-常量、变量
  5. Linux 桌面玩家指南:12. 优秀的文本化编辑思想大碰撞(Markdown、LaTeX、MathJax)
  6. frontpage 2010.2003绿色版
  7. Spring读取外部的资源配置文件—@PropertySource和@Value实现资源文件配置
  8. WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for 'jquery'. Please add a ScriptResourceMapping named jquery(case-sensitive).
  9. python入门-直方图
  10. 小测(noip2005的两道题) 2017.3.3
  11. mysql 数据操作 单表查询 limit 练习
  12. sqlserver create table
  13. hdu1575 Tr A 矩阵初识
  14. C#多线程方法同步
  15. Python之freshman07 面向对象编程jinjie
  16. Qt之QThread随记
  17. jmeter非GUI模式如何压测并生成测试报告
  18. 【黑金教程笔记之007】【建模篇】【Lab 06 SOS信号之二】—笔记
  19. HDU 1255 覆盖的面积(线段树+扫描线)
  20. 用vue-cli快速构建项目

热门文章

  1. wireshark如何抓取分析https的加密报文
  2. Vue中去除文本框回车默认事件
  3. restful设计风格
  4. AutoPy开发文档
  5. 走进springboot
  6. 计算机体系结构——CH4 输入输出系统
  7. 【Django】有关多用户管理的一点小经验分享
  8. [GDKOI2021] 普及组 Day3 总结 && 题解
  9. Python基础(十三):for循环
  10. C#类的一些基础知识(静态方法可以不用实例化调用)