LDA 不区分一个以上的主题——怎么了?
LDA Doesn't distinguish more than one topic - what's going wrong?
我最近才开始在我的工作中使用 LDA,但是,每次我使用 LDA(在 R 中)时,返回的主题在顶级术语中基本上是相同的。本质上,只有一个潜在主题可以与我的结果区分开来。这个问题在不同的数据集、不同的主题和不同的来源上一直存在。 N.B 所有数据集都在 10,000 行中 - 可能太小了?
我正在使用此代码;
data_DL_dtm <- NPS_Clientidentified %>%
filter(!is.na(Comment)) %>%
unnest_tokens(word, Comment) %>%
anti_join(stop_words) %>%
anti_join(custom_stop_words) %>%
count(`Full Name`, word) %>%
cast_dtm(`Full Name`, word, n)
nrow(data_DL_tidy)
DL_lda <- LDA(data_DL_dtm, k = 3, control = list(seed = 1234))
DL_topics <- tidy(DL_lda, matrix="beta")
DL_top_terms <- DL_topics %>%
group_by(topic) %>%
top_n(10, beta) %>%
ungroup() %>%
arrange(topic, -beta)
DL_top_terms %>%
mutate(term = reorder(term, beta)) %>%
ggplot(aes(term, beta, fill = factor(topic))) +
geom_col(show.legend = FALSE) +
facet_wrap(~ topic, scales = "free") +
coord_flip()
这给了我这个:
https://i.imgur.com/zE2SeFX.png
我没想到系统会出现在每个话题的首位。
我是不是漏掉了什么?或者有什么方法可以改进我的 LDA 模型吗?
看起来您的主题很接近,出现这种情况的原因可能有以下三个:
- 您可能迭代了太多次
- 你传递语料库的次数太多了
- 低数据量 - 10,000 行很小,我的 LDA 通常在 1.5 -170 万行上进行训练。我在 300,000 或更少的问题上的连贯性很低,但没有收敛主题
希望对您有所帮助:)
我最近才开始在我的工作中使用 LDA,但是,每次我使用 LDA(在 R 中)时,返回的主题在顶级术语中基本上是相同的。本质上,只有一个潜在主题可以与我的结果区分开来。这个问题在不同的数据集、不同的主题和不同的来源上一直存在。 N.B 所有数据集都在 10,000 行中 - 可能太小了?
我正在使用此代码;
data_DL_dtm <- NPS_Clientidentified %>%
filter(!is.na(Comment)) %>%
unnest_tokens(word, Comment) %>%
anti_join(stop_words) %>%
anti_join(custom_stop_words) %>%
count(`Full Name`, word) %>%
cast_dtm(`Full Name`, word, n)
nrow(data_DL_tidy)
DL_lda <- LDA(data_DL_dtm, k = 3, control = list(seed = 1234))
DL_topics <- tidy(DL_lda, matrix="beta")
DL_top_terms <- DL_topics %>%
group_by(topic) %>%
top_n(10, beta) %>%
ungroup() %>%
arrange(topic, -beta)
DL_top_terms %>%
mutate(term = reorder(term, beta)) %>%
ggplot(aes(term, beta, fill = factor(topic))) +
geom_col(show.legend = FALSE) +
facet_wrap(~ topic, scales = "free") +
coord_flip()
这给了我这个:
https://i.imgur.com/zE2SeFX.png
我没想到系统会出现在每个话题的首位。
我是不是漏掉了什么?或者有什么方法可以改进我的 LDA 模型吗?
看起来您的主题很接近,出现这种情况的原因可能有以下三个:
- 您可能迭代了太多次
- 你传递语料库的次数太多了
- 低数据量 - 10,000 行很小,我的 LDA 通常在 1.5 -170 万行上进行训练。我在 300,000 或更少的问题上的连贯性很低,但没有收敛主题
希望对您有所帮助:)