AttributeError от gensim под управлением модели LDA - PullRequest
0 голосов
/ 21 ноября 2018

Я пытаюсь запустить простую модель LDA на Gensim:

from gensim import corpora
#text_data here is a list of tokens
dictionary = corpora.Dictionary(text_data)
corpus = [dictionary.doc2bow(text) for text in text_data]

lda = gensim.models.ldamodel.LdaModel(corpus=corpus, num_topics=5, id2word=dictionary, passes=15)

и получаю следующую ошибку:

File ".../anaconda3/lib/python3.6/site-packages/gensim/models/ldamodel.py", line 465, in __init__
    self.random_state = utils.get_random_state(random_state)

  File ".../anaconda3/lib/python3.6/site-packages/gensim/utils.py", line 84, in get_random_state
    return np.random.mtrand._rand

AttributeError: module 'numpy.random' has no attribute 'mtrand'

Я пробовал from numpy import random, но некажется, работает, и не совсем уверен, почему эта ошибка выбрасывается.

Есть предложения?

РЕДАКТИРОВАТЬ: перезапуск Anaconda и Spyder исправил проблему.

...