Git Product home page Git Product logo

kerascollaborativefiltering's Introduction

Keras Collaborative Filtering

My Keras implementation of vanilla Matrix Factorization (MF) and Bayesian Personalized Ranking via Matrix Factorization (BPR-MF).

Introduction

Collaborative filtering based recommender systems assume that a user's preferences over items can be predicted from other users' preferences. Two users that have similar preferences could like or dislike the same set of items. If one user rated (or seen) an item but the other did not, then the recommender system can push the unseen item to the other user.

For real-valued ratings, Matrix Factorization (MF) may be the most popular collaborative filtering implementation. However, if we can access only implicit feedbacks (also named one-class collaborative filtering; that is, we can observe a user ever saw an item, but not understand how the user rated the item), the traditional MF fails to recommend items. BPR framework provides an extension of MF to tackle the one-class collaborative filtering.

Keras is a well-known Python library to build deep neural networks (or multi-layer perceptron), but it could implement other machine learning models optimized by stochastic gradient descent (SGD). I try to build MF and BPR-MF using Keras, in order to call its convenient buiit-in machine learning functions like Adam or early stopping.

Running

python3 matrix_factorization.py [rating_file]
python3 bayesian_personalized_ranking.py [rating_file]

Most of the hyperparameters can be seen in the arguments of class constructor method.

Input File

Three values for each line in [rating_file]:

user_id item_id rating

Output Files

  • [rating_file].user_embedding: factorized matrix about user latent factors (i.e. embeddings).
  • [rating_file].item_embedding: factorized matrix about item latent factors (i.e. embeddings).

Comments

The output embeddings can be used to predict the rating or preference for a user to an item, but I do not implement the prediction functions.

References

[1] Koren, Yehuda, Robert Bell, and Chris Volinsky. "Matrix factorization techniques for recommender systems." Computer 42.8 (2009).

[2] Rendle, Steffen, et al. "BPR: Bayesian personalized ranking from implicit feedback." Proceedings of the twenty-fifth conference on uncertainty in artificial intelligence. AUAI Press, 2009.

kerascollaborativefiltering's People

Contributors

chinchi-hsu avatar

Watchers

James Cloos 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.