Giter Club home page Giter Club logo

diffnet's Introduction

⭐UPDATE 20221220:

As the python 2.7 is deprecated, I have convert the diffnet code into a new one to make it can be used under python 3.x. If you use python 3.x, tensorflow-gpu-1.x, you can run the code in directory diffnet-tensorflow-v1-python3. I have tested the development environment python 3.7, and tensorflow-1.15.

Basic Information:

This code is released for the papers:

Le Wu, Peijie Sun, Yanjie Fu, Richang Hong, Xiting Wang and Meng Wang. A Neural Influence Diffusion Model for Social Recommendation. Accepted by SIGIR2019. pdf.
Le Wu, Junwei Li, Peijie Sun, Richang Hong, Yong Ge, and Meng Wang. DiffNet++: A Neural Influence and Interest Diffusion Network for Social Recommendation. Accepted by IEEE Transactions on Knowledge and Data Engineering in Dec 2020. pdf

Usage:

  1. Environment: If you use python2.7, tensorflow-gpu-1.12.0, you can run the code in directory diffnet-tensorflow-v1; if you use python 3.7, tensorflow-gpu-1.15, you can run the code in directory diffnet-tensorflow-v1-python3.
  2. Run DiffNet:
    1. Download the yelp data from this link, and unzip the directories in yelp data to the sub-directory named diffnet of your local clone repository.
    2. cd the sub-directory diffnet and execute the command python entry.py --data_name=<data_name> --model_name=diffnet --gpu=<gpu id>
  3. Run DiffNet++:
    1. Download datasets from this link, and just put the downloaded folder 'data' in the sub-directory named diffnet++ of your local clone repository.
    2. cd the sub-directory diffnet++ and execute the command python entry.py --data_name=<data_name> --model_name=diffnetplus --gpu=<gpu id>
  4. If you have any available gpu device, you can specify the gpu id, or you can just ignore the gpu id.

Following are the command examples:
python entry.py --data_name=yelp --model_name=diffnet
python entry.py --data_name=yelp --model_name=diffnetplus

Citation:

The dataset flickr we use from this paper:
 @article{HASC2019,
  title={A Hierarchical Attention Model for Social Contextual Image Recommendation},
  author={Le, Wu and Lei, Chen and Richang, Hong and Yanjie, Fu and Xing, Xie and Meng, Wang},
  journal={IEEE Transactions on Knowledge and Data Engineering},
  year={2019}
 }

 The algorithm is from DiffNet and DiffNet++:
 @inproceedings{DiffNet2019.
 title={A Neural Influence Diffusion Model for Social Recommendation},
 author={Le Wu, Peijie Sun, Yanjie Fu, Richang Hong, Xiting Wang and Meng Wang},
 conference={42nd International ACM SIGIR Conference on Research and Development in Information Retrieval},
 year={2019}
 }

 @article{wu2020diffnet++,
  title={DiffNet++: A Neural Influence and Interest Diffusion Network for Social Recommendation},
  author={Wu, Le and Li, Junwei and Sun, Peijie and Ge, Yong and Wang, Meng},
  journal={arXiv preprint arXiv:2002.00844},
  year={2020}
 }
 
 We utilized the key technique in following paper to tackle the graph oversmoothing issue, and we have annotated
 the change in line 114 in diffnet/diffnet.py, if you want to konw more details, please refer to:
 @inproceedings{
 title={Revisiting Graph based Collaborative Filtering: A Linear Residual Graph Convolutional Network Approach},
 author={Lei Chen, Le Wu, Richang Hong, Kun Zhang, Meng Wang},
 conference={The 34th AAAI Conference on Artificial Intelligence (AAAI 2020)},
 year={2020}
 }

Author contact:

Email: [email protected], [email protected]

diffnet's People

Contributors

dependabot[bot] avatar lijunweiyhn avatar peijiesun 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  avatar  avatar  avatar

diffnet's Issues

about effect of validation dataset

In the training phase, why should you calculate the loss on the verification set and the test set in each epoch? Isn't gradient descent performed only on the training set?

Understanding of num_evaluate?

Hi, I feel confused about the num_evaluate in config file. Does this parameter controls how many samples are used during evaluate process, no matter how many examples in the dataset file yelp.test.rating?

Another question: It seems that the code can not fully use the power of GPU when the dataset is really large. In my case, I found the GPU utilization is 0 during some time in training although the GPU memory is full. And the code can only use 1 CPU core, which is also a pity.

关于注意力分数的计算

您好!我对在使用社交网络和兴趣网络更新用户表示过程中,注意力分数的计算有些疑问。
首先,
1662013313836
1662013390247
1662013597406
从以上代码可以看出 gama^(k+1)(a1) =1/2* self.consumed_items_attention,gama^(k+1)(a2) =1/2* self.social_neighbors_attention。gama^(k+1)(a1)和gama^(k+1)(a2)也确实是利用了使用到MLP的GAT实现的。

我看到您论文中提及,
1662013776145
1662013813772
1662013823848
说alpha^(k+1)(ab)和beta^(k+1)(ai)的计算过程也是和gama的计算过程类似,使用MLP借助两个embedding得到。但是,我去看了源码中beta^(k+1)_(ai)的计算过程,我发现,beta与gama的计算过程存在差别,感觉并没有借助两个embedding,倒像是随机产生的。
1662014004306

期待您的回复!

AttributeError: 'ParserConf' object has no attribute 'data_name'

