CalcProbCoherence: Probailistic coherence of topics

Description Usage Arguments Value Examples

Description

Calculates the probabilistic coherence of a topic or topics. This approximates semmantic coherence or human understandability of a topic.

Usage

1
CalcProbCoherence(phi, dtm, M = 5)

Arguments

phi

A numeric matrix or a numeric vector. The vector, or rows of the matrix represent the numeric relationship between topic(s) and terms. For example, this relationship may be p(word|topic) or p(topic|word).

dtm

A document term matrix or co-occurence matrix of class matrix or whose class inherits from the Matrix packge. Columns must index terms.

M

An integer for the number of words to be used in the calculation. Defaults to 5

Value

Returns an object of class numeric corresponding to the probabilistic coherence of the input topic(s).

Examples

1
2
3
4
5
# Load a pre-formatted dtm and topic model
data(nih_sample_topic_model)
data(nih_sample_dtm) 

CalcProbCoherence(phi = nih_sample_topic_model$phi, dtm = nih_sample_dtm, M = 5)

ChengMengli/topic documentation built on May 31, 2019, 8:44 p.m.