GithubHelp home page GithubHelp logo

mgl-test's Introduction

Meta Graph Learning for Long-tail Recommendation

This repository is the re-implementation of MGL.

File Descriptions:

  • ml-1m/transform_ml.py: data preprocessing of movielens-1m dataset
  • bx/transform_bx.py: data preprocessing of bookcrossing dataset
  • dataset/bx: preprocessed bookcrossing data
  • dataset/ml: preprocessed movielens-1m data
  • data_process2.py: another preprocessing, mainly for creating train, val, and test sets
  • load_data2.py: data loader and feature processing
  • metric.py: for calculating metrics
  • model2.py: for embeddings, prediction and loss
  • train2.py: for training, validating and testing

Experiment Environment

  • ubuntu 18.04
  • GPU L20(48GB) * 1
  • CPU20 vCPU Intel(R) Xeon(R) Platinum 8457C
  • RAM 100GB

Requirements

To install requirements:

python 3.8.19

# this may not work
conda env create -f environment.yaml -n mgl

# CUDA 11.0
conda install pytorch==1.7.0 torchvision==0.8.0 torchaudio==0.7.0 cudatoolkit=11.0 -c pytorch

# CPU Only
conda install pytorch==1.7.0 torchvision==0.8.0 torchaudio==0.7.0 cpuonly -c pytorch

pip install torch-sparse==0.6.9 torch-scatter==2.0.7 tqdm==4.54.1 pandas==1.4.4 scikit-learn==0.23.2 rectorch==0.0.9b0

Data Process

To prepare the data for the model training:

python data_process2.py

Book crossing:

item_feature.pkl:
  ['item', 'title', 'Book-Author', 'Year-Of-Publication', 'Publisher']

user_feature.pkl:
  ['user', 'location', 'age']

interact_train.pkl:
  ['userid', 'itemid', 'score', 'timestamp'] (timestamp = 0)

Movielens-1M:

item_feature.pkl:
  ['item', 'title', 'genres', 'year']

user_feature.pkl:
   ['user', 'gender', 'age', 'occupation', 'zip-code']

interact_train.pkl:
  ['userid', 'itemid', 'score', 'timestamp']

Training

To train the model(s) in the paper:

python train2.py --dataset bx --epoch 100

or:
python train2.py --dataset bx --epoch 100 --output <model_name> --model <model_name>

To test a model:

python train2.py --dataset bx --epoch 0 --model <model_name>

Output: the file "model/model.tar" or "model/<model_name>"

mgl-test's People

Contributors

shaun1280 avatar shane0821 avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

shane0821

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.