Giter Site home page Giter Site logo

duxy-me / convncf Goto Github PK

View Code? Open in Web Editor NEW
137.0 7.0 44.0 66.15 MB

Experimental codes for paper "Outer Product-based Neural Collaborative Filtering".

Home Page: https://github.com/duxy-me/ConvNCF

Python 100.00%
convolutional-neural-networks neural-collaborative-filtering recommendation

convncf's Introduction

Outer Product-based Neural Collaborative Filtering

Convolutional Neural Collaborative Filtering performs well based on outer product of user and item embeddings. This is our official implementation for the paper:

Xiangnan He, Xiaoyu Du, Xiang Wang, Feng Tian, Jinhui Tang, Tat-Seng Chua, Outer Product-based Neural Collaborative Filtering, In Proceedings of IJCAI'18.

If you use the codes, please cite our paper . Thanks!

Requirements

  • Tensorflow 1.7
  • numpy, scipy

Quick Start

figure.png

  1. decompress the data files.

    cd Data
    gunzip *
    
  2. Pretrain the embeddings using MF_BPR with

    python MF_BPR.py
    
  3. Train ConvNCF with pretrained embeddings

    python ConvNCF.py --pretrain=1
    

Dataset

We provide the compressed dataset Yelp(yelp) in Data/

train.rating:

Train file.

Each Line is a training instance:

userID\t itemID\t rating\t timestamp (if have)

test.rating:

Test file (positive instances). Each Line is a testing instance:

userID\t itemID\t rating\t timestamp (if have)

test.negative

Test file (negative instances). Each line corresponds to the line of test.rating, containing 999 negative samples. Each line is in the format:

(userID,itemID)\t negativeItemID1\t negativeItemID2 ...

Files

  • Data. Training and testing data.
    • yelp.train.rating. Rating of training data.
    • yelp.test.rating. Rating of testing data.
    • yelp.test.negative. 1000 testing samples for each user. (0,32) means this row is for user 0 and the positive test item is 32.
  • Dataset.py. Module preprocessing data.
  • saver.py. Module saving parameters.
  • MF_BPR.py. MF model with BPR loss.
  • ConvNCF.py. Our model.

convncf's People

Contributors

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

convncf's Issues

The code cannot be executed

Hey! Thanks for sharing the code.

The code cannot be executed in my environment. And here are my configuration:
Windows 10, Anaconda, Python 3.5+Tensorflow 1.8

I have changed the ' print "" -> print() ' since the code seems to be written in python 2.x. After that, the code still cannot be executed, the errors are as follows:

1.NULL appears in the fifth line of saver.py. What does this mean?
2. When I run python MF_BPR.py, there is a bug.

Traceback (most recent call last):
  File "D:\Anaconda\lib\multiprocessing\pool.py", line 119, in worker
    result = (True, func(*args, **kwds))
  File "D:\Anaconda\lib\multiprocessing\pool.py", line 44, in mapstar
    return list(map(*args))
  File "E:\BaiduNetdiskDownload\ConvNCF-master\ConvNCF-master\MF_BPR.py", line 355, in _evaluate_input
    item_input = dataset.testNegatives[user] # read negative samples from files
NameError: name 'dataset' is not defined
  1. Training ConvNCF with python ConvNCF.py --pretrain=0 also failed, the Traceback is
Traceback (most recent call last):
  File "ConvNCF.py", line 580, in <module>
    training(model, dataset, args)
  File "ConvNCF.py", line 319, in training
    eval_feed_dicts = init_eval_model(model, dataset)
  File "ConvNCF.py", line 444, in init_eval_model
    feed_dicts = pool.map(_evaluate_input, range(_dataset.num_users))
  File "D:\Anaconda\envs\tensorflow\lib\multiprocessing\pool.py", line 260, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()
  File "D:\Anaconda\envs\tensorflow\lib\multiprocessing\pool.py", line 608, in get
    raise self._value
