Skip to content

Instantly share code, notes, and snippets.

@rchurch4
Created October 3, 2022 15:52
Show Gist options
  • Save rchurch4/50af586a6147eb6976018c476199e1f6 to your computer and use it in GitHub Desktop.
Save rchurch4/50af586a6147eb6976018c476199e1f6 to your computer and use it in GitHub Desktop.
from gdtm.models import dNLDA
# Set these paths to the path where you saved the Mallet implementation of each model, plus bin/mallet
tnd_path = 'path/to/mallet-dtnd/bin/mallet'
lda_path = 'path/to/mallet-dlda/bin/mallet'
# We pass in the paths to the java code along with the data set and whatever parameters we want to set
model = dNLDA(dataset=split_dataset, mallet_tnd_path=tnd_path, mallet_lda_path=lda_path, num_time_periods=num_time_periods,
tnd_k=30, lda_k=30, phi=10, top_words=20, save_path='results/dnlda/', run=True)
# When we provide a save path to the dynamic models, topics and noise are automatically saved for each time period.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment