-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
A division overflow can occur when subdividing groups multiple times.
Example:
from sklearn.datasets import fetch_20newsgroups
from sklearn.feature_extraction.text import CountVectorizer
from turftopic import KeyNMF
def split_groups(groups, n):
if n == 0:
return
for group in groups:
group.divide(5)
split_groups(group, n - 1)
if __name__ == '__main__':
corpus = fetch_20newsgroups(subset='all', remove=('headers', 'footers', 'quotes')).data
corpus = corpus[0:250]
vectorizer = CountVectorizer(min_df=5, max_df=0.8, stop_words='english')
model = KeyNMF(n_components=5, vectorizer=vectorizer)
topic_data = model.prepare_topic_data(corpus)
split_groups(topic_data.hierarchy, 3)Error:
/.venv1/lib/python3.10/site-packages/turftopic/models/wnmf.py:40: RuntimeWarning:
overflow encountered in divide
Metadata
Metadata
Assignees
Labels
No labels