From 8a977bb162c14210cfa23173dc48c6410b837786 Mon Sep 17 00:00:00 2001 From: xpai Date: Tue, 5 Nov 2024 22:25:25 +0800 Subject: [PATCH] Update ShareBottom --- README.md | 2 +- docs/img/{SharedBottom.jpg => ShareBottom.jpg} | Bin .../{SharedBottom => ShareBottom}/README.md | 12 ++++++------ .../config/dataset_config.yaml | 0 .../config/model_config.yaml | 12 ++++++------ .../fuxictr_version.py | 0 .../{SharedBottom => ShareBottom}/run_expid.py | 2 +- .../src/ShareBottom.py} | 4 ++-- model_zoo/multitask/ShareBottom/src/__init__.py | 1 + model_zoo/multitask/SharedBottom/src/__init__.py | 1 - model_zoo/multitask/__init__.py | 3 ++- 11 files changed, 19 insertions(+), 18 deletions(-) rename docs/img/{SharedBottom.jpg => ShareBottom.jpg} (100%) rename model_zoo/multitask/{SharedBottom => ShareBottom}/README.md (95%) rename model_zoo/multitask/{SharedBottom => ShareBottom}/config/dataset_config.yaml (100%) rename model_zoo/multitask/{SharedBottom => ShareBottom}/config/model_config.yaml (76%) rename model_zoo/multitask/{SharedBottom => ShareBottom}/fuxictr_version.py (100%) rename model_zoo/multitask/{SharedBottom => ShareBottom}/run_expid.py (94%) rename model_zoo/multitask/{SharedBottom/src/SharedBottom.py => ShareBottom/src/ShareBottom.py} (97%) create mode 100644 model_zoo/multitask/ShareBottom/src/__init__.py delete mode 100644 model_zoo/multitask/SharedBottom/src/__init__.py diff --git a/README.md b/README.md index c9fdddb..5cfe26d 100644 --- a/README.md +++ b/README.md @@ -88,7 +88,7 @@ Click-through rate (CTR) prediction is a critical task for various industrial ap | 50 | NeurIPS'22 | [APG](./model_zoo/APG) | [APG: Adaptive Parameter Generation Network for Click-Through Rate Prediction](https://arxiv.org/abs/2203.16218) :triangular_flag_on_post:**Alibaba** | [:arrow_upper_right:](https://github.com/reczoo/BARS/tree/main/ranking/ctr/APG) | `torch` | | 51 | KDD'23 | [PPNet](./model_zoo/PEPNet) | [PEPNet: Parameter and Embedding Personalized Network for Infusing with Personalized Prior Information](https://arxiv.org/abs/2302.01115) :triangular_flag_on_post:**KuaiShou** | [:arrow_upper_right:](https://github.com/reczoo/BARS/tree/main/ranking/ctr/PPNet) | `torch` | |:open_file_folder: **Multi-Task Modeling**| -| 52 | MachineLearn'97 | [SharedBottom](./model_zoo/multitask/SharedBottom) | [Multitask Learning](https://link.springer.com/article/10.1023/A:1007379606734) | | `torch` | +| 52 | Arxiv'17 | [ShareBottom](./model_zoo/multitask/ShareBottom) | [An Overview of Multi-Task Learning in Deep Neural Networks](https://arxiv.org/abs/1706.05098) | | `torch` | | 53 | KDD'18 | [MMoE](./model_zoo/multitask/MMOE) | [Modeling Task Relationships in Multi-task Learning with Multi-Gate Mixture-of-Experts](https://dl.acm.org/doi/pdf/10.1145/3219819.3220007) :triangular_flag_on_post:**Google** | | `torch` | | 54 | KDD'18 | [PLE](./model_zoo/multitask/PLE) | [Progressive Layered Extraction (PLE): A Novel Multi-Task Learning (MTL) Model for Personalized Recommendations](https://dl.acm.org/doi/10.1145/3383313.3412236) :triangular_flag_on_post:**Tencent** | | `torch` | |:open_file_folder: **Multi-Domain Modeling**| diff --git a/docs/img/SharedBottom.jpg b/docs/img/ShareBottom.jpg similarity index 100% rename from docs/img/SharedBottom.jpg rename to docs/img/ShareBottom.jpg diff --git a/model_zoo/multitask/SharedBottom/README.md b/model_zoo/multitask/ShareBottom/README.md similarity index 95% rename from model_zoo/multitask/SharedBottom/README.md rename to model_zoo/multitask/ShareBottom/README.md index b1c66da..ba67be7 100644 --- a/model_zoo/multitask/SharedBottom/README.md +++ b/model_zoo/multitask/ShareBottom/README.md @@ -1,18 +1,18 @@ -## Shared-Bottom +## ShareBottom | [Overview](#Overview) | [Configuration](#Configuration) | [Implementation](#Implementation) | ### Overview -Shared-Bottom is the classic multitasking model based on a shared bottom. The model is published in the following paper: +Share-Bottom is the classic multitasking model based on a Share bottom. The model is published in the following paper: + Rich Caruana. [Multitask Learning](https://link.springer.com/article/10.1023/A:1007379606734), in Machine learning 1997. **Model structure:**
- +
This figure comes from the paper of [MMoE (KDD 2018)](https://www.kdd.org/kdd2018/accepted-papers/view/modeling-task-relationships-in-multi-task-learning-with-multi-gate-mixture-). @@ -33,7 +33,7 @@ The `model_config.yaml` file contains all the model hyper-parameters as follows. | Params | Type | Default | Description | | ---------------------- | --------------- | ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| model | str | "SharedBottom" | model name,  which should be same with model class name | +| model | str | "ShareBottom" | model name,  which should be same with model class name | | dataset_id | str | "TBD" | dataset_id to be determined | | loss | list | ["binary_crossentropy","binary_crossentropy"] | loss function for each task | | metrics | list | ['logloss', 'AUC'] | a list of metrics for evaluation | @@ -76,7 +76,7 @@ The `model_config.yaml` file contains all the model hyper-parameters as follows. │ ├── dataset_config.yaml # 数据集配置文件 │ └── model_config.yaml # 模型配置文件 ├── src # 模型代码文件夹 -│ └── SharedBottom.py # 模型代码 +│ └── ShareBottom.py # 模型代码 ├── fuxictr_version.py # fuxictr加载及版本检查文件 ├── README.md # 使用说明 └── run_expid.py # 执行脚本文件 @@ -95,6 +95,6 @@ The model is tested with the following dependencies. Running the model on the tiny data: ``` -python run_expid.py --expid SharedBottom_test --gpu 0 +python run_expid.py --expid ShareBottom_test --gpu 0 ``` diff --git a/model_zoo/multitask/SharedBottom/config/dataset_config.yaml b/model_zoo/multitask/ShareBottom/config/dataset_config.yaml similarity index 100% rename from model_zoo/multitask/SharedBottom/config/dataset_config.yaml rename to model_zoo/multitask/ShareBottom/config/dataset_config.yaml diff --git a/model_zoo/multitask/SharedBottom/config/model_config.yaml b/model_zoo/multitask/ShareBottom/config/model_config.yaml similarity index 76% rename from model_zoo/multitask/SharedBottom/config/model_config.yaml rename to model_zoo/multitask/ShareBottom/config/model_config.yaml index 3507af5..7325476 100644 --- a/model_zoo/multitask/SharedBottom/config/model_config.yaml +++ b/model_zoo/multitask/ShareBottom/config/model_config.yaml @@ -12,16 +12,16 @@ Base: feature_specs: null feature_config: null -SharedBottom_test: +ShareBottom_test: model: SharedBottom dataset_id: tiny_mtl - loss: ['binary_crossentropy','binary_crossentropy'] + loss: ['binary_crossentropy', 'binary_crossentropy'] metrics: ['logloss', 'AUC'] - task: ['binary_classification','binary_classification'] + task: ['binary_classification', 'binary_classification'] num_tasks: 2 optimizer: adam learning_rate: 1.e-3 - bottom_hidden_units: [512,256,128] + bottom_hidden_units: [512, 256, 128] tower_hidden_units: [128, 64] hidden_activations: relu net_regularizer: 0 @@ -30,8 +30,8 @@ SharedBottom_test: net_dropout: 0 batch_size: 128 embedding_dim: 128 - epochs: 50 + epochs: 1 shuffle: True seed: 2023 monitor: 'AUC' - monitor_mode: 'max' \ No newline at end of file + monitor_mode: 'max' diff --git a/model_zoo/multitask/SharedBottom/fuxictr_version.py b/model_zoo/multitask/ShareBottom/fuxictr_version.py similarity index 100% rename from model_zoo/multitask/SharedBottom/fuxictr_version.py rename to model_zoo/multitask/ShareBottom/fuxictr_version.py diff --git a/model_zoo/multitask/SharedBottom/run_expid.py b/model_zoo/multitask/ShareBottom/run_expid.py similarity index 94% rename from model_zoo/multitask/SharedBottom/run_expid.py rename to model_zoo/multitask/ShareBottom/run_expid.py index 79c6c51..3a74f94 100644 --- a/model_zoo/multitask/SharedBottom/run_expid.py +++ b/model_zoo/multitask/ShareBottom/run_expid.py @@ -39,7 +39,7 @@ ''' parser = argparse.ArgumentParser() parser.add_argument('--config', type=str, default='./config/', help='The config directory.') - parser.add_argument('--expid', type=str, default='SharedBottom_test', help='The experiment id to run.') + parser.add_argument('--expid', type=str, default='ShareBottom_test', help='The experiment id to run.') parser.add_argument('--gpu', type=int, default=-1, help='The gpu index, -1 for cpu') args = vars(parser.parse_args()) diff --git a/model_zoo/multitask/SharedBottom/src/SharedBottom.py b/model_zoo/multitask/ShareBottom/src/ShareBottom.py similarity index 97% rename from model_zoo/multitask/SharedBottom/src/SharedBottom.py rename to model_zoo/multitask/ShareBottom/src/ShareBottom.py index 00d1394..b463317 100644 --- a/model_zoo/multitask/SharedBottom/src/SharedBottom.py +++ b/model_zoo/multitask/ShareBottom/src/ShareBottom.py @@ -22,7 +22,7 @@ from fuxictr.pytorch.layers import FeatureEmbedding, MLP_Block -class SharedBottom(MultiTaskModel): +class ShareBottom(MultiTaskModel): def __init__(self, feature_map, model_id="SharedBottom", @@ -40,7 +40,7 @@ def __init__(self, embedding_regularizer=None, net_regularizer=None, **kwargs): - super(SharedBottom, self).__init__(feature_map, + super(ShareBottom, self).__init__(feature_map, task=task, loss_weight=loss_weight, num_tasks=num_tasks, diff --git a/model_zoo/multitask/ShareBottom/src/__init__.py b/model_zoo/multitask/ShareBottom/src/__init__.py new file mode 100644 index 0000000..901e562 --- /dev/null +++ b/model_zoo/multitask/ShareBottom/src/__init__.py @@ -0,0 +1 @@ +from .ShareBottom import * diff --git a/model_zoo/multitask/SharedBottom/src/__init__.py b/model_zoo/multitask/SharedBottom/src/__init__.py deleted file mode 100644 index 0b4fe9e..0000000 --- a/model_zoo/multitask/SharedBottom/src/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from .SharedBottom import * \ No newline at end of file diff --git a/model_zoo/multitask/__init__.py b/model_zoo/multitask/__init__.py index f425c77..7e47b63 100644 --- a/model_zoo/multitask/__init__.py +++ b/model_zoo/multitask/__init__.py @@ -1,2 +1,3 @@ from .MMoE.src import MMoE -from .SharedBottom.src import SharedBottom \ No newline at end of file +from .ShareBottom.src import ShareBottom +from .PLE.src import PLE