lda_distribution: View distribution of fitted LDA Models

Description Usage Arguments Value Examples

View source: R/fit_lda.R

Description

View the distribution of your fitted LDA model.

Usage

1
lda_distribution(lda_model, param = "gamma", tidy = FALSE)

Arguments

lda_model

Object of class LDA).

param

String. Specify either "beta" to return the term distribution over topics (term per document) or "gamma" for the document distribution over. topics (i.e. hashtag pool per topic probability).

tidy

Logical. Specify TRUE for return distribution in tidy format (tbl).

Value

Data frame or tbl of Term (beta) or document (gamma) distribution over topics.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## Not run: 

library(Twitmo)

# load tweets (included in package)
mytweets <- load_tweets(system.file("extdata", "tweets_20191027-141233.json", package = "Twitmo"))

# Pool tweets into longer pseudo-documents
pool <- pool_tweets(data = mytweets)
pooled_dfm <- pool$document_term_matrix

# fit your LDA model with 7 topics
model <- fit_lda(pooled_dfm, n_topics = 7, method = "Gibbs")

# Choose either "beta" to return the term distribution
# over topics (term per document) or "gamma" for the document distribution over
# topics (hashtag pool per topic probability)
lda_distribution(model, param = "gamma")

## End(Not run)

Twitmo documentation built on Dec. 11, 2021, 10:01 a.m.