0

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 に取得できれば、うまくいくはずです。ただし、SFrame の使用は、標準の Python ライブラリよりも扱いにくいものです。そこにたどり着くための助けをいただければ幸いです。

4

1 に答える 1