forked from PaddlePaddle/PaddleRec
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/PaddlePaddle/PaddleRec in…
…to new_trainer
- Loading branch information
Showing
91 changed files
with
358,688 additions
and
279 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<h2 align="center">外部开发者贡献列表</h2> | ||
|
||
<div align="center"> | ||
|
||
| 方向 | 模型 | githubID | PR | 来源 | | ||
| :------: | :-----------------------------------------------------------------------: | :-----: | :--: | :---: | | ||
| 多任务 | [MAML](models/multitask/maml/) | [hrdwsong](https://github.com/hrdwsong) | https://github.com/PaddlePaddle/PaddleRec/pull/522 | 论文复现赛第三期 | | ||
| 排序 | [DMR](models/rank/dmr/) | [thinkall](https://github.com/thinkall) | https://github.com/PaddlePaddle/PaddleRec/pull/540 | 论文复现赛第三期 | | ||
| 排序 | [DeepFEFM](models/rank/deepfefm/) | [thinkall](https://github.com/thinkall) | https://github.com/PaddlePaddle/PaddleRec/pull/540 | 论文复现赛第四期 | | ||
| 排序 | [DLRM](models/rank/dlrm/) | [Andy1314Chen](https://github.com/Andy1314Chen) | https://github.com/PaddlePaddle/PaddleRec/pull/554 | 论文复现赛第四期 | | ||
| 排序 | [DIFM](models/rank/difm/) | [Andy1314Chen](https://github.com/Andy1314Chen) | https://github.com/PaddlePaddle/PaddleRec/pull/562 | 论文复现赛第四期 | | ||
| 排序 | [BERT4REC](models/rank/bert4rec/) | [jinweiluo](https://github.com/jinweiluo) | https://github.com/PaddlePaddle/PaddleRec/pull/624 | 论文复现赛第四期 | | ||
|
||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
# esmm (Entire Space Multi-Task Model: An Effective Approach for Estimating Post-Click Conversion Rate) | ||
|
||
代码请参考:[ESMM](https://github.com/PaddlePaddle/PaddleRec/blob/master/models/multitask/esmm) | ||
如果我们的代码对您有用,还请点个star啊~ | ||
|
||
## 内容 | ||
|
||
- [模型简介](#模型简介) | ||
- [数据准备](#数据准备) | ||
- [运行环境](#运行环境) | ||
- [快速开始](#快速开始) | ||
- [模型组网](#模型组网) | ||
- [效果复现](#效果复现) | ||
- [进阶使用](#进阶使用) | ||
- [FAQ](#FAQ) | ||
|
||
## 模型简介 | ||
不同于CTR预估问题,CVR预估面临两个关键问题: | ||
|
||
1. **Sample Selection Bias (SSB)** 转化是在点击之后才“有可能”发生的动作,传统CVR模型通常以点击数据为训练集,其中点击未转化为负例,点击并转化为正例。但是训练好的模型实际使用时,则是对整个空间的样本进行预估,而非只对点击样本进行预估。即是说,训练数据与实际要预测的数据来自不同分布,这个偏差对模型的泛化能力构成了很大挑战。 | ||
2. **Data Sparsity (DS)** 作为CVR训练数据的点击样本远小于CTR预估训练使用的曝光样本。 | ||
|
||
ESMM是发表在 SIGIR’2018 的论文[《Entire Space Multi-Task Model: An Effective Approach for Estimating Post-Click Conversion Rate》]( https://arxiv.org/abs/1804.07931 )文章基于 Multi-Task Learning 的思路,提出一种新的CVR预估模型——ESMM,有效解决了真实场景中CVR预估面临的数据稀疏以及样本选择偏差这两个关键问题 | ||
|
||
## 数据准备 | ||
我们在开源数据集[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 | ||
|
||
## 快速开始 | ||
本文提供了样例数据可以供您快速体验,在任意目录下均可执行。在esmm模型目录的快速执行命令如下: | ||
```bash | ||
# 进入模型目录 | ||
# cd models/multitask/esmm # 在任意目录均可运行 | ||
# 动态图训练 | ||
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 | ||
``` | ||
|
||
## 模型组网 | ||
ESMM是发表在 SIGIR’2018 的论文[《Entire Space Multi-Task Model: An Effective Approach for Estimating Post-Click Conversion Rate》]( https://arxiv.org/abs/1804.07931 )文章基于 Multi-Task Learning 的思路,提出一种新的CVR预估模型——ESMM,有效解决了真实场景中CVR预估面临的数据稀疏以及样本选择偏差这两个关键问题。模型的主要组网结构如下: | ||
[ESMM](https://arxiv.org/abs/1804.07931): | ||
<p align="center"> | ||
<img align="center" src="../../../doc/imgs/esmm.png"> | ||
<p> | ||
|
||
### 效果复现 | ||
为了方便使用者能够快速的跑通每一个模型,我们在每个模型下都提供了样例数据。如果需要复现readme中的效果,请按如下步骤依次操作即可。 | ||
在全量数据下模型的训练指标如下: | ||
| 模型 | auc_ctr | batch_size | epoch_num | Time of each epoch | | ||
| :------| :------ | :------ | :------| :------ | | ||
| ESMM | 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# maml (Model-agnostic meta-learning for fast adaptation of deep networks) | ||
|
||
代码请参考:[MAML](https://github.com/PaddlePaddle/PaddleRec/tree/master/models/multitask/maml) | ||
如果我们的代码对您有用,还请点个star啊~ | ||
|
||
## 内容 | ||
|
||
- [模型简介](#模型简介) | ||
- [数据准备](#数据准备) | ||
- [运行环境](#运行环境) | ||
- [快速开始](#快速开始) | ||
- [模型组网](#模型组网) | ||
- [效果复现](#效果复现) | ||
- [进阶使用](#进阶使用) | ||
- [FAQ](#FAQ) | ||
|
||
## 模型简介 | ||
[Model-Agnostic Meta-Learning for Fast Adaptation of Deep Networks](https://arxiv.org/pdf/1703.03400.pdf)算法是一种模型无关的元学习算法,其模型无关体现在,能够与任何使用了梯度下降法的模型相兼容,广泛应用于各种不同的机器学习任务,包括分类、识别、强化学习等领域。 | ||
元学习的目标,是在大量不同的任务上训练一个模型,使其能够使用极少量的训练数据(即小样本),进行极少量的梯度下降步数,就能够迅速适应新任务,解决新问题。 | ||
本模型来自飞桨论文复现挑战赛 hrdws 大神贡献的[MAML元学习算法,小样本学习,多任务学习](https://aistudio.baidu.com/aistudio/projectdetail/1869590?channelType=0&channel=0)。 | ||
|
||
## 数据准备 | ||
训练及测试数据集选用omniglot数据集。Omniglot 数据集包含50个不同的字母表,每个字母表中的字母各包含20个手写字符样本,每一个手写样本都是不同的人通过亚马逊的 Mechanical Turk 在线绘制的。Omniglot数据集的多样性强于MNIST数据集,是增强版的MNIST,常用与小样本识别任务。 | ||
在模型目录的data目录下为您准备了快速运行的示例数据,若需要使用全量数据可以参考下方[效果复现](#效果复现)部分。 | ||
|
||
## 运行环境 | ||
PaddlePaddle>=2.0 | ||
|
||
python 2.7/3.5/3.6/3.7 | ||
|
||
os : windows/linux/macos | ||
|
||
|
||
## 快速开始 | ||
本文提供了样例数据可以供您快速体验,在任意目录下均可执行。在maml模型目录的快速执行命令如下: | ||
```bash | ||
# 进入模型目录 | ||
# cd models/multitask/maml # 在任意目录均可运行 | ||
# 动态图训练 | ||
python -u ../../../tools/trainer.py -m config.yaml # 全量数据运行config_bigdata.yaml | ||
# 动态图预测 | ||
python -u ../../../tools/infer.py -m config.yaml | ||
``` | ||
|
||
## 模型组网 | ||
考虑一个关于任务T的分布p(T),我们希望模型能够对该任务分布很好的适配。在K-shot(即K个学习样本)的学习任务下,从p(T)分布中随机采样一个新任务Ti,在任务Ti的样本分布qi中随机采样K个样本,用这K个样本训练模型,获得LOSS,实现对模型f的内循环更新。然后再采样query个样本,评估新模型的LOSS,然后对模型f进行外循环更新。反复上述过程,从而使最终模型能够对任务分布p(T)上的所有情况,能够良好地泛化。MAML算法针对小样本图像分类任务的计算流程可用下图进行示意: | ||
<p align="center"> | ||
<img align="center" src="../../../doc/imgs/maml.png"> | ||
<p> | ||
|
||
## 效果复现 | ||
为了方便使用者能够快速的跑通每一个模型,我们在每个模型下都提供了样例数据。如果需要复现readme中的效果,请按如下步骤依次操作即可。 | ||
在全量数据下模型的指标如下: | ||
|
||
| 模型 | acc | batch_size | thread_num| epoch_num| Time of each epoch | | ||
| :------| :------ | :------| :------ | :------| :------ | | ||
| maml | 0.98 | 32 | 1 | 100 | 约4分钟 | | ||
|
||
1. 确认您当前所在目录为PaddleRec/models/multitask/maml | ||
2. 进入paddlerec/datasets/omniglot目录下,执行该脚本,会从国内源的服务器上下载我们预处理完成的Omniglot全量数据集,并解压到指定文件夹。 | ||
``` bash | ||
cd ../../../datasets/omniglot | ||
sh run.sh | ||
``` | ||
3. 切回模型目录,执行命令运行全量数据 | ||
```bash | ||
cd - # 切回模型目录 | ||
export FLAGS_cudnn_deterministic=True # 固定确定性算法 | ||
# 动态图训练 | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# mmoe (Modeling Task Relationships in Multi-task Learning with Multi-gate Mixture-of-Experts) | ||
|
||
代码请参考:[MMOE](https://github.com/PaddlePaddle/PaddleRec/blob/master/models/multitask/mmoe) | ||
如果我们的代码对您有用,还请点个star啊~ | ||
|
||
## 内容 | ||
|
||
- [模型简介](#模型简介) | ||
- [数据准备](#数据准备) | ||
- [运行环境](#运行环境) | ||
- [快速开始](#快速开始) | ||
- [模型组网](#模型组网) | ||
- [效果复现](#效果复现) | ||
- [进阶使用](#进阶使用) | ||
- [FAQ](#FAQ) | ||
|
||
## 模型简介 | ||
多任务模型通过学习不同任务的联系和差异,可提高每个任务的学习效率和质量。多任务学习的的框架广泛采用shared-bottom的结构,不同任务间共用底部的隐层。这种结构本质上可以减少过拟合的风险,但是效果上可能受到任务差异和数据分布带来的影响。 论文[《Modeling Task Relationships in Multi-task Learning with Multi-gate Mixture-of-Experts》]( https://www.kdd.org/kdd2018/accepted-papers/view/modeling-task-relationships-in-multi-task-learning-with-multi-gate-mixture- )中提出了一个Multi-gate Mixture-of-Experts(MMOE)的多任务学习结构。 | ||
|
||
## 数据准备 | ||
我们在开源数据集Census-income Data上验证模型效果,在模型目录的data目录下为您准备了快速运行的示例数据,若需要使用全量数据可以参考下方[效果复现](#效果复现)部分. | ||
数据的格式如下: | ||
生成的格式以逗号为分割点 | ||
``` | ||
0,0,73,0,0,0,0,1700.09,0,0 | ||
``` | ||
|
||
## 运行环境 | ||
PaddlePaddle>=2.0 | ||
|
||
python 2.7/3.5/3.6/3.7 | ||
|
||
os : windows/linux/macos | ||
|
||
## 快速开始 | ||
本文提供了样例数据可以供您快速体验,在任意目录下均可执行。在mmoe模型目录的快速执行命令如下: | ||
```bash | ||
# 进入模型目录 | ||
# cd models/multitask/mmoe # 在任意目录均可运行 | ||
# 动态图训练 | ||
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 | ||
``` | ||
|
||
## 模型组网 | ||
MMOE模型刻画了任务相关性,基于共享表示来学习特定任务的函数,避免了明显增加参数的缺点。模型的主要组网结构如下: | ||
[MMoE](https://dl.acm.org/doi/abs/10.1145/3219819.3220007): | ||
<p align="center"> | ||
<img align="center" src="../../../doc/imgs/mmoe.png"> | ||
<p> | ||
|
||
### 效果复现 | ||
为了方便使用者能够快速的跑通每一个模型,我们在每个模型下都提供了样例数据。如果需要复现readme中的效果,请按如下步骤依次操作即可。 | ||
在全量数据下模型的指标如下: | ||
| 模型 | auc_marital | batch_size | epoch_num | Time of each epoch | | ||
| :------| :------ | :------ | :------| :------ | | ||
| MMOE | 0.99 | 32 | 100 | 约1分钟 | | ||
|
||
1. 确认您当前所在目录为PaddleRec/models/multitask/mmoe | ||
2. 进入paddlerec/datasets/census目录下,执行该脚本,会从国内源的服务器上下载我们预处理完成的census全量数据集,并解压到指定文件夹。 | ||
``` bash | ||
cd ../../../datasets/census | ||
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 |
Oops, something went wrong.