AttributeError: 'NoneType' object has no attribute 'testNegatives'

How can I fix it? Looking forward to your suggestion.

Dataset

Please upload the script to process the dataset.

运行 python MF_BPR.py

Epoch 0 [2.2s + 10.6s]: HR = 0.1706, NDCG = 0.0905 AUC = 0.7705 train_AUC = 0.0000 [46.4s] ACC = 0.5003 train_loss = 0.0000 ACC = 0.0000 [0.0s]
Epoch 50 [2.4s + 10.2s]: HR = 0.2545, NDCG = 0.1337 AUC = 0.9258 train_AUC = 0.0000 [32.8s] ACC = 0.9674 train_loss = 0.0000 ACC = 0.0000 [0.0s]
Epoch 100 [2.4s + 10.1s]: HR = 0.2651, NDCG = 0.1379 AUC = 0.9295 train_AUC = 0.0000 [41.5s] ACC = 0.9730 train_loss = 0.0000 ACC = 0.0000 [0.0s]
Epoch 150 [2.4s + 9.8s]: HR = 0.2695, NDCG = 0.1390 AUC = 0.9305 train_AUC = 0.0000 [41.5s] ACC = 0.9759 train_loss = 0.0000 ACC = 0.0000 [0.0s]
Epoch 200 [2.4s + 9.9s]: HR = 0.2795, NDCG = 0.1474 AUC = 0.9318 train_AUC = 0.0000 [42.0s] ACC = 0.9777 train_loss = 0.0000 ACC = 0.0000 [0.0s]
Epoch 250 [1.6s + 3.5s]: HR = 0.2801, NDCG = 0.1464 AUC = 0.9323 train_AUC = 0.0000 [18.6s] ACC = 0.9792 train_loss = 0.0000 ACC = 0.0000 [0.0s]
Epoch 300 [1.7s + 3.5s]: HR = 0.2822, NDCG = 0.1485 AUC = 0.9330 train_AUC = 0.0000 [17.8s] ACC = 0.9798 train_loss = 0.0000 ACC = 0.0000 [0.0s]
Epoch 350 [1.6s + 3.5s]: HR = 0.2875, NDCG = 0.1516 AUC = 0.9334 train_AUC = 0.0000 [18.3s] ACC = 0.9806 train_loss = 0.0000 ACC = 0.0000 [0.0s]
Epoch 400 [1.7s + 3.5s]: HR = 0.2840, NDCG = 0.1491 AUC = 0.9336 train_AUC = 0.0000 [18.6s] ACC = 0.9807 train_loss = 0.0000 ACC = 0.0000 [0.0s]
Epoch 450 [1.6s + 3.5s]: HR = 0.2841, NDCG = 0.1490 AUC = 0.9335 train_AUC = 0.0000 [17.7s] ACC = 0.9815 train_loss = 0.0000 ACC = 0.0000 [0.0s]
Epoch 499 [1.6s + 3.5s]: HR = 0.2860, NDCG = 0.1490 AUC = 0.9337 train_AUC = 0.0000 [18.4s] ACC = 0.9820 train_loss = 0.0000 ACC = 0.0000 [0.0s]
best:Epoch 350 [1.6s + 3.5s]: HR = 0.2875, NDCG = 0.1516 AUC = 0.9334 train_AUC = 0.0000 [18.3s] ACC = 0.9806 train_loss = 0.0000 ACC = 0.0000 [0.0s]

为什么interaction map可以解释为图像呢?

图像的局部是有相似/相同的语义的,所以用CNN来提取特征是有意义的。但interaction map只是两个embedding的外积,对interaction map来说,有这样的局部意义吗?请问你是怎么思考这一点的呢?谢谢!

conv-ncf

问下 为什么 optimizer 里设两个梯度?

the running time

hi,i hava a question that how much time do you spend running the ConvNCF.py,and your CPU and GPU?

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.