You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 4.1 kB

5 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. recommendation Model
  2. ## Overview
  3. This is an implementation of WideDeep as described in the [Wide & Deep Learning for Recommender System](https://arxiv.org/pdf/1606.07792.pdf) paper.
  4. WideDeep model jointly trained wide linear models and deep neural network, which combined the benefits of memorization and generalization for recommender systems.
  5. ## Dataset
  6. The [Criteo datasets](http://labs.criteo.com/2014/02/download-kaggle-display-advertising-challenge-dataset/) are used for model training and evaluation.
  7. ## Running Code
  8. ### Download and preprocess dataset
  9. To download the dataset, please install Pandas package first. Then issue the following command:
  10. ```
  11. bash download.sh
  12. ```
  13. ### Code Structure
  14. The entire code structure is as following:
  15. ```
  16. |--- wide_and_deep/
  17. train_and_test.py "Entrance of Wide&Deep model training and evaluation"
  18. test.py "Entrance of Wide&Deep model evaluation"
  19. train.py "Entrance of Wide&Deep model training"
  20. train_and_test_multinpu.py "Entrance of Wide&Deep model data parallel training and evaluation"
  21. |--- src/ "entrance of training and evaluation"
  22. config.py "parameters configuration"
  23. dataset.py "Dataset loader class"
  24. WideDeep.py "Model structure"
  25. callbacks.py "Callback class for training and evaluation"
  26. metrics.py "Metric class"
  27. ```
  28. ### Train and evaluate model
  29. To train and evaluate the model, issue the following command:
  30. ```
  31. python train_and_test.py
  32. ```
  33. Arguments:
  34. * `--data_path`: This should be set to the same directory given to the data_download's data_dir argument.
  35. * `--epochs`: Total train epochs.
  36. * `--batch_size`: Training batch size.
  37. * `--eval_batch_size`: Eval batch size.
  38. * `--field_size`: The number of features.
  39. * `--vocab_size`: The total features of dataset.
  40. * `--emb_dim`: The dense embedding dimension of sparse feature.
  41. * `--deep_layers_dim`: The dimension of all deep layers.
  42. * `--deep_layers_act`: The activation of all deep layers.
  43. * `--keep_prob`: The rate to keep in dropout layer.
  44. * `--ckpt_path`:The location of the checkpoint file.
  45. * `--eval_file_name` : Eval output file.
  46. * `--loss_file_name` : Loss output file.
  47. To train the model, issue the following command:
  48. ```
  49. python train.py
  50. ```
  51. Arguments:
  52. * `--data_path`: This should be set to the same directory given to the data_download's data_dir argument.
  53. * `--epochs`: Total train epochs.
  54. * `--batch_size`: Training batch size.
  55. * `--eval_batch_size`: Eval batch size.
  56. * `--field_size`: The number of features.
  57. * `--vocab_size`: The total features of dataset.
  58. * `--emb_dim`: The dense embedding dimension of sparse feature.
  59. * `--deep_layers_dim`: The dimension of all deep layers.
  60. * `--deep_layers_act`: The activation of all deep layers.
  61. * `--keep_prob`: The rate to keep in dropout layer.
  62. * `--ckpt_path`:The location of the checkpoint file.
  63. * `--eval_file_name` : Eval output file.
  64. * `--loss_file_name` : Loss output file.
  65. To evaluate the model, issue the following command:
  66. ```
  67. python test.py
  68. ```
  69. Arguments:
  70. * `--data_path`: This should be set to the same directory given to the data_download's data_dir argument.
  71. * `--epochs`: Total train epochs.
  72. * `--batch_size`: Training batch size.
  73. * `--eval_batch_size`: Eval batch size.
  74. * `--field_size`: The number of features.
  75. * `--vocab_size`: The total features of dataset.
  76. * `--emb_dim`: The dense embedding dimension of sparse feature.
  77. * `--deep_layers_dim`: The dimension of all deep layers.
  78. * `--deep_layers_act`: The activation of all deep layers.
  79. * `--keep_prob`: The rate to keep in dropout layer.
  80. * `--ckpt_path`:The location of the checkpoint file.
  81. * `--eval_file_name` : Eval output file.
  82. * `--loss_file_name` : Loss output file.
  83. There are other arguments about models and training process. Use the `--help` or `-h` flag to get a full list of possible arguments with detailed descriptions.