dipanjanS / practical-machine-learning-with-python

Master the essential skills needed to recognize and solve complex real-world problems with Machine Learning and Deep Learning by leveraging the highly popular Python Machine Learning Eco-system.
Apache License 2.0
2.28k stars 1.65k forks source link

PyLDAvis doesn't display anything #2

Closed hisen630 closed 6 years ago

hisen630 commented 6 years ago

hi, great book. however, i followed all your instructions in chapter 7, the code pyLDAvis.sklearn.prepare(pos_nmf, ptvf_features, ptvf, R=15) displays nothing in my notebook. And i found this warning from jupyter console:

RuntimeWarning: invalid value encountered in multiply
  relevance = lambda_ * log_ttd + (1 - lambda_) * log_lift

i don't know if there's anything i can do to get the pic. thanks


this should be a bug comes from pyLDAvis, following codes could work:

data = pyLDAvis.sklearn.prepare(pos_nmf, ptvf_features, ptvf, R=15)
pyLDAvis.show(data)
raghavbali commented 6 years ago

Hey @hisen630 ,

Thanks for the feedback. Glad you found the book useful, do share your feedback on amazon (it really encourages and would be highly appreciated).

Apologies for delayed response, we have been busy with some other projects. Could you share python version /Anaconda installation details along with your import statements. We can take it from there.

In case you found the fix, do post how you handled it for the benefit of others.

Cheers.

dipanjanS commented 6 years ago

Did you also execute pyLDAvis.enable_notebook() before running the other piece of code?

Please refer to http://nbviewer.jupyter.org/github/bmabey/hacker_news_topic_modelling/blob/master/HN%20Topic%20Model%20Talk.ipynb for a demo by the author of the package. If you use the enable_notebook() function then you don't need to use the show function explicitely. Do let us know if this worked or you still needed to use the show function and then we can check out if something changed in the library recently.

dipanjanS commented 6 years ago

Closing this due to lack of further activity (> 1 month). Feel free to reach out in the future as needed or open a new issue in case of further problems.

sachindevsharma commented 4 years ago

trying with pyLDAvis.enable_notebook(local=True) worked for me