1、什么是Featuretools?
为了能使框架普适,就像pandas用于数据准备或scikit-learn用于机器学习。
链接:https://www.featuretools.com/
2、安装
通过源码安装,代码如下:
git clone https://github.com/featuretools/featuretools.git
cd featuretools
python setup.py install
通过pip安装,命令如下:
pip install featuretools
3、五分钟快速开始
1)首先导入相关包:
In [1]: import featuretools as ft
2)准备相关数据:
In [2]: data = ft.demo.load_mock_customer()
In [3]: customers_df = data["customers"]
In [5]: sessions_df = data["sessions"]
In [7]: transactions_df = data["transactions"]
In [10]: relationships = [("sessions", "session_id", "transactions", "session_id"),
....: ("customers", "customer_id", "sessions", "customer_id")]
3)特征综合:
In [11]: feature_matrix_customers, features_defs = ft.dfs(entities=entities,
....: relationships=relationships,
....: target_entity="customers")
In [12]: feature_matrix_customers