5

I'd like to fix the random seed from BERTopic library to get reproducible results. Looking at the code of BERTopic I see it uses numpy. Will using np.random.seed(123) be enough? or do I also need to other libraries as random or pytorch as in this question.

RM-
  • 986
  • 1
  • 13
  • 30

1 Answers1

1

you can fix the random seed

from bertopic import BERTopic
from umap import UMAP

umap_model = UMAP(random_state=42)

topic_model = BERTopic(umap_model=umap_model)
sxyxxn
  • 13
  • 7