D:\Download\Anaconda\envs\Diffnet\python.exe F:/diffnet-master/entry.py
F:\diffnet-master\conf/None_None.ini
Traceback (most recent call last):
File "F:/diffnet-master/entry.py", line 51, in
executeTrainModel(config_path, model_name)
File "F:/diffnet-master/entry.py", line 21, in executeTrainModel
conf.parserConf()
File "F:\diffnet-master\class\ParserConf.py", line 50, in parserConf
self.data_dir = os.path.join(os.getcwd(), 'data/%s' % self.data_name)
AttributeError: 'ParserConf' object has no attribute 'data_name'

---- something wrong occur, I do not kanow how to solve it . hope for help !

请问user feature和item feature是必须的吗?

作者您好!

我想将diffnet用在一些不带user feature和item feature的数据集上。我将每个用户和物品的feature都改为长度很短的零向量(例如[0,0,0,0,0])。按照论文里的公式,这样改动后user feature和item feature都不会起作用,而社交信息依然能起作用。但我做了这样以后会导致训练时train loss、val loss、test loss均为nan,模型无法正常训练。

请问我这样来去掉额外的feature信息是否可行?您是否试过把diffnet修改后用在不带user feature、item feature的数据集上? 谢谢!

About the diffnet on gcn layer is zero.

Hi, I set diffnet with different K gcn layers. While for k =0, it means the self.final_user_embedding = self.fusion_user_embedding + user_embedding_from_consumed_items, and fixed other components. For yelp, during 300 epochs, I get the best performance: HR=0.2630, NDCG=0.1415. It looks terrible.

About the model performance of diffnetplus

Hi, I run the diffnetplus code on yelp data, get HR=0.3676,NDCG=0.2274, which is consistent with the performance in paper.
When I remove the user and item features byself.fusion_user_embedding = self.user_embedding, self.fusion_item_embedding = self.item_embedding. get HR=0.3104, NDCG=0.1877, which is lower than Diffnet++-nf in paper. Are there any adjusted parameters when remove feature?

社交扩散过程

您好!对于社交扩散过程不是很理解,
first_gcn_user_embedding=self.generateUserEmbeddingFromSocialNeighbors(self.fusion_user_embedding)
second_gcn_user_embedding=self.generateUserEmbeddingFromSocialNeighbors(first_gcn_user_embedding)
代码中这应该是两层所表示的扩散过程,但是不是可以这样理解每次都是前一层的输出乘以 社交关系矩阵呢,这样不弱化了社交关系影响了吗?

测试集中的负样本的生成方式似乎有bug

作者您好!

在DataModule.py的generateEvaNegative函数里,对于某个用户,测试集里针对他随机生成的负样本应该同时避开他训练集和测试集里的正样本。但generateEvaNegative函数里的hash_data仅能指示当前样本是否为测试集里的正样本。这会导致训练集里的正样本有可能被采样成了测试集里的负样本。模型的实际性能会因此被低估。请问这个地方是不是有点bug?

Some implementation problems

Thanks for providing the source code for your work diffnet and diffnet++.

Since I am a pytorch user, I want to reimplement your works with pytorch and more recent python version, so that more researchers can compare their works with yours. However, I was confused by some of your implementation details:

  1. In DataModule.py, you use generateConsumedItemsSparseMatrix() to get the user-item graph. As I understand, you make the train/valid/test data correspond to a data file and get the user-item graph described by this file, which cause severe problem: during testing, your model are avaliable with all true test data, which means that your model answer some questions it has the ground truth. Your training process also has the same data leakeage problem.
  2. In your paper 'A Neural Influence Diffusion Model for Social Recommendation' eq-4, you said you use a regularization parameter to control the complexity of user and item free embedding matrices. But in your code diffnet.py, you seems only compute the MSE loss between the ground truth and your predictions.

Pretraining details

Hi Peijie, thank you for open sourcing the models. I am trying to re-implement diffnet in pytorch and it would be a great help if you could let me know the details of model pretraining. Specifically, how was the model by the name "diffnet_hr_0.3437_ndcg_0.2092_epoch_98.ckpt" trained? Thanks in advance.

Tensorflow 2

Why don't you use TensorFlow 2 for this code ? And have you been able to convert this code in tf2

Consultation on the dataset preprocessing part

I wonder that how the datasets item_vector.npy (dimension (38342, 150)) and user_vector.npy (dimension is (17237, 150)) are obtained. Looking forward to your reply, I will be very grateful.

about pretain

你好,请问我执行您readme中的代码提示找不到
image
但是我已经下载了link中的pretain并解压,里面只有三个文件,都是上面那串字符再加后缀的,没有单独的这个文件
TIM截图20200324205715
不知这是什么问题呢?非常感谢

Quick question about the Inconsistent between Diffnet code and paper

In your great original paper Sec 3.2 you use a sigmoid-based BPR loss (i.e., Eq(13)) to train the model. And in Eq(13) you use (r_ai-r_aj). But in your implement code diffnet.py line-127 you use self.opt_loss = tf.nn.l2_loss(self.labels_input - self.prediction) to generate the loss. It means you use the MSE-loss which is greatly different from BPR loss. I wonder to know which one is the correct version?

How do you set the parameter for SVD++?

Hi, when I run SVD++ on yelp, self.final_user_embedding = self.user_embedding + user_embedding_from_consumed_items, while during 300 epochs, the best performance just achieve hr: 0.1282, ndcg:0.0770,

模型的执行顺序?

您好!
请问项目执行的顺序是什么样的呢?运行entry.py总是提示NameError: name 'diffnet' is not defined

About Yelp Dataset

Hello! Can you provide the code for processing the Yelp dataset? I want to know the relationship between the id in the data set you provided and the original data set.
I really appreciate your help

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.