Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPython is not visualizing the gensim model. #33

Closed
Grinshpun opened this issue Oct 31, 2015 · 10 comments
Closed

IPython is not visualizing the gensim model. #33

Grinshpun opened this issue Oct 31, 2015 · 10 comments

Comments

@Grinshpun
Copy link

First and foremost wanted to thank everyone for helping me get this far. I am able to generate a gensim model, run it in IPython notebook, and get to see some results - but not the beautiful graphic we all were hoping for. I'm running WinPython 3.4 QT5 (latest I believe) and I installed both the genism and pyLDAvis also today, so everything is fresh. Here is what my output looks like:

In[9]: pyLDAvis.enable_notebook()
In[10]: pyLDAvis.gensim.prepare(lda, corpus, dictionary)
C:\WinPython\python-3.4.3.amd64\lib\site-packages\skbio\stats\ordination_principal_coordinate_analysis.py:109: RuntimeWarning: The result contains negative eigenvalues. Please compare their magnitude with the magnitude of some of the largest positive eigenvalues. If the negative ones are smaller, it's probably safe to ignore them, but if they are large in magnitude, the results won't be useful. See the Notes section for more details. The smallest eigenvalue is -0.009952346420900118 and the largest is 0.034359155356682575.
RuntimeWarning
Out[10]:
PreparedData(topic_coordinates= Freq cluster topics x y
topic
24 20.249823 1 1 0.055595 0.006318
3 18.859849 1 2 0.003016 0.038028
17 16.519686 1 3 -0.117297 0.009020
18 9.578099 1 4 -0.014738 0.006581
....
13 0.000586 1 24 0.003268 0.007722
9 0.000586 1 25 -0.008638 -0.009829, topic_info= Category Freq Term Total loglift logprob
2300 Default 1280.000000 gladia 1280 30.0000 30.0000
5920 Default 984.000000 giskard 984 29.0000 29.0000
1512 Default 676.000000 amadiro 676 28.0000 28.0000
...
2252 Topic25 0.000562 anacreon 117 -0.3992 -6.2565
9440 Topic25 0.000626 madam 372 -1.5745 -6.2751

[1929 rows x 6 columns], token_table= Topic Freq Term
term
3268 1 0.181818 abilities
3268 2 0.318182 abilities
...
1155 10 0.019608 york

[1984 rows x 3 columns], R=30, lambda_step=0.01, plot_opts={'ylab': 'PC2', 'xlab': 'PC1'}, topic_order=[25, 4, 18, 19, 21, 11, 23, 17, 22, 8, 12, 24, 15, 13, 2, 7, 20, 9, 16, 3, 6, 5, 1, 14, 10])

@Grinshpun
Copy link
Author

Alternatively I tried to use display() function:
In[11]: pyLDAvis.display(pyLDAvis.gensim.prepare(lda, corpus, dictionary))
Out[11]: <IPython.core.display.HTML object>

not that much better.

@bmabey
Copy link
Owner

bmabey commented Oct 31, 2015

Odd.. what version of ipython are you using? You can trying using the pyLDAvis.show function to launch a webserver or save_html to save the vis out. Are you using the web notebook or another fronted?

@Grinshpun
Copy link
Author

I thought I did mentioned in my original post: I am on Windows 10, with WinPython-64bit-3.4.3.5Qt5
And I was running this thing one-line at the time from the Ipython interactive notebook.
Btw If you could hint at how I can run the whole script end-to-end, instead of one line at a time it would be great.
BTW When I try to run it outside of the Ipython - I get the initialization error from it.

@Grinshpun
Copy link
Author

Ben

Apparently I have gotten a "position out of range" error, perhaps causing the graphs not to display.

QTextCursor::setPosition: Position '29941' out of range
QTextCursor::setPosition: Position '29941' out of range
QTextCursor::setPosition: Position '29950' out of range

Any help would be really-really-really appreciated.

@bmabey
Copy link
Owner

bmabey commented Nov 3, 2015

Only the web/browser notebook is supported. It looks like you are using the QT notebook so it is not expected to work at all.

On Nov 3, 2015, at 5:58 AM, Vadim Grinshpun notifications@github.com wrote:

QTextCursor

@Grinshpun
Copy link
Author

Mr. Mabey

If you can find it in your heart and in your schedule and tell with exact version of Python or WinPython for that matter I should use in order for this to work correctly?

Thanks
Vadim

@bmabey
Copy link
Owner

bmabey commented Nov 4, 2015

pyldavis has been tested and is known to work on python 2.x and 3.x on OSx and Linux. I've used it with Anaconda Python 2.x on Windows as well and should work with Anaconda Python 3.x as well.

@bmabey
Copy link
Owner

bmabey commented Nov 4, 2015

Sorry I can't be of more help. I've never heard of WinPython and I don't have access to a Windows box. I did have to use pyLDAvis for work on Windows a few months ago and that is when I used it with Anaconda.

@Grinshpun
Copy link
Author

Mr. Mabey

This helps. WinPython is a comprehensive assembly of Python packages for Windows bums, like myself. I chose it because I'm very new to Python and don't have a ready access to the Unix box.
It's installs all major packages automatically, and has some utilities making things more familiar to a Windows use.
In any case I'm very greateful for your help, and I'm ready for try 3 or 4 today or tomorrow. At least I will get a refreshed version of pyLDAvis.

Thank you very much
Vadim

@nanounanue
Copy link

Hi

I want to reopen this issue

I am in a GNU/Linux box and I have the same problem with python 3.4.3

/home/nanounanue/.pyenv/versions/3.4.3/lib/python3.4/site-packages/skbio/stats/ordination/_principal_coordinate_analysis.py:107: RuntimeWarning: The result contains negative eigenvalues. Please compare their magnitude with the magnitude of some of the largest positive eigenvalues. If the negative ones are smaller, it's probably safe to ignore them, but if they are large in magnitude, the results won't be useful. See the Notes section for more details. The smallest eigenvalue is -0.004193835760226034 and the largest is 0.0034918908647356794.
  RuntimeWarning

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants