Giter Site home page Giter Site logo

Comments (1)

tommasocarraro avatar tommasocarraro commented on July 17, 2024

The implementation is proper.
Consider that Rendle implementation uses one-hot vectors, so when you compute the sum you are mentioning, just one user will be at 1, and just one item will be at 1.
In this implementation, you are not using one-hot vectors. Instead, you are using indexes. That 0 in your example is the same as the one-hot vector for the first item, which should be [1,0,0, ..., 0]. So, the implementation is correct as it's summing the feature of user 1 with the feature for item 0. This is the same as multiplying the corresponding one-hot vectors with the feature vector w in Rendle implementation.

A more interesting question could be: "How does this implementation work with continuous features and multi-hot vectors?".
Everything in this implementation is used as an index, assuming each variable is encoded as a one-hot vector. However, the original implementation can work with any possible type of feature vector in input.

In particular, I am interested in the multi-hot question. I read the implementation, which assumes the dataset comes as user-item indexes followed by the ground truth. However, if I want to add movie genres as multi-hot features, how can I do that with this implementation? If we assume each movie has just one genre, it is straightforward since it is enough to add a column after the item index column. If, instead, we have multiple genres for each movie, how is it possible to model that with the current implementation?

To reformulate better, an example in the dataset could be encoded as follows, following the syntax of Rendle:
[1 0 0 0 0 0 0][0 0 1 0 0 0 0 0 0 0 0 0 0 0][1 0 1 0 0 0 1 0 0 1][4]
The meaning of the vectors is the following: user | item | item genres/categories | rating

Clearly, the item genres are encoded as multi-hot vectors.

I want to model this data with factorization machines using the implementation provided in this repository.

Thank you very much for your time and effort in realizing such a suitable repository.

from pytorch-fm.

Related Issues (20)

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.