# NOT RUN {
library(torch)
library(topicmodels.etm)
path <- system.file(package = "topicmodels.etm", "example", "example_etm.ckpt")
model <- torch_load(path)
# Get most emitted words for each topic
terminology <- predict(model, type = "terms", top_n = 5)
terminology
# Get topics probabilities for each document
path <- system.file(package = "topicmodels.etm", "example", "example_dtm.rds")
dtm <- readRDS(path)
dtm <- head(dtm, n = 5)
scores <- predict(model, newdata = dtm, type = "topics")
scores
# }
Run the code above in your browser using DataLab