shenweichen/DeepCTR
Easy-to-use,Modular and Extendible package of deep-learning based CTR models .
What is DeepCTR?
DeepCTR is an open‑source Python library that makes it easy to build, train, and evaluate deep‑learning models for click‑through‑rate (CTR) prediction – a core task in online advertising and recommendation systems. It wraps a large collection of state‑of‑the‑art CTR models (e.g., Wide & Deep, DeepFM, xDeepFM, AutoInt, DCN‑V2, etc.) behind a familiar tf.keras.Model‑style API, so you can use the usual model.fit() / model.predict() workflow. For very large datasets it also offers a TensorFlow Estimator interface that works with TFRecord files and distributed training.
Who is it for?
- Data scientists / ML engineers who need to experiment quickly with many CTR architectures without writing each model from scratch.
- Researchers who want a solid, well‑tested implementation of published CTR papers for reproducibility or as baselines.
- Practitioners at e‑commerce, ad‑tech, or recommendation platforms who need a production‑ready, TensorFlow‑compatible library that scales to billions of examples.
Key Features (as described in the README)
| Feature | What it means |
|---|---|
| Easy‑to‑use, Keras‑like interface | Models behave like tf.keras.Model; you can call model.compile(), model.fit(), model.predict() just like any other Keras model. |
| Estimator support | An alternative API for TensorFlow Estimators, enabling TFRecord input pipelines and distributed training on large clusters. |
| Broad model catalogue | Implements dozens of CTR models from the literature (e.g., Wide & Deep, DeepFM, xDeepFM, AutoInt, DCN‑V2, PLE, etc.) with a single import. |
| Modular building blocks | Provides reusable layers (embedding, feature interaction, attention, etc.) so you can assemble custom architectures beyond the built‑in list. |
| TensorFlow version flexibility | Works with both TensorFlow 1.15 and TensorFlow 2.x, letting you choose the runtime that fits your environment. |
| Installation simplicity | No TensorFlow bundled; you install the TF version you need first, then pip install deepctr. |
| Extensive documentation & CI | Read‑the‑docs site, badge‑driven CI for both TF 1 and TF 2, code coverage, and a discussion channel on GitHub/WeChat. |
How to Get Started (quick steps from the README)
- Install TensorFlow that matches your Python/CPU‑GPU setup.
- Install DeepCTR:
pip install deepctr. - Prepare your data in the format expected by the library (categorical feature indices + dense features).
- Choose a model, e.g.,
from deepctr.models import DeepFM. - Build the model with
model = DeepFM(linear_feature_columns, dnn_feature_columns, ...). - Compile and train:
model.compile(optimizer='adam', loss='binary_crossentropy')thenmodel.fit(train_data, epochs=10). - Predict with
model.predict(test_data).
The README links to a Quick‑Start guide that walks through these four steps in detail, including an example using the Estimator API for TFRecord‑based large‑scale training.
When (and why) to Use DeepCTR
- You need many CTR models: Instead of re‑implementing each paper, import the ready‑made version.
- Rapid prototyping: Swap models by changing a single import line while keeping the rest of your pipeline unchanged.
- Scalable training: Use the Estimator interface for distributed jobs on clusters or cloud services.
- Research reproducibility: The implementations follow the original papers and are tested via CI, making them reliable baselines.
Limitations & Things to Watch Out For
- TensorFlow‑only: The library is built on TensorFlow; if you prefer PyTorch you’d need the separate
DeepCTR‑Torchproject. - CTR‑specific: It focuses on click‑through‑rate / conversion prediction; it isn’t a general‑purpose deep‑learning framework.
- Manual data preprocessing: Users must convert raw logs into the required feature column format; the library does not include end‑to‑end data pipelines.
- Version compatibility: You must ensure your TensorFlow version matches the NumPy/h5py constraints noted in the README.
Who’s Behind It?
The core maintainers are engineers and researchers from Alibaba Group, Amazon, ByteDance, and academia (Chongqing University). The project is open‑source under the MIT license and welcomes contributions via a CONTRIBUTING guide.
Bottom line: DeepCTR is a mature, well‑documented toolbox for anyone building or researching deep CTR models, offering a Keras‑style API, support for large‑scale training, and a comprehensive list of published architectures—all within the TensorFlow ecosystem.
Related
- Project
- Project
- Project
- Project