次の名前の Featuretools チュートリアルに従おうとしています: Predicting a customer's next purchase using automatic feature engineering
Featuretools の詳細については、https ://docs.featuretools.com/index.html を参照してください。
データはこちらから入手できます: https://www.instacart.com/datasets/grocery-shopping-2017
チュートリアル (jupyter ノートブック) に含まれているコマンドを実行しようとすると、この例外が発生します。
import featuretools as ft
from dask import bag
from dask.diagnostics import ProgressBar
import pandas as pd
import utils
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import cross_val_score
import os
ft.__version__
label_times = utils.make_labels(es=es,
product_name = "Banana",
cutoff_time = pd.Timestamp('March 15, 2015'),
prediction_window = ft.Timedelta("4 weeks"),
training_window = ft.Timedelta("60 days"))
AttributeError: module 'utils' has no attribute 'make_labels'
es オブジェクトは、featuretools の「EntitySet」クラス オブジェクトです。
次のコマンドを使用して es を作成しました。
es = es.entity_from_dataframe(entity_id = 'orders',
dataframe = orders,
index = 'order_id',
variable_types = {
'user_id' : ft.variable_types.Categorical,
'eval_set' : ft.variable_types.Categorical,
'order_number' : ft.variable_types.Numeric,
'order_dow' : ft.variable_types.Numeric,
'order_hour_of_day' : ft.variable_types.Numeric,
'days_since_prior_order' : ft.variable_types.Numeric
})
es = es.entity_from_dataframe(entity_id = 'products',
dataframe = products,
index = 'product_id',
variable_types = {
'product_name' : ft.variable_types.Categorical,
'aisle_id' : ft.variable_types.Categorical,
'department_id' : ft.variable_types.Categorical
})
es = es.entity_from_dataframe(entity_id = 'departments',
dataframe = departments,
index = 'department_id',
variable_types = {
'department' : ft.variable_types.Categorical
})
es = es.entity_from_dataframe(entity_id = 'aisles',
dataframe = aisles,
index = 'aisle_id',
variable_types = {
'aisle' : ft.variable_types.Categorical
})