flwr-nightly 1.5.0.dev20230615__tar.gz → 1.5.0.dev20230619__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/PKG-INFO +1 -1
  2. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/pyproject.toml +38 -1
  3. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/setup.py +1 -1
  4. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/client/grpc_client/connection.py +5 -2
  5. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/common/constant.py +1 -1
  6. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/server/app.py +1 -1
  7. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/server/state/sqlite_state.py +1 -1
  8. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/server/strategy/dpfedavg_adaptive.py +1 -0
  9. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/server/strategy/dpfedavg_fixed.py +1 -0
  10. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/server/strategy/fault_tolerant_fedavg.py +1 -0
  11. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/server/strategy/fedadagrad.py +6 -6
  12. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/server/strategy/fedadam.py +6 -5
  13. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/server/strategy/fedavg.py +4 -4
  14. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/server/strategy/fedavg_android.py +4 -5
  15. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/server/strategy/fedavgm.py +2 -3
  16. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/server/strategy/fedmedian.py +1 -1
  17. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/server/strategy/fedopt.py +2 -2
  18. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/server/strategy/fedprox.py +13 -11
  19. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/server/strategy/fedtrimmedavg.py +7 -8
  20. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/server/strategy/fedxgb_nn_avg.py +8 -6
  21. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/server/strategy/fedyogi.py +5 -4
  22. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/server/strategy/krum.py +5 -5
  23. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/server/strategy/qfedavg.py +1 -1
  24. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/server/utils/tensorboard.py +1 -1
  25. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/LICENSE +0 -0
  26. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/README.md +0 -0
  27. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/__init__.py +0 -0
  28. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/client/__init__.py +0 -0
  29. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/client/app.py +0 -0
  30. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/client/client.py +0 -0
  31. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/client/dpfedavg_numpy_client.py +0 -0
  32. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/client/grpc_client/__init__.py +0 -0
  33. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/client/grpc_rere_client/__init__.py +0 -0
  34. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/client/grpc_rere_client/connection.py +0 -0
  35. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/client/message_handler/__init__.py +0 -0
  36. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/client/message_handler/message_handler.py +0 -0
  37. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/client/message_handler/task_handler.py +0 -0
  38. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/client/numpy_client.py +0 -0
  39. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/client/rest_client/__init__.py +0 -0
  40. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/client/rest_client/connection.py +0 -0
  41. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/common/__init__.py +0 -0
  42. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/common/address.py +0 -0
  43. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/common/date.py +0 -0
  44. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/common/dp.py +0 -0
  45. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/common/grpc.py +0 -0
  46. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/common/logger.py +0 -0
  47. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/common/parameter.py +0 -0
  48. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/common/serde.py +0 -0
  49. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/common/telemetry.py +0 -0
  50. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/common/typing.py +0 -0
  51. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/common/version.py +0 -0
  52. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/driver/__init__.py +0 -0
  53. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/driver/app.py +0 -0
  54. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/driver/driver.py +0 -0
  55. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/driver/driver_client_manager.py +0 -0
  56. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/driver/driver_client_proxy.py +0 -0
  57. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/proto/__init__.py +0 -0
  58. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/proto/driver_pb2.py +0 -0
  59. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/proto/driver_pb2.pyi +0 -0
  60. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/proto/driver_pb2_grpc.py +0 -0
  61. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/proto/driver_pb2_grpc.pyi +0 -0
  62. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/proto/fleet_pb2.py +0 -0
  63. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/proto/fleet_pb2.pyi +0 -0
  64. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/proto/fleet_pb2_grpc.py +0 -0
  65. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/proto/fleet_pb2_grpc.pyi +0 -0
  66. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/proto/node_pb2.py +0 -0
  67. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/proto/node_pb2.pyi +0 -0
  68. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/proto/node_pb2_grpc.py +0 -0
  69. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/proto/node_pb2_grpc.pyi +0 -0
  70. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/proto/task_pb2.py +0 -0
  71. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/proto/task_pb2.pyi +0 -0
  72. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/proto/task_pb2_grpc.py +0 -0
  73. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/proto/task_pb2_grpc.pyi +0 -0
  74. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/proto/transport_pb2.py +0 -0
  75. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/proto/transport_pb2.pyi +0 -0
  76. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/proto/transport_pb2_grpc.py +0 -0
  77. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/proto/transport_pb2_grpc.pyi +0 -0
  78. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/py.typed +0 -0
  79. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/server/__init__.py +0 -0
  80. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/server/client_manager.py +0 -0
  81. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/server/client_proxy.py +0 -0
  82. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/server/criterion.py +0 -0
  83. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/server/driver/__init__.py +0 -0
  84. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/server/driver/driver_servicer.py +0 -0
  85. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/server/fleet/__init__.py +0 -0
  86. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/server/fleet/grpc_bidi/__init__.py +0 -0
  87. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/server/fleet/grpc_bidi/driver_client_manager.py +0 -0
  88. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/server/fleet/grpc_bidi/flower_service_servicer.py +0 -0
  89. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/server/fleet/grpc_bidi/grpc_bridge.py +0 -0
  90. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/server/fleet/grpc_bidi/grpc_client_proxy.py +0 -0
  91. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/server/fleet/grpc_bidi/grpc_server.py +0 -0
  92. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/server/fleet/grpc_bidi/ins_scheduler.py +0 -0
  93. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/server/fleet/grpc_rere/__init__.py +0 -0
  94. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/server/fleet/grpc_rere/fleet_servicer.py +0 -0
  95. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/server/fleet/message_handler/__init__.py +0 -0
  96. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/server/fleet/message_handler/message_handler.py +0 -0
  97. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/server/fleet/rest_rere/__init__.py +0 -0
  98. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/server/fleet/rest_rere/rest_api.py +0 -0
  99. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/server/history.py +0 -0
  100. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/server/server.py +0 -0
  101. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/server/state/__init__.py +0 -0
  102. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/server/state/in_memory_state.py +0 -0
  103. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/server/state/state.py +0 -0
  104. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/server/state/state_factory.py +0 -0
  105. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/server/strategy/__init__.py +0 -0
  106. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/server/strategy/aggregate.py +0 -0
  107. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/server/strategy/strategy.py +0 -0
  108. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/server/utils/__init__.py +0 -0
  109. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/server/utils/validator.py +0 -0
  110. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/simulation/__init__.py +0 -0
  111. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/simulation/app.py +0 -0
  112. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/simulation/ray_transport/__init__.py +0 -0
  113. {flwr_nightly-1.5.0.dev20230615 → flwr_nightly-1.5.0.dev20230619}/src/py/flwr/simulation/ray_transport/ray_client_proxy.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: flwr-nightly
