Skip to content

Instantly share code, notes, and snippets.

@CyrilRJK
Created Jun 7, 2022
Embed
What would you like to do?
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