summary.ETM: Project ETM embeddings using UMAP

Description Usage Arguments Value See Also Examples

View source: R/ETM.R

Description

Uses the uwot package to map the word embeddings and the center of the topic embeddings to a 2-dimensional space

Usage

1
2
## S3 method for class 'ETM'
summary(object, type = c("umap"), n_components = 2, top_n = 20, ...)

Arguments

object

object of class ETM

type

character string with the type of summary to extract. Defaults to 'umap', no other summary information currently implemented.

n_components

the dimension of the space to embed into. Passed on to umap. Defaults to 2.

top_n

passed on to predict.ETM to get the top_n most relevant words for each topic in the 2-dimensional space

...

further arguments passed onto umap

Value

a list with elements

See Also

umap, ETM

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
library(torch)
library(topicmodels.etm)
library(uwot)
path     <- system.file(package = "topicmodels.etm", "example", "example_etm.ckpt")
model    <- torch_load(path)
overview <- summary(model, 
                    metric = "cosine", n_neighbors = 15, 
                    fast_sgd = FALSE, n_threads = 1, verbose = TRUE) 
overview$center
overview$embed_2d

topicmodels.etm documentation built on Nov. 8, 2021, 9:07 a.m.