- [Description of Random Situation](#description-of-random-situation)
- [Description of Random Situation](#description-of-random-situation)
- [ModelZoo Homepage](#modelzoo-homepage)
- [ModelZoo Homepage](#modelzoo-homepage)
# [DeepFM Description](#contents)
# [DeepFM Description](#contents)
Learning sophisticated feature interactions behind user behaviors is critical in maximizing CTR for recommender systems. Despite great progress, existing methods seem to have a strong bias towards low- or high-order interactions, or require expertise feature engineering. In this paper, we show that it is possible to derive an end-to-end learning model that emphasizes both low- and high-order feature interactions. The proposed model, DeepFM, combines the power of factorization machines for recommendation and deep learning for feature learning in a new neural network architecture.
Learning sophisticated feature interactions behind user behaviors is critical in maximizing CTR for recommender systems. Despite great progress, existing methods seem to have a strong bias towards low- or high-order interactions, or require expertise feature engineering. In this paper, we show that it is possible to derive an end-to-end learning model that emphasizes both low- and high-order feature interactions. The proposed model, DeepFM, combines the power of factorization machines for recommendation and deep learning for feature learning in a new neural network architecture.
[Paper](https://arxiv.org/abs/1703.04247): Huifeng Guo, Ruiming Tang, Yunming Ye, Zhenguo Li, Xiuqiang He. DeepFM: A Factorization-Machine based Neural Network for CTR Prediction
[Paper](https://arxiv.org/abs/1703.04247): Huifeng Guo, Ruiming Tang, Yunming Ye, Zhenguo Li, Xiuqiang He. DeepFM: A Factorization-Machine based Neural Network for CTR Prediction
@@ -35,27 +34,24 @@ The FM and deep component share the same input raw feature vector, which enables
# [Dataset](#contents)
# [Dataset](#contents)
- [1] A dataset used in Huifeng Guo, Ruiming Tang, Yunming Ye, Zhenguo Li, Xiuqiang He. DeepFM: A Factorization-Machine based Neural Network for CTR Prediction[J]. 2017.
- [1] A dataset used in Huifeng Guo, Ruiming Tang, Yunming Ye, Zhenguo Li, Xiuqiang He. DeepFM: A Factorization-Machine based Neural Network for CTR Prediction[J]. 2017.
# [Environment Requirements](#contents)
# [Environment Requirements](#contents)
- Hardware(Ascend/GPU)
- Prepare hardware environment with Ascend or GPU processor. If you want to try Ascend, please send the [application form](https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/file/other/Ascend%20Model%20Zoo%E4%BD%93%E9%AA%8C%E8%B5%84%E6%BA%90%E7%94%B3%E8%AF%B7%E8%A1%A8.docx) to ascend@huawei.com. Once approved, you can get the resources.
- Hardware(Ascend/GPU/CPU)
- Prepare hardware environment with Ascend, GPU, or CPU processor. If you want to try Ascend, please send the [application form](https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/file/other/Ascend%20Model%20Zoo%E4%BD%93%E9%AA%8C%E8%B5%84%E6%BA%90%E7%94%B3%E8%AF%B7%E8%A1%A8.docx) to ascend@huawei.com. Once approved, you can get the resources.
├─mindspore_hub_conf.md # config for mindspore hub
├─mindspore_hub_conf.md # config for mindspore hub
├─scripts
├─scripts
├─run_standalone_train.sh # launch standalone training(1p) in Ascend or GPU
├─run_standalone_train.sh # launch standalone training(1p) in Ascend or GPU
├─run_distribute_train.sh # launch distributed training(8p) in Ascend
├─run_distribute_train.sh # launch distributed training(8p) in Ascend
├─run_distribute_train_gpu.sh # launch distributed training(8p) in GPU
├─run_distribute_train_gpu.sh # launch distributed training(8p) in GPU
@@ -138,7 +153,8 @@ After installing MindSpore via the official website, you can start training and
Parameters for both training and evaluation can be set in config.py
Parameters for both training and evaluation can be set in config.py
- train parameters
- train parameters
```
```help
optional arguments:
optional arguments:
-h, --help show this help message and exit
-h, --help show this help message and exit
--dataset_path DATASET_PATH
--dataset_path DATASET_PATH
@@ -153,8 +169,10 @@ Parameters for both training and evaluation can be set in config.py
--device_target DEVICE_TARGET
--device_target DEVICE_TARGET
Ascend or GPU. Default: Ascend
Ascend or GPU. Default: Ascend
```
```
- eval parameters
- eval parameters
```
```help
optional arguments:
optional arguments:
-h, --help show this help message and exit
-h, --help show this help message and exit
--checkpoint_path CHECKPOINT_PATH
--checkpoint_path CHECKPOINT_PATH
@@ -165,14 +183,13 @@ Parameters for both training and evaluation can be set in config.py
Ascend or GPU. Default: Ascend
Ascend or GPU. Default: Ascend
```
```
## [Training Process](#contents)
## [Training Process](#contents)
### Training
### Training
- running on Ascend
- running on Ascend
```
```shell
python train.py \
python train.py \
--dataset_path='dataset/train' \
--dataset_path='dataset/train' \
--ckpt_path='./checkpoint' \
--ckpt_path='./checkpoint' \
@@ -181,36 +198,36 @@ Parameters for both training and evaluation can be set in config.py
--device_target='Ascend' \
--device_target='Ascend' \
--do_eval=True > ms_log/output.log 2>&1 &
--do_eval=True > ms_log/output.log 2>&1 &
```
```
The python command above will run in the background, you can view the results through the file `ms_log/output.log`.
The python command above will run in the background, you can view the results through the file `ms_log/output.log`.
After training, you'll get some checkpoint files under `./checkpoint` folder by default. The loss value are saved in loss.log file.
After training, you'll get some checkpoint files under `./checkpoint` folder by default. The loss value are saved in loss.log file.
```
```log
2020-05-27 15:26:29 epoch: 1 step: 41257, loss is 0.498953253030777
2020-05-27 15:26:29 epoch: 1 step: 41257, loss is 0.498953253030777
2020-05-27 15:32:32 epoch: 2 step: 41257, loss is 0.45545706152915955
2020-05-27 15:32:32 epoch: 2 step: 41257, loss is 0.45545706152915955
...
...
```
```
The model checkpoint will be saved in the current directory.
The model checkpoint will be saved in the current directory.
- running on GPU
- running on GPU
To do.
To do.
### Distributed Training
### Distributed Training
- running on Ascend
- running on Ascend
```
```shell
sh scripts/run_distribute_train.sh 8 /dataset_path /rank_table_8p.json
sh scripts/run_distribute_train.sh 8 /dataset_path /rank_table_8p.json
```
```
The above shell script will run distribute training in the background. You can view the results through the file `log[X]/output.log`. The loss value are saved in loss.log file.
The above shell script will run distribute training in the background. You can view the results through the file `log[X]/output.log`. The loss value are saved in loss.log file.
- running on GPU
- running on GPU
To do.
To do.
## [Evaluation Process](#contents)
## [Evaluation Process](#contents)
@@ -219,8 +236,8 @@ Parameters for both training and evaluation can be set in config.py
- evaluation on dataset when running on Ascend
- evaluation on dataset when running on Ascend
Before running the command below, please check the checkpoint path used for evaluation.
Before running the command below, please check the checkpoint path used for evaluation.
```
```shell
python eval.py \
python eval.py \
--dataset_path='dataset/test' \
--dataset_path='dataset/test' \
--checkpoint_path='./checkpoint/deepfm.ckpt' \
--checkpoint_path='./checkpoint/deepfm.ckpt' \
@@ -228,22 +245,22 @@ Parameters for both training and evaluation can be set in config.py
OR
OR
sh scripts/run_eval.sh 0 Ascend /dataset_path /checkpoint_path/deepfm.ckpt
sh scripts/run_eval.sh 0 Ascend /dataset_path /checkpoint_path/deepfm.ckpt
```
```
The above python command will run in the background. You can view the results through the file "eval_output.log". The accuracy is saved in auc.log file.
The above python command will run in the background. You can view the results through the file "eval_output.log". The accuracy is saved in auc.log file.