ToR[e]cSys is a PyTorch Framework to implement recommendation system algorithms

Overview

ToR[e]cSys


News

It is happy to know the new package of Tensorflow Recommenders.


ToR[e]cSys is a PyTorch Framework to implement recommendation system algorithms, including but not limited to click-through-rate (CTR) prediction, learning-to-ranking (LTR), and Matrix/Tensor Embedding. The project objective is to develop a ecosystem to experiment, share, reproduce, and deploy in real world in a smooth and easy way (Hope it can be done).

Installation

TBU

Documentation

The complete documentation for ToR[e]cSys is available via ReadTheDocs website.
Thank you for ReadTheDocs! You are the best!

Implemented Models

1. Subsampling

Model Name Research Paper Year
Word2Vec Omer Levy et al, 2015. Improving Distributional Similarity with Lessons Learned from Word Embeddings 2015

2. Negative Sampling

Model Name Research Paper Year
TBU

3. Click through Rate (CTR) Model

Model Name Research Paper Year
Logistic Regression / /
Factorization Machine Steffen Rendle, 2010. Factorization Machine 2010
Factorization Machine Support Neural Network Weinan Zhang et al, 2016. Deep Learning over Multi-field Categorical Data: A Case Study on User Response Prediction 2016
Field-Aware Factorization Machine Yuchin Juan et al, 2016. Field-aware Factorization Machines for CTR Prediction 2016
Product Neural Network Yanru QU et al, 2016. Product-based Neural Networks for User Response Prediction 2016
Attentional Factorization Machine Jun Xiao et al, 2017. Attentional Factorization Machines: Learning the Weight of Feature Interactions via Attention Networks 2017
Deep and Cross Network Ruoxi Wang et al, 2017. Deep & Cross Network for Ad Click Predictions 2017
Deep Factorization Machine Huifeng Guo et al, 2017. DeepFM: A Factorization-Machine based Neural Network for CTR Prediction 2017
Neural Collaborative Filtering Xiangnan He et al, 2017. Neural Collaborative Filtering 2017
Neural Factorization Machine Xiangnan He et al, 2017. Neural Factorization Machines for Sparse Predictive Analytics 2017
eXtreme Deep Factorization Machine Jianxun Lian et al, 2018. xDeepFM: Combining Explicit and Implicit Feature Interactions for Recommender Systems 2018
Deep Field-Aware Factorization Machine Junlin Zhang et al, 2019. FAT-DeepFFM: Field Attentive Deep Field-aware Factorization Machine 2019
Deep Matching Correlation Prediction Wentao Ouyang et al, 2019. Representation Learning-Assisted Click-Through Rate Prediction 2019
Deep Session Interest Network Yufei Feng et al, 2019. Deep Session Interest Network for Click-Through Rate Prediction 2019
Elaborated Entire Space Supervised Multi Task Model Hong Wen et al, 2019. Conversion Rate Prediction via Post-Click Behaviour Modeling 2019
Entire Space Multi Task Model Xiao Ma et al, 2019. Entire Space Multi-Task Model: An Effective Approach for Estimating Post-Click Conversion Rate 2019
Field Attentive Deep Field Aware Factorization Machine Junlin Zhang et al, 2019. FAT-DeepFFM: Field Attentive Deep Field-aware Factorization Machine 2019
Position-bias aware learning framework Huifeng Guo et al, 2019. PAL: a position-bias aware learning framework for CTR prediction in live recommender systems 2019

4. Embedding Model

Model Name Research Paper Year
Matrix Factorization / /
Starspace Ledell Wu et al, 2017 StarSpace: Embed All The Things! 2017

5. Learning-to-Rank (LTR) Model

Model Name Research Paper Year
Personalized Re-ranking Model Changhua Pei et al, 2019. Personalized Re-ranking for Recommendation 2019

Getting Started

There are several ways using ToR[e]cSys to develop a Recommendation System. Before talking about them, we first need to discuss about components of ToR[e]cSys.

A model in ToR[e]cSys is constructed by two parts mainly: inputs and model, and they will be wrapped into a sequential module (torecsys.models.sequential) to be trained by Trainer (torecsys.trainer.Trainer). \

For inputs module (torecsys.inputs), it will handle most kinds of inputs in recommendation system, like categorical features, images, etc, with several kinds of methods, including token embedding, pre-trained image models, etc.

