semantic_coherence_stm_light: Semantic Coherence (as used in stm package, but a light...

View source: R/semantic_coherence_stm_light.R

semantic_coherence_stm_lightR Documentation

Semantic Coherence (as used in stm package, but a light version)

Description

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.

Usage

semantic_coherence_stm_light(simple_triplet_dtm, n_top_words, beta)

Arguments

simple_triplet_dtm

A document term matrix in simple triplet format from slam package.

n_top_words

Number of top n words in beta to be considererd per topic.

beta

NUmeric matrix with Word distributions over topics (column = word, each row = 1 topic, entries = probabilities)

Value

Coherence score per topic.


manuelbickel/textility documentation built on Nov. 25, 2022, 9:07 p.m.