Giter VIP home page Giter VIP logo

nfm-pyorch's Introduction

NFM-pytorch

A pytorch implementation for Neural Factorization Machine (NFM) at SIGIR 2017. The original tensorflow implementation can be found at Xiangnan's repo.

Please download the dataset from here.

Performance Comparison

I run the model for 100 epochs and compare the performance shown in Table 3 of the original paper and keep all the settings identical with the original implementation (i.e., one hiddent layer, relu as the activation function, lr is 0.05 (should be), batch_size is 128 for frappe, 4096 for movielens).

Models Frappe-128 Frappe-256 MovieLens-128 MovieLens-256
NFM-tf 0.313 0.310 0.456 0.444
NFM-pytorch 0.310 0.310 0.456 0.446

The requirements are as follows:

* python==3.6
* numpy==1.16.2
* pytorch==1.0.1
* tensorboardX==1.6 (mainly useful when you want to visulize the loss, see https://github.com/lanpa/tensorboard-pytorch)

Example to Run:

python main.py --batch_size=128 --lr=0.05 --hidden_factor=128

nfm-pyorch's People

Contributors

guoyang9 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

Watchers

 avatar  avatar

nfm-pyorch's Issues

bug report

Traceback (most recent call last):
File "main.py", line 126, in
prediction = model(features, feature_values)
File "C:\Users\qiwang\anaconda3\lib\site-packages\torch\nn\modules\module.py", line 493, in call
result = self.forward(*input, **kwargs)
File "C:\Users\qiwang\Desktop\NFM-pyorch-master\model.py", line 83, in forward
nonzero_embed = self.embeddings(features)
File "C:\Users\qiwang\anaconda3\lib\site-packages\torch\nn\modules\module.py", line 493, in call
result = self.forward(*input, **kwargs)
File "C:\Users\qiwang\anaconda3\lib\site-packages\torch\nn\modules\sparse.py", line 117, in forward
self.norm_type, self.scale_grad_by_freq, self.sparse)
File "C:\Users\qiwang\anaconda3\lib\site-packages\torch\nn\functional.py", line 1506, in embedding
return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse)
RuntimeError: Expected tensor for argument #1 'indices' to have scalar type Long; but got CUDAType instead (while checking arguments for embedding)

when I run your original code, bug raised above, can you fix it?

turn to pair-wise ranking issue

this NFM implementation is really good, how can I turn this rating prediction method to a pair-wise ranking issue just like the BPR-torch repo u did before?
where should I change the code? loss function or other parts?

Thx.

Dataset format

Can u tell me what is the exact meaning of each column in ml-tag.train.libfm file?

A question about the dataset.

Hi, guoyang9.
I am a new learner of deep learning. I want to refer to your research but I have a question about the dataste. The dataset you use in this program is libfm format I think. I find the original dataset is csv format. How do you change it? I do not the concept and method. Could you give me an instruction? Thank you very much!

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.