Convert Figma logo to code with AI

shenweichen logoDeepCTR

Easy-to-use,Modular and Extendible package of deep-learning based CTR models .

7,510
2,203
7,510
102

Top Related Projects

3,713

An implementation of a deep learning recommendation model (DLRM)

TensorFlow Recommenders is a library for building recommender system models using TensorFlow.

An industrial deep learning framework for high-dimension sparse data

Quick Overview

DeepCTR is an open-source library for building deep learning-based CTR (Click-Through Rate) prediction models. It provides a collection of popular CTR models implemented in TensorFlow and PyTorch, making it easier for researchers and practitioners to experiment with and deploy state-of-the-art CTR prediction algorithms.

Pros

  • Comprehensive collection of CTR models, including both classic and cutting-edge algorithms
  • Supports both TensorFlow and PyTorch backends, offering flexibility for different deep learning frameworks
  • Well-documented with clear examples and tutorials for easy adoption
  • Actively maintained with regular updates and contributions from the community

Cons

  • Steep learning curve for users unfamiliar with deep learning concepts
  • Limited customization options for some models compared to implementing from scratch
  • Performance may vary depending on the specific use case and dataset
  • Requires significant computational resources for training large-scale models

Code Examples

  1. Creating a DeepFM model:
from deepctr.models import DeepFM
from deepctr.feature_column import SparseFeat, DenseFeat, get_feature_names

# Define feature columns
sparse_features = ['category', 'ad_type']
dense_features = ['age', 'ctr_history']

feature_columns = [SparseFeat(feat, vocabulary_size=1000, embedding_dim=4)
                   for feat in sparse_features] + \
                  [DenseFeat(feat, 1) for feat in dense_features]

model = DeepFM(feature_columns, feature_names=get_feature_names(feature_columns))
  1. Compiling and training the model:
model.compile("adam", "binary_crossentropy", metrics=['binary_crossentropy'])
history = model.fit(train_model_input, train_labels,
                    batch_size=256, epochs=10, verbose=2, validation_split=0.2)
  1. Making predictions:
pred_ans = model.predict(test_model_input, batch_size=256)

Getting Started

To get started with DeepCTR, follow these steps:

  1. Install the library:
pip install deepctr
  1. Import the necessary modules:
from deepctr.models import DeepFM
from deepctr.feature_column import SparseFeat, DenseFeat, get_feature_names
  1. Prepare your data and define feature columns:
feature_columns = [SparseFeat('user_id', vocabulary_size=100, embedding_dim=4),
                   SparseFeat('item_id', vocabulary_size=100, embedding_dim=4),
                   DenseFeat('user_age', 1)]
feature_names = get_feature_names(feature_columns)
  1. Create, compile, and train the model:
model = DeepFM(feature_columns, feature_names=feature_names)
model.compile("adam", "binary_crossentropy", metrics=['AUC'])
model.fit(train_model_input, train_labels, batch_size=256, epochs=10, validation_split=0.2)

Competitor Comparisons

3,713

An implementation of a deep learning recommendation model (DLRM)

Pros of DLRM

  • Developed and maintained by Facebook, benefiting from their expertise in large-scale recommendation systems
  • Focuses specifically on deep learning recommendation models, offering specialized features for this domain
  • Includes both PyTorch and Caffe2 implementations, providing flexibility for different frameworks

Cons of DLRM

  • Less comprehensive in terms of model variety compared to DeepCTR
  • May have a steeper learning curve for users not familiar with Facebook's specific approach to recommendation systems
  • Documentation could be more extensive, especially for beginners

Code Comparison

DLRM (PyTorch implementation):

dlrm = DLRM_Net(
    m_spa, ln_emb, ln_bot, ln_top,
    arch_interaction_op="dot",
    arch_interaction_itself=False,
    sigmoid_bot=-1, sigmoid_top=ln_top.size - 2,
    sync_dense_params=True
)

DeepCTR (TensorFlow implementation):

model = DeepFM(linear_feature_columns, dnn_feature_columns, task='binary')
model.compile("adam", "binary_crossentropy", metrics=['binary_crossentropy'], )

Both repositories provide implementations for deep learning recommendation models, but they differ in their approach and focus. DLRM is more specialized for Facebook's recommendation use cases, while DeepCTR offers a wider range of models and may be more accessible for general use cases.

TensorFlow Recommenders is a library for building recommender system models using TensorFlow.

