R を使用したことはありませんが、R でアソシエーション ルールを実行するために疎行列をインポートする必要があります。
インポート データは次のような疎行列です。
i j x
1 2 3 1
2 3 5 1
3 3 1 1
4 2 5 1
. . . .
. . . .
200000000 . . .
疎行列のサイズは200,000,000 X 3、行列は200000 X 100000 (ビッグデータ?)
このデータを使用して R でアソシエーション ルールを実行したいのですが、
' Package arules ' itemMatrix-class & tidLists-class()を使用していますか? または他の人?
そして、どのように行うのですか?
私はこれが好きですが、うまくいきません:
channel <- odbcConnect("test")
data<-sqlQuery(channel,"select i,j,x from table") # it's work
(args <- data.frame(data)) # it's work ,print sparse matrix
# i j x
#1 2 3 1
#2 3 5 1
#3 3 1 1
#3 2 5 1
# ....
(Aa <- do.call(sparseMatrix, args)) # it's work ,print sparse Matrix of class "dgCMatrix"
# 200000 X 100000 sparse Matrix of class "dgCMatrix"
# 1 2 3 4 5....
# [1,] . . . . .
# [2,] . . | . |
# [3,] | . . . |
# ....
rules <- apriori(Aa) # it's not work
Error in as(data, "transactions") :
no method or default for coercing “dgCMatrix” to “transactions”
アプリオリ関数で疎行列を使用できますか?
間違ったパッケージを使用している可能性がありますか?sparse matrix-> matrix->association rule
が必要ですか?
または疎行列 -> 関連付けルール?