我正在准备数据以从 Graphlab 运行 KMEAMS,并且遇到以下错误:
tmp = data.select_columns(['a.item_id'])
tmp['sku'] = tmp['a.item_id'].apply(lambda x: x.split(','))
tmp = tmp.unpack('sku')
kmeans_model = gl.kmeans.create(tmp, num_clusters=K)
Feature 'sku.0' excluded because of its type. Kmeans features must be int, float, dict, or array.array type.
Feature 'sku.1' excluded because of its type. Kmeans features must be int, float, dict, or array.array type.
以下是每列的当前数据类型:
a.item_id str
sku.0 str
sku.1 str
如果我可以将数据类型从 str 获取到 int,我认为它应该可以工作。然而,使用 SFrames 比标准的 python 库更棘手。任何帮助到达那里表示赞赏。