-
Notifications
You must be signed in to change notification settings - Fork 119
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
Index error when using anchors #34
Comments
Is |
Thanks for pointing this out. I think anchors has to be a list of lists: like anchors = [['cat', 'dog'], ['apple']].
|
The anchor input for the topic model should be a list. Within that list, the entries can be either strings, ints, or lists, and you should be able to do any combination of those for anchoring. Individual strings or ints (indicating you want to anchor only one word to a topic) are converted to lists with a single entry, and strings are converted to their corresponding column index. So @gregversteeg isn't quite right, even if you pass just a string or int in the anchors list, it should be preprocessed properly. (He's right that the last example is missing a bracket though, my bad). @owlas Can you provide a simple reproducible example? I can run the examples in the README without any issues using version 1.0.5, so I'm not sure what error you may be getting. |
Can report the same for 1.0.6. Although I cannot reproduce the error consistently. For some sets of anchors it works, for some it throws an error (all of those should be valid according to the docs though) |
@d-lowl Would you be able to provide a minimal reproducible example that does fail? |
Yeah, I made it work for my case (it was partially a problem in my code), but I still think that there are some edge cases. I will play around with it tomorrow and try to come up with one. |
Hi! I am not sure if this repo is still maintained but I ran into the same issue. I found that single item anchor lists are transferred (back) into single items here: This would contradict @ryanjgallagher comment:
Removing the edge case for single item lists solved the problem for me: if len(new_anchor_list) == 0:
continue
# if len(new_anchor_list) == 1:
# processed_anchors.append(new_anchor_list[0])
else:
processed_anchors.append(new_anchor_list) |
When using the fit method with anchors I get an index error from this line:
corex_topic/corextopic/corextopic.py
Line 185 in 8399148
The error is understandable because if
X
is a 2d array, thenX[:,i]
is a 1d slice and thereforeX[:,i].mean(axis=1)
is undefined because there is no dimension1
.I've installed version
corextopic==1.0.5
from pypi.I can reproduce this for any arguments passed to
anchors
The text was updated successfully, but these errors were encountered: