AnacletoLAB / grape

🍇 GRAPE is a Rust/Python Graph Representation Learning library for Predictions and Evaluations
MIT License
502 stars 38 forks source link

Graph visualization error #13

Closed arpelletier closed 1 year ago

arpelletier commented 1 year ago

Hello. I am trying the Using CBOW to embed Cora python notebook (linked) and after replacing "CBOWEnsmallen" with "DeepWalkCBOWEnsmallen", the first order embedding runs successfully but fails at the graph visualization. I get the following error:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/tmp/ipykernel_3453/3695275499.py in <module>
----> 1 GraphVisualizer(
      2     graph,
      3     node_embedding_method_name="CBOW - First order"
      4 ).fit_and_plot_all(first_embedding)

~/anaconda3/lib/python3.9/site-packages/embiggen/visualizations/graph_visualizer.py in fit_and_plot_all(self, node_embedding, number_of_columns, show_letters, include_distribution_plots, **node_embedding_kwargs)
   4236         distribution_plot_methods_to_call = []
   4237 
-> 4238         if not self._graph.has_constant_non_zero_node_degrees():
   4239             node_scatter_plot_methods_to_call.append(
   4240                 self.plot_node_degrees,

AttributeError: The method 'has_constant_non_zero_node_degrees' does not exists, did you mean one of the following?
* 'has_constant_edge_weights'
* 'get_non_zero_subgraph_node_degrees'
* 'has_nodes'
* 'has_edges'
* 'has_selfloops'
* 'has_node_ontologies'
* 'has_node_oddities'
* 'get_node_degrees'
* 'has_node_name'
* 'has_node_types'

Looks like the issue has to do with embiggen dependencies in the graph visualization. Below are the package versions I am using: embiggen==0.11.13 ensmallen==0.8.7 grape==0.1.9

As well, I was not able to successfully run the second-order embeddings

model = DeepWalkCBOWEnsmallen(
    return_weight=2.0,
    explore_weight=0.1
)
second_embedding = model.fit_transform(graph).get_node_embedding_from_index(0)

The above code gives the below error:


---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/tmp/ipykernel_3453/3112314827.py in <module>
----> 1 model = DeepWalkCBOWEnsmallen(
      2     return_weight=2.0,
      3     explore_weight=0.1
      4 )
      5 second_embedding = model.fit_transform(graph).get_node_embedding_from_index(0)

TypeError: __init__() got an unexpected keyword argument 'return_weight'```
LucaCappelletti94 commented 1 year ago

Thank you for the clear issue!

The issue boils down to a not up-to-date jupyter notebook; I have now inserted the execution of jupyter notebooks in the test suite to avoid such things from happening again.

I expect to make available the update Jupiters by later this afternoon (central European time).

LucaCappelletti94 commented 1 year ago

To keep you posted, I am currently rendering the Jupyter Notebooks. I had to solve some cross-browser compatibility issues to integrate the animated embeddings, which took far more than I had hoped.

If everything goes smoothly, I expect to push them online later today or tomorrow.

LucaCappelletti94 commented 1 year ago

Hello and sorry for the delay! The reported issue is solved in the current version of 🍇, namely the 0.1.10.

Furthermore, I have updated and extended the available tutorials in this directory.

LucaCappelletti94 commented 1 year ago

I assume the error is no more since I have tested all tutorials. Please feel free to reopen the issue if that is not the case.