[英]How can I set random-seed of topic model using mallet in gensim?
我一直在嘗試通過使用槌子作為gensim中的庫來保持主題建模的輸出穩定。 但是,我發現木槌可以設置隨機種子,但是在gensim中看不到任何參數可以設置它。
這剛剛被添加到ldamallet.py包裝器中
def __init__(self, mallet_path, corpus=None, num_topics=100, alpha=50, id2word=None, workers=4, prefix=None,
optimize_interval=0, iterations=1000, topic_threshold=0.0, random_seed=0):
"""
Parameters
----------
mallet_path : str
Path to the mallet binary, e.g. `/home/username/mallet-2.0.7/bin/mallet`.
corpus : iterable of iterable of (int, int), optional
Collection of texts in BoW format.
num_topics : int, optional
Number of topics.
alpha : int, optional
Alpha parameter of LDA.
id2word : :class:`~gensim.corpora.dictionary.Dictionary`, optional
Mapping between tokens ids and words from corpus, if not specified - will be inferred from `corpus`.
workers : int, optional
Number of threads that will be used for training.
prefix : str, optional
Prefix for produced temporary files.
optimize_interval : int, optional
Optimize hyperparameters every `optimize_interval` iterations
(sometimes leads to Java exception 0 to switch off hyperparameter optimization).
iterations : int, optional
Number of training iterations.
topic_threshold : float, optional
Threshold of the probability above which we consider a topic.
random_seed: int, optional
Random seed to ensure consistent results, if 0 - use system clock.
"""
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.