All Projects → Praful932 → Tf-Rec

Praful932 / Tf-Rec

Licence: MIT license
Tf-Rec is a python💻 package for building⚒ Recommender Systems. It is built on top of Keras and Tensorflow 2 to utilize GPU Acceleration during training.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Tf-Rec

Rsparse
Fast and accurate machine learning on sparse matrices - matrix factorizations, regression, classification, top-N recommendations.
Stars: ✭ 145 (+705.56%)
Mutual labels:  matrix-factorization, recommender-system, svd
Cornac
A Comparative Framework for Multimodal Recommender Systems
Stars: ✭ 308 (+1611.11%)
Mutual labels:  matrix-factorization, recommendation-system, recommender-system
tf-recsys
tf-recsys contains collaborative filtering (CF) model based on famous SVD and SVD++ algorithm. Both of them are implemented by tensorflow in order to utilize GPU acceleration.
Stars: ✭ 91 (+405.56%)
Mutual labels:  recommender-system, svd, svdplusplus
recommender system with Python
recommender system tutorial with Python
Stars: ✭ 106 (+488.89%)
Mutual labels:  matrix-factorization, recommendation-system, recommender-system
retailbox
🛍️RetailBox - eCommerce Recommender System using Machine Learning
Stars: ✭ 32 (+77.78%)
Mutual labels:  matrix-factorization, recommendation-system, recommender-system
Recsys2019 deeplearning evaluation
This is the repository of our article published in RecSys 2019 "Are We Really Making Much Progress? A Worrying Analysis of Recent Neural Recommendation Approaches" and of several follow-up studies.
Stars: ✭ 780 (+4233.33%)
Mutual labels:  matrix-factorization, recommendation-system, recommender-system
Recommendation-System-Baseline
Some common recommendation system baseline, with description and link.
Stars: ✭ 34 (+88.89%)
Mutual labels:  matrix-factorization, recommendation-system
Implicit
Fast Python Collaborative Filtering for Implicit Feedback Datasets
Stars: ✭ 2,569 (+14172.22%)
Mutual labels:  matrix-factorization, recommender-system
Spotlight
Deep recommender models using PyTorch.
Stars: ✭ 2,623 (+14472.22%)
Mutual labels:  matrix-factorization, recommender-system
Nmflibrary
MATLAB library for non-negative matrix factorization (NMF): Version 1.8.1
Stars: ✭ 153 (+750%)
Mutual labels:  machine-learning-algorithms, matrix-factorization
Carskit
Java-Based Context-aware Recommendation Library
Stars: ✭ 98 (+444.44%)
Mutual labels:  matrix-factorization, recommender-system
online-course-recommendation-system
Built on data from Pluralsight's course API fetched results. Works with model trained with K-means unsupervised clustering algorithm.
Stars: ✭ 31 (+72.22%)
Mutual labels:  machine-learning-algorithms, recommender-system
mildnet
Visual Similarity research at Fynd. Contains code to reproduce 2 of our research papers.
Stars: ✭ 76 (+322.22%)
Mutual labels:  recommendation-system, recommender-system
Cofactor
CoFactor: Regularizing Matrix Factorization with Item Co-occurrence
Stars: ✭ 160 (+788.89%)
Mutual labels:  matrix-factorization, recommender-system
Polara
Recommender system and evaluation framework for top-n recommendations tasks that respects polarity of feedbacks. Fast, flexible and easy to use. Written in python, boosted by scientific python stack.
Stars: ✭ 205 (+1038.89%)
Mutual labels:  matrix-factorization, recommender-system
Rectorch
rectorch is a pytorch-based framework for state-of-the-art top-N recommendation
Stars: ✭ 121 (+572.22%)
Mutual labels:  matrix-factorization, recommender-system
Recommendation.jl
Building recommender systems in Julia
Stars: ✭ 42 (+133.33%)
Mutual labels:  matrix-factorization, recommender-system
GNN-Recommender-Systems
An index of recommendation algorithms that are based on Graph Neural Networks.
Stars: ✭ 505 (+2705.56%)
Mutual labels:  recommendation-system, recommender-system
Expo Mf
Exposure Matrix Factorization: modeling user exposure in recommendation
Stars: ✭ 81 (+350%)
Mutual labels:  matrix-factorization, recommender-system
Flurs
🌊 FluRS: A Python library for streaming recommendation algorithms
Stars: ✭ 97 (+438.89%)
Mutual labels:  matrix-factorization, recommender-system

