Skip to content

Instantly share code, notes, and snippets.

@rchurch4
Last active October 3, 2022 14:33
Show Gist options
  • Save rchurch4/b1c917d7906d25f262ba3caeb497b9ef to your computer and use it in GitHub Desktop.
Save rchurch4/b1c917d7906d25f262ba3caeb497b9ef to your computer and use it in GitHub Desktop.
from gdtm.models import GTM
# Set these paths to the path where you saved the Mallet implementation of each model, plus bin/mallet
tnd_path = 'path/to/mallet-tnd/bin/mallet'
gtm_path = 'path/to/mallet-gtm/bin/mallet'
seed_topics_file = 'data/seed_topics.csv'
# We pass in the paths to the java code along with the data set and whatever parameters we want to set
model = GTM(dataset=dataset, mallet_tnd_path=tnd_path, mallet_gtm_path=gtm_path,
tnd_k=10, gtm_k=10, phi=10, top_words=20, seed_topics_file=seed_topics_file)
topics = model.get_topics()
noise = model.get_noise_distribution()
@paul1776
Copy link

from gdtm.helpers.common import save_topics

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment