LoslegenKostenlos loslegen

Visualizing topics

Using what we've covered in previous chapters, let's visualize the topics produced by the LDA.

Diese Übung ist Teil des Kurses

Introduction to Text Analysis in R

Kurs anzeigen

Anleitung zur Übung

  • Keep the top 10 highest word probabilities by topic.
  • Create term2, a factor ordering term by word probability.
  • Plot term2 and the word probabilities.
  • Facet the bar plot by (i.e., ~) topic.

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

word_probs <- lda_topics %>%
  # Keep the top 10 highest word probabilities by topic
  ___(___) %>% 
  ___(___) %>% 
  ___() %>%
  # Create term2, a factor ordered by word probability
  ___(term2 = ___(___))

# Plot term2 and the word probabilities
___(___) +
  geom_col() +
  # Facet the bar plot by topic
  ___(___, scales = "free") +
  coord_flip()
Code bearbeiten und ausführen