my_searchK: Find the appropriate number of topics for stm

View source: R/text_mining.R

my_searchKR Documentation

Find the appropriate number of topics for stm

Description

This function is just like stm's searchK, but it uses tidyverse and allows a formula for prevalence. Adapted from Julia Silge's blog.

Usage

my_searchK(documents, K, prevalence = ~1, seed1 = 19, ...)

Arguments

documents

Quanteda dfm object.

K

Numeric vector of numbers of topics to try.

prevalence

Formula of topic prevalence.

seed1

Random seed to use.

...

Other arguments to pass to stm::stm.

Value

A tibble with the metrics output by searchK, plus a column for the fitted model for each value of K tried.


pachterlab/museumst documentation built on July 25, 2022, 11:53 a.m.