View source: R/semantic_coherence_stm_light.R
semantic_coherence_stm_light | R Documentation |
This function is simply an adapted copy of to core function in stm package to calcuate semantic coherence. Basically it is the UMass coherence measure with log smooth constant of .01 instead of 1. Core function was extracted to make it versatile by enabling input that does not come from stm package (especially for testing other coherence calculation implementaions). Its a light version, because no checks are made regarding correctness of input and for true versatility acceptance of more input types would have to be imnplemented than only simple triplet matrices. Note that some names were changed in comparison to original implementation.
semantic_coherence_stm_light(simple_triplet_dtm, n_top_words, beta)
simple_triplet_dtm |
A document term matrix in simple triplet format from slam package. |
n_top_words |
Number of top n words in |
beta |
NUmeric matrix with Word distributions over topics (column = word, each row = 1 topic, entries = probabilities) |
Coherence score per topic.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.