Tf-rec

Tf-Rec is a python💻 package for building Recommender Systems. It is built on top of Keras and Tensorflow 2 to utilize GPU Acceleration during training.

PyPI version Python contributions welcome
Tests Publish(Package) Deploy(Docs)
Hits GitHub stars GitHub forks GitHub watchers

Contents

Why Tf-Rec? 🧐

There are several open source libraries which implement popular recommender algorithms in, infact this library is inspired by them - Surprise and Funk-SVD. However, there is bottleneck in training time, when the training data is huge. This can be solved by using ready frameworks like Tensorflow 2 & Keras which support running computations on GPU thus delivering speed and higher throughput. Building on top of such frameworks also provide us with off the shelf capabilities such as using different optimizers, Data API, exporting the model to other platforms and much more. Tfrec provides ready implementations of algorithms which can be directly used with few lines of Tensorflow Code. Currently this library supports these algorithms.

Installation

The package is available on PyPi:

pip install tfrec

Quick Start & Documentation 📝

API Docs

SVD Example

from tfrec.models import SVD
from tfrec.datasets import fetch_ml_100k
from tfrec.utils import preprocess_and_split
import numpy as np

data = fetch_ml_100k()
dataset, user_item_encodings = preprocess_and_split(data)

(x_train, y_train), (x_test, y_test) = dataset
(user_to_encoded, encoded_to_user,item_to_encoded, encoded_to_item) = user_item_encodings

num_users = len(np.unique(data['userId']))
num_movies = len(np.unique(data['movieId']))
global_mean = np.mean(data['rating'])

model = SVD(num_users, num_movies, global_mean)
model.compile(loss = 'mean_squared_error', optimizer = 'adam')
model.fit(x_train, y_train)
2521/2521 [==============================] - 11s 4ms/step - loss: 0.9963

SVD++ Example

from tfrec.models import SVDpp

model = SVDpp(num_users, num_movies, global_mean)
# Needs to be called before fitting
model.implicit_feedback(x_train)
model.compile(loss = 'mean_squared_error', optimizer = 'adam')

model.fit(x_train, y_train)
2521/2521 [==============================] - 49s 20ms/step - loss: 1.0332

KFold Cross Validation Example

from tfrec.utils import cross_validate
model = SVD(num_users, num_movies, global_mean)
model.compile(loss = 'mean_squared_error', optimizer = 'adam', metrics=['mae','RootMeanSquaredError'])
all_metrics = cross_validate(model, x_train, y_train)
Mean Loss : 0.899022102355957
Mean Mae : 0.6596329569816589
Mean Root_mean_squared_error : 0.8578477501869202

Supported Algorithms 🎯

Currently the library supports these algorithms:

  • SVD - Despite the Name, it is different from the Eigen Decomposition of Assymmetric Matrices. In a gist, it approximates a vector for each user and each item. The vector contains latent factors which signify for brevity sake, if the item is a movie the movie vector would represent - how much the movie contains action or romance likewise. Similarly for the user. The predicted rating is given by:

  • SVD++ - This is an extension of SVD which incorporates implicit feedback, by also taking into account the interactions between the user and the item by involving another factor. More Precisely, it takes into account the fact that the user has rated an item itself as a preference than an item which the user has not rated. The predicted rating is given by:
    image

Benchmark 🔥

Both of the algorithms were tested on Google Collab using a GPU Runtime. The dataset used was the MovieLens-100k. Default parameters were used for intilization of Model. Optimizer used was Adam and batch size used was 128. These are the 5-Fold Cross Validation Scores:

Algorithm Mean MAE Mean RMSE Time per Epoch
SVD 0.6701 0.8694 < 3 sec
SVD++ 0.6838 0.8862 < 45 sec
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].