Diễn giải chủ đề

Nhập môn Phân tích Văn bản bằng R

Maham Faisal Khan

Senior Data Science Content Developer

Hai chủ đề

lda_topics <- LDA(
  dtm_review,
  k = 2,
  method = "Gibbs",
  control = list(seed = 42)
) %>% 
  tidy(matrix = "beta")

word_probs <- lda_topics %>% group_by(topic) %>% slice_max(beta, n = 15) %>% ungroup() %>% mutate(term2 = fct_reorder(term, beta))
Nhập môn Phân tích Văn bản bằng R

Hai chủ đề

ggplot(
  word_probs, 
  aes(
    term2, 
    beta, 
    fill = as.factor(topic)
  )
) +
  geom_col(show.legend = FALSE) +
  facet_wrap(~ topic, scales = "free") +
  coord_flip()

Nhập môn Phân tích Văn bản bằng R

Ba chủ đề

lda_topics2 <- LDA(
  dtm_review,
  k = 3,
  method = "Gibbs",
  control = list(seed = 42)
) %>% 
  tidy(matrix = "beta")

word_probs2 <- lda_topics2 %>% group_by(topic) %>% slice_max(beta, n = 15) %>% ungroup() %>% mutate(term2 = fct_reorder(term, beta))
Nhập môn Phân tích Văn bản bằng R

Ba chủ đề

ggplot(
  word_probs2, 
  aes(
    term2, 
    beta, 
    fill = as.factor(topic)
  )
) +
  geom_col(show.legend = FALSE) +
  facet_wrap(~ topic, scales = "free") +
  coord_flip()

Nhập môn Phân tích Văn bản bằng R

Bốn chủ đề

Nhập môn Phân tích Văn bản bằng R

Nghệ thuật chọn mô hình

  • Thêm các chủ đề khác nhau là tốt
  • Lặp lại chủ đề là quá mức
  • Đặt tên theo tổ hợp các từ có xác suất cao
Nhập môn Phân tích Văn bản bằng R

Hãy thực hành!

Nhập môn Phân tích Văn bản bằng R

Preparing Video For Download...