Coder Social home page Coder Social logo

transfm's Introduction

TransFM

This repository contains an implementation of TransFM, as described in the paper:

Rajiv Pasricha, Julian McAuley, "Translation-based Factorization Machines for Sequential Recommendation", RecSys 2018.

This repository also includes implementations of vanilla FMs, as well as the proposed PRME-FM and HRM-FM models.

Please cite the paper above if you use or extend our models.

File formats

  • Input dataset

    • One example per line
    • <user_id> <item_id> <rating> <timestamp>
    • Values separated by a space
    • No header row
    • Example row: User_12 Item_65 5.0 1376697600
  • Item categories

    • CSV file, one item per line
    • Expected header: item_id,item_cat_seq
    • item_cat_seq: comma separated list of item category IDs, enclosed as a string.
    • Example row: 2643,"[165, 193, 442]"
  • User features

    • CSV file with numeric features, one user per line
    • Header row expected, first column should be named idx
  • Item features

    • CSV file with numeric features, one item per line
    • Header row expected, first column should be named idx
  • Geographical features

    • CSV file with numeric features, one item per line
    • Header row expected, first column should be named place_id

Example command

python main.py \
      --filename ratings_Automotive.txt.gz
      --model TransFM
      --features categories
      --features_file item_cat_seq_Automotive.csv.gz
      --max_iters 1000000
      --num_dims 10
      --linear_reg 10.0
      --emb_reg 1.0
      --trans_reg 0.1
      --init_mean 0.1
      --starting_lr 0.02
      --lr_decay_factor 1.0
      --lr_decay_freq 1000
      --eval_freq 50
      --quit_delta 1000

transfm's People

Contributors

macfarll avatar rpasricha 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

transfm's Issues

user data

How do you get the csv file with numeric features of users? Thanks for your help.

Possible error in prediction operation

Hi,

I think there could be an error in the factorization machine prediction operations. Possibly also in the translation-based factorization machine prediction operations. Its seems that all the features are summed up already in the sparse_tensor_dense_matmul operation.

The operations for the positive predictions are for example:

pos_emb_mul = tf.sparse_tensor_dense_matmul(sparse_pos_feats, var_factors)
term_1_pos = tf.square(tf.reduce_sum(pos_emb_mul, axis=1, keep_dims=True))
term_2_pos = tf.reduce_sum(tf.square(pos_emb_mul), axis=1, keep_dims=True)
pos_preds = pos_linear + 0.5 * (term_1_pos - term_2_pos)

This would result in the following model:

wrong

Instead of the desired model:

right

The following changed operations might fix the problem:

term_1_pos = tf.sparse_tensor_dense_matmul(sparse_pos_feats, var_factors)
term_1_pos = tf.reduce_sum(tf.square(term_1_pos), axis=1, keep_dims=True)
term_2_pos = tf.sparse_tensor_dense_matmul(tf.square(sparse_pos_feats), tf.square(var_factors))
term_2_pos = tf.reduce_sum(term_2_pos, axis=1, keep_dims=True)
pos_preds = pos_linear + 0.5 * (term_1_pos - term_2_pos)

Am I right here or am I missing something?

Best regards,
Markus

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.