For models module (torecsys.models), it will implement some famous models in recommendation system, like Factorization Machine family. I hope I can make the library rich. To construct a model in the module, in addition to the modules implemented in PyTorch, I will also implement some layers in torecsys.layers which are called by models usually.

After the explanation of ToR[e]cSys, let's move on to the Getting Started. We can use ToR[e]cSys in the following ways:

  1. Run by command-line (In development)

    
    

torecsys build --inputs_config='{}'
--model_config='{"method":"FM", "embed_size": 8, "num_fields": 2}'
--regularizer_config='{"weight_decay": 0.1}'
--criterion_config='{"method": "MSELoss"}'
--optimizer_config='{"method": "SGD", "lr": "0.01"}'
... ```

  1. Run by class method

    
    

import torecsys as trs

build trainer by class method

trainer = trs.trainer.Trainer()
.bind_objective("CTR")
.set_inputs()
.set_model(method="FM", embed_size=8, num_fields=2)
.set_sequential()
.set_regularizer(weight_decay=0.1)
.build_criterion(method="MSELoss")
.build_optimizer(method="SGD", lr="0.01")
.build_loader(name="train", ...)
.build_loader(name="eval", ...)
.set_target_fields("labels")
.set_max_num_epochs(10)
.use_cuda()

start to fit the model

trainer.fit() ```

  1. Run like PyTorch Module

    
    

import torch import torch.nn as nn import torecsys as trs

some codes here

inputs = trs.inputs.InputsWrapper(schema=schema) model = trs.models.FactorizationMachineModel(embed_size=8, num_fields=2)

for i in range(epochs): optimizer.zero_grad() outputs = model(**inputs(batches)) loss = criterion(outputs, labels) loss.backward() optimizer.step() ```

(In development) You can anyone you like to train a Recommender System and serve it in the following ways:

  1. Run by command-line

    > torecsys serve --load_from='{}'
  2. Run by class method

    
    

import torecsys as trs

serving = trs.serving.Model()
.load_from(filepath=filepath) .run() ```

  1. Serve it yourself

    
    

from flask import Flask, request import torecsys as trs

model = trs.serving.Model()
.load_from(filepath=filepath)

@app.route("/predict") def predict(): args = request.json inference = model.predict(args) return inference, 200