Pros of TensorFlow Recommenders

  • Built on TensorFlow 2.x, offering better integration with the TensorFlow ecosystem
  • Provides end-to-end solutions for building recommendation systems
  • Includes pre-built models and layers specifically designed for recommendation tasks

Cons of TensorFlow Recommenders

  • Less flexible compared to DeepCTR's modular approach
  • Steeper learning curve for users not familiar with TensorFlow
  • Limited support for some advanced CTR prediction models

Code Comparison

DeepCTR:

from deepctr.models import DeepFM
from deepctr.feature_column import SparseFeat, DenseFeat

model = DeepFM(linear_feature_columns, dnn_feature_columns)
model.compile("adam", "binary_crossentropy", metrics=['AUC'])

TensorFlow Recommenders:

import tensorflow_recommenders as tfrs

class MovieLensModel(tfrs.Model):
    def __init__(self):
        super().__init__()
        self.ranking_model = tf.keras.Sequential([...])
        self.task = tfrs.tasks.Ranking(...)

    def call(self, features):
        return self.ranking_model(features)

Both repositories offer powerful tools for building recommendation systems, but they cater to different user needs. DeepCTR provides a more flexible and modular approach, allowing users to easily implement various CTR prediction models. TensorFlow Recommenders, on the other hand, offers a more integrated solution within the TensorFlow ecosystem, with pre-built components specifically designed for recommendation tasks.

An industrial deep learning framework for high-dimension sparse data

Pros of x-deeplearning

  • More comprehensive and enterprise-grade solution for large-scale deep learning
  • Supports distributed training and inference on heterogeneous hardware
  • Offers a wider range of advanced features and optimizations

Cons of x-deeplearning

  • Steeper learning curve due to its complexity and extensive feature set
  • Less focused on specific CTR prediction tasks compared to DeepCTR
  • Requires more computational resources and setup time

Code Comparison

x-deeplearning:

