bab2min / tomotopy

Python package of Tomoto, the Topic Modeling Tool
https://bab2min.github.io/tomotopy
MIT License
548 stars 62 forks source link

pyLDAvis for PAModel visualization #186

Closed juneMJ closed 1 year ago

juneMJ commented 1 year ago

Hello, When I'm trying to visualize the distributions from PAModel with pyLDAvis, I use get_sub_topic_dist() for the documents distributions, like this:

dt_dist = np.stack([doc.get_sub_topic_dist() for doc in mdl.docs])

But I get this error:

SystemError: \python\getargs.c:1463: bad argument to internal function

How can I solve this?

bab2min commented 1 year ago

Hi @juneMJ Thank you for reporting the bug. There was a bug at the internal C++ implementation of get_sub_topic_dist() method. https://github.com/bab2min/tomotopy/blob/073c44334a0141e4831ede575ad66b26343ff81d/src/python/py_utils.cpp#L1200 Actually, it should take one argument normalize but it was declared as METH_NOARGS, which is causing the bug you reported. I'll fix it asap. Thank you again for your reporting.

juneMJ commented 1 year ago

@bab2min Cool! Thank you for your quick response! Waiting for the update :)