55├── data # 样例数据
66│ ├── demo # demo训练数据
77│ │ └── demo.txt
8- │ ├── processs.py # 处理全量数据的脚本
9- │ ├── run.sh # 全量数据下载的脚本
108│ └── valid # demo测试数据
119│ └── part-0
12- ├── config.yaml # 数据配置
10+ ├── config.yaml # demo数据配置
11+ ├── config_bigdata.yaml # 全量数据配置
12+ ├── infer.py # 评测动态图
1313├── dygraph_model.py # 构建动态图
14- ├── evaluate_dygraph.py # 评测动态图
15- ├── evaluate_reader.py # 评测数据reader
16- ├── evaluate_static.py # 评测静态图
1714├── mind_reader.py # 训练数据reader
15+ ├── mind_infer_reader.py # 评测数据reader
1816├── net.py # 模型核心组网(动静合一)
17+ ├── static_infer.py # 评测静态图
1918└── static_model.py # 构建静态图
2019```
2120
@@ -57,11 +56,14 @@ Multi-Interest Network with Dynamic Routing (MIND) 是通过构建用户和商
5756
5857测试数据的格式如下:
5958```
60- user_id:543354 hist_item:143963 hist_item:157508 hist_item:105486 hist_item:40502 hist_item:167813 hist_item:233564 hist_item:221866 hist_item:280310 hist_item:61638 hist_item:158494 hist_item:74449 hist_item:283630 hist_item:135155 hist_item:96176 hist_item:20139 hist_item:89420 hist_item:247990 hist_item:126605 target_item:172183 target_item:114193 target_item:79966 target_item:134420 target_item:50557
61- user_id:543362 hist_item:119546 hist_item:78597 hist_item:86809 hist_item:63551 target_item:326165
62- user_id:543366 hist_item:45463 hist_item:9903 hist_item:3956 hist_item:49726 target_item:199426
59+ user_id:487766 target_item:0 hist_item:17784 hist_item:126 hist_item:36 hist_item:124 hist_item:34 hist_item:1 hist_item:134 hist_item:6331 hist_item:141 hist_item:4336 hist_item:1373 eval_item:1062 eval_item:867 eval_item:62
60+ user_id:487793 target_item:0 hist_item:153428 hist_item:132997 hist_item:155723 hist_item:66546 hist_item:335397 hist_item:1926 eval_item:1122 eval_item:10105
61+ user_id:487805 target_item:0 hist_item:291025 hist_item:25190 hist_item:2820 hist_item:26047 hist_item:47259 hist_item:36376 eval_item:260145 eval_item:83865
62+ user_id:487811 target_item:0 hist_item:180837 hist_item:202701 hist_item:184587 hist_item:211642 eval_item:101621 eval_item:55716
63+ user_id:487820 target_item:0 hist_item:268524 hist_item:44318 hist_item:35153 hist_item:70847 eval_item:238318
64+ user_id:487825 target_item:0 hist_item:35602 hist_item:4353 hist_item:1540 hist_item:72921 eval_item:501
6365```
64- 其中` hist_item ` 和` target_item ` 均是变长序列,读取方式可以看` evaluate_reader .py`
66+ 其中` hist_item ` 和` eval_item ` 均是变长序列,读取方式可以看` mind_infer_reader .py`
6567
6668## 运行环境
6769PaddlePaddle>=2.0
@@ -75,16 +77,16 @@ os : windows/linux/macos
7577在mind模型目录的快速执行命令如下:
7678```
7779# 进入模型目录
78- # cd models/recall/word2vec # 在任意目录均可运行
80+ # cd models/recall/mind # 在任意目录均可运行
7981# 动态图训练
8082python -u ../../../tools/trainer.py -m config.yaml
8183# 动态图预测
82- python -u evaluate_dygraph .py -m config.yaml -top_n 50 #对测试数据进行预测,并通过faiss召回候选结果评测Reacll、NDCG、HitRate指标
84+ python -u infer .py -m config.yaml -top_n 50 #对测试数据进行预测,并通过faiss召回候选结果评测Reacll、NDCG、HitRate指标
8385
8486# 静态图训练
8587python -u ../../../tools/static_trainer.py -m config.yaml # 全量数据运行config_bigdata.yaml
8688# 静态图预测
87- python -u evaluate_static .py -m config.yaml -top_n 50 #对测试数据进行预测,并通过faiss召回候选结果评测Reacll、NDCG、HitRate指标
89+ python -u static_infer .py -m config.yaml -top_n 50 #对测试数据进行预测,并通过faiss召回候选结果评测Reacll、NDCG、HitRate指标
8890```
8991
9092## 模型组网
@@ -97,21 +99,21 @@ python -u evaluate_static.py -m config.yaml -top_n 50 #对测试数据进行
9799在全量数据下模型的指标如下:
98100| 模型 | batch_size | epoch_num| Recall@50 | NDCG@50 | HitRate@50 | Time of each epoch |
99101| :------| :------ | :------ | :------| :------ | :------| :------ |
100- | mind(静态图) | 128 | 6 | 4 .61% | 11.28% | 18.92% | -- |
101- | mind(动态图) | 128 | 6 | 4.57 % | 11.25% | 18.99% | -- |
102+ | mind(静态图) | 128 | 6 | 5 .61% | 8.96% | 11.81% | -- |
103+ | mind(动态图) | 128 | 6 | 5.54 % | 8.85% | 11.75% | -- |
102104
1031051 . 确认您当前所在目录为PaddleRec/models/recall/mind
104- 2 . 进入data目录下执行run .sh脚本,会下载处理完成的AmazonBook数据集,并解压到指定目录
106+ 2 . 进入paddlerec/datasets/AmazonBook目录下执行run .sh脚本,会下载处理完成的AmazonBook数据集,并解压到指定目录
105107``` bash
106- cd ./data
108+ cd ../../../datasets/AmazonBook
107109sh run.sh
108110```
1091113 . 切回模型目录,执行命令运行全量数据
110112``` bash
111- d - # 切回模型目录
113+ cd - # 切回模型目录
112114# 动态图训练
113- python -u ../../../tools/trainer.py -m config .yaml # 全量数据运行config.yaml
114- python -u evaluate_dygraph .py -m config .yaml # 全量数据运行config.yaml
115+ python -u ../../../tools/trainer.py -m config_bigdata .yaml # 全量数据运行config_bigdata
116+ python -u infer .py -m config_bigdata .yaml # 全量数据运行config_bigdata
115117```
116118
117119## 进阶使用
0 commit comments