xiaxin1998 / dhcn Goto Github PK
View Code? Open in Web Editor NEWCodes for AAAI'21 paper 'Self-Supervised Hypergraph Convolutional Networks for Session-based Recommendation'
Codes for AAAI'21 paper 'Self-Supervised Hypergraph Convolutional Networks for Session-based Recommendation'
Thank you for your sharing.
However, we found a very serious problem in the DHCN, the labels were leaked during the testing.
As mentioned in the paper, a sequence splitting method is used to augment and label the dataset. Figure 1 shows an example of the data after preprocessing.
Notice that, the data is not shuffled during the training and testing in DHCN, which means the last item in the previous sequence is the target item of the current sequence. (The target of each sequence is shown in Figure 2.)
In DHCN, you convert each batch (100 sequences) into a hypergraph, and the prediction for each sequence in the current batch is based on the items in the sequence and the hypergraph. However, previous sequences contain both the items and the target item of the current sequence, which means in the hypergraph the items of each sequence directly connect with the target item (The co-occur of items in previous sequences makes the target item have a great influence on the current prediction according to the Equation 2
in the paper).
In my opinion, we should not make predictions with the help of neighbor sequences in the test data, unless we shuffle the dataset or do not use the sequence splitting method to augment and label the dataset. (CSRM uses neighbor sequences to help predictions, but it shuffles the dataset before training and testing.)
This is the result of DHCN we obtained on Diginetica after data shuffling: Prec@20: 49.14
, MRR@20: 16.05
The datasets downloaded from link "https://www.dropbox.com/sh/j12um64gsig5wqk/AAD4Vov6hUGwbLoVxh3wASg_a?dl=0"
are garbled.I tired to solve this problem by changing the encoding format and other ways,but it still goes wrong.Could you please send me a dataset?My email address is [email protected] will be appreciated for your reply, thank you very much!
(pytorch) XXX@xxxxx:/DATA/XXX/DHCN$ python main.py --dataset Tmall --beta 0.02
Traceback (most recent call last):
File "main.py", line 5, in <module>
from util import Data, split_validation
ImportError: cannot import name 'Data' from 'util' (/DATA/XXX/DHCN/util.py)
(pytorch) XXX@cvpruser:/DATA/XXX/DHCN$ python main.py --dataset Tmall --beta 0.02
Namespace(batchSize=100, beta=0.02, dataset='Tmall', embSize=100, epoch=30, filter=False, l2=1e-05, layer=3, lr=0.001)
/home/XXX/anaconda3/envs/pytorch/lib/python3.8/site-packages/numpy/core/_asarray.py:102: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray.
return array(a, dtype, copy=False, order=order)
-------------------------------------------------------
epoch: 0
start training: 2021-09-17 10:49:17.124433
Traceback (most recent call last):
File "main.py", line 71, in <module>
main()
File "main.py", line 53, in main
metrics, total_loss = train_test(model, train_data, test_data)
File "/DATA/XXX/DHCN/model.py", line 180, in train_test
targets, scores, con_loss = forward(model, i, train_data)
File "/DATA/XXX/DHCN/model.py", line 168, in forward
item_emb_hg, sess_emb_hgnn, con_loss = model(session_item, session_len, D_hat, A_hat, reversed_sess_item, mask)
File "/home/XXX/anaconda3/envs/pytorch/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl
return forward_call(*input, **kwargs)
File "/DATA/XXX/DHCN/model.py", line 153, in forward
session_emb_lg = self.LineGraph(self.embedding.weight, D, A, session_item, session_len)
File "/home/XXX/anaconda3/envs/pytorch/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl
return forward_call(*input, **kwargs)
File "/DATA/XXX/DHCN/model.py", line 75, in forward
session_emb_lgcn = np.sum(session, 0)
File "<__array_function__ internals>", line 5, in sum
File "/home/XXX/anaconda3/envs/pytorch/lib/python3.8/site-packages/numpy/core/fromnumeric.py", line 2247, in sum
return _wrapreduction(a, np.add, 'sum', axis, dtype, out, keepdims=keepdims,
File "/home/XXX/anaconda3/envs/pytorch/lib/python3.8/site-packages/numpy/core/fromnumeric.py", line 87, in _wrapreduction
return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
File "/home/XXX/anaconda3/envs/pytorch/lib/python3.8/site-packages/torch/_tensor.py", line 643, in __array__
return self.numpy()
TypeError: can't convert cuda:0 device type tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.
请问论文中以前模型的数据在哪里找到或者说怎么运行得到,比如Yoochoose1/64数据集的FPMC的P10,M10
你好!有几个问题:
1.完整的代码下载下来是S²-DHCN吗?论文中写道S²-DHCN是自监督版本,S²也就是SSL部分吗?
2.如果我想运行DHCN而不是S²-DHCN,是需要将与SSL部分有关的代码删除吗?如果将此部分删除,con_loss也就不存了在对吗?
3.con_loss与超图和线性图生成的session有关,如果只是想运行DHCN而删除SSL、con_loss,那么是否意味着LineGraph生成的session在模型中已无用处?进而LineGraph这条通道也无用处?
问题可能比较傻,还希望您不吝赐教。谢谢!
is the Line Graph in the figure has some problem? the weight of e1 and e3 should be 1/6?
Thank you for solving this confusion for me!
Hello,
I have a question regarding the calculation method for "Improv. (%)" as stated in Table 2 of the paper. The paper mentions that "The improvements are calculated by using the difference between the performance of S2-DHCN and the best baseline to divide the performance of the latter."
I interpreted this statement as:
For example, in the Tmall dataset with the metric P@10, the calculation would be:
For metric M@10:
Could you please clarify if my understanding is correct, or if there's another way the "Improv. (%)" value is being calculated?
Thank you!
Hi, may I ask if the result of P@K in the paper is in the code? I couldn't find it in the code. How to calculate P@K? Thank you.
Excuse me, at present, I plan to add some other information in the data set to the session-based recommendation task to improve the recommendation accuracy (such as timestamp), and plan to cite and compare your DHCN model. According to what you mentioned in the paper, I have downloaded the original data of the data set Tmall from IJCAI-15 competition. The original Tmall data set contains the information I want to use. May I ask you about the method of preprocessing the Tmall raw data? If you can send me the preprocessing code, I would be very grateful, thank you.
The result of the baseline methods is to reference GCE-GNN. It seems that your model is not compared with GCE-GNN.
i want to test my model in the sample dataset(Mentioned in your code),I didn’t find it in the dataset link, where can I get it, or the sample is generated according to certain rules.
It would be appreciated if you could provide it!!
hi i'm trying to use your code but i am getting error related to datasets ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape
was (351268,) + inhomogeneous part. can you guide me how to solve this issue and i have attached image as well
In file "model.py" ,line 51, in forward
item_embeddings = np.sum(final, 0)
RuntimeError: Can't call numpy() on Tensor that requires grad. Use tensor.detach().numpy() instead.
Excuse me, why the code is gone?Excuse me, why is the result of running the author's code very different from that in the paper (for example, diginetica dataset, P@20 value is about 50 in the paper , but recall@20 value is about 17 in the code).Is it because it is not set correctly?
model.py的第40行“ item_embeddings = np.sum(final, 0) / (self.layers+1)” 报错:
TypeError: can't convert cuda:0 device type tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.
Process finished with exit code 1
there is only code but no paper. it's hard to understand the cod.
Hi, thanks for sharing this interesting work.
I am confused about the generation of session embedding during the training and testing phases. Specifically, during the training, we can generate a session embedding via the hypergraph, which means we use the interactions in the other sessions to learn the embedding for items within the current batch.
When it comes to the testing, we only get access to the interactions within the current session, without the interactions from the other sessions. However when I read the code, I found no matter in the training or testing phase, the function build will always go through the hypergraph conv layer, and then it generates an embedding for the current session, as refers to,
Line 129 in aeb54db
I am not sure if I miss some key details, but I find it is hard to understand the current implementation in generating session embedding during the testing phase. Would you mind clarifying it?
i can't download the datasets of this code from the links in readme, can you give me a method to get it? thank you
发生异常: ValueError
setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (719470,) + inhomogeneous part.
File "/17119/mf/models/DHCN/util.py", line 43, in init
self.raw = np.asarray(data[0])
^^^^^^^^^^^^^^^^^^^
File "/17119/mf/models/DHCN/main.py", line 41, in main
train_data = Data(train_data, shuffle=True, n_node=n_node)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/17119/mf/models/DHCN/main.py", line 72, in
main()
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (719470,) + inhomogeneous part.
Line 40 in b798a7b
A warning will appear on this line of code:
RuntimeWarning: divide by zero encountered in true_divide
DH = H.T.multiply(1.0/H.sum(axis=1).reshape(1, -1))
There is an element with a value of 0 in H.sum(axis=1), this will eventually lead to the generation of inf. Doesn’t it affect the model data?
I only tested the model in the diginetica dataset, using the original code and the preprocessed data provided by Dropbox. I guess the preprocessed code should be the same as SR-GNN, but the results I ran are abnormal. I hope you can provide some suggestions.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.