263 人のユーザーで構成されるデータセットがあります。次のデータ フレーム構造があります。
userID bookmarkID tagID value
1 52 101 1
1 114 154 1
2 127 14 1
4 114 4 1
各ユーザーについて、次の式で頻度を表す変数の値を計算します: count() / (ブックマーク ID の数 * タグ ID の数)。注文されていません。
1 2 3 4 5 6
0.0003716331 0.0005655286 0.0001777376 0.0003070012 0.0019389552 0.0002746853
...
...
259 260 261 262 263 264
0.0003393172 0.0006463184 0.0002100535 0.0002100535 0.0001777376 0.0004685808
265
0.0001777376
次の R コードを使用します。
#each user: number of tensor elements which >0 / (num of tags* number of items)
d.file <-
"E:/My_Projects/Bitbucket/TylerRecommender/src/test/resources/DAI_LAbor/p-core of level 12/dataFilePathBeforeTensorDecompositionForTraining80percent.txt"
df<-read.table(d.file,sep="\t",header=T)
itemsize<-length(unique(df$bookmarkID))
tagsize<-length(unique(df$tagID))
itemtagmatrixsize<-itemsize*tagsize
userid.bag<-df$userID
user.tas.count<-table(userid.bag)
dens.tas<-density(user.tas.count/itemtagmatrixsize)
plot(dens.tas, col="red")
d.file2 <-
"E:/My_Projects/Bitbucket/TylerRecommender/src/test/resources/DAI_LAbor/p-core of level 12/~sample_tensor_afterDecomposition_Condensed.example.txt"
df2<-read.table(d.file2,sep="\t",header=T)
lines(density(table(df2$userID)/itemtagmatrixsize), col="blue")
今私の問題は、ユーザーの頻度分布を最もよく説明するグラフをどのようにプロットできるかです。
Rでカーネル密度推定関数density()を使用して、頻度値の確率分布をプロットしています。(これは私の目的に合っていますか?)
ただし、次のグラフの前のもの (青) よりもはるかに高い周波数値を持つ別のデータセットがあります。赤い線は前のデータセットに関連しています。
しかし、最初のデータセットの赤い線は完全にフラットになり、意味がありません。何故ですか?デフォルトで選択された帯域幅が原因ですか? それらを同じグラフにプロットして、正常に見えるようにすることは可能ですか? ありがとう!