Git Product home page Git Product logo

dhcn's People

Contributors

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

Watchers

 avatar

dhcn's Issues

The labels were leaked during the testing

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.

image

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.)

image

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

TypeError: can't convert cuda:0 device type tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.

(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

DHCN和S²-DHCN的区别

你好!有几个问题:

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这条通道也无用处?

问题可能比较傻,还希望您不吝赐教。谢谢!

Calculation Method for Improv. (%) in Table 2 of the Paper

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:

$$\left( \frac{{\text{Performance of } S^2-\text{DHCN} - \text{Performance of best baseline}}}{{\text{Performance of best baseline}}} \right) \times 100%$$

For example, in the Tmall dataset with the metric P@10, the calculation would be:
$$\left( \frac{{26.22 - 23.41}}{23.41} \right) \times 100\ = 12 \neq 10.71\ \text{ (as stated in the paper)}$$
For metric M@10:
$$\left( \frac{{14.60 - 13.45}}{13.45} \right) \times 100\ = 8.55 \neq 7.87\ \text{ (as stated in the paper)}$$

Could you please clarify if my understanding is correct, or if there's another way the "Improv. (%)" value is being calculated?

Thank you!

How to calculate P@K

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.

Data_preprocess

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.

i want to sue the sample dataset

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

Dataset Loading issue

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
image

precision and recall

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?

How to generate the session embedding during the testing phase

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,

DHCN/model.py

Line 129 in aeb54db

self.item_embedding, self.item_embedding_layer0 = self.HypergraphConv()

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?

datasets

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

Do you have such an error "ValueError: setting an array element with a sequence" when you run the code?

发生异常: 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.

Abnormal code result and the warning about divide by zero

DHCN/util.py

Line 40 in b798a7b

DH = H.T.multiply(1.0/H.sum(axis=1).reshape(1, -1))

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.

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.