import xdl
model = xdl.Model()
model.add(xdl.layers.Embedding(...)
model.add(xdl.layers.FCLayer(...))
model.compile(optimizer='adam', loss='binary_crossentropy')

DeepCTR:

from deepctr.models import DeepFM
model = DeepFM(linear_feature_columns, dnn_feature_columns)
model.compile(optimizer='adam', loss='binary_crossentropy')

Summary

x-deeplearning is a more comprehensive and powerful deep learning framework suitable for large-scale enterprise applications, while DeepCTR is more focused and easier to use for specific CTR prediction tasks. x-deeplearning offers advanced features and distributed training capabilities but requires more resources and expertise. DeepCTR provides a simpler API and is more accessible for smaller projects or those specifically focused on CTR prediction.

Pros of RecommenderSystems

  • Focuses on graph-based recommendation algorithms, which can capture complex user-item interactions
  • Includes implementations of advanced techniques like Graph Neural Networks (GNNs) for recommendations
  • Provides a broader range of recommendation models beyond just CTR prediction

Cons of RecommenderSystems

  • Less specialized in Click-Through Rate (CTR) prediction compared to DeepCTR
  • May have a steeper learning curve due to its focus on graph-based methods
  • Potentially less optimized for large-scale industrial applications

Code Comparison

DeepCTR example:

from deepctr.models import DeepFM
from deepctr.feature_column import SparseFeat, DenseFeat, get_feature_names

model = DeepFM(linear_feature_columns, dnn_feature_columns)
model.compile("adam", "binary_crossentropy", metrics=['AUC'])

RecommenderSystems example:

from recbole.quick_start import run_recbole

run_recbole(model='GCN', dataset='ml-100k')

The DeepCTR code shows a more explicit model setup, while RecommenderSystems offers a higher-level API for quick experimentation with different recommendation models and datasets.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

DeepCTR

Python Versions TensorFlow Versions Downloads PyPI Version GitHub Issues

Documentation Status CI status codecov Codacy Badge Disscussion License

DeepCTR is a Easy-to-use, Modular and Extendible package of deep-learning based CTR models along with lots of core components layers which can be used to easily build custom models.You can use any complex model with model.fit() ,and model.predict() .

  • Provide tf.keras.Model like interfaces for quick experiment. example
  • Provide tensorflow estimator interface for large scale data and distributed training. example
  • It is compatible with both tf 1.x and tf 2.x.

Some related projects:

Let's Get Started!(Chinese Introduction) and welcome to join us!

Models List

ModelPaper
Convolutional Click Prediction Model[CIKM 2015]A Convolutional Click Prediction Model
Factorization-supported Neural Network[ECIR 2016]Deep Learning over Multi-field Categorical Data: A Case Study on User Response Prediction
Product-based Neural Network[ICDM 2016]Product-based neural networks for user response prediction
Wide & Deep[DLRS 2016]Wide & Deep Learning for Recommender Systems
DeepFM[IJCAI 2017]DeepFM: A Factorization-Machine based Neural Network for CTR Prediction
Piece-wise Linear Model[arxiv 2017]Learning Piece-wise Linear Models from Large Scale Data for Ad Click Prediction
Deep & Cross Network[ADKDD 2017]Deep & Cross Network for Ad Click Predictions
Attentional Factorization Machine[IJCAI 2017]Attentional Factorization Machines: Learning the Weight of Feature Interactions via Attention Networks
Neural Factorization Machine[SIGIR 2017]Neural Factorization Machines for Sparse Predictive Analytics
xDeepFM[KDD 2018]xDeepFM: Combining Explicit and Implicit Feature Interactions for Recommender Systems
Deep Interest Network[KDD 2018]Deep Interest Network for Click-Through Rate Prediction
AutoInt[CIKM 2019]AutoInt: Automatic Feature Interaction Learning via Self-Attentive Neural Networks
Deep Interest Evolution Network[AAAI 2019]Deep Interest Evolution Network for Click-Through Rate Prediction
FwFM[WWW 2018]Field-weighted Factorization Machines for Click-Through Rate Prediction in Display Advertising
ONN[arxiv 2019]Operation-aware Neural Networks for User Response Prediction
FGCNN[WWW 2019]Feature Generation by Convolutional Neural Network for Click-Through Rate Prediction
Deep Session Interest Network[IJCAI 2019]Deep Session Interest Network for Click-Through Rate Prediction
FiBiNET[RecSys 2019]FiBiNET: Combining Feature Importance and Bilinear feature Interaction for Click-Through Rate Prediction
FLEN[arxiv 2019]FLEN: Leveraging Field for Scalable CTR Prediction
BST[DLP-KDD 2019]Behavior sequence transformer for e-commerce recommendation in Alibaba
IFM[IJCAI 2019]An Input-aware Factorization Machine for Sparse Prediction
DCN V2[arxiv 2020]DCN V2: Improved Deep & Cross Network and Practical Lessons for Web-scale Learning to Rank Systems
DIFM[IJCAI 2020]A Dual Input-aware Factorization Machine for CTR Prediction
FEFM and DeepFEFM[arxiv 2020]Field-Embedded Factorization Machines for Click-through rate prediction
SharedBottom[arxiv 2017]An Overview of Multi-Task Learning in Deep Neural Networks
ESMM[SIGIR 2018]Entire Space Multi-Task Model: An Effective Approach for Estimating Post-Click Conversion Rate
MMOE[KDD 2018]Modeling Task Relationships in Multi-task Learning with Multi-gate Mixture-of-Experts
PLE[RecSys 2020]Progressive Layered Extraction (PLE): A Novel Multi-Task Learning (MTL) Model for Personalized Recommendations
EDCN[KDD 2021]Enhancing Explicit and Implicit Feature Interactions via Information Sharing for Parallel Deep CTR Models

Citation

If you find this code useful in your research, please cite it using the following BibTeX:

@misc{shen2017deepctr,
  author = {Weichen Shen},
  title = {DeepCTR: Easy-to-use,Modular and Extendible package of deep-learning based CTR models},
  year = {2017},
  publisher = {GitHub},
  journal = {GitHub Repository},
  howpublished = {\url{https://github.com/shenweichen/deepctr}},
}

DisscussionGroup

公众号:浅梦学习笔记微信:deepctrbot学习小组 加入 主题集合
公众号微信学习小组

Main contributors(welcome to join us!)

​ pic
​ Shen Weichen ​

Alibaba Group

​
pic
Zan Shuxun ​

Alibaba Group

​
​ pic
​ Harshit Pande

Amazon

​
​ pic
​ Lai Mincai

ByteDance

​
​ pic
​ Li Zichao

ByteDance

​
​ pic
Tan Tingyi

Chongqing University
of Posts and
Telecommunications

​