Skip to contents

Coherence for each topic

Usage

coherence_segmentr(dtm, lda, M = 10)

Arguments

dtm

The Dtms object which was originally made with make_DTMs or make_DTMs_parrellel

lda

The LDA object made with fit_LDAs or par_fit_LDAs

M

the value for perplexity, use sqrt(n_terms) as a guide, or just 10.

Value

a list column containing values of coherence

Examples

ldas <- SegmentR:::test_data()$lda
#> removing stopwords
#> Making DTMs
#> making tuning grid
#> setting up LDAs
dtms <- ldas$dtm
ldas <- ldas$lda
coherence <- 
 purrr::map2(dtms,
             ldas, 
             coherence_segmentr)
coherence[[1]]
#> # A tibble: 3 × 2
#>   topic   coherence
#>   <chr>       <dbl>
#> 1 topic_1  -0.0148 
#> 2 topic_2  -0.00638
#> 3 topic_3   0.0139