ValueError: list.remove(x): x not in list in model.hierarchical_topic_reduction()
See original GitHub issueI created a model with
model= Top2Vec(documents_text2, min_count = 4,
speed = "fast-learn",
document_ids=document_ids2,
workers = workers_n,keep_documents=False)
Then I tried to reduce the number of topics with
model.hierarchical_topic_reduction()
and get this error
model10 = model.hierarchical_topic_reduction(1000)
Traceback (most recent call last):
File "<ipython-input-12-4ee6e263e4a0>", line 1, in <module>
model10 = model.hierarchical_topic_reduction(1000)
File "C:\Users\anaconda\.conda\envs\top2vec_final\lib\site-packages\top2vec\Top2Vec.py", line 1215, in hierarchical_topic_reduction
ix_keep.remove(most_sim)
ValueError: list.remove(x): x not in list
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Python throws ValueError: list.remove(x): x not in list
Removing items from a list you are looping over twice makes things a little more complicated still, resulting in a ValueError:
Read more >ValueError: list.remove(x): x not in list - STechies
This error is generated when we try to remove a list item that is not present in the list while using the remove(...
Read more >Python ValueError: list.remove(x): x not in list Solution
The ValueError: list.remove(x): x not in list Python error tells us we are using the remove() method to remove an item that does...
Read more >I keep getting "ValueError: list.remove(x): x not in list" - Reddit
The problem is list.remove() expects the element to be deleted, not it's index.
Read more >ValueError: list.remove(x): x not in list · Issue #139 - GitHub
When I use python setup.py install to install, the terminal will display the following information. setup.py:66: UserWarning: Assuming ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
First I load the model an tested the reducing again. Same error
After that I run:
Could it be that most_sim == smallest because two topics have a similarity of 1, so somehow “smallest” ends up in index 1 of flip(res)? In that case the topic would already be removed by line 1214. I am in the process of verifying this but I am only getting this error when the number of topics is very large and that takes a long time to run.