pyLDAvis arguments for specifying principal components

458 views Asked by At

Need assistance regarding the Principal components to be displayed in pyLDAvis. It shows PC1 and PC2 by default, however I am interested in exploring other components as well.

I referred this documentation but the specified option plot_opts={'xlab': 'PC1', 'ylab': 'PC2'} only changes plot labels.

I am using pyLDAvis through gensim:

pyLDAvis.enable_notebook()
vis = pyLDAvis.gensim.prepare(lda_model, corpus, id2word)
1

There are 1 answers

0
Nils_Denter On

You can not change the dimensions in this library. However, you could do a multidimensional scaling on your own. In this package, they use "Dimension reduction via Jensen-Shannon Divergence & Principal Coordinate Analysis (aka Classical Multidimensional Scaling)". Just replicate this method and set dimensions to more the amount you want.

You can do it with scikit-learn: https://scikit-learn.org/stable/auto_examples/manifold/plot_mds.html