Skip to content

Instantly share code, notes, and snippets.

@CyrilRJK
Created June 7, 2022 14:37
Show Gist options
  • Select an option

  • Save CyrilRJK/ff6843ce16b058c22a1550d89fd14bfe to your computer and use it in GitHub Desktop.

Select an option

Save CyrilRJK/ff6843ce16b058c22a1550d89fd14bfe to your computer and use it in GitHub Desktop.
def get_artm_model(topic_names, dictionary):
# model
model_artm = artm.ARTM(num_topics=len(topic_names),
topic_names=topic_names,
cache_theta=True,
seed=1,
scores=[artm.PerplexityScore(name='PerplexityScore', dictionary=dictionary)],
regularizers=[artm.SmoothSparseThetaRegularizer(name='SparseTheta', tau=-0.2),
artm.SmoothSparsePhiRegularizer(name='SparsePhi', tau=-0.2),
artm.DecorrelatorPhiRegularizer(name='DecorrelatorPhi', tau=2.5e+5)]
# metrics
model_artm.scores.add(artm.TopTokensScore(name='TopTokensScore', num_tokens=5))
model_artm.initialize(dictionary)
return model_artm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment