一、版本以及安装包
python 3.7.6
featuretools==0.13.4
scikit-learn==0.22.2.post1
附加功能:
在Featuretools使用来自TSFresh的60+个特征 : python -m pip install featuretools[tsfresh]
接受Featuretools自动更新的提醒 :python -m pip install featuretools[update_checker]
二、简单示例
import featuretools as ft
data = ft.demo.load_mock_customer()
transactions_df = data["transactions"].merge(data["sessions"]).merge(data["customers"])
transactions_df.sample(10)
数据结构
data["transactions"]
shape : (500, 5)
columns :['transaction_id', 'session_id', 'transaction_time', 'product_id','amount']
data["sessions"]
shape :(35, 4)
columns :['session_id', 'customer_id', 'device', 'session_start']
data["customers"]
shape :(5, 4)
columns :['customer_id', 'zip_code', 'join_date', 'date_of_birth']
transactions_df (合并后)
shape :(500, 11)
columns :['transaction_id', 'session_id', 'transaction_time', 'product_id','amount',
'customer_id', 'device', 'session_start', 'zip_code','join_date', 'date_of_birth']
三、featuretools的3个基本组成
实体集(EntitySet):把一个二维表看作一个实体,实体集是一个或多个二维表的集合
特征基元(Feature Primitives):分为聚合和转换两类,相当于构造新特征的方法
深度特征合成(DFS, Deep Feature Synthesis):根据实体集里的实体和特征基元创造新特征
网友评论