gregversteeg / corex_topic

Hierarchical unsupervised and semi-supervised topic models for sparse count data with CorEx
Apache License 2.0
626 stars 119 forks source link

AttributeError: 'DiGraph' object has no attribute 'node' #32

Closed mchaduteau closed 4 years ago

mchaduteau commented 4 years ago

Hi, I followed strictly the corex_topic_example notebook with my own data (7611 research paper abstracts) and everything ran fine until the visualization step of the example hierarchical topic model at the end for which I got this error (cf.below).

Any idea where this would come from? Many thanks for your answer.

Regards,

Michel

vt.vis_hierarchy([topic_model, tm_layer2, tm_layer3], column_label=words, max_edges=200, prefix='topic-model-example') weight threshold is 0.000000 for graph with max of 200.000000 edges Traceback (most recent call last):

File "", line 2, in prefix='topic-model-example')

File "/home/michel/Documents/CURRENT WORK/Correlation Explanation/corex_topic/corextopic/vis_topic.py", line 68, in vis_hierarchy g = make_graph(weights, node_weights, l1_labels, max_edges=max_edges)

File "/home/michel/Documents/CURRENT WORK/Correlation Explanation/corex_topic/corextopic/vis_topic.py", line 139, in make_graph g.node[(layer + 1, j)]['weight'] = 0.3 * node_weights[layer][j] / max_node_weight

AttributeError: 'DiGraph' object has no attribute 'node'

mchaduteau commented 4 years ago

I found the solution: I reverted to version 1.8.1 of networkx (I had the 2.4 installed in Anaconda). Sorry for the inconvenience. Regards, Michel

gregversteeg commented 4 years ago

Glad you figured it out. Sorry about that, networkx seems to make frequent breaking changes.