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