Skip to contents

Extract topic-center embeddings from an embedded topic model (ETM).

Usage

get_topic_embeddings(x)

Arguments

x

Either an nlp_topic_fit with engine = "topicmodels.etm" or a raw ETM object.

Value

A data.table with one row per topic, a standardized topic_id column using the Topic### convention, and one column per embedding dimension named dim_001, dim_002, and so on.

Examples

if (FALSE) { # requireNamespace("topicmodels.etm", quietly = TRUE) && requireNamespace("torch", quietly = TRUE) && torch::torch_is_installed()
path <- system.file(package = "topicmodels.etm", "example", "example_etm.ckpt")
model <- torch::torch_load(path)
get_topic_embeddings(model)
}