model_distances | R Documentation |
This function calculates dissimilarities between topic-word
distributions over a list of models. The result can be used to align
topics in different models of the same (or similar) corpora: see
align_topics
.
model_distances(ms, n_words, g = JS_divergence) ## S3 method for class 'model_distances' x[m1, m2, i, j] print.model_distances(x)
ms |
list of |
n_words |
number of top words from each topic to consider |
g |
dissimilarity function taking two topic-word matrices and
returning the matrix of dissimilarities between rows, d_{ij} =
g(θ_i, θ_j). By default, the Jensen-Shannon divergence
is used ( |
The models in ms
need not have the same number of topics.
a model_distances
object, which is a list
including elements d
, a list of lists of matrices representing the
upper block-triangle of distances, and ms, n_words, g storing
the arguments. If x
is the result of the
function, the dissimilarity between topic i
from model
m1
and topic j
from model m2 > m1
is found at
x$d[[m1]][[m2 - m1]][i, j]
. For convenience, this can be
expressed as x[m1, m2, i, j]
.
align_topics
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.