Skip to content

Commit

Permalink
add new model to readthedoc
Browse files Browse the repository at this point in the history
  • Loading branch information
wangzhen38 committed Jun 28, 2022
1 parent d4beb2e commit 9886269
Show file tree
Hide file tree
Showing 10 changed files with 171 additions and 96 deletions.
2 changes: 1 addition & 1 deletion README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

* [2022/6/15] 重磅福利:短视频推荐场景下的多任务学习应用实战视频直播课,欢迎扫码关注:<p align="center"><img width="200" height="200" margin="500" src="./doc/imgs/aistudio_micro_video.png"/></p>
* [2022/6/15] 新增3个前沿算法:[ESCM2](models/multitask/escm2),[MetaHeac](models/multitask/metaheac),[KIM](models/match/kim)
* [2022/5/18] 新增3个前沿算法:[AITM](models/multitask/aitm),[SIGN](models/rank/sign),[DSIN](models/rank/dsin)
* [2022/5/18] 新增3个前沿算法:[AITM](models/multitask/aitm),[SIGN](models/rank/sign),[DSIN](models/rank/dsin), [IPRec](models/rank/iprec)
* [2022/3/21] 新增[paper](./paper)目录,发布我们对21年的推荐顶会论文的分析,以及工业界的推荐论文列表,供大家参考。
* [2022/3/10] 新增5个前沿算法: [DCN_V2](models/rank/dcn_v2), [MHCN](models/recall/mhcn), [FLEN](models/rank/flen), [Dselect_K](models/multitask/dselect_k), [AutoFIS](models/rank/autofis)
* [2022/1/12] 新增AI Studio一键[在线运行](https://aistudio.baidu.com/aistudio/projectdetail/3240640)功能,可以方便快捷的在AI Studio平台上在线体验我们的模型。
Expand Down
2 changes: 1 addition & 1 deletion README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

* [2022/6/15] Excellent course about multi-task learning application under short video recommendation scenarios,welcome to scan the code and follow:<p align="center"><img width="200" height="200" margin="500" src="./doc/imgs/aistudio_micro_video.png"/></p>
* [2022/6/15] Add 3 algorithms:[ESCM2](models/multitask/escm2),[MetaHeac](models/multitask/metaheac),[KIM](models/match/kim)
* [2022/5/18] Add 3 algorithms::[AITM](models/multitask/aitm),[SIGN](models/rank/sign),[DSIN](models/rank/dsin)
* [2022/5/18] Add 3 algorithms::[AITM](models/multitask/aitm),[SIGN](models/rank/sign),[DSIN](models/rank/dsin),[IPRec](models/rank/iprec)
* [2022/3/21] Add a new [paper](./paper) directory , show our analysis of the top meeting papers of the recommendation system in 2021 years and the list of recommendation system papers in the industry for your reference.
* [2022/3/10] Add 5 algorithms: [DCN_V2](models/rank/dcn_v2), [MHCN](models/recall/mhcn), [FLEN](models/rank/flen), [Dselect_K](models/multitask/dselect_k)[AutoFIS](models/rank/autofis)
* [2022/1/12] Add AI Studio [Online running](https://aistudio.baidu.com/aistudio/projectdetail/3240640) function, you can easily and quickly online experience our model on AI studio platform.
Expand Down
7 changes: 7 additions & 0 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
models/match/dssm.md
models/match/match-pyramid.md
models/match/multiview-simnet.md
models/match/kim.md
models/recall/gru4rec.md
models/recall/deepwalk.md
models/recall/mind.md
Expand Down Expand Up @@ -86,13 +87,19 @@
models/rank/fat_deepffm.md
models/rank/deeprec.md
models/rank/autofis.md
models/rank/sign.md
models/rank/dsin.md
models/rank/iprec.md
models/multitask/esmm.md
models/multitask/maml.md
models/multitask/mmoe.md
models/multitask/ple.md
models/multitask/share_bottom.md
models/multitask/dselect_k.md
models/multitask/metaheac.md
models/multitask/escm2.md
models/multitask/aitm.md
models/multitask/metaheac.md

.. toctree::
:maxdepth: 1
Expand Down
39 changes: 7 additions & 32 deletions doc/source/models/match/kim.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,8 @@
# kim文本匹配模型
# kim (Personalized News Recommendation with Knowledge-aware Interactive Matching)
代码请参考:[KIM](https://paddlerec.readthedocs.io/en/latest/models/match/kim.html)
如果我们的代码对您有用,还请点个star啊~


以下是本例的简要目录结构及说明:

```
├── data #样例数据
├── sample_data #样例数据
├── docs.tsv #新闻文本
├── entity2id.txt #实体映射表
├── glove.840B.300d.txt #glove词向量
├── KGGraph #知识图谱关系
├── KGGraph #知识图谱关系
├── train.tsv #训练数据样例
├── test.txt #测试数据样例
├── __init__.py
├── README.md #文档
├── config.yaml # sample数据配置
├── config_bigdata.yaml # 全量数据配置
├── dygraph_model.py # 构建动态图
├── net.py # 模型核心组网(动静统一)
├── mind_reader.py #数据读取程序
├── eval_utils #评估函数
```

注:在阅读该示例前,建议您先了解以下内容:

[paddlerec入门教程](https://github.com/PaddlePaddle/PaddleRec/blob/master/README.md)
[kim](https://paddlerec.readthedocs.io/en/latest/models/match/kim.html)

## 内容

- [模型简介](#模型简介)
Expand Down Expand Up @@ -55,7 +30,7 @@ os : windows/linux/macos
本文提供了样例数据可以供您快速体验,在任意目录下均可执行。在kim模型目录的快速执行命令如下:
```bash
# 进入模型目录
# cd models/match/match-pyramid # 在任意目录均可运行
# cd models/match/kim # 在任意目录均可运行
# 动态图训练
python -u trainer.py -m config.yaml -o mode=train # 全量数据运行config_bigdata.yaml
# 动态图预测
Expand Down Expand Up @@ -87,10 +62,10 @@ python -u infer.py -m config.yaml -o mode=test
cd ../../../datasets/kim
bash run.sh
```
3. 切回模型目录f
3. 切回模型目录
```bash
python -u trainer.py -m config_bigdata.yml -o mode=train
python -u infer.py -m config_bigdata.yml -o mode=test
python -u trainer.py -m config_bigdata.yaml -o mode=train
python -u infer.py -m config_bigdata.yaml -o mode=test
```

## 进阶使用
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# AITM模型的点击率预估模型
# aitm (Modeling the Sequential Dependence among Audience Multi-step Conversions with Multi-task Learning in Targeted Display Advertising)

代码请参考:[MMOE](https://github.com/PaddlePaddle/PaddleRec/blob/master/models/multitask/aitm)
如果我们的代码对您有用,还请点个star啊~

代码请参考:[AITM](https://github.com/PaddlePaddle/PaddleRec/tree/master/models/rank/aitm)
如果我们的代码对您有用,还请点个star啊~

## 内容

Expand Down Expand Up @@ -33,7 +34,7 @@ os : windows/linux/macos
本文提供了样例数据可以供您快速体验,在任意目录下均可执行。在aitm模型目录的快速执行命令如下:
```bash
# 进入模型目录
# cd models/rank/aitm # 在任意目录均可运行
# cd models/multitask/aitm # 在任意目录均可运行
# 动态图训练
python -u ../../../tools/trainer.py -m config.yaml

Expand All @@ -45,9 +46,9 @@ python -u ../../../tools/infer.py -m config.yaml
在全量数据下模型的指标如下:
| 模型 | click auc | purchase auc |batch_size | epoch_num| Time of each epoch |
| :------| :------ | :------ | :------ | :------| :------ |
| aitm | 0.6186 |0.6525 | 2000 | 6| 约3小时 |
| aitm | 0.6130 |0.6166 | 2000 | 6| 约3小时 |

1. 确认您当前所在目录为PaddleRec/models/rank/aitm
1. 确认您当前所在目录为PaddleRec/models/multitask/aitm
2. 进入Paddlerec/datasets/ali-cpp_aitm
3. 执行命令运行全量数据

Expand Down
103 changes: 103 additions & 0 deletions doc/source/models/multitask/escm2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# ESCM2
# escm2 (ESCM2: Entire Space Counterfactual Multi-Task Model for Post-Click Conversion Rate Estimation)

代码请参考:[ESCM2](https://github.com/PaddlePaddle/PaddleRec/blob/master/models/multitask/escm2)
如果我们的代码对您有用,还请点个star啊~



## 内容

- [模型简介](#模型简介)
- [数据准备](#数据准备)
- [运行环境](#运行环境)
- [快速开始](#快速开始)
- [模型组网](#模型组网)
- [效果复现](#效果复现)
- [进阶使用](#进阶使用)
- [FAQ](#FAQ)

## 模型简介
该模型主要解决ESMM存在的两个问题:

1. **Inherent Estimation Bias (IEB)** 作者认为ESMM的CVR估计是高于真实情况的。
2. **Potential Independence Priority (PIP)** ESMM忽略了转化依赖点击这一因果性关系。

ESCM2是阿里发表在 SIGIR’2022 的论文[《ESCM2: Entire Space Counterfactual Multi-Task Model for Post-Click Conversion Rate Estimation》]( https://arxiv.org/pdf/2204.05125.pdf )文章基于因果推断的思路来解决ESMM中的IEB和PIP问题。

## 数据准备
我们在开源数据集[Ali-CCP:Alibaba Click and Conversion Prediction]( https://tianchi.aliyun.com/datalab/dataSet.html?dataId=408 )上验证模型效果。在模型目录的data目录下为您准备了快速运行的示例数据,若需要使用全量数据可以参考下方[效果复现](#效果复现)部分。
数据格式参见demo数据:data/train

## 运行环境
PaddlePaddle>=2.0

python 2.7/3.5/3.6/3.7

os : windows/linux/macos

## 快速开始
本文提供了样例数据可以供您快速体验,在任意目录下均可执行。在escm2模型目录的快速执行命令如下:
```bash
# 进入模型目录
# cd models/multitask/escm2 # 在任意目录均可运行
# 动态图训练
python -u ../../../tools/trainer.py -m config.yaml # 全量数据运行config_bigdata.yaml
# 动态图预测
python -u ../../../tools/infer.py -m config.yaml

# 静态图训练
python -u ../../../tools/static_trainer.py -m config.yaml # 全量数据运行config_bigdata.yaml
# 静态图预测
python -u ../../../tools/static_infer.py -m config.yaml
```

## 模型组网
ESCM2使用了因果推荐中的IPW和DR方法来进行纠偏。模型的主要组网结构如下:

<p align="center">
<img align="center" src="../../../doc/imgs/escm2.png">
<p>

其中IPW部分优化函数为:

<p align="center">
<img align="center" src="../../../doc/imgs/escm2_ipw.png">
<p>

DR部分优化函数为:

<p align="center">
<img align="center" src="../../../doc/imgs/escm2_dr1.png">
<p>
<p align="center">
<img align="center" src="../../../doc/imgs/escm2_dr2.png">
<p>
<p align="center">
<img align="center" src="../../../doc/imgs/escm2_dr3.png">
<p>

## 效果复现
为了方便使用者能够快速的跑通每一个模型,我们在每个模型下都提供了样例数据。如果需要复现readme中的效果,请按如下步骤依次操作即可。
在全量数据下模型的训练指标如下:
| 模型 | auc_ctr | batch_size | epoch_num | Time of each epoch |
| :------| :------ | :------ | :------| :------ |
| ESCM2 | 0.82 | 1024 | 10 | 约3分钟 |

1. 确认您当前所在目录为PaddleRec/models/multitask/esmm
2. 进入paddlerec/datasets/ali-ccp目录下,执行该脚本,会从国内源的服务器上下载我们预处理完成的ali-ccp全量数据集,并解压到指定文件夹。
``` bash
cd ../../../datasets/ali-ccp
sh run.sh
```
3. 切回模型目录,执行命令运行全量数据
```bash
cd - # 切回模型目录
# 动态图训练
python -u ../../../tools/trainer.py -m config_bigdata.yaml # 全量数据运行config_bigdata.yaml
python -u ../../../tools/infer.py -m config_bigdata.yaml # 全量数据运行config_bigdata.yaml
```

## 进阶使用

## FAQ
24 changes: 3 additions & 21 deletions doc/source/models/multitask/metaheac.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,8 @@
# MetaHeac
# metaheac (Learning to Expand Audience via Meta Hybrid Experts and Critics for Recommendation and Advertising)

以下是本例的简要目录结构及说明:
代码请参考:[MetaHeac](https://github.com/PaddlePaddle/PaddleRec/blob/master/models/multitask/metaheac)
如果我们的代码对您有用,还请点个star啊~

```
├── data #样例数据
├── train #训练数据
├── train_stage1.pkl
├── test #测试数据
├── test_stage1.pkl
├── test_stage2.pkl
├── net.py # 核心模型组网
├── config.yaml # sample数据配置
├── config_big.yaml # 全量数据配置
├── dygraph_model.py # 构建动态图
├── reader_train.py # 训练数据读取程序
├── reader_test.py # infer数据读取程序
├── readme.md #文档
```

注:在阅读该示例前,建议您先了解以下内容:

[paddlerec入门教程](https://github.com/PaddlePaddle/PaddleRec/blob/master/README.md)

## 内容

Expand Down
20 changes: 11 additions & 9 deletions doc/source/models/rank/dsin.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# dsin (Deep Session Interest Network for Click-Through Rate Prediction)
# DSIN (Deep Session Interest Network for Click-Through Rate Prediction)

代码请参考:[dsin](https://github.com/PaddlePaddle/PaddleRec/tree/master/models/rank/dsin)
代码请参考:[DSIN](https://github.com/PaddlePaddle/PaddleRec/tree/master/models/rank/dsin)
如果我们的代码对您有用,还请点个star啊~


## 内容

- [DSIN模型](#dsin模型)
- [模型简介](#模型简介)
- [数据准备](#数据准备)
- [运行环境](#运行环境)
Expand All @@ -15,23 +17,23 @@
- [FAQ](#FAQ)

## 模型简介
本模型主要聚焦于用户的历史会话行为,通过Self-Attention和BiLSTM对历史会话行为进行学习,最后通过Activation Unit得到最终的session表征向量,再结合其他特征送入MLP计算最后的ctr score。[Deep Session Interest Network for Click-Through Rate Prediction](https://arxiv.org/pdf/1905.06482v1.pdf)文章通过 Transformer 和 BiLSTM 来学习用户的 Session Interest Interacting,提升模型的表达能力。
模型主要聚焦于用户的历史会话行为,通过Self-Attention和BiLSTM对历史会话行为进行学习,最后通过Activation Unit得到最终的session表征向量,再结合其他特征送入MLP计算最后的ctr score。[Deep Session Interest Network for Click-Through Rate Prediction](https://arxiv.org/pdf/1905.06482v1.pdf)文章通过 Transformer 和 BiLSTM 来学习用户的 Session Interest Interacting,提升模型的表达能力。[知乎解析看这里](https://zhuanlan.zhihu.com/p/514780690)

## 数据准备
本模型使用论文中的数据集Alimama Dataset,参考[原文作者的数据预处理过程](https://github.com/shenweichen/DSIN/tree/master/code)对数据进行处理。在模型目录的data目录下为您准备了快速运行的示例数据,若需要使用全量数据可以参考下方[效果复现](#效果复现)部分。
本模型使用论文中的数据集Alimama Dataset,参考[原文作者的数据预处理过程](https://github.com/shenweichen/DSIN/tree/master/code)对数据进行处理。

## 运行环境
PaddlePaddle>=2.0
PaddlePaddle == 2.2.2

python 3.5/3.6/3.7
python 3.7.4

os : windows/linux/macos

## 快速开始
本文提供了样例数据可以供您快速体验,在任意目录下均可执行。在DSIN模型目录的快速执行命令如下
本文提供了样例数据可以供您快速体验,在任意目录下均可执行。在DMR模型目录的快速执行命令如下
```bash
# 进入模型目录
# cd models/rank/dmr # 在任意目录均可运行
# cd models/rank/dsin # 在任意目录均可运行
# 动态图训练
python -u ../../../tools/trainer.py -m config.yaml # 全量数据运行config_bigdata.yaml
# 动态图预测
Expand All @@ -49,7 +51,7 @@ python -u ../../../tools/static_infer.py -m config.yaml
<img align="center" src="../../../doc/imgs/dsin.png">
<p>

## 效果复现
## 效果复现
为了方便使用者能够快速的跑通每一个模型,我们在每个模型下都提供了样例数据。如果需要复现readme中的效果,请按如下步骤依次操作即可。
在全量数据下模型的指标如下:

Expand Down
6 changes: 2 additions & 4 deletions doc/source/models/rank/iprec.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# iprec模型
代码请参考:[AITM](https://github.com/PaddlePaddle/PaddleRec/tree/master/models/rank/iprec)
# iprec (Package Recommendation with Intra- and Inter-Package Attention Networks)
代码请参考:[IPRec](https://github.com/PaddlePaddle/PaddleRec/tree/master/models/rank/iprec)
如果我们的代码对您有用,还请点个star啊~
注:在阅读该示例前,建议您先了解以下内容:

[paddlerec入门教程](https://github.com/PaddlePaddle/PaddleRec/blob/master/README.md)

## 内容

Expand Down
Loading

0 comments on commit 9886269

Please sign in to comment.