3
- Version: 1.5.0.dev20230615
3
+ Version: 1.5.0.dev20230619
4
4
  Summary: Flower: A Friendly Federated Learning Framework
5
5
  Home-page: https://flower.dev
6
6
  License: Apache-2.0
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
4
4
 
5
5
  [tool.poetry]
6
6
  name = "flwr-nightly"
7
- version = "1.5.0-dev20230615"
7
+ version = "1.5.0-dev20230619"
8
8
  description = "Flower: A Friendly Federated Learning Framework"
9
9
  license = "Apache-2.0"
10
10
  authors = ["The Flower Authors <hello@flower.dev>"]
@@ -98,6 +98,7 @@ furo = "==2022.12.7"
98
98
  sphinx-reredirects = "==0.1.2"
99
99
  nbsphinx = "==0.9.2"
100
100
  nbstripout = "==0.6.1"
101
+ ruff = "==0.0.272"
101
102
  sphinx-argparse = "==0.4.0"
102
103
  pipreqs = "==0.4.13"
103
104
 
@@ -156,3 +157,39 @@ follow_imports_for_stubs = true
156
157
  [tool.docformatter]
157
158
  wrap-summaries = 88
158
159
  wrap-descriptions = 88
160
+
161
+ [tool.ruff]
162
+ target-version = "py37"
163
+ line-length = 88
164
+ select = ["D", "E", "F", "W", "B", "ISC", "C4"]
165
+ fixable = ["D", "E", "F", "W", "B", "ISC", "C4"]
166
+ ignore = ["B024", "B027"]
167
+ exclude = [
168
+ ".bzr",
169
+ ".direnv",
170
+ ".eggs",
171
+ ".git",
172
+ ".hg",
173
+ ".mypy_cache",
174
+ ".nox",
175
+ ".pants.d",
176
+ ".pytype",
177
+ ".ruff_cache",
178
+ ".svn",
179
+ ".tox",
180
+ ".venv",
181
+ "__pypackages__",
182
+ "_build",
183
+ "buck-out",
184
+ "build",
185
+ "dist",
186
+ "node_modules",
187
+ "venv",
188
+ "proto",
189
+ ]
190
+
191
+ [tool.ruff.pydocstyle]
192
+ convention = "numpy"
193
+
194
+ [tool.ruff.per-file-ignores]
195
+ "src/py/flwr/server/strategy/*.py" = ["E501"]
@@ -52,7 +52,7 @@ entry_points = \
52
52
 
