predict_lda | R Documentation |
Predict topics of tweets using fitted LDA model.
predict_lda( data, lda_model, response = "max", remove_numbers = TRUE, remove_punct = TRUE, remove_symbols = TRUE, remove_url = TRUE )
data |
Data frame containing tweets and hashtags. Works with any data frame, as long as there
is a "text" column of type character string and a "hashtags" column with comma separated character vectors.
Can be obtained either by using |
lda_model |
Fitted LDA Model. Object of class LDA. |
response |
Type of response. Either "prob" for probabilities or "max" one topic (default). |
remove_numbers |
Logical. If |
remove_punct |
Logical. If |
remove_symbols |
Logical. If |
remove_url |
Logical. If |
Data frame of topic predictions or predicted probabilities per topic (see response).
## 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") # Predict topics of tweets using your fitted LDA model predict_lda(mytweets, model, response = "prob") ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.