Python Forum

Full Version: LDA Model prepare() method failure in Python
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm trying to utilize the pyLDAvis Python package in Spyder, and while the LdaModel() function appears to work correctly, when I enable_notebook() and then attempt to prepare() the model for visualization, I run into the following error: 'NoneType' object has no attribute 'memmap'.

Can anybody shed some light on what might be going on? The internet seems to suggest the issue might be tied to invalid inputs to the prepare() function, but I'm following this reference guide line-for-line: Mastering Text Analysis and Topic Modeling with spaCy and Gensim

I'm using Python 3.12 with fresh installs of Anaconda and Spyder. I'm not above using a different package/approach if it gets me to a similar end-point re visualization of topic modeling.

The full Traceback is:

Cell In[5], line 1 topic_model(3,Child_Category_Notes_df['answer_note_clean_list'])

File ~\OneDrive - JFCS\Credible\Web Services\Additional_Custom_Functions.py:90 in topic_model vis = pyLDAvis.gensim_models.prepare(lda_model,corpus, dictionary=lda_model.id2word)

File ~\anaconda3\Lib\site-packages\pyLDAvis\gensim_models.py:123 in prepare return pyLDAvis.prepare(**opts)

File ~\anaconda3\Lib\site-packages\pyLDAvis_prepare.py:432 in prepare topic_info = _topic_info(topic_term_dists, topic_proportion,

File ~\anaconda3\Lib\site-packages\pyLDAvis_prepare.py:273 in _topic_info top_terms = pd.concat(Parallel(n_jobs=n_jobs)

File ~\anaconda3\Lib\site-packages\joblib\parallel.py:1952 in call return output if self.return_generator else list(output)

File ~\anaconda3\Lib\site-packages\joblib\parallel.py:1595 in _get_outputs yield from self._retrieve()

File ~\anaconda3\Lib\site-packages\joblib\parallel.py:1699 in _retrieve self._raise_error_fast()

File ~\anaconda3\Lib\site-packages\joblib\parallel.py:1734 in _raise_error_fast error_job.get_result(self.timeout)

File ~\anaconda3\Lib\site-packages\joblib\parallel.py:736 in get_result return self._return_or_raise()

File ~\anaconda3\Lib\site-packages\joblib\parallel.py:754 in _return_or_raise raise self._result