{"id":28098863,"url":"https://github.com/rmanluo/mamdr","last_synced_at":"2025-05-13T17:59:03.594Z","repository":{"id":43488070,"uuid":"455762785","full_name":"RManLuo/MAMDR","owner":"RManLuo","description":"Official code implementation for ICDE 23 paper MAMDR: A Model Agnostic Learning Method for Multi-Domain Recommendation","archived":false,"fork":false,"pushed_at":"2023-11-27T03:38:56.000Z","size":1866,"stargazers_count":32,"open_issues_count":0,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-05-22T00:06:30.527Z","etag":null,"topics":["deep-learning","meta-learning","multi-domain-learning","recommender-system"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RManLuo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-02-05T03:14:52.000Z","updated_at":"2024-04-09T19:45:15.000Z","dependencies_parsed_at":"2023-11-27T04:38:25.633Z","dependency_job_id":null,"html_url":"https://github.com/RManLuo/MAMDR","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RManLuo%2FMAMDR","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RManLuo%2FMAMDR/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RManLuo%2FMAMDR/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RManLuo%2FMAMDR/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RManLuo","download_url":"https://codeload.github.com/RManLuo/MAMDR/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254000037,"owners_count":21997374,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deep-learning","meta-learning","multi-domain-learning","recommender-system"],"created_at":"2025-05-13T17:59:02.927Z","updated_at":"2025-05-13T17:59:03.569Z","avatar_url":"https://github.com/RManLuo.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MAMDR: A Model Agnostic Learning Method for Multi-Domain Recommendation\nOfficial code implementation for ICDE 23 paper MAMDR: A Model Agnostic Learning Method for Multi-Domain Recommendation.\n\n[\\[Paper\\]](https://arxiv.org/abs/2202.12524)   \n[\\[Slides\\]](./ICDE-23-Slides-MAMDR.pdf)  \n## Requirements\n```text\ntensorflow-gpu==1.12.0\nrequests==2.26.0\ntqdm==4.62.2\npandas==1.1.5\nscikit-learn==0.24.2\nnumpy==1.16.6\ndeepctr==0.9.0\n```\n* RTX 2080 + 64G RAM\n* python: 3.6\n* Ubuntu 20.04\n## Data Preprocess\n\n### Amazon dataset\nEnter `dataset/Amazon`\n\nraw dataset at：https://nijianmo.github.io/amazon/index.html#complete-data\n1. change the split rule in config_*.json.\n2. run `split.py --config config_*.json`. It will automatically download and split the domains.\n\n### Taobao dataset\nEnter `dataset/Taobao`\n1. [download dataset](https://tianchi.aliyun.com/dataset/dataDetail?dataId=9716)\n2. unzip the dataset into `raw_data`\n   1. theme_click_log.csv\n   2. theme_item_pool.csv\n   3. user_item_purchase_log.csv\n   4. item_embedding.csv\n   5. user_embedding.csv\n3. change the dataset config in `config_*.json`. theme_num = -1 denotes using all domains.\n4. run `split.py --config config_*.json` to create dataset.\n\n## Preprocessed dataset\nYou can download the datasets and extract the folders into `dataset/Amazon` and `dataset/Taobao`, respectively.\n* [Amazon-6/13](https://drive.google.com/file/d/1JpzaDZioLTlGMJdiLIvrP8m9ngOGe7dI/view?usp=sharing)\n* [Taobao-10/20/30](https://drive.google.com/file/d/1L-Y6KZ5-DWKYLspaLo0oxPAQ-MxUgIKe/view?usp=sharing)\n## Run experiments\n\n### Run baselines\n* change model name in `config.json`\n``` python\npython3 run.py --config config/Taobao-10/deepctr.json\n```\n### Run Domain Negotiation\n``` python\npython3 run.py --config config/Taobao-10/deepctr_DN.json\n```\n### Run MAMDR\n``` python\npython3 run.py --config config/Taobao-10/deepctr_DN+DR.json\n```\n\n## Config Description\n\nModel Name：\n\n``basemodel_extenstion(s)``\n\n### Base model：\n\nsingle domain： `mlp`, `wdl`, `nfm`, `autoint`, `deepfm`\n\nmulti tasks： `shared_bottom`, `mmoe`, `ple`\n\nmulti domain： `star`\n\n### Extenstion：\n```json\ndefault: joint learning\nseparate: separatly train for each domain\nfinetune: finetune after joint training\nmeta: training using MAML\nreptile: reptile meta learning\nmldg: MLDG\nuncertainty_weight: weighted loss\npcgrad: pcgrad        \ndomain_negotiation: domain negotiation meta learning\nmamdr: DN + DR       \nbatch: using batch for meta learning\n```\n#### Example\n* MLP + Joint:`mlp`\n* DeepFM + Joint: `deepfm`\n* MLP + Joint + Finetune:`mlp_finetune`\n* MLP + MAML:`mlp_meta_finetune`\n* MLP + DN: `mlp_meta_domain_negotiation_finetune_`\n* MLP + DN + DR : `mlp_meta_mamdr_finetune`\n\nYou can find more examples in `config/`.\n\n### Config example\n```json\n{\n  \"model\": {\n    \"name\": \"mlp_meta_mamdr_finetune\", // model name\n    \"norm\": \"none\", // noarmalization method for star: none, bn, pn\n    \"dense\": \"dense\", // dense for star: dense, star\n    \"auxiliary_net\": false,\n    \"user_dim\": 128,\n    \"item_dim\": 128,\n    \"domain_dim\": 128,\n    \"auxiliary_dim\": 128,\n    \"hidden_dim\": [ // hidden sizes for hidden layers\n      256,\n      128,\n      64\n    ],\n    \"dropout\": 0.5\n  },\n  \"train\": {\n    \"load_pretrain_emb\": true, // whether load pretrain embding, only support for Taobao\n    \"emb_trainable\": false, // whether train embedding\n    \"epoch\": 99999,\n    \"learning_rate\": 0.001, // inner learning rate\n    \"meta_learning_rate\": 0.1, // outer learning rate\n    \"domain_meta_learning_rate\": 0.1, // Not used\n    \"merged_method\": \"plus\", \n    \"sample_num\": 5, // sample number for DR\n    \"add_query_domain\": true,\n    \"finetune_every_epoch\": false,\n    \"shuffle_sequence\": true, // whether shuffle the domain sequence\n    \"meta_sequence\": \"random\",\n    \"target_domain\": -1, // disabled\n    \"domain_regulation_step\": 0, // disabled\n    \"meta_train_step\": 0, // disabled\n    \"meta_finetune_step\": 0, // disabled\n    \"meta_split\": \"train-train\", // how to split the query and support set for meta-learning: train-train, meta-train/val, meta-train/val-no-exclusive\n    \"meta_split_ratio\": 0.8,\n    \"average_meta_grad\": \"none\",\n    \"meta_parms\": [\n      \"all\"\n    ],\n    \"result_save_path\": \"result\",\n    \"checkpoint_path\": \"checkpoint\",\n    \"loss\": \"binary_crossentropy\",\n    \"optimizer\": \"adam\",\n    \"patience\": 3,\n    \"val_every_step\": 1,\n    \"histogram_freq\": 0,\n    \"shuffle_buff_size\": 10000\n  },\n  \"dataset\": {\n    \"name\": \"Taobao\",\n    \"dataset_path\": \"dataset/Taobao\",\n    \"domain_split_path\": \"split_by_theme_10\",\n    \"batch_size\": 1024,\n    \"shuffle_buffer_size\": 10000,\n    \"num_parallel_reads\": 8,\n    \"seed\": 123\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frmanluo%2Fmamdr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frmanluo%2Fmamdr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frmanluo%2Fmamdr/lists"}