Text Mining with R: A Tidy Approach by Julia Silge & David Robinson
Author:Julia Silge & David Robinson [Silge, Julia]
Language: eng
Format: azw3
Publisher: O'Reilly Media
Published: 2017-06-12T04:00:00+00:00
library(tidytext) ap_topics <- tidy(ap_lda, matrix = "beta") ap_topics
## # A tibble: 20,946 × 3 ## topic term beta ## <int> <chr> <dbl> ## 1 1 aaron 1.686917e-12 ## 2 2 aaron 3.895941e-05 ## 3 1 abandon 2.654910e-05 ## 4 2 abandon 3.990786e-05 ## 5 1 abandoned 1.390663e-04 ## 6 2 abandoned 5.876946e-05 ## 7 1 abandoning 2.454843e-33 ## 8 2 abandoning 2.337565e-05 ## 9 1 abbott 2.130484e-06 ## 10 2 abbott 2.968045e-05 ## # ... with 20,936 more rows
Notice that this has turned the model into a one-topic-per-term-per-row format. For each combination, the model computes the probability of that term being generated from that topic. For example, the term “aaron” has a 1.686917 × 10-12 probability of being generated from topic 1, but a 3.8959408 × 10-5 probability of being generated from topic 2.
We could use dplyr’s top_n() to find the 10 terms that are most common within each topic. As a tidy data frame, this lends itself well to a ggplot2 visualization (Figure 6-2).
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8308)
Azure Data and AI Architect Handbook by Olivier Mertens & Breght Van Baelen(6784)
Building Statistical Models in Python by Huy Hoang Nguyen & Paul N Adams & Stuart J Miller(6758)
Serverless Machine Learning with Amazon Redshift ML by Debu Panda & Phil Bates & Bhanu Pittampally & Sumeet Joshi(6644)
Data Wrangling on AWS by Navnit Shukla | Sankar M | Sam Palani(6431)
Driving Data Quality with Data Contracts by Andrew Jones(6371)
Machine Learning Model Serving Patterns and Best Practices by Md Johirul Islam(6132)
Learning SQL by Alan Beaulieu(6003)
Weapons of Math Destruction by Cathy O'Neil(5794)
Big Data Analysis with Python by Ivan Marin(5385)
Data Engineering with dbt by Roberto Zagni(4389)
Solidity Programming Essentials by Ritesh Modi(4038)
Time Series Analysis with Python Cookbook by Tarek A. Atwan(3897)
Pandas Cookbook by Theodore Petrou(3598)
Blockchain Basics by Daniel Drescher(3304)
Hands-On Machine Learning for Algorithmic Trading by Stefan Jansen(2914)
Feature Store for Machine Learning by Jayanth Kumar M J(2819)
Learn T-SQL Querying by Pam Lahoud & Pedro Lopes(2801)
Mastering Python for Finance by Unknown(2748)
