{"id":18401713,"url":"https://github.com/borealisai/mmoeex-mtl","last_synced_at":"2025-04-07T07:31:40.389Z","repository":{"id":59509934,"uuid":"368363801","full_name":"BorealisAI/MMoEEx-MTL","owner":"BorealisAI","description":"PyTorch Implementation of the Multi-gate Mixture-of-Experts with Exclusivity (MMoEEx)","archived":false,"fork":false,"pushed_at":"2021-07-06T19:45:38.000Z","size":32898,"stargazers_count":31,"open_issues_count":2,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-22T14:12:08.783Z","etag":null,"topics":["mixture-of-experts","multi-task-learning","pytorch"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BorealisAI.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}},"created_at":"2021-05-18T01:13:38.000Z","updated_at":"2025-02-19T09:14:39.000Z","dependencies_parsed_at":"2022-09-17T15:22:24.593Z","dependency_job_id":null,"html_url":"https://github.com/BorealisAI/MMoEEx-MTL","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/BorealisAI%2FMMoEEx-MTL","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BorealisAI%2FMMoEEx-MTL/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BorealisAI%2FMMoEEx-MTL/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BorealisAI%2FMMoEEx-MTL/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BorealisAI","download_url":"https://codeload.github.com/BorealisAI/MMoEEx-MTL/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247612111,"owners_count":20966668,"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":["mixture-of-experts","multi-task-learning","pytorch"],"created_at":"2024-11-06T02:39:43.058Z","updated_at":"2025-04-07T07:31:38.481Z","avatar_url":"https://github.com/BorealisAI.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MMoEEx-MTL\n\nThis repository provides the codes for training and testing the Multi-Gated Mixture of Expert with Exclusivity (MMoEEx)\nused for multi-task learning as described in the paper:\n\n[Raquel Aoki, Frederick Tung, Gabriel L. Oliveira, Heterogeneous multi-task learning with expert diversity. BIOKDD 2021](http://arxiv.org/abs/2106.10595)\n\n## How to Run\n\n1. To run the code on terminal:\n\n   Create a virtual environment using the these [requirements](requirements.txt), and run the code:\n   ```\n   python main.py config/config_file.yaml\n   ```\t\n\n2. Config Files most import parameters:\n\n   a. `tasks`: define the tasks the model will use and depends on the `data` being used.\n\n   b. `models`: MMoE (no task exclusivity/exclusion, no MAML), Md (task exclusivity/exclusion, no MAML), and MMoEEx (\n   task exclusivity/exclusion + MAML)\n\n   c. `save_tensor`: boolean.\n\n   d. `seqlen`, `prop` and `lambda`: Required only if `data` is `mimic`. `seqlen` is the maximum size of the\n   sequences; `prop` is the proportion of the dataset being used; `lambda` is the loss weight.\n\nWe also added [four examples of config](config) files in our repo.\n\n## Files Structure:\n\n* `main.py`: call the data loaders, responsible for the training phase (loss functions, optimization);\n* `data_preprocessing.py`: reads the data, performs all the preprocessing, creates and outputs the data loaders;\n* `mmoeex.py`: it has the `torch.nn.Module`s for the models, implementation of MMoE, and MMoEEX;\n* `utils.py`: support functions for main.py (organize outputs, calculate AUC values, gradients, etc).\n\n## Datasets\n\nShort description of the datasets\n\n### Census\n\n3 tasks:\n\n- Income (+50000)\n- marital status (is married)\n- education (at least undergrad).\n\nTraining data (199,523), validation shape (49,881), test shape (49,881), and 482 features.\n\nThis dataset is public available, so our code download the datasets into the `mtl_datasets/census_dataset` folder. If\nyou already have the data downloaded in this folder, the code will only load the data.\n\n### MIMIC3\n\n4 tasks:\n\n- IHM (in-hospital Mortality)\n- decomp (decompensation, time-series)\n- LOS (length-of-stay, time-series)\n- pheno (phenotyping).\n\nTraining (28233), validation (6152), test (6056), **time-series** data, 76 features\n\nThis dataset is not public available, so you need to submit a request to work with this data\nat [https://mimic.mit.edu/iii/gettingstarted/](https://mimic.mit.edu/iii/gettingstarted/). We followed the\npre-processing steps available\nhere: [https://github.com/YerevaNN/mimic3-benchmarks](https://github.com/YerevaNN/mimic3-benchmarks) and saved the\nresults in a folder named `mimic_dataset`.\n\n### PCBA\n\n128 tasks: 439863 molecules, with 1024 features. Each task is a biological target.\n\nThis dataset is public available. We provide this dataset in our repo because its pre-processing takes more time than\nthe Census dataset. This [Jupyter Notebook](resources/pcba_preprocessing.ipynb) shows from where to download and perform\nthe pre-processing.\n\n## Citation\n\nIf you use MMoEEx-MTL, please consider citing:\n\n```latex\n@inproceedings{AokiBIOKDD21,\n  author    = {Raquel Aoki and Frederick Tung and Gabriel L. Oliveira},\n  title     = {{Heterogeneous Multi-task Learning with Expert Diversity}},\n  booktitle = {BIOKDD},\n  year      = {2021},\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fborealisai%2Fmmoeex-mtl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fborealisai%2Fmmoeex-mtl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fborealisai%2Fmmoeex-mtl/lists"}