find_stm | R Documentation |
Gridsearch for optimal K for your STM/CTM
find_stm(data, search_space = seq(4, 20, by = 2), ...)
data |
Either a pooled dfm object returned by pool_tweets or
a named list of pre-processed tweets for stm modeling returned by |
search_space |
Vector with number of topics to compare different models. |
... |
Additional parameters passed to searchK |
Wrapper function around searchK
for pooled dfm objects returned by
pool_tweets and prepped stm documents returned by fit_stm
.
Plot with different metrics compared.
searchK
searchK
## 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 # compare different K for CTM find_stm(pooled_dfm, search_space = seq(1, 10, 1)) # OR # compare different K for STM prepped_stm <- stm_model$prep find_stm(prepped_stm, search_space = seq(4, 16, by = 2)) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.