Code Monkey home page Code Monkey logo

mcrec's Introduction

MCRec

Source code for KDD 2018 paper "Leverage Meta-path based Context for Top-N Recommendation with a Neural Co-Attention Model"

Requirements

  • numpy

  • scipy

  • Tensorflow-gpu (1.2.1) or Theano (1.0.1)

  • Keras (2.1.1)

  • My machine with two GPUs (NVIDIA GTX-1080 *2) and two CPUs (Intel Xeon E5-2690 * 2)

Reference

@inproceedings{

author = {Binbin Hu, Chuan Shi, Wayne Xin Zhao and Philip S. Yu.},

title = {Leverage Meta-path based Context for Top-N Recommendation with a Neural Co-Attention Model},

booktitle = {Proceedings of the 24th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining},

year = {2018},

url = {https://dl.acm.org/citation.cfm?id=3219965},

publisher = {ACM},

address = {London, United Kingdom},

keywords = {Recommender System, Heterogeneous Information Network, Deep Learning, Attention Mechanism},

}

More Details

Dataset

We provide one processed dataset : MovieLens 100k (ml-100k). For each user, we treat the latest interaction as the test set and remaining data for training. Besides, we randomly select 50 movies that are not interacted by the user and rank the test movie amongst the 50 movies.

train.rating:

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

test.rating:

  • Test file (positive instances).
  • Each Line is a testing instance: userID rated_itemID_1 rated_itemID_2 rated_itemID_3...

test.negative

  • Test file (negative instances).
  • Each line corresponds to the line of test.rating, containing 50 negative samples.
  • Each line is in the format: (userID,rated_itemID_1,rated_itemID_2,rated_itemID_3,...) negativeItemID1 negativeItemID2 ...

Metapath Construction

The data we utilize is located in HIN Datasets or you can obtain it by executing the dataProcessing.py.

python dataProcessing.py

Run metapath construction :

The metapathbasedPathSampleForMovielens.py constructs different meta-paths for the following model training.

python metapathbasedPathSampleForMovielens.py --walk_num 5 --metapath umtm

Here,

  • uafile : user_age.dat , which extracts from original u.user,

    010 : 1; 11 20 : 2; 2130 : 3; 3140 : 4;4150 : 5; 5160 : 6

  • uofile : user_occupation.dat, which is the relation between u.user and u.occupation

  • mtfile : movie_genre.dat, which the relation between u.user and u.genre

  • uufile : user_user(knn).dat

  • mmfile : movie_movie(knn).dat

Output:

  • the meaningful meta-path samples,which constructs “umtm / ummm / umum / uuum” meta-path samples.
  • the filename's format is "dataset"."metapath"_"walk_length"_"K"

Example to run the codes.

The parameter setting is set on line 476-484 of file MCRec, and the dataset for which is Movielens-100K. Be sure to refer to it while experimenting with different datasets.

Run MCRec:

python MCRec.py --dataset ml-100k --epochs 30 --batch_size 256 --learner adam --lr 0.001 --latent_dim 128 --latent_layer_dim [512, 256, 128, 64] --num_neg 4

Remarkable

  • the pretrain embedding will be useful for the model training and meta-path construction
  • the negative sample is necessary for our model training, which is located in the line 413 of MCRec.py

MCRec

mcrec's People

Contributors

stevenn9981 avatar

Stargazers

 avatar

Watchers

 avatar

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.