GithubHelp home page GithubHelp logo

attentive-group-recommendation's Introduction

Attentive Group Recommendation

This is our implementation for the paper:

Da Cao, Xiangnan He, Lianhai Miao, Yahui An, Chao Yang, and Richang Hong. 2018. Attentive Group Recommendation. In The 41st International ACM SIGIR Conference on Research & Development in Information Retrieval (SIGIR '18). ACM, New York, NY, USA, 645-654.

In order to learn the group interest, we use attention mechanism to learn the aggregation strategy from data in a dynamic way.

Please cite our SIGIR'18 paper if you use our codes. Thanks!

BibTeX:

@inproceedings{Cao2018Attentive,
 author = {Cao, Da and He, Xiangnan and Miao, Lianhai and An, Yahui and Yang, Chao and Hong, Richang},
 title = {Attentive Group Recommendation},
 booktitle = {The 41st International ACM SIGIR Conference on Research \&\#38; Development in Information Retrieval},
 series = {SIGIR '18},
 year = {2018},
 isbn = {978-1-4503-5657-2},
 location = {Ann Arbor, MI, USA},
 pages = {645--654},
 numpages = {10},
 url = {http://doi.acm.org/10.1145/3209978.3209998},
 doi = {10.1145/3209978.3209998},
 acmid = {3209998},
 publisher = {ACM},
 address = {New York, NY, USA},
 keywords = {atention mechanism, cold-start problem, group recommendation, neural collaborative filtering, recommender systems},
}

Environment Settings

We use the framework pytorch.

  • pytorch version: '0.3.0' or '1.x'
  • python version: '3.5'

It's better to use Pytorch 1.x to run the code.

Thanks zanshuxun for providing the newest pytorch version code.

Example to run the codes.

Run AGREE:

python main.py

After training process, the value of HR and NDCG in the test dataset will be printed in command window after each optimization iteration.

Output:

AGREE at embedding size 32, run Iteration:30, NDCG and HR at 5
...
User Iteration 10 [449.8 s]: HR = 0.6216, NDCG = 0.4133, [1.0 s]
Group Iteration 10 [471.9 s]: HR = 0.5910, NDCG = 0.4005, [23.0 s]

Parameter Tuning

we put all the papameters in the config.py

Dataset

We provide one processed dataset: CAMRa2011.

Because we have another paper use the MaFengWo dataset are under reviewing, so we can't release MaFengWo dataset now.

group(user) train.rating:

  • Train file.
  • Each Line is a training instance: groupID(userID)\t itemID\t rating\t timestamp (if have)

test.rating:

  • group(user) Test file (positive instances).
  • Each Line is a testing instance: groupID(userID)\t itemID\t rating\t timestamp (if have)

test.negative

  • group(user) Test file (negative instances).
  • Each line corresponds to the line of test.rating, containing 100 negative samples.
  • Each line is in the format: (groupID(userID),itemID)\t negativeItemID1\t negativeItemID2 ...

attentive-group-recommendation's People

Contributors

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

attentive-group-recommendation's Issues

should I use pytorch 0.3.0 in GPU or CPU version? Or pytorch 1.0.1 can work out?

I seem to have a problem with the code. The error is "TypeError: torch.index_select received an invalid combination of arguments - got (torch.FloatTensor, int, !torch.IntTensor!), but expected (torch.FloatTensor source, int dim, torch.LongTensor index)". I wonder if I get the pytorch version wrong. Now I'm using the pytorch 0.3.0 and python 3.5.4.

您好,在运行代码时遇到了内存溢出的问题。

运行错误如下:
RuntimeError: [enforce fail at ..\c10\core\CPUAllocator.cpp:72] data. DefaultCPUAllocator: not enough memory: you tried to allocate 986880 bytes. Buy new RAM!

----》错误指向这一行 training(agree, dataset.get_group_dataloader(config.batch_size), epoch, config, 'group'),请问这个可以通过减小batch_size来处理吗? 谢谢

problem with install torch=0.3.0

I have a problem with install torch=0.3.0. I try to install by pip and Conda. but I get these errors:

  1. with pip:

pip install torch==0.3.0
Collecting torch==0.3.0
Could not find a version that satisfies the requirement torch==0.3.0 (from versions: 0.1.2, 0.1.2.post1, 0.1.2.post2)
No matching distribution found for torch==0.3.0

  1. with Conda

(C:\Users\ASUS\Anaconda3) C:\Users\ASUS>conda install pytorch=0.3.0 -c pytorch
Fetching package metadata .....
CondaHTTPError: HTTP 000 CONNECTION FAILED for url https://repo.continuum.io/pkgs/main/win-64/repodata.json.bz2
Elapsed: -

An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
ConnectTimeout(MaxRetryError("HTTPSConnectionPool(host='repo.continuum.io', port=443): Max retries exceeded with url: /pkgs/main/win-64/repodata.json.bz2 (Caused by ConnectTimeoutError(<urllib3.connection.VerifiedHTTPSConnection object at 0x0000023DB7E31358>, 'Connection to repo.continuum.io timed out. (connect timeout=9.15)'))",),)

i have receive this issue,can you give me some advice? thanks very much!!

AGREE at embedding size 32, run Iteration:30, NDCG and HR at 5Traceback (most recent call last): File "E:/Attentive-Group-Recommendation-master/main.py", line 101, in training(agree, dataset.get_user_dataloader(config.batch_size), epoch, config, 'user') File "E:/Attentive-Group-Recommendation-master/main.py", line 62, in training print('Iteration %d, loss is [%.4f ]' % (epoch_id, np.mean(losses))) File "D:\anaconda\lib\site-packages\numpy\core\fromnumeric.py", line 3118, in mean out=out, **kwargs) File "D:\anaconda\lib\site-packages\numpy\core_methods.py", line 85, in _mean ret = ret.dtype.type(ret / rcount)AttributeError: 'torch.dtype' object has no attribute 'type'

Why can you achieve such high training speed?

Excuse me, After reading your thesis and code, i have benefited a lot. Again, there are some doubts, I hope you can help answer

1)Is the training speed displayed by REAME.md (shown below) based on CAMRa2011?

AGREE at embedding size 32, run Iteration:30, NDCG and HR at 5
...
User Iteration 10 [449.8 s]: HR = 0.6216, NDCG = 0.4133, [1.0 s]
Group Iteration 10 [471.9 s]: HR = 0.5910, NDCG = 0.4005, [23.0 s]

2)If so, do you run with gpu or cpu? I use your code directly and find that I can't reach this speed.

Looking forward for your response, thank you

KeyError: tensor(259)

In main.py:

def grp_forward(self, group_inputs, item_inputs):
    group_embeds = Variable(torch.Tensor())
    item_embeds_full = self.itemembeds(Variable(torch.LongTensor(item_inputs)))
    for i, j in zip(group_inputs, item_inputs):
        members = self.group_member_dict[i]   ## Showing Error here
        members_embeds = self.userembeds(Variable(torch.LongTensor(members)))

Error:

AGREE at embedding size 32, run Iteration:30, NDCG and HR at 5
E:\Anaconda3\lib\site-packages\torch\nn\functional.py:1006: UserWarning: nn.functional.sigmoid is deprecated. Use torch.sigmoid instead.
warnings.warn("nn.functional.sigmoid is deprecated. Use torch.sigmoid instead.")
Iteration 0, loss is [0.9998 ]
Traceback (most recent call last):
File "C:/Users/Leela Sravani/Desktop/RECO PAPERS/Attentive-Group-Recommendation-master/main.py", line 103, in
training(agree, dataset.get_group_dataloader(config.batch_size), epoch, config, 'group')
File "C:/Users/Leela Sravani/Desktop/RECO PAPERS/Attentive-Group-Recommendation-master/main.py", line 50, in training
pos_prediction = model(user_input, None, pos_item_input)
File "E:\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 477, in call
result = self.forward(*input, **kwargs)
File "C:\Users\Leela Sravani\Desktop\RECO PAPERS\Attentive-Group-Recommendation-master\model\agree.py", line 34, in forward
out = self.grp_forward(group_inputs, item_inputs)
File "C:\Users\Leela Sravani\Desktop\RECO PAPERS\Attentive-Group-Recommendation-master\model\agree.py", line 47, in grp_forward
members = self.group_member_dict[i]
KeyError: tensor(259)

Process finished with exit code 1

Kindly help solving this..

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.