Giter Site home page Giter Site logo

hyper-sagnn's People

Contributors

ma-compbio avatar ruochiz avatar

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  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  avatar

hyper-sagnn's Issues

Some errors running the code

Hi, thanks for sharing your great code.
I encountered some errors while running the code.
I used python 3.7.10 with tensorflow 1.14.0 and pytorch 1.9.0 in anaconda3 environment (cuda 11.1 with RTX 3090)
(Summary of my question is written at the last part of the issue.)

At Code directory, I executed the following
python main.py --data MovieLens -f walk

This returned the following error:

torch.Size([15594, 64])
Traceback (most recent call last):
  File "main.py", line 732, in <module>
    summary(classifier_model, (3,))
  File "/home/user/Desktop/ab/Hyper-SAGNN/Code/torchsummary.py", line 73, in summary
    model(*x)
  File "/home/user/anaconda3/envs/hyper_sagnn/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/user/Desktop/ab/Hyper-SAGNN/Code/Modules.py", line 272, in forward
    dynamic, static, attn = self.get_embedding(x, slf_attn_mask, non_pad_mask, return_recon)
  File "/home/user/Desktop/ab/Hyper-SAGNN/Code/Modules.py", line 241, in get_embedding
    dynamic, static, attn = self.encode1(x, x, slf_attn_mask, non_pad_mask)
  File "/home/user/anaconda3/envs/hyper_sagnn/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1071, in _call_impl
    result = forward_call(*input, **kwargs)
  File "/home/user/Desktop/ab/Hyper-SAGNN/Code/Modules.py", line 614, in forward
    dynamic = self.pff_n1(dynamic * non_pad_mask) * non_pad_mask
  File "/home/user/anaconda3/envs/hyper_sagnn/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1071, in _call_impl
    result = forward_call(*input, **kwargs)
  File "/home/user/Desktop/ab/Hyper-SAGNN/Code/Modules.py", line 355, in forward
    output = self.w_stack[i](output)
  File "/home/user/anaconda3/envs/hyper_sagnn/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1071, in _call_impl
    result = forward_call(*input, **kwargs)
  File "/home/user/anaconda3/envs/hyper_sagnn/lib/python3.7/site-packages/torch/nn/modules/conv.py", line 298, in forward
    return self._conv_forward(input, self.weight, self.bias)
  File "/home/user/anaconda3/envs/hyper_sagnn/lib/python3.7/site-packages/torch/nn/modules/conv.py", line 295, in _conv_forward
    self.padding, self.dilation, self.groups)
TypeError: conv1d() received an invalid combination of arguments - got (Tensor, Parameter, Parameter, tuple, tuple, tuple, int), but expected one of:
 * (Tensor input, Tensor weight, Tensor bias, tuple of ints stride, tuple of ints padding, tuple of ints dilation, int groups)
      didn't match because some of the arguments have invalid types: (Tensor, Parameter, Parameter, tuple, tuple, tuple, int)
 * (Tensor input, Tensor weight, Tensor bias, tuple of ints stride, str padding, tuple of ints dilation, int groups)
      didn't match because some of the arguments have invalid types: (Tensor, Parameter, Parameter, tuple, tuple, tuple, int)

This error seems to be happening at line 337 at Modules.py "self.w_stack.append(nn.Conv1d(dims[i], dims[i + 1], 1, use_bias))" so I changed this to "self.w_stack.append(nn.Conv1d(dims[i], dims[i + 1], 1, bias= use_bias))".
(This removed error but I'm not sure this is right solution.)

After doing this, another error happened:

Data file:  ../walks/MovieLens/p2_q0.25_r10_l40_walks.txt
Vocab size:  15593  + UNK
Words per epoch:  6237200
params to be trained 2070189
[ Epoch 0 of 300 ]
Traceback (most recent call last):                                                                                                                                                                                               
  File "main.py", line 761, in <module>
    optimizer=[optimizer], epochs=300, batch_size=batch_size, only_rw=False)
  File "main.py", line 301, in train
    args, model, loss, training_data, optimizer, batch_size, only_rw, train_type)
  File "main.py", line 205, in train_epoch
    pred, batch_y, loss_bce, loss_recon = train_batch_hyperedge(model_1, loss_1, batch_edge, batch_edge_weight, type, y=batch_y)
  File "main.py", line 115, in train_batch_hyperedge
    x, y, w = generate_negative(x, "train_dict", type, w)
  File "main.py", line 448, in generate_negative
    x = pad_sequence(x, batch_first=True, padding_value=0).to(device)
  File "/home/user/anaconda3/envs/hyper_sagnn/lib/python3.7/site-packages/torch/nn/utils/rnn.py", line 363, in pad_sequence
    return torch._C._nn.pad_sequence(sequences, batch_first, padding_value)
TypeError: pad_sequence(): argument 'sequences' (position 1) must be tuple of Tensors, not Tensor

This error seems to be happening at line 24 at utils.py "return torch.as_tensor(vec, dtype = dtype)" so I changed this to " return [torch.as_tensor(v, dtype=dtype) for v in vec]".
After doing this, no further error occured during execution. But the training results(attached as Result_MovieLens_walk.txt) shows that "skipgram: 0.0000, recon: 0.0000". I'm not sure this is right result. Also AUC and AUPR values seems to be much lower than the result in the paper.
I'm worried because there can be more parts that does not work as intended but not detected as errors.

