{"id":18053677,"url":"https://github.com/microsoft/personalizedfl","last_synced_at":"2025-04-05T21:09:13.885Z","repository":{"id":46067616,"uuid":"488824986","full_name":"microsoft/PersonalizedFL","owner":"microsoft","description":"Personalized federated learning codebase for research","archived":false,"fork":false,"pushed_at":"2023-10-04T01:05:44.000Z","size":279,"stargazers_count":377,"open_issues_count":5,"forks_count":49,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-05T21:09:09.250Z","etag":null,"topics":["deep-learning","federated-learning","machine-learning","non-iid","personalized-federated-learning"],"latest_commit_sha":null,"homepage":"http://aka.ms/pfed","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/microsoft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":"SUPPORT.md","governance":null,"roadmap":null,"authors":null}},"created_at":"2022-05-05T03:57:57.000Z","updated_at":"2025-04-01T14:10:49.000Z","dependencies_parsed_at":"2024-01-16T09:01:05.064Z","dependency_job_id":"81d35191-f9cb-4475-8df7-528e02d174a7","html_url":"https://github.com/microsoft/PersonalizedFL","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/microsoft%2FPersonalizedFL","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2FPersonalizedFL/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2FPersonalizedFL/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2FPersonalizedFL/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/microsoft","download_url":"https://codeload.github.com/microsoft/PersonalizedFL/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247399878,"owners_count":20932880,"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","federated-learning","machine-learning","non-iid","personalized-federated-learning"],"created_at":"2024-10-31T00:05:38.460Z","updated_at":"2025-04-05T21:09:13.852Z","avatar_url":"https://github.com/microsoft.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PersonalizedFL: Personalized Federated Learning Codebase\n\nAn easy-to-learn, easy-to-extend, and for-fair-comparison codebase based on PyTorch for federated learning (FL). \nPlease note that this repository is designed mainly for research, and we discard lots of unnecessary extensions for a quick start.\nExample usage: when you want to recognize activities of different persons without accessing their privacy data; when you want to build a model based on multiple patients' data but not access their own data.\n\n## Implemented Algorithms\n\nAs initial version, we support the following algoirthms. We are working on more algorithms. \n\n1. Baseline, train in the client without communication.\n2. FedAvg [1].\n3. FedProx [2].\n4. FedBN [3].\n5. FedAP [4].\n6. MetaFed [5].\n7. FedCLIP [6].\n\n**NOTE:** The code for FedCLIP is located at [`./fedclip`](./fedclip/). This folder is independent of other folders in this repo. You can just download the folder and run it for this algorithm.\n\n## Installation\n\n```\ngit clone https://github.com/microsoft/PersonalizedFL.git\ncd PersonalizedFL\n```\nWe recommend to use `Python 3.7.1` and `torch 1.7.1` which are in our development environment. \nFor more environmental details and a full re-production of our results, please refer to `luwang0517/torch10:latest` (docker) or `jindongwang/docker` (docker).\n\n## Dataset\n\nOur code supports the following dataset:\n\n* [VLCS](https://wjdcloud.blob.core.windows.net/dataset/VLCS/VLCS.zip)\n* [PACS](https://wjdcloud.blob.core.windows.net/dataset/PACS.zip)\n* [Office-Home](https://wjdcloud.blob.core.windows.net/dataset/OfficeHome.zip)\n* [PAMAP2](https://wjdcloud.blob.core.windows.net/dataset/cycfed/pamap.tar.gz)\n* [COVID](https://wjdcloud.blob.core.windows.net/dataset/cycfed/covid19.tar.gz)\n* [OrganS-MNIST](https://wjdcloud.blob.core.windows.net/dataset/cycfed/medmnist.tar.gz)\n* [OrganA-MNIST](https://wjdcloud.blob.core.windows.net/dataset/cycfed/medmnistA.tar.gz)\n* [OrganC-MNIST](https://wjdcloud.blob.core.windows.net/dataset/cycfed/medmnistC.tar.gz)\n\nIf you want to use your own dataset, please modifty `datautil/prepare_data.py` to contain the dataset.\n\n## Usage\n\n1. Modify the file in the scripts\n2. `bash run.sh`\n\n## Benchmark\n\nWe offer a benchmark for OrganS-MNIST. Please note that the results are based on the data splits in `split/medmnist0.1`. Different data splits may lead different results. For complete parameters, please refer to `run.sh`.\n\n| Non-iid alpha | Base | FedAvg | FedProx | FedBN | FedAP | MetaFed |\n|----------|----------|----------|----------|----------|----------|----------|\n| 0.1 | 73.99 | 75.62 | 75.97 | 79.96 | 81.33 | 83.87 |\n| 0.01 | 75.83 | 74.81 | 75.09 | 81.85 | 82.87 | 84.98 |\n\n## Customization\n\nIt is easy to design your own method following the steps:\n\n1. Add your method to `alg/`, and add the reference to it in `alg/algs.py`.\n\n2. Midify `scripts/run.sh` and execuate it.\n\n\n## Contribution\n\nThe toolkit is under active development and contributions are welcome! Feel free to submit issues and PRs to ask questions or contribute your code. If you would like to implement new features, please submit a issue to discuss with us first.\n\n## Reference\n\n[1] McMahan, Brendan, et al. \"Communication-efficient learning of deep networks from decentralized data.\" Artificial intelligence and statistics. PMLR, 2017.\n\n[2] Li, Tian, et al. \"Federated optimization in heterogeneous networks.\" Proceedings of Machine Learning and Systems 2 (2020): 429-450.\n\n[3] Li, Xiaoxiao, et al. \"FedBN: Federated Learning on Non-IID Features via Local Batch Normalization.\" International Conference on Learning Representations. 2021.\n\n[4] Lu, Wang, et al. \"Personalized Federated Learning with Adaptive Batchnorm for Healthcare.\" IEEE Transactions on Big Data (2022).\n\n[5] Yiqiang, Chen, et al. \"MetaFed: Federated Learning among Federations with Cyclic Knowledge Distillation for Personalized Healthcare.\" FL-IJCAI Workshop 2022.\n\n[6] Lu, Wang, et al. \"FedCLIP: Fast Generalization and Personalization for CLIP in Federated Learning.\" IEEE Data Engineering Bulletin 2023. \n\n## Citation\n\nIf you think this toolkit or the results are helpful to you and your research, please cite us!\n\n```\n@Misc{PersonalizedFL,\nhowpublished = {\\url{https://github.com/microsoft/PersonalizedFL}},   \ntitle = {PersonalizedFL: Personalized Federated Learning Toolkit},  \nauthor = {Lu, Wang and Wang, Jindong}\n}  \n```\n\n## Contact\n\n- Wang lu: luwang@ict.ac.cn\n- [Jindong Wang](http://www.jd92.wang/): jindongwang@outlook.com\n\n## Contributing\n\nThis project welcomes contributions and suggestions.  Most contributions require you to agree to a\nContributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us\nthe rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.\n\nWhen you submit a pull request, a CLA bot will automatically determine whether you need to provide\na CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions\nprovided by the bot. You will only need to do this once across all repos using our CLA.\n\nThis project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).\nFor more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or\ncontact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.\n\n## Trademarks\n\nThis project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft \ntrademarks or logos is subject to and must follow \n[Microsoft's Trademark \u0026 Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).\nUse of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.\nAny use of third-party trademarks or logos are subject to those third-party's policies.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrosoft%2Fpersonalizedfl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicrosoft%2Fpersonalizedfl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrosoft%2Fpersonalizedfl/lists"}