Skip to content

Commit fc49d2f

Browse files
authored
optimize and refactor codes of multitask models (#402)
- optimize and refactor codes of multitask models - set dnn_hidden_units parameter to (256, 128, 64) for all models - adjust code structure - add docs and examples
1 parent 2491dfb commit fc49d2f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+1029
-635
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Steps to reproduce the behavior:
2020
**Operating environment(运行环境):**
2121
- python version [e.g. 3.6, 3.7]
2222
- tensorflow version [e.g. 1.4.0, 1.15.0, 2.5.0]
23-
- deepctr version [e.g. 0.8.6,]
23+
- deepctr version [e.g. 0.9.0,]
2424

2525
**Additional context**
2626
Add any other context about the problem here.

.github/ISSUE_TEMPLATE/question.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ Add any other context about the problem here.
1717
**Operating environment(运行环境):**
1818
- python version [e.g. 3.6]
1919
- tensorflow version [e.g. 1.4.0, 1.15.0, 2.5.0]
20-
- deepctr version [e.g. 0.8.6,]
20+
- deepctr version [e.g. 0.9.0,]

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ jobs:
2828

2929
steps:
3030

31-
- uses: actions/checkout@v1
31+
- uses: actions/checkout@v2
3232

3333
- name: Setup python environment
34-
uses: actions/setup-python@v1
34+
uses: actions/setup-python@v2.2.2
3535
with:
3636
python-version: ${{ matrix.python-version }}
3737

@@ -49,7 +49,7 @@ jobs:
4949
pip install -q python-coveralls
5050
pytest --cov=deepctr --cov-report=xml
5151
- name: Upload coverage to Codecov
52-
uses: codecov/codecov-action@v1.0.2
52+
uses: codecov/codecov-action@v2.0.3
5353
with:
5454
token: ${{secrets.CODECOV_TOKEN}}
5555
file: ./coverage.xml

README.md

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,23 @@
1818
<!-- [![Gitter](https://badges.gitter.im/DeepCTR/community.svg)](https://gitter.im/DeepCTR/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) -->
1919

2020

21-
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()` .
22-
23-
- Provide `tf.keras.Model` like interface for **quick experiment**. [example](https://deepctr-doc.readthedocs.io/en/latest/Quick-Start.html#getting-started-4-steps-to-deepctr)
24-
- Provide `tensorflow estimator` interface for **large scale data** and **distributed training**. [example](https://deepctr-doc.readthedocs.io/en/latest/Quick-Start.html#getting-started-4-steps-to-deepctr-estimator-with-tfrecord)
21+
DeepCTR is a **Easy-to-use**,**Modular** and **Extendible** package of deep-learning based CTR models along with lots of
22+
core components layers which can be used to easily build custom models.You can use any complex model with `model.fit()`
23+
,and `model.predict()` .
24+
25+
- Provide `tf.keras.Model` like interface for **quick experiment**
26+
. [example](https://deepctr-doc.readthedocs.io/en/latest/Quick-Start.html#getting-started-4-steps-to-deepctr)
27+
- Provide `tensorflow estimator` interface for **large scale data** and **distributed training**
28+
. [example](https://deepctr-doc.readthedocs.io/en/latest/Quick-Start.html#getting-started-4-steps-to-deepctr-estimator-with-tfrecord)
2529
- It is compatible with both `tf 1.x` and `tf 2.x`.
2630

2731
Some related projects:
32+
2833
- DeepMatch: https://github.com/shenweichen/DeepMatch
2934
- DeepCTR-Torch: https://github.com/shenweichen/DeepCTR-Torch
3035

31-
32-
Let's [**Get Started!**](https://deepctr-doc.readthedocs.io/en/latest/Quick-Start.html)([Chinese Introduction](https://zhuanlan.zhihu.com/p/53231955)) and [welcome to join us!](./CONTRIBUTING.md)
36+
Let's [**Get Started!**](https://deepctr-doc.readthedocs.io/en/latest/Quick-Start.html)([Chinese
37+
Introduction](https://zhuanlan.zhihu.com/p/53231955)) and [welcome to join us!](./CONTRIBUTING.md)
3338

3439
## Models List
3540

@@ -59,15 +64,15 @@ Let's [**Get Started!**](https://deepctr-doc.readthedocs.io/en/latest/Quick-Star
5964
| DCN V2 | [arxiv 2020][DCN V2: Improved Deep & Cross Network and Practical Lessons for Web-scale Learning to Rank Systems](https://arxiv.org/abs/2008.13535) |
6065
| DIFM | [IJCAI 2020][A Dual Input-aware Factorization Machine for CTR Prediction](https://www.ijcai.org/Proceedings/2020/0434.pdf) |
6166
| FEFM and DeepFEFM | [arxiv 2020][Field-Embedded Factorization Machines for Click-through rate prediction](https://arxiv.org/abs/2009.09931) |
62-
| Shared-Bottom | [Multitask learning](http://reports-archive.adm.cs.cmu.edu/anon/1997/CMU-CS-97-203.pdf) |
63-
| ESSM | [SIGIR 2018][Entire Space Multi-Task Model: An Effective Approach for Estimating Post-Click Conversion Rate](https://arxiv.org/abs/1804.07931) |
67+
| SharedBottom | [arxiv 2017][An Overview of Multi-Task Learning in Deep Neural Networks](https://arxiv.org/pdf/1706.05098.pdf) |
68+
| ESMM | [SIGIR 2018][Entire Space Multi-Task Model: An Effective Approach for Estimating Post-Click Conversion Rate](https://arxiv.org/abs/1804.07931) |
6469
| MMOE | [KDD 2018][Modeling Task Relationships in Multi-task Learning with Multi-gate Mixture-of-Experts](https://dl.acm.org/doi/abs/10.1145/3219819.3220007) |
65-
| CGC | [RecSys 2020][Progressive Layered Extraction (PLE): A Novel Multi-Task Learning (MTL) Model for Personalized Recommendations](https://dl.acm.org/doi/10.1145/3383313.3412236) |
6670
| PLE | [RecSys 2020][Progressive Layered Extraction (PLE): A Novel Multi-Task Learning (MTL) Model for Personalized Recommendations](https://dl.acm.org/doi/10.1145/3383313.3412236) |
67-
## Citation
6871

69-
- Weichen Shen. (2017). DeepCTR: Easy-to-use,Modular and Extendible package of deep-learning based CTR models. https://github.com/shenweichen/deepctr.
72+
## Citation
7073

74+
- Weichen Shen. (2017). DeepCTR: Easy-to-use,Modular and Extendible package of deep-learning based CTR
75+
models. https://github.com/shenweichen/deepctr.
7176

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

@@ -85,11 +90,10 @@ If you find this code useful in your research, please cite it using the followin
8590
## DisscussionGroup
8691

8792
- [Discussions](https://github.com/shenweichen/DeepCTR/discussions)
88-
- 公众号:**浅梦学习笔记**
89-
- wechat ID: **deepctrbot**
93+
- 公众号:**浅梦学习笔记**
94+
- wechat ID: **deepctrbot**
9095

9196
![wechat](./docs/pics/code.png)
92-
9397

9498
## Main contributors([welcome to join us!](./CONTRIBUTING.md))
9599

@@ -112,6 +116,11 @@ If you find this code useful in your research, please cite it using the followin
112116
​ <a href="https://github.com/pandeconscious">Harshit Pande</a>
113117
<p> Amazon </p>​
114118
</td>
119+
<td>
120+
​ <a href="https://github.com/morningsky"><img width="70" height="70" src="https://github.com/morningsky.png?s=40" alt="pic"></a><br>
121+
​ <a href="https://github.com/morningsky">Lai Mincai</a>
122+
<p> ShanghaiTech University </p>​
123+
</td>
115124
<td>
116125
​ <a href="https://github.com/codewithzichao"><img width="70" height="70" src="https://github.com/codewithzichao.png?s=40" alt="pic"></a><br>
117126
​ <a href="https://github.com/codewithzichao">Li Zichao</a>

deepctr/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
from .utils import check_version
22

3-
__version__ = '0.8.7'
3+
__version__ = '0.9.0'
44
check_version(__version__)

deepctr/estimator/feature_column.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@ def input_from_feature_columns(features, feature_columns, l2_reg_embedding=0.0):
4747
def is_embedding(feature_column):
4848
try:
4949
from tensorflow.python.feature_column.feature_column_v2 import EmbeddingColumn
50-
except:
50+
except ImportError:
5151
EmbeddingColumn = _EmbeddingColumn
5252
return isinstance(feature_column, (_EmbeddingColumn, EmbeddingColumn))

deepctr/estimator/models/autoint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
def AutoIntEstimator(linear_feature_columns, dnn_feature_columns, att_layer_num=3, att_embedding_size=8, att_head_num=2,
2222
att_res=True,
23-
dnn_hidden_units=(256, 256), dnn_activation='relu', l2_reg_linear=1e-5,
23+
dnn_hidden_units=(256, 128, 64), dnn_activation='relu', l2_reg_linear=1e-5,
2424
l2_reg_embedding=1e-5, l2_reg_dnn=0, dnn_use_bn=False, dnn_dropout=0, seed=1024,
2525
task='binary', model_dir=None, config=None, linear_optimizer='Ftrl',
2626
dnn_optimizer='Adagrad', training_chief_hooks=None):

deepctr/estimator/models/ccpm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020

2121
def CCPMEstimator(linear_feature_columns, dnn_feature_columns, conv_kernel_width=(6, 5), conv_filters=(4, 4),
22-
dnn_hidden_units=(256,), l2_reg_linear=1e-5, l2_reg_embedding=1e-5, l2_reg_dnn=0, dnn_dropout=0,
22+
dnn_hidden_units=(128, 64), l2_reg_linear=1e-5, l2_reg_embedding=1e-5, l2_reg_dnn=0, dnn_dropout=0,
2323
seed=1024, task='binary', model_dir=None, config=None, linear_optimizer='Ftrl',
2424
dnn_optimizer='Adagrad', training_chief_hooks=None):
2525
"""Instantiates the Convolutional Click Prediction Model architecture.

deepctr/estimator/models/dcn.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from ...layers.utils import combined_dnn_input
1616

1717

18-
def DCNEstimator(linear_feature_columns, dnn_feature_columns, cross_num=2, dnn_hidden_units=(128, 128,),
18+
def DCNEstimator(linear_feature_columns, dnn_feature_columns, cross_num=2, dnn_hidden_units=(256, 128, 64),
1919
l2_reg_linear=1e-5,
2020
l2_reg_embedding=1e-5,
2121
l2_reg_cross=1e-5, l2_reg_dnn=0, seed=1024, dnn_dropout=0, dnn_use_bn=False,

deepctr/estimator/models/deepfefm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020

2121
def DeepFEFMEstimator(linear_feature_columns, dnn_feature_columns,
22-
dnn_hidden_units=(128, 128), l2_reg_linear=0.00001, l2_reg_embedding_feat=0.00001,
22+
dnn_hidden_units=(256, 128, 64), l2_reg_linear=0.00001, l2_reg_embedding_feat=0.00001,
2323
l2_reg_embedding_field=0.00001, l2_reg_dnn=0, seed=1024, dnn_dropout=0.0,
2424
dnn_activation='relu', dnn_use_bn=False, task='binary', model_dir=None,
2525
config=None, linear_optimizer='Ftrl', dnn_optimizer='Adagrad', training_chief_hooks=None):

0 commit comments

Comments
 (0)