So my question is...
(As some errors occured with my environment) Would you check whether code works properly as intended with the environment? Or can you let me know the exact environment(with detailed version) that works well as intended without errors?
Also, I think it would be helpful if you let me know the examplary result of "python main.py --data MovieLens -f walk" like attached Result_MovieLens_walk.txt file. It will be helpful to check whether the code is running well.

Result_MovieLens_walk.txt

FileNotFoundErro

FileNotFoundError: [Errno 2] No such file or directory: '../walks/wordnet/'

How to reproduce the results and visualizations that are in paper

Hi,
Thank you for the great code. I can successfully run the code but it doesn't show any output as like in the paper. Therefore I want to know how can I reproduce the results and visualizations as shown in the paper. Your guidance would be highly appreciated.

Question about non-k-uniform hyperedge

Hi, thanks for sharing the code of the exciting work. I have several questions about the paper and the implementation.

  1. What does the argument only_rw stand for in the main file?
  2. The datasets used in the paper have three types of nodes. Did you carry out any experiments on non-k-uniform hyperedges? How do you handle the following case: The dataset is a mix of hyperedges of four nodes and hyperedges of three nodes. The hyperedges of three nodes are the same as the ones in the given datasets. As for the hyperedges of four nodes, some of them have four different types of nodes. Some of the hyperedges of four nodes have only three data types or two data types. For such a case, what should be the input file format? The generate_H function and the generate_embeddings function are similar to the ones in DHNE. If I understand correctly, there's one incidence matrix for one type of node. Correct me if I'm wrong.

I appreciate any help you can provide.

Runtime Error: Integer division of tensors using div or / is no longer supported, and in a future release div will perform true division as in Python 3. Use true_divide or floor_divide (// in Python) instead

Hi,

Thanks for sharing the code. I am currently seeing a runtime error when I try to run the code. I have included the details below. Can you please take a look into this:

python version: 3.6.10
pytorch version: 1.6.0
tensorflow version: 1.15.2

run command: python main.py --data wordnet -f adj

WARNING:tensorflow:From /home/ubuntu/anaconda3/envs/tensorflow_p36/lib/python3.6/site-packages/tensorflow_core/init.py:1473: The name tf.estimator.inputs is deprecated. Please use tf.compat.v1.estimator.inputs instead.

1.0 -0.5
model_no_randomwalk
no specific train weight
Node type num [40750 18 40752]
[5. 5. 5. ... 5. 5. 5.]
[5. 5. 5. ... 5. 5. 5.] 5.0 5.0
walk type
Traceback (most recent call last):
File "main.py", line 604, in
node_list = np.arange(num_list[-1]).astype('int')
RuntimeError: Integer division of tensors using div or / is no longer supported, and in a future release div will perform true division as in Python 3. Use true_divide or floor_divide (// in Python) instead.

problem of training both models of classifier_model annd Randomwalk_Word2vec

Hello, I am very admiring your work.But I notice last line of main.py can train both model of classifier_model and Randomwalk_Word2vec but setting loss=(loss, 1.0), (loss2, 0.0) can only train model of classifier_model, right?

Then here is my question, setting loss=(loss, 1.0), (loss2, 1.0), code got error:
image
image

And I want to know whether only one model of classifier_model perform better or both model?

concurrent.futures.process.BrokenProcessPool: A process in the process pool was terminated abruptly while the future was running or pending.

打扰您了,我在运行程序时在random_walk.py文件中的函数preprocess_transition_probs(sg)产生了报错,报错内容如下:
Traceback (most recent call last):
File "E:/pythonProject/Hyper-SAGNN/Hyper-SAGNN/Code/main.py", line 608, in
walk_path = random_walk(args, num, train_data)
File "E:\pythonProject\Hyper-SAGNN\Hyper-SAGNN\Code\random_walk.py", line 263, in random_walk
preprocess_transition_probs(G)
File "E:\pythonProject\Hyper-SAGNN\Hyper-SAGNN\Code\random_walk.py", line 110, in preprocess_transition_probs
alias_t = p.result()
File "D:\ZKJ\anaconda3\envs\tensorflow2\lib\concurrent\futures_base.py", line 428, in result
return self.__get_result()
File "D:\ZKJ\anaconda3\envs\tensorflow2\lib\concurrent\futures_base.py", line 384, in __get_result
raise self._exception
concurrent.futures.process.BrokenProcessPool: A process in the process pool was terminated abruptly while the future was running or pending.
不知如何修改程序可以消除错误,再次对打扰您表示歉意。

Too many warnings of deprecation

The code gives tons of warning of Deprecations "Warning: masked_fill_ received a mask with dtype torch.uint8, this behavior is now deprecated,please use a mask with dtype torch.bool instead." The warnings mess up the layout of output messages.

It is just too painful for a user to scrutinize the code piece by piece for this warning. Please fix it. Appreciated!

Edit:
Solved by backing to Pytorch 1.1.

How to do classification task.

Hello, Hyper-SAGNN is a really a good work. We want to conduct some experiments using this model. Could you please tell me how to reproduce node classification task in the paper using your code.

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.