Skip to content

Instantly share code, notes, and snippets.

@amacanovic
amacanovic / ldatuning_keyATM.R
Last active November 10, 2022 07:27
A code that allows you to use the measures from the ldatuning R package (https://github.com/nikita-moor/ldatuning) for use with keyATM models (https://keyatm.github.io/keyATM/). These measures allow you to choose the optimal number of topics to cluster textual data into with the keyATM models by Eshima, Imai, and Sasaki (http://arxiv.org/abs/200…
# Adapting the ldatuning functions to keyATM model structure in R
# Code modified by Ana Macanovic (see amacanovic.github.io for contact details)
# Please let me know if you find errors or have suggestions regarding these functions.
# The function metrics_ldatuning below adapts the metrics from the ldatuning
# package (https://github.com/nikita-moor/ldatuning) so they can be used with the output
# of keyATM models (https://keyatm.github.io/keyATM/) .
# See this discussion for more details: https://github.com/keyATM/keyATM/issues/169
# Note that the authors of keyATM models suggest that one does not need to adjust the number of topics