未验证 提交 34eddbc6 编写于 作者: 1 123malin 提交者: GitHub

Merge branch 'master' into readme

...@@ -34,19 +34,7 @@ ...@@ -34,19 +34,7 @@
多任务模型通过学习不同任务的联系和差异,可提高每个任务的学习效率和质量。多任务学习的的框架广泛采用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)的多任务学习结构。MMOE模型刻画了任务相关性,基于共享表示来学习特定任务的函数,避免了明显增加参数的缺点。 多任务模型通过学习不同任务的联系和差异,可提高每个任务的学习效率和质量。多任务学习的的框架广泛采用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)的多任务学习结构。MMOE模型刻画了任务相关性,基于共享表示来学习特定任务的函数,避免了明显增加参数的缺点。
我们在Paddlepaddle定义MMOE的网络结构,在开源数据集Census-income Data上验证模型效果,两个任务的auc分别为: 我们在Paddlepaddle定义MMOE的网络结构,在开源数据集Census-income Data上验证模型效果。
1.income
> max_mmoe_test_auc_income:0.94937
>
> mean_mmoe_test_auc_income:0.94465
2.marital
> max_mmoe_test_auc_marital:0.99419
>
> mean_mmoe_test_auc_marital:0.99324
若进行精度验证,请参考[论文复现](https://github.com/PaddlePaddle/PaddleRec/tree/master/models/multitask/mmoe#论文复现)部分。 若进行精度验证,请参考[论文复现](https://github.com/PaddlePaddle/PaddleRec/tree/master/models/multitask/mmoe#论文复现)部分。
...@@ -59,26 +47,6 @@ ...@@ -59,26 +47,6 @@
数据地址: [Census-income Data](https://archive.ics.uci.edu/ml/machine-learning-databases/census-income-mld/census.tar.gz ) 数据地址: [Census-income Data](https://archive.ics.uci.edu/ml/machine-learning-databases/census-income-mld/census.tar.gz )
数据解压后, 在run.sh脚本文件中添加文件的路径,并运行脚本。
```sh
mkdir train_data
mkdir test_data
mkdir data
train_path="data/census-income.data"
test_path="data/census-income.test"
train_data_path="train_data/"
test_data_path="test_data/"
pip install -r requirements.txt
wget -P data/ https://archive.ics.uci.edu/ml/machine-learning-databases/census-income-mld/census.tar.gz
tar -zxvf data/census.tar.gz -C data/
python data_preparation.py --train_path ${train_path} \
--test_path ${test_path} \
--train_data_path ${train_data_path}\
--test_data_path ${test_data_path}
```
生成的格式以逗号为分割点 生成的格式以逗号为分割点
...@@ -86,6 +54,7 @@ python data_preparation.py --train_path ${train_path} \ ...@@ -86,6 +54,7 @@ python data_preparation.py --train_path ${train_path} \
0,0,73,0,0,0,0,1700.09,0,0 0,0,73,0,0,0,0,1700.09,0,0
``` ```
完整的大数据参考论文复现部分。
## 运行环境 ## 运行环境
...@@ -124,7 +93,6 @@ dataset: ...@@ -124,7 +93,6 @@ dataset:
CPU环境 CPU环境
在config.yaml文件中设置好epochs、device等参数。 在config.yaml文件中设置好epochs、device等参数。
``` ```
- name: infer_runner - name: infer_runner
class: infer class: infer
...@@ -134,14 +102,20 @@ CPU环境 ...@@ -134,14 +102,20 @@ CPU环境
## 论文复现 ## 论文复现
用原论文的完整数据复现论文效果需要在config.yaml中修改batch_size=1000, thread_num=8, epoch_num=4 数据下载,我们提供了在百度云上预处理好的数据,可以直接训练
使用gpu p100 单卡训练 6.5h 测试auc: best:0.9940, mean:0.9932 ```
wget https://paddlerec.bj.bcebos.com/mmoe/train_data.csv
wget https://paddlerec.bj.bcebos.com/mmoe/test_data.csv
wget https://paddlerec.bj.bcebos.com/mmoe/config_all.yaml
```
用原论文的完整数据复现论文效果需要在config.yaml中修改batch_size=32 gpu配置等,可参考config_all.yaml
修改后运行方案:修改config.yaml中的'workspace'为config.yaml的目录位置,执行 使用gpu p100 单卡训练 6.5h 测试auc: best:0.9940, mean:0.9932
``` ```
python -m paddlerec.run -m /home/your/dir/config.yaml #调试模式 直接指定本地config的绝对路径 python -m paddlerec.run -m /home/your/dir/config_all.yaml #调试模式 直接指定本地config的绝对路径
``` ```
## 进阶使用 ## 进阶使用
......
...@@ -16,12 +16,12 @@ workspace: "models/multitask/mmoe" ...@@ -16,12 +16,12 @@ workspace: "models/multitask/mmoe"
dataset: dataset:
- name: dataset_train - name: dataset_train
batch_size: 1 batch_size: 5
type: QueueDataset type: QueueDataset
data_path: "{workspace}/data/train" data_path: "{workspace}/data/train"
data_converter: "{workspace}/census_reader.py" data_converter: "{workspace}/census_reader.py"
- name: dataset_infer - name: dataset_infer
batch_size: 1 batch_size: 5
type: QueueDataset type: QueueDataset
data_path: "{workspace}/data/train" data_path: "{workspace}/data/train"
data_converter: "{workspace}/census_reader.py" data_converter: "{workspace}/census_reader.py"
...@@ -38,15 +38,14 @@ hyper_parameters: ...@@ -38,15 +38,14 @@ hyper_parameters:
strategy: async strategy: async
#use infer_runner mode and modify 'phase' below if infer #use infer_runner mode and modify 'phase' below if infer
mode: train_runner mode: [train_runner, infer_runner]
#mode: infer_runner
runner: runner:
- name: train_runner - name: train_runner
class: train class: train
device: cpu device: cpu
epochs: 3 epochs: 3
save_checkpoint_interval: 2 save_checkpoint_interval: 1
save_inference_interval: 4 save_inference_interval: 4
save_checkpoint_path: "increment" save_checkpoint_path: "increment"
save_inference_path: "inference" save_inference_path: "inference"
...@@ -61,7 +60,7 @@ phase: ...@@ -61,7 +60,7 @@ phase:
model: "{workspace}/model.py" model: "{workspace}/model.py"
dataset_name: dataset_train dataset_name: dataset_train
thread_num: 1 thread_num: 1
#- name: infer - name: infer
# model: "{workspace}/model.py" model: "{workspace}/model.py"
# dataset_name: dataset_infer dataset_name: dataset_infer
# thread_num: 1 thread_num: 1
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册