find_lda: Find best LDA model

Description Usage Arguments Value See Also Examples

View source: R/fit_lda.R

Description

Find the optimal hyperparameter k for your LDA model

Usage

1
find_lda(pooled_dfm, search_space = seq(1, 10, 2), method = "Gibbs", ...)

Arguments

pooled_dfm

object of class dfm (see dfm) containing (pooled) tweets

search_space

Vector with number of topics to compare different models.

method

The method to be used for fitting. Currently method = "VEM" or method = "Gibbs" are supported.

...

Additional arguments passed to FindTopicsNumber.

Value

Plot with different metrics compared.

See Also

FindTopicsNumber

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## 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

# use the ldatuner to compare different K
find_lda(pooled_dfm, search_space = seq(1, 10, 1),  method = "Gibbs")

## End(Not run)

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