
8.4
トピックモデリング
■
169
がおかしくなります。このことについてはあとで詳しく説明します。
library(topicmodels)
#
このモデルの実行には時間がかかることに注意
desc_lda <- LDA(desc_dtm, k = 24, control = list(seed = 1234))
desc_lda
## A LDA_VEM topic model with 24 topics.
LDA
は、どこからスタートするかによって結果が変わる確率的なアルゴリズムな
ので、同じ結果を得るためには、ここで示したように
seed
を指定する必要がありま
す。
8.4.3
トピックモデルの解釈
モデルができたので、得られたモデルの要点を示す整理データフレームを作りま
しょう。
tidytext
パッケージには、
topicmodels
パッケージで得られた
LDA
モデルを
整理するメソッドが含まれています。
tidy_lda <- tidy(desc_lda)
tidy_lda
## # A tibble: 861,624
×
3
## topic term beta
## <int> <chr> <dbl>
## 1 1 suit 1.003981e-121
## 2 2 suit 2.630614e-145
## 3 3 suit 1.916240e-79
## 4 4 suit 6.715725e-45
## 5 5 suit 1.738334e-85
## 6 6 suit 7.692116e-84
## 7 ...