53
53
  setup_kwargs = {
54
54
  'name': 'flwr-nightly',
55
- 'version': '1.5.0.dev20230615',
55
+ 'version': '1.5.0.dev20230619',
56
56
  'description': 'Flower: A Friendly Federated Learning Framework',
57
57
  'long_description': '# Flower: A Friendly Federated Learning Framework\n\n<p align="center">\n <a href="https://flower.dev/">\n <img src="https://flower.dev/_next/image/?url=%2F_next%2Fstatic%2Fmedia%2Fflower_white_border.c2012e70.png&w=640&q=75" width="140px" alt="Flower Website" />\n </a>\n</p>\n<p align="center">\n <a href="https://flower.dev/">Website</a> |\n <a href="https://flower.dev/blog">Blog</a> |\n <a href="https://flower.dev/docs/">Docs</a> |\n <a href="https://flower.dev/conf/flower-summit-2022">Conference</a> |\n <a href="https://flower.dev/join-slack">Slack</a>\n <br /><br />\n</p>\n\n[![GitHub license](https://img.shields.io/github/license/adap/flower)](https://github.com/adap/flower/blob/main/LICENSE)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/adap/flower/blob/main/CONTRIBUTING.md)\n![Build](https://github.com/adap/flower/actions/workflows/flower.yml/badge.svg)\n![Downloads](https://pepy.tech/badge/flwr)\n[![Slack](https://img.shields.io/badge/Chat-Slack-red)](https://flower.dev/join-slack)\n\nFlower (`flwr`) is a framework for building federated learning systems. The\ndesign of Flower is based on a few guiding principles:\n\n* **Customizable**: Federated learning systems vary wildly from one use case to\n another. Flower allows for a wide range of different configurations depending\n on the needs of each individual use case.\n\n* **Extendable**: Flower originated from a research project at the University of\n Oxford, so it was built with AI research in mind. Many components can be\n extended and overridden to build new state-of-the-art systems.\n\n* **Framework-agnostic**: Different machine learning frameworks have different\n strengths. Flower can be used with any machine learning framework, for\n example, [PyTorch](https://pytorch.org),\n [TensorFlow](https://tensorflow.org), [Hugging Face Transformers](https://huggingface.co/), [PyTorch Lightning](https://pytorchlightning.ai/), [MXNet](https://mxnet.apache.org/), [scikit-learn](https://scikit-learn.org/), [JAX](https://jax.readthedocs.io/), [TFLite](https://tensorflow.org/lite/), [fastai](https://www.fast.ai/), [Pandas](https://pandas.pydata.org/\n) for federated analytics, or even raw [NumPy](https://numpy.org/)\n for users who enjoy computing gradients by hand.\n\n* **Understandable**: Flower is written with maintainability in mind. The\n community is encouraged to both read and contribute to the codebase.\n\nMeet the Flower community on [flower.dev](https://flower.dev)!\n\n## Federated Learning Tutorial\n\nFlower\'s goal is to make federated learning accessible to everyone. This series of tutorials introduces the fundamentals of federated learning and how to implement them in Flower.\n\n0. **What is Federated Learning?**\n\n [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/adap/flower/blob/main/doc/source/tutorial/Flower-0-What-is-FL.ipynb) (or open the [Jupyter Notebook](https://github.com/adap/flower/blob/main/doc/source/tutorial/Flower-0-What-is-FL.ipynb))\n\n1. **An Introduction to Federated Learning**\n\n [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/adap/flower/blob/main/doc/source/tutorial/Flower-1-Intro-to-FL-PyTorch.ipynb) (or open the [Jupyter Notebook](https://github.com/adap/flower/blob/main/doc/source/tutorial/Flower-1-Intro-to-FL-PyTorch.ipynb))\n\n2. **Using Strategies in Federated Learning**\n\n [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/adap/flower/blob/main/doc/source/tutorial/Flower-2-Strategies-in-FL-PyTorch.ipynb) (or open the [Jupyter Notebook](https://github.com/adap/flower/blob/main/doc/source/tutorial/Flower-2-Strategies-in-FL-PyTorch.ipynb))\n \n3. **Building Strategies for Federated Learning**\n\n [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/adap/flower/blob/main/doc/source/tutorial/Flower-3-Building-a-Strategy-PyTorch.ipynb) (or open the [Jupyter Notebook](https://github.com/adap/flower/blob/main/doc/source/tutorial/Flower-3-Building-a-Strategy-PyTorch.ipynb))\n \n4. **Custom Clients for Federated Learning**\n\n [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/adap/flower/blob/main/doc/source/tutorial/Flower-4-Client-and-NumPyClient-PyTorch.ipynb) (or open the [Jupyter Notebook](https://github.com/adap/flower/blob/main/doc/source/tutorial/Flower-4-Client-and-NumPyClient-PyTorch.ipynb))\n\nStay tuned, more tutorials are coming soon. Topics include **Privacy and Security in Federated Learning**, and **Scaling Federated Learning**.\n\n## Documentation\n\n[Flower Docs](https://flower.dev/docs):\n* [Installation](https://flower.dev/docs/installation.html)\n* [Quickstart (TensorFlow)](https://flower.dev/docs/quickstart-tensorflow.html)\n* [Quickstart (PyTorch)](https://flower.dev/docs/quickstart-pytorch.html)\n* [Quickstart (Hugging Face [code example])](https://flower.dev/docs/quickstart-huggingface.html)\n* [Quickstart (PyTorch Lightning [code example])](https://flower.dev/docs/quickstart-pytorch-lightning.html)\n* [Quickstart (MXNet)](https://flower.dev/docs/example-mxnet-walk-through.html)\n* [Quickstart (Pandas)](https://flower.dev/docs/quickstart-pandas.html)\n* [Quickstart (fastai)](https://flower.dev/docs/quickstart-fastai.html)\n* [Quickstart (JAX)](https://github.com/adap/flower/tree/main/examples/quickstart_jax)\n* [Quickstart (scikit-learn)](https://github.com/adap/flower/tree/main/examples/sklearn-logreg-mnist)\n* [Quickstart (TFLite on Android [code example])](https://github.com/adap/flower/tree/main/examples/android)\n* [Quickstart (iOS)](https://flower.dev/docs/quickstart-ios.html)\n\n## Flower Baselines\n\nFlower Baselines is a collection of community-contributed experiments that reproduce the experiments performed in popular federated learning publications. Researchers can build on Flower Baselines to quickly evaluate new ideas:\n\n* [FedAvg](https://arxiv.org/abs/1602.05629):\n * [MNIST](https://github.com/adap/flower/tree/main/baselines/flwr_baselines/publications/fedavg_mnist)\n* [FedProx](https://arxiv.org/abs/1812.06127):\n * [MNIST](https://github.com/adap/flower/tree/main/baselines/flwr_baselines/publications/fedprox_mnist)\n* [FedBN: Federated Learning on non-IID Features via Local Batch Normalization](https://arxiv.org/abs/2102.07623):\n * [Convergence Rate](https://github.com/adap/flower/tree/main/baselines/flwr_baselines/publications/fedbn/convergence_rate)\n* [Adaptive Federated Optimization](https://arxiv.org/abs/2003.00295):\n * [CIFAR-10/100](https://github.com/adap/flower/tree/main/baselines/flwr_baselines/publications/adaptive_federated_optimization)\n\nCheck the Flower documentation to learn more: [Using Baselines](https://flower.dev/docs/using-baselines.html)\n\nThe Flower community loves contributions! Make your work more visible and enable others to build on it by contributing it as a baseline: [Contributing Baselines](https://flower.dev/docs/contributing-baselines.html)\n\n## Flower Usage Examples\n\nSeveral code examples show different usage scenarios of Flower (in combination with popular machine learning frameworks such as PyTorch or TensorFlow).\n\nQuickstart examples:\n\n* [Quickstart (TensorFlow)](https://github.com/adap/flower/tree/main/examples/quickstart_tensorflow)\n* [Quickstart (PyTorch)](https://github.com/adap/flower/tree/main/examples/quickstart_pytorch)\n* [Quickstart (Hugging Face)](https://github.com/adap/flower/tree/main/examples/quickstart_huggingface)\n* [Quickstart (PyTorch Lightning)](https://github.com/adap/flower/tree/main/examples/quickstart_pytorch_lightning)\n* [Quickstart (fastai)](https://github.com/adap/flower/tree/main/examples/quickstart_fastai)\n* [Quickstart (Pandas)](https://github.com/adap/flower/tree/main/examples/quickstart_pandas)\n* [Quickstart (MXNet)](https://github.com/adap/flower/tree/main/examples/quickstart_mxnet)\n* [Quickstart (JAX)](https://github.com/adap/flower/tree/main/examples/quickstart_jax)\n* [Quickstart (scikit-learn)](https://github.com/adap/flower/tree/main/examples/sklearn-logreg-mnist)\n* [Quickstart (TFLite on Android)](https://github.com/adap/flower/tree/main/examples/android)\n\nOther [examples](https://github.com/adap/flower/tree/main/examples):\n\n* [Raspberry Pi & Nvidia Jetson Tutorial](https://github.com/adap/flower/tree/main/examples/embedded_devices)\n* [Android & TFLite](https://github.com/adap/flower/tree/main/examples/android)\n* [PyTorch: From Centralized to Federated](https://github.com/adap/flower/tree/main/examples/pytorch_from_centralized_to_federated)\n* [MXNet: From Centralized to Federated](https://github.com/adap/flower/tree/main/examples/mxnet_from_centralized_to_federated)\n* [Advanced Flower with TensorFlow/Keras](https://github.com/adap/flower/tree/main/examples/advanced_tensorflow)\n* [Advanced Flower with PyTorch](https://github.com/adap/flower/tree/main/examples/advanced_pytorch)\n* Single-Machine Simulation of Federated Learning Systems ([PyTorch](https://github.com/adap/flower/tree/main/examples/simulation_pytorch)) ([Tensorflow](https://github.com/adap/flower/tree/main/examples/simulation_tensorflow))\n\n## Community\n\nFlower is built by a wonderful community of researchers and engineers. [Join Slack](https://flower.dev/join-slack) to meet them, [contributions](#contributing-to-flower) are welcome.\n\n<a href="https://github.com/adap/flower/graphs/contributors">\n <img src="https://contrib.rocks/image?repo=adap/flower" />\n</a>\n\n## Citation\n\nIf you publish work that uses Flower, please cite Flower as follows: \n\n```bibtex\n@article{beutel2020flower,\n title={Flower: A Friendly Federated Learning Research Framework},\n author={Beutel, Daniel J and Topal, Taner and Mathur, Akhil and Qiu, Xinchi and Fernandez-Marques, Javier and Gao, Yan and Sani, Lorenzo and Kwing, Hei Li and Parcollet, Titouan and Gusmão, Pedro PB de and Lane, Nicholas D}, \n journal={arXiv preprint arXiv:2007.14390},\n year={2020}\n}\n```\n\nPlease also consider adding your publication to the list of Flower-based publications in the docs, just open a Pull Request.\n\n## Contributing to Flower\n\nWe welcome contributions. Please see [CONTRIBUTING.md](CONTRIBUTING.md) to get started!\n',
58
58
  'author': 'The Flower Authors',
@@ -102,8 +102,11 @@ def grpc_connection(
102
102
 
103
103
  server_message_iterator: Iterator[ServerMessage] = stub.Join(iter(queue.get, None))
104
104
 
105
- receive: Callable[[], ServerMessage] = lambda: next(server_message_iterator)
106
- send: Callable[[ClientMessage], None] = lambda msg: queue.put(msg, block=False)
105
+ def receive() -> ServerMessage:
106
+ return next(server_message_iterator)
107
+
108
+ def send(msg: ClientMessage) -> None:
109
+ return queue.put(msg, block=False)
107
110
 
108
111
  try:
109
112
  yield (receive, send)
@@ -23,7 +23,7 @@ To use the REST API, install `flwr` with the `rest` extra:
23
23
  `pip install flwr[rest]`.
24
24
  """
25
25
 
26
- TRANSPORT_TYPE_GRPC_BIDI = "grpc-bido"
26
+ TRANSPORT_TYPE_GRPC_BIDI = "grpc-bidi"
27
27
  TRANSPORT_TYPE_GRPC_RERE = "grpc-rere"
28
28
  TRANSPORT_TYPE_REST = "rest"
29
29
  TRANSPORT_TYPES = [
@@ -628,7 +628,7 @@ def _validate_ssl_files(
628
628
  if not bool(ssl_keyfile) == bool(ssl_certfile):
629
629
  msg = (
630
630
  "When setting one of `--ssl-keyfile` and "
631
- + "`--ssl-certfile`, both have to be used."
631
+ "`--ssl-certfile`, both have to be used."
632
632
  )
633
633
  log(ERROR, msg)
634
634
  validation_exceptions.append(ValueError(msg))
@@ -226,7 +226,7 @@ class SqliteState(State):
226
226
  if node_id == 0:
227
227
  msg = (
228
228
  "`node_id` must be >= 1"
229
- + "\n\n For requesting anonymous tasks use `node_id` equal `None`"
229
+ "\n\n For requesting anonymous tasks use `node_id` equal `None`"
230
230
  )
231
231
  raise AssertionError(msg)
232
232
 
@@ -67,6 +67,7 @@ class DPFedAvgAdaptive(DPFedAvgFixed):
67
67
  ) ** (-0.5)
68
68
 
69
69
  def __repr__(self) -> str:
70
+ """Compute a string representation of the strategy."""
70
71
  rep = "Strategy with DP with Adaptive Clipping enabled."
71
72
  return rep
72
73
 
@@ -56,6 +56,7 @@ class DPFedAvgFixed(Strategy):
56
56
  self.server_side_noising = server_side_noising
57
57
 
58
58
  def __repr__(self) -> str:
59
+ """Compute a string representation of the strategy."""
59
60
  rep = "Strategy with DP with Fixed Clipping enabled."
60
61
  return rep
61
62
 
@@ -79,6 +79,7 @@ class FaultTolerantFedAvg(FedAvg):
79
79
  self.completion_rate_evaluate = min_completion_rate_evaluate
80
80
 
81
81
  def __repr__(self) -> str:
82
+ """Compute a string representation of the strategy."""
82
83
  return "FaultTolerantFedAvg()"
83
84
 
84
85
  def aggregate_fit(
@@ -12,8 +12,9 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
  # ==============================================================================
15
- """Adaptive Federated Optimization using Adagrad (FedAdagrad) [Reddi et al., 2020]
16
- strategy.
15
+ """FedAdagrad [Reddi et al., 2020] strategy.
16
+
17
+ Adaptive Federated Optimization using Adagrad.
17
18
 
18
19
  Paper: arxiv.org/abs/2003.00295
19
20
  """
@@ -37,15 +38,13 @@ from flwr.server.client_proxy import ClientProxy
37
38
  from .fedopt import FedOpt
38
39
 
39
40
 
40
- # flake8: noqa: E501
41
41
  class FedAdagrad(FedOpt):
42
- """Adaptive Federated Optimization using Adagrad (FedAdagrad) [Reddi et al., 2020]
43
- strategy.
42
+ """FedAdagrad strategy - Adaptive Federated Optimization using Adagrad.
44
43
 
45
44
  Paper: https://arxiv.org/abs/2003.00295
46
45
  """
47
46
 
48
- # pylint: disable=too-many-arguments,too-many-locals,too-many-instance-attributes,line-too-long
47
+ # pylint: disable=too-many-arguments,too-many-locals,too-many-instance-attributes, line-too-long
49
48
  def __init__(
50
49
  self,
51
50
  *,
@@ -128,6 +127,7 @@ class FedAdagrad(FedOpt):
128
127
  )
129
128
 
130
129
  def __repr__(self) -> str:
130
+ """Compute a string representation of the strategy."""
131
131
  rep = f"FedAdagrad(accept_failures={self.accept_failures})"
132
132
  return rep
133
133
 
@@ -12,7 +12,9 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
  # ==============================================================================
15
- """Adaptive Federated Optimization using Adam (FedAdam) [Reddi et al., 2020] strategy.
15
+ """Adaptive Federated Optimization using Adam (FedAdam) strategy.
16
+
17
+ [Reddi et al., 2020]
16
18
 
17
19
  Paper: arxiv.org/abs/2003.00295
18
20
  """
@@ -36,15 +38,13 @@ from flwr.server.client_proxy import ClientProxy
36
38
  from .fedopt import FedOpt
37
39
 
38
40
 
39
- # flake8: noqa: E501
40
41
  class FedAdam(FedOpt):
41
- """Adaptive Federated Optimization using Adam (FedAdam) [Reddi et al., 2020]
42
- strategy.
42
+ """FedAdam - Adaptive Federated Optimization using Adam.
43
43
 
44
44
  Paper: https://arxiv.org/abs/2003.00295
45
45
  """
46
46
 
47
- # pylint: disable=too-many-arguments,too-many-instance-attributes,too-many-locals,line-too-long
47
+ # pylint: disable=too-many-arguments,too-many-instance-attributes,too-many-locals, line-too-long
48
48
  def __init__(
49
49
  self,
50
50
  *,
@@ -133,6 +133,7 @@ class FedAdam(FedOpt):
133
133
  )
134
134
 
135
135
  def __repr__(self) -> str:
136
+ """Compute a string representation of the strategy."""
136
137
  rep = f"FedAdam(accept_failures={self.accept_failures})"
137
138
  return rep
138
139
 
@@ -48,11 +48,10 @@ than or equal to the values of `min_fit_clients` and `min_evaluate_clients`.
48
48
  """
49
49
 
50
50
 
51
- # flake8: noqa: E501
52
51
  class FedAvg(Strategy):
53
52
  """Configurable FedAvg strategy implementation."""
54
53
 
55
- # pylint: disable=too-many-arguments,too-many-instance-attributes,line-too-long
54
+ # pylint: disable=too-many-arguments,too-many-instance-attributes, line-too-long
56
55
  def __init__(
57
56
  self,
58
57
  *,
@@ -86,8 +85,8 @@ class FedAvg(Strategy):
86
85
  will still be sampled. Defaults to 1.0.
87
86
  fraction_evaluate : float, optional
88
87
  Fraction of clients used during validation. In case `min_evaluate_clients`
89
- is larger than `fraction_evaluate * available_clients`, `min_evaluate_clients`
90
- will still be sampled. Defaults to 1.0.
88
+ is larger than `fraction_evaluate * available_clients`,
89
+ `min_evaluate_clients` will still be sampled. Defaults to 1.0.
91
90
  min_fit_clients : int, optional
92
91
  Minimum number of clients used during training. Defaults to 2.
93
92
  min_evaluate_clients : int, optional
@@ -131,6 +130,7 @@ class FedAvg(Strategy):
131
130
  self.evaluate_metrics_aggregation_fn = evaluate_metrics_aggregation_fn
132
131
 
133
132
  def __repr__(self) -> str:
133
+ """Compute a string representation of the strategy."""
134
134
  rep = f"FedAvg(accept_failures={self.accept_failures})"
135
135
  return rep
136
136
 
@@ -12,8 +12,7 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
  # ==============================================================================
15
- """Federated Averaging (FedAvg) [McMahan et al., 2016] strategy with custom
16
- serialization for Android devices.
15
+ """FedAvg [McMahan et al., 2016] strategy with custom serialization for Android devices.
17
16
 
18
17
  Paper: arxiv.org/abs/1602.05629
19
18
  """
@@ -40,11 +39,10 @@ from .aggregate import aggregate, weighted_loss_avg
40
39
  from .strategy import Strategy
41
40
 
42
41
 
43
- # flake8: noqa: E501
44
42
  class FedAvgAndroid(Strategy):
45
43
  """Configurable FedAvg strategy implementation."""
46
44
 
47
- # pylint: disable=too-many-arguments,too-many-instance-attributes,line-too-long
45
+ # pylint: disable=too-many-arguments,too-many-instance-attributes, line-too-long
48
46
  def __init__(
49
47
  self,
50
48
  *,
@@ -80,7 +78,7 @@ class FedAvgAndroid(Strategy):
80
78
  Minimum number of clients used during validation. Defaults to 2.
81
79
  min_available_clients : Optional[int]
82
80
  Minimum number of total clients in the system. Defaults to 2.
83
- evaluate_fn : Optional[Callable[[int, NDArrays, Dict[str, Scalar]],Optional[Tuple[float, Dict[str, Scalar]]]]]
81
+ evaluate_fn : Optional[Callable[[int, NDArrays, Dict[str, Scalar]], Optional[Tuple[float, Dict[str, Scalar]]]]]
84
82
  Optional function used for validation. Defaults to None.
85
83
  on_fit_config_fn : Optional[Callable[[int], Dict[str, Scalar]]]
86
84
  Function used to configure training. Defaults to None.
@@ -105,6 +103,7 @@ class FedAvgAndroid(Strategy):
105
103
  self.initial_parameters = initial_parameters
106
104
 
107
105
  def __repr__(self) -> str:
106
+ """Compute a string representation of the strategy."""
108
107
  rep = f"FedAvg(accept_failures={self.accept_failures})"
109
108
  return rep
110
109
 
@@ -38,11 +38,10 @@ from .aggregate import aggregate
38
38
  from .fedavg import FedAvg
39
39
 
40
40
 
41
- # flake8: noqa: E501
42
41
  class FedAvgM(FedAvg):
43
42
  """Configurable FedAvg with Momentum strategy implementation."""
44
43
 
45
- # pylint: disable=too-many-arguments,too-many-instance-attributes,line-too-long
44
+ # pylint: disable=too-many-arguments,too-many-instance-attributes, line-too-long
46
45
  def __init__(
47
46
  self,
48
47
  *,
@@ -98,7 +97,6 @@ class FedAvgM(FedAvg):
98
97
  server_momentum: float
99
98
  Server-side momentum factor used for FedAvgM. Defaults to 0.0.
100
99
  """
101
-
102
100
  super().__init__(
103
101
  fraction_fit=fraction_fit,
104
102
  fraction_evaluate=fraction_evaluate,
@@ -121,6 +119,7 @@ class FedAvgM(FedAvg):
121
119
  self.momentum_vector: Optional[NDArrays] = None
122
120
 
123
121
  def __repr__(self) -> str:
122
+ """Compute a string representation of the strategy."""
124
123
  rep = f"FedAvgM(accept_failures={self.accept_failures})"
125
124
  return rep
126
125
 
@@ -35,11 +35,11 @@ from .aggregate import aggregate_median
35
35
  from .fedavg import FedAvg
36
36
 
37
37
 
38
- # flake8: noqa: E501
39
38
  class FedMedian(FedAvg):
40
39
  """Configurable FedAvg with Momentum strategy implementation."""
41
40
 
42
41
  def __repr__(self) -> str:
42
+ """Compute a string representation of the strategy."""
43
43
  rep = f"FedMedian(accept_failures={self.accept_failures})"
44
44
  return rep
45
45
 
@@ -31,11 +31,10 @@ from flwr.common import (
31
31
  from .fedavg import FedAvg
32
32
 
33
33
 
34
- # flake8: noqa: E501
35
34
  class FedOpt(FedAvg):
36
35
  """Configurable FedAdagrad strategy implementation."""
37
36
 
38
- # pylint: disable=too-many-arguments,too-many-instance-attributes,too-many-locals,line-too-long
37
+ # pylint: disable=too-many-arguments,too-many-instance-attributes,too-many-locals, line-too-long
39
38
  def __init__(
40
39
  self,
41
40
  *,
@@ -127,5 +126,6 @@ class FedOpt(FedAvg):
127
126
  self.v_t: Optional[NDArrays] = None
128
127
 
129
128
  def __repr__(self) -> str:
129
+ """Compute a string representation of the strategy."""
130
130
  rep = f"FedOpt(accept_failures={self.accept_failures})"
131
131
  return rep
@@ -27,11 +27,10 @@ from flwr.server.client_proxy import ClientProxy
27
27
  from .fedavg import FedAvg
28
28
 
29
29
 
30
- # flake8: noqa: E501
31
30
  class FedProx(FedAvg):
32
31
  """Configurable FedProx strategy implementation."""
33
32
 
34
- # pylint: disable=too-many-arguments,too-many-instance-attributes,line-too-long
33
+ # pylint: disable=too-many-arguments,too-many-instance-attributes, line-too-long
35
34
  def __init__(
36
35
  self,
37
36
  *,
@@ -54,18 +53,19 @@ class FedProx(FedAvg):
54
53
  evaluate_metrics_aggregation_fn: Optional[MetricsAggregationFn] = None,
55
54
  proximal_mu: float,
56
55
  ) -> None:
57
- """Federated Optimization strategy.
56
+ r"""Federated Optimization strategy.
58
57
 
59
58
  Implementation based on https://arxiv.org/abs/1812.06127
60
59
 
61
- The strategy in itself will not be different than FedAvg, the client needs to be adjusted.
60
+ The strategy in itself will not be different than FedAvg, the client needs to
61
+ be adjusted.
62
62
  A proximal term needs to be added to the loss function during the training:
63
63
 
64
64
  .. math::
65
65
  \\frac{\\mu}{2} || w - w^t ||^2
66
66
 
67
- Where $w^t$ are the global parameters and $w$ are the local weights the function will
68
- be optimized with.
67
+ Where $w^t$ are the global parameters and $w$ are the local weights the function
68
+ will be optimized with.
69
69
 
70
70
  In PyTorch, for example, the loss would go from:
71
71
 
@@ -79,9 +79,11 @@ class FedProx(FedAvg):
79
79
 
80
80
  for local_weights, global_weights in zip(net.parameters(), global_params):
81
81
  proximal_term += (local_weights - global_weights).norm(2)
82
- loss = criterion(net(inputs), labels) + (config["proximal_mu"] / 2) * proximal_term
82
+ loss = criterion(net(inputs), labels) + (config["proximal_mu"] / 2) *
83
+ proximal_term
83
84
 
84
- With `global_params` being a copy of the parameters before the training takes place.
85
+ With `global_params` being a copy of the parameters before the training takes
86
+ place.
85
87
 
86
88
  .. code:: python
87
89
 
@@ -95,8 +97,8 @@ class FedProx(FedAvg):
95
97
  will still be sampled. Defaults to 1.0.
96
98
  fraction_evaluate : float, optional
97
99
  Fraction of clients used during validation. In case `min_evaluate_clients`
98
- is larger than `fraction_evaluate * available_clients`, `min_evaluate_clients`
99
- will still be sampled. Defaults to 1.0.
100
+ is larger than `fraction_evaluate * available_clients`,
101
+ `min_evaluate_clients` will still be sampled. Defaults to 1.0.
100
102
  min_fit_clients : int, optional
101
103
  Minimum number of clients used during training. Defaults to 2.
102
104
  min_evaluate_clients : int, optional
@@ -123,7 +125,6 @@ class FedProx(FedAvg):
123
125
  regularization will be used (that is, the client parameters will need to be
124
126
  closer to the server parameters during training).
125
127
  """
126
-
127
128
  super().__init__(
128
129
  fraction_fit=fraction_fit,
129
130
  fraction_evaluate=fraction_evaluate,
@@ -141,6 +142,7 @@ class FedProx(FedAvg):
141
142
  self.proximal_mu = proximal_mu
142
143
 
143
144
  def __repr__(self) -> str:
145
+ """Compute a string representation of the strategy."""
144
146
  rep = f"FedProx(accept_failures={self.accept_failures})"
145
147
  return rep
146
148
 
@@ -12,7 +12,7 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
  # ==============================================================================
15
- """Federated Averaging with Trimmed Mean [Dong Yin, et al., 2021]
15
+ """Federated Averaging with Trimmed Mean [Dong Yin, et al., 2021].
16
16
 
17
17
  Paper: arxiv.org/abs/1803.01498
18
18
  """
@@ -35,14 +35,13 @@ from .aggregate import aggregate_trimmed_avg
35
35
  from .fedavg import FedAvg
36
36
 
37
37
 
38
- # flake8: noqa: E501
39
38
  class FedTrimmedAvg(FedAvg):
40
- """Federated Averaging with Trimmed Mean [Dong Yin, et al., 2021]
39
+ """Federated Averaging with Trimmed Mean [Dong Yin, et al., 2021].
41
40
 
42
41
  Paper: https://arxiv.org/abs/1803.01498
43
42
  """
44
43
 
45
- # pylint: disable=too-many-arguments,too-many-instance-attributes
44
+ # pylint: disable=too-many-arguments,too-many-instance-attributes, line-too-long
46
45
  def __init__(
47
46
  self,
48
47
  *,
@@ -65,7 +64,8 @@ class FedTrimmedAvg(FedAvg):
65
64
  evaluate_metrics_aggregation_fn: Optional[MetricsAggregationFn] = None,
66
65
  beta: float = 0.2,
67
66
  ) -> None:
68
- """
67
+ """Federated Averaging with Trimmed Mean [Dong Yin, et al., 2021].
68
+
69
69
  Parameters
70
70
  ----------
71
71
  fraction_fit : float, optional
@@ -78,8 +78,7 @@ class FedTrimmedAvg(FedAvg):
78
78
  Minimum number of clients used during validation. Defaults to 2.
79
79
  min_available_clients : int, optional
80
80
  Minimum number of total clients in the system. Defaults to 2.
81
- evaluate_fn : Optional[Callable[[int, NDArrays, Dict[str, Scalar]],
82
- Optional[Tuple[float, Dict[str, Scalar]]]]]
81
+ evaluate_fn : Optional[Callable[[int, NDArrays, Dict[str, Scalar]], Optional[Tuple[float, Dict[str, Scalar]]]]]
83
82
  Optional function used for validation. Defaults to None.
84
83
  on_fit_config_fn : Callable[[int], Dict[str, Scalar]], optional
85
84
  Function used to configure training. Defaults to None.
@@ -92,7 +91,6 @@ class FedTrimmedAvg(FedAvg):
92
91
  beta : float, optional
93
92
  Fraction to cut off of both tails of the distribution. Defaults to 0.2.
94
93
  """
95
-
96
94
  super().__init__(
97
95
  fraction_fit=fraction_fit,
98
96
  fraction_evaluate=fraction_evaluate,
@@ -110,6 +108,7 @@ class FedTrimmedAvg(FedAvg):
110
108
  self.beta = beta
111
109
 
112
110
  def __repr__(self) -> str:
111
+ """Compute a string representation of the strategy."""
113
112
  rep = f"FedTrimmedAvg(accept_failures={self.accept_failures})"
114
113
  return rep
115
114
 
@@ -12,8 +12,10 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
  # ==============================================================================
15
- """Federated XGBoost in the horizontal setting based on building Neural Network and
16
- averaging on prediction outcomes [Ma et al., 2023].
15
+ """Federated XGBoost [Ma et al., 2023] strategy.
16
+
17
+ Strategy in the horizontal setting based on building Neural Network and averaging on
18
+ prediction outcomes.
17
19
 
18
20
  Paper: Coming
19
21
  """
@@ -30,11 +32,11 @@ from .aggregate import aggregate
30
32
  from .fedavg import FedAvg
31
33
 
32
34
 
33
- # flake8: noqa: E501
34
35
  class FedXgbNnAvg(FedAvg):
35
36
  """Configurable FedXgbNnAvg strategy implementation."""
36
37
 
37
38
  def __repr__(self) -> str:
39
+ """Compute a string representation of the strategy."""
38
40
  rep = f"FedXgbNnAvg(accept_failures={self.accept_failures})"
39
41
  return rep
40
42
 
@@ -56,7 +58,7 @@ class FedXgbNnAvg(FedAvg):
56
58
  server_round: int,
57
59
  results: List[Tuple[ClientProxy, FitRes]],
58
60
  failures: List[Union[Tuple[ClientProxy, FitRes], BaseException]],
59
- ) -> Tuple[Optional[Any], Dict[str, Scalar],]:
61
+ ) -> Tuple[Optional[Any], Dict[str, Scalar]]:
60
62
  """Aggregate fit results using weighted average."""
61
63
  if not results:
62
64
  return None, {}
@@ -67,7 +69,7 @@ class FedXgbNnAvg(FedAvg):
67
69
  # Convert results
68
70
  weights_results = [
69
71
  (
70
- parameters_to_ndarrays(fit_res.parameters[0].parameters), # type: ignore
72
+ parameters_to_ndarrays(fit_res.parameters[0].parameters), # type: ignore # noqa: E501 # pylint: disable=line-too-long
71
73
  fit_res.num_examples,
72
74
  )
73
75
  for _, fit_res in results
@@ -75,7 +77,7 @@ class FedXgbNnAvg(FedAvg):
75
77
  parameters_aggregated = ndarrays_to_parameters(aggregate(weights_results))
76
78
 
77
79
  # Aggregate XGBoost trees from all clients
78
- trees_aggregated = [fit_res.parameters[1] for _, fit_res in results] # type: ignore
80
+ trees_aggregated = [fit_res.parameters[1] for _, fit_res in results] # type: ignore # noqa: E501 # pylint: disable=line-too-long
79
81
 
80
82
  # Aggregate custom metrics if aggregation fn was provided
81
83
  metrics_aggregated = {}
@@ -36,15 +36,15 @@ from flwr.server.client_proxy import ClientProxy
36
36
  from .fedopt import FedOpt
37
37
 
38
38
 
39
- # flake8: noqa: E501
40
39
  class FedYogi(FedOpt):
41
- """Adaptive Federated Optimization using Yogi (FedYogi) [Reddi et al., 2020]
42
- strategy.
40
+ """FedYogi [Reddi et al., 2020] strategy.
41
+
42
+ Adaptive Federated Optimization using Yogi.
43
43
 
44
44
  Paper: https://arxiv.org/abs/2003.00295
45
45
  """
46
46
 
47
- # pylint: disable=too-many-arguments,too-many-instance-attributes,too-many-locals,line-too-long
47
+ # pylint: disable=too-many-arguments,too-many-instance-attributes,too-many-locals, line-too-long
48
48
  def __init__(
49
49
  self,
50
50
  *,
@@ -134,6 +134,7 @@ class FedYogi(FedOpt):
134
134
  )
135
135
 
136
136
  def __repr__(self) -> str:
137
+ """Compute a string representation of the strategy."""
137
138
  rep = f"FedYogi(accept_failures={self.accept_failures})"
138
139
  return rep
139
140
 
@@ -39,11 +39,10 @@ from .aggregate import aggregate_krum
39
39
  from .fedavg import FedAvg
40
40
 
41
41
 
42
- # flake8: noqa: E501
43
42
  class Krum(FedAvg):
44
43
  """Configurable Krum strategy implementation."""
45
44
 
46
- # pylint: disable=too-many-arguments,too-many-instance-attributes,line-too-long
45
+ # pylint: disable=too-many-arguments,too-many-instance-attributes, line-too-long
47
46
  def __init__(
48
47
  self,
49
48
  *,
@@ -67,7 +66,7 @@ class Krum(FedAvg):
67
66
  fit_metrics_aggregation_fn: Optional[MetricsAggregationFn] = None,
68
67
  evaluate_metrics_aggregation_fn: Optional[MetricsAggregationFn] = None,
69
68
  ) -> None:
70
- """Configurable Krum strategy.
69
+ """Krum strategy.
71
70
 
72
71
  Parameters
73
72
  ----------
@@ -84,7 +83,8 @@ class Krum(FedAvg):
84
83
  num_malicious_clients : int, optional
85
84
  Number of malicious clients in the system. Defaults to 0.
86
85
  num_clients_to_keep : int, optional
87
- Number of clients to keep before averaging (MultiKrum). Defaults to 0, in that case classical Krum is applied.
86
+ Number of clients to keep before averaging (MultiKrum). Defaults to 0, in
87
+ that case classical Krum is applied.
88
88
  evaluate_fn : Optional[Callable[[int, NDArrays, Dict[str, Scalar]], Optional[Tuple[float, Dict[str, Scalar]]]]]
89
89
  Optional function used for validation. Defaults to None.
90
90
  on_fit_config_fn : Callable[[int], Dict[str, Scalar]], optional
@@ -96,7 +96,6 @@ class Krum(FedAvg):
96
96
  initial_parameters : Parameters, optional
97
97
  Initial global model parameters.
98
98
  """
99
-
100
99
  super().__init__(
101
100
  fraction_fit=fraction_fit,
102
101
  fraction_evaluate=fraction_evaluate,
@@ -115,6 +114,7 @@ class Krum(FedAvg):
115
114
  self.num_clients_to_keep = num_clients_to_keep
116
115
 
117
116
  def __repr__(self) -> str:
117
+ """Compute a string representation of the strategy."""
118
118
  rep = f"Krum(accept_failures={self.accept_failures})"
119
119
  return rep
120
120
 
@@ -90,7 +90,7 @@ class QFedAvg(FedAvg):
90
90
  self.pre_weights: Optional[NDArrays] = None
91
91
 
92
92
  def __repr__(self) -> str:
93
- # pylint: disable=line-too-long
93
+ """Compute a string representation of the strategy."""
94
94
  rep = f"QffedAvg(learning_rate={self.learning_rate}, "
95
95
  rep += f"q_param={self.q_param}, pre_weights={self.pre_weights})"
96
96
  return rep
@@ -50,7 +50,7 @@ def tensorboard(logdir: str) -> Callable[[Strategy], Strategy]:
50
50
  """
51
51
  print(
52
52
  "\n\t\033[32mStart TensorBoard with the following parameters"
53
- + f"\n\t$ tensorboard --logdir {logdir}\033[39m\n"
53
+ f"\n\t$ tensorboard --logdir {logdir}\033[39m\n"
54
54
  )
55
55
  # Create logdir if it does not yet exist
56
56
  os.makedirs(logdir, exist_ok=True)