Giter Site home page Giter Site logo

gentlezhu / shift-robust-gnns Goto Github PK

View Code? Open in Web Editor NEW
46.0 4.0 6.0 10.23 MB

"Shift-Robust GNNs: Overcoming the Limitations of Localized Graph Training Data" (NeurIPS 21')

Python 100.00%
network-embeddings graph-representation-learning graph-neural-networks distribution-shift

shift-robust-gnns's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

shift-robust-gnns's Issues

Errors when running GAT and GraphSAGE

Hi,

I get the following errors when running main_gnn.py:

  1. GAT:
Using backend: pytorch
number of classes 7
Using CUDA
Traceback (most recent call last):
  File "main_gnn.py", line 729, in <module>
    micro_f1, macro_f1, out_acc = main(args, [])
  File "main_gnn.py", line 463, in main
    args.aggregator_type
  File ".../Shift-Robust-GNNs/dgl_models.py", line 254, in __init__
    self.layers.append(GATConv(in_feats, n_hidden, num_heads=num_heads, feat_drop=dropout, activation=activation))
  File ".../python3.7/site-packages/dgl/nn/pytorch/conv/gatconv.py", line 160, in __init__
    self._in_src_feats, out_feats * num_heads, bias=False)
  File ".../python3.7/site-packages/torch/nn/modules/linear.py", line 81, in __init__
    self.weight = Parameter(torch.empty((out_features, in_features), **factory_kwargs))
TypeError: empty() received an invalid combination of arguments - got (tuple, dtype=NoneType, device=NoneType), but expected one of:
 * (tuple of ints size, *, tuple of names names, torch.memory_format memory_format, torch.dtype dtype, torch.layout layout, torch.device device, bool pin_memory, bool requires_grad)
 * (tuple of ints size, *, torch.memory_format memory_format, Tensor out, torch.dtype dtype, torch.layout layout, torch.device device, bool pin_memory, bool requires_grad)

and 2. GraphSAGE:

Using backend: pytorch
number of classes 7
Using CUDA
Traceback (most recent call last):
  File "main_gnn.py", line 729, in <module>
    micro_f1, macro_f1, out_acc = main(args, [])
  File "main_gnn.py", line 544, in main
    total_loss = loss + 1 * cmd(model.h[idx_train, :], model.h[iid_train, :])
  File ".../python3.7/site-packages/torch/nn/modules/module.py", line 1131, in __getattr__
    type(self).__name__, name))
AttributeError: 'GraphSAGE' object has no attribute 'h'

relevant packages form pip freeze:
dgl-cu102==0.6.1
torch==1.9.0+cu102

Thanks.

Suggest to loosen the dependency on networkx

Hi, your project Shift-Robust-GNNs requires "networkx==2.5" in its dependency. After analyzing the source code, we found that some other versions of networkx can also be suitable without affecting your project, i.e., networkx 2.5.1. Therefore, we suggest to loosen the dependency on networkx from "networkx==2.5" to "networkx>=2.5,<=2.5.1" to avoid any possible conflict for importing more packages or for downstream projects that may use Shift-Robust-GNNs.

May I pull a request to loosen the dependency on networkx?

By the way, could you please tell us whether such dependency analysis may be potentially helpful for maintaining dependencies easier during your development?



For your reference, here are details in our analysis.

Your project Shift-Robust-GNNs(commit id: 28ddefd) directly uses 4 APIs from package networkx.

networkx.classes.graph.Graph.__init__, networkx.convert.from_dict_of_lists, networkx.algorithms.centrality.betweenness._single_source_shortest_path_basic, networkx.linalg.graphmatrix.adjacency_matrix

From which, 2 functions are then indirectly called, including 1 networkx's internal APIs and 1 outsider APIs, as follows (neglecting some repeated function occurrences).

[/GentleZhu/Shift-Robust-GNNs]
+--networkx.classes.graph.Graph.__init__
|      +--networkx.convert.to_networkx_graph
|      |      +--networkx.convert.from_dict_of_dicts
|      |      +--networkx.convert.from_dict_of_lists
|      |      +--warnings.warn
|      |      +--networkx.convert.from_edgelist
+--networkx.convert.from_dict_of_lists
+--networkx.algorithms.centrality.betweenness._single_source_shortest_path_basic
+--networkx.linalg.graphmatrix.adjacency_matrix

We scan networkx's versions among [2.5.1] and 2.5, the changing functions (diffs being listed below) have none intersection with any function or API we mentioned above (either directly or indirectly called by this project).

diff: 2.5(original) 2.5.1
[](no clear difference between the source codes of two versions)

As for other packages, the APIs of @outside_package_name are called by networkx in the call graph and the dependencies on these packages also stay the same in our suggested versions, thus avoiding any outside conflict.

Therefore, we believe that it is quite safe to loose your dependency on networkx from "networkx==2.5" to "networkx>=2.5,<=2.5.1". This will improve the applicability of Shift-Robust-GNNs and reduce the possibility of any further dependency conflict with other projects/packages.

Inquiry About Figure 1 and Related Code

I would like to express my sincere appreciation for your contributions to this project. The work you've shared has been invaluable.

I'm currently delving deeper into your research and was particularly intrigued by Figure 1 presented in your paper. Could you please provide further details? If feasible, access to the related code would significantly enhance my understanding and ability to follow along with your work.

Thank you for considering my request.

Screenshot 2024-03-05 at 19 36 50

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.