if name == "main": app.run() ```

For further details, please refer to the example in repository or read the documentation. Hope you enjoy~

Examples

TBU

Sample Codes

TBU

Sample of Experiments

TBU

Authors

License

ToR[e]cSys is MIT-style licensed, as found in the LICENSE file.

Group-Buying Recommendation for Social E-Commerce

Group-Buying Recommendation for Social E-Commerce This is the official implementation of the paper Group-Buying Recommendation for Social E-Commerce (

Jun Zhang 37 Nov 28, 2022
Respiratory Health Recommendation System

Respiratory-Health-Recommendation-System Respiratory Health Recommendation System based on Air Quality Index Forecasts This project aims to provide pr

Abhishek Gawabde 1 Jan 29, 2022
Movie Recommender System

Movie-Recommender-System Movie-Recommender-System is a web application using which a user can select his/her watched movie from list and system will r

1 Jul 14, 2022
Recommendation Systems for IBM Watson Studio platform

Recommendation-Systems-for-IBM-Watson-Studio-platform Project Overview In this project, I analyze the interactions that users have with articles on th

Milad Sadat-Mohammadi 1 Jan 21, 2022
Incorporating User Micro-behaviors and Item Knowledge 59 60 3 into Multi-task Learning for Session-based Recommendation

MKM-SR Incorporating User Micro-behaviors and Item Knowledge into Multi-task Learning for Session-based Recommendation Paper data and code This is the

ciecus 38 Dec 05, 2022
A framework for large scale recommendation algorithms.

A framework for large scale recommendation algorithms.

Alibaba Group - PAI 880 Jan 03, 2023
大规模推荐算法库,包含推荐系统经典及最新算法LR、Wide&Deep、DSSM、TDM、MIND、Word2Vec、DeepWalk、SSR、GRU4Rec、Youtube_dnn、NCF、GNN、FM、FFM、DeepFM、DCN、DIN、DIEN、DLRM、MMOE、PLE、ESMM、MAML、xDeepFM、DeepFEFM、NFM、AFM、RALM、Deep Crossing、PNN、BST、AutoInt、FGCNN、FLEN、ListWise等

(中文文档|简体中文|English) 什么是推荐系统? 推荐系统是在互联网信息爆炸式增长的时代背景下,帮助用户高效获得感兴趣信息的关键; 推荐系统也是帮助产品最大限度吸引用户、留存用户、增加用户粘性、提高用户转化率的银弹。 有无数优秀的产品依靠用户可感知的推荐系统建立了良好的口碑,也有无数的公司依

3.6k Dec 30, 2022
Price-aware Recommendation with Graph Convolutional Networks,

PUP This is the official implementation of our ICDE'20 paper: Yu Zheng, Chen Gao, Xiangnan He, Yong Li, Depeng Jin, Price-aware Recommendation with Gr

S4rawBer2y 3 Oct 30, 2022
[ICDMW 2020] Code and dataset for "DGTN: Dual-channel Graph Transition Network for Session-based Recommendation"

DGTN: Dual-channel Graph Transition Network for Session-based Recommendation This repository contains PyTorch Implementation of ICDMW 2020 (NeuRec @ I

Yujia 25 Nov 17, 2022
RetaGNN: Relational Temporal Attentive Graph Neural Networks for Holistic Sequential Recommendation

RetaGNN: Relational Temporal Attentive Graph Neural Networks for Holistic Sequential Recommendation Pytorch based implemention of Relational Temporal

28 Dec 28, 2022
Code for KHGT model, AAAI2021

KHGT Code for KHGT accepted by AAAI2021 Please unzip the data files in Datasets/ first. To run KHGT on Yelp data, use python labcode_yelp.py For Movi

32 Nov 29, 2022
A Library for Field-aware Factorization Machines

Table of Contents ================= - What is LIBFFM - Overfitting and Early Stopping - Installation - Data Format - Command Line Usage - Examples -

1.6k Dec 05, 2022
Graph Neural Network based Social Recommendation Model. SIGIR2019.

Basic Information: This code is released for the papers: Le Wu, Peijie Sun, Yanjie Fu, Richang Hong, Xiting Wang and Meng Wang. A Neural Influence Dif

PeijieSun 144 Dec 29, 2022
Beyond Clicks: Modeling Multi-Relational Item Graph for Session-Based Target Behavior Prediction

MGNN-SPred This is our Tensorflow implementation for the paper: WenWang,Wei Zhang, Shukai Liu, Qi Liu, Bo Zhang, Leyu Lin, and Hongyuan Zha. 2020. Bey

Wen Wang 18 Jan 02, 2023
Reinforcement Knowledge Graph Reasoning for Explainable Recommendation

Reinforcement Knowledge Graph Reasoning for Explainable Recommendation This repository contains the source code of the SIGIR 2019 paper "Reinforcement

Yikun Xian 197 Dec 28, 2022
Mutual Fund Recommender System. Tailor for fund transactions.

Explainable Mutual Fund Recommendation Data Please see 'DATA_DESCRIPTION.md' for mode detail. Recommender System Methods Baseline Collabarative Fiilte

JHJu 2 May 19, 2022
Pytorch domain library for recommendation systems

TorchRec (Experimental Release) TorchRec is a PyTorch domain library built to provide common sparsity & parallelism primitives needed for large-scale

Meta Research 1.3k Jan 05, 2023
Code for my ORSUM, ACM RecSys 2020, HeroGRAPH: A Heterogeneous Graph Framework for Multi-Target Cross-Domain Recommendation

HeroGRAPH Code for my ORSUM @ RecSys 2020, HeroGRAPH: A Heterogeneous Graph Framework for Multi-Target Cross-Domain Recommendation Paper, workshop pro

Qiang Cui 9 Sep 14, 2022
Implementation of a hadoop based movie recommendation system

Implementation-of-a-hadoop-based-movie-recommendation-system 通过编写代码,设计一个基于Hadoop的电影推荐系统,通过此推荐系统的编写,掌握在Hadoop平台上的文件操作,数据处理的技能。windows 10 hadoop 2.8.3 p

汝聪(Ricardo) 5 Oct 02, 2022
fastFM: A Library for Factorization Machines

Citing fastFM The library fastFM is an academic project. The time and resources spent developing fastFM are therefore justified by the number of citat

1k Dec 24, 2022