create_stm: Create a Structural Topic Model

Description Usage Arguments Value Author(s) See Also

View source: R/create_stm.R

Description

Create a topic model from a document-to-term matrix.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
create_stm(
  dtm,
  topic_nbr = 0,
  prevalence = NULL,
  content = NULL,
  init_type = "Spectral",
  seed = 1234,
  iterations = 50,
  tolerance = 0,
  keywords = NULL,
  baselab = "prob",
  frexweight = 0.6,
  min_gamma = 0.1,
  min_beta = 0.01,
  min_common = 1,
  verbose = TRUE
)

Arguments

dtm

Document-to-Term matrix.

topic_nbr

Numeric. Number of topics to model.

prevalence

Formula. See the stm function for detailed instructions.

content

Formula. See the stm function for detailed instructions.

init_type

Character string. See the stm function for detailed instructions.

seed

Numeric. Seed for initialization.

iterations

Integer. Maximum number of iteration.

tolerance

Numeric. See the stm function for detailed instructions.

keywords

Tibble. Two variables: one for the "document" and one of the related "keywords".

baselab

Character string. Whether labels should be based on "prob", "frex", "lift", or "score".

frexweight

Numeric. The weight on discriminance in term selection.

min_gamma

Numeric. Minimum strength of the relationship between document and topic.

min_beta

Numeric. Minimum strength of the relationship between term and topic.

min_common

Integer. Maximum number of topics allowed per document.

verbose

Logical. Should messages be printed.

Value

A list with the "topic_model", the "topic_term", the "topic_label", and the "topic_document".

Author(s)

Nicolas Mangin

See Also

stm

create_dtm


NicolasJBM/lexR documentation built on Feb. 4, 2021, 6:43 p.m.