Session Ready
Exercise

Reviewing LDA results

You have developed a topic model, napoleon_model, with 5 topics for the sentences from the book Animal Farm that reference the main character Napoleon. You have had 5 local authors review the top words and top sentences for each topic and they have provided you with themes for each topic.

To finalize your results, prepare some summary statistics about the topics. You will present these summary values along with the themes to your boss for review.

Instructions
100 XP
  • Extract the gamma matrix from the topic model, napoleon_model.
  • Use dplyr functions to create a tibble of the top topic in each sentence called grouped_gammas.
  • Use grouped_gammas to count the number of sentences most like each topic.
  • Use grouped_gammas and calculate the average gamma value for each topic.