Interpréter les thèmes

Introduction à l'analyse de texte en R

Maham Faisal Khan

Senior Data Science Content Developer

Deux thèmes

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))
Introduction à l'analyse de texte en R

Deux thèmes

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

Introduction à l'analyse de texte en R

Trois thèmes

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))
Introduction à l'analyse de texte en R

Trois thèmes

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

Introduction à l'analyse de texte en R

Quatre thèmes

Introduction à l'analyse de texte en R

L'art de choisir le bon modèle

  • Ajouter des thèmes distincts est utile
  • Si des thèmes se répètent, on est allé trop loin
  • Nommez les thèmes selon la combinaison des mots à forte probabilité
Introduction à l'analyse de texte en R

Passons à la pratique !

Introduction à l'analyse de texte en R

Preparing Video For Download...