Skip to content

Commit cb41e69

Browse files
authored
update fl docs (Project-MONAI#5364)
Signed-off-by: Holger Roth <hroth@nvidia.com> Fixes Project-MONAI#5363. ### Description Update what's new and module description with new Monai FL features. ### Types of changes <!--- Put an `x` in all the boxes that apply, and remove the not applicable items --> - [x] Non-breaking change (fix or new feature that would not break existing functionality). - [ ] Breaking change (fix or new feature that would cause existing functionality to change). - [ ] New tests added to cover the changes. - [ ] Integration tests passed locally by running `./runtests.sh -f -u --net --coverage`. - [ ] Quick tests passed locally by running `./runtests.sh --quick --unittests --disttests`. - [ ] In-line docstrings updated. - [x] Documentation updated, tested `make html` command in the `docs/` folder. Signed-off-by: Holger Roth <hroth@nvidia.com>
1 parent c17c825 commit cb41e69

File tree

4 files changed

+40
-14
lines changed

4 files changed

+40
-14
lines changed

docs/source/fl.rst

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,23 @@ Federated Learning
66
==================
77
.. currentmodule:: monai.fl.client
88

9-
`ClientAlgo`
10-
------------
9+
`Client Base Classes`
10+
---------------------
11+
12+
.. autoclass:: BaseClient
13+
:members:
1114

1215
.. autoclass:: ClientAlgo
1316
:members:
1417

18+
.. autoclass:: ClientAlgoStats
19+
:members:
20+
21+
`MONAI Bundle Reference Implementations`
22+
----------------------------------------
23+
1524
.. autoclass:: MonaiAlgo
1625
:members:
26+
27+
.. autoclass:: MonaiAlgoStats
28+
:members:

docs/source/modules.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -270,15 +270,21 @@ A step-by-step [get started](https://github.com/Project-MONAI/tutorials/blob/mas
270270

271271
![federated-learning](../images/federated.svg)
272272

273-
Using the MONAI bundle configurations, we can use MONAI's [`MonaiAlgo`](https://docs.monai.io/en/latest/fl.html#monai.fl.client.MonaiAlgo) class (an implementation of the abstract [`ClientAlgo`](https://docs.monai.io/en/latest/fl.html#clientalgo) class for federated learning)
273+
Using the MONAI bundle configurations, we can use MONAI's [`MonaiAlgo`](https://docs.monai.io/en/latest/fl.html#monai.fl.client.MonaiAlgo)
274+
class, an implementation of the abstract [`ClientAlgo`](https://docs.monai.io/en/latest/fl.html#clientalgo) class for federated learning (FL),
274275
to execute bundles from the [MONAI model zoo](https://github.com/Project-MONAI/model-zoo).
275-
Note that [`ClientAlgo`](https://docs.monai.io/en/latest/fl.html#clientalgo) is provided as an abstract base class for defining an algorithm to be run on any federated learning platform.
276-
[`MonaiAlgo`](https://docs.monai.io/en/latest/fl.html#monai.fl.client.MonaiAlgo) implements the main functionalities needed to run federated learning experiments, namely `train()`, `get_weights()`, and `evaluate()`.
276+
Note that [`ClientAlgo`](https://docs.monai.io/en/latest/fl.html#clientalgo) is provided as an abstract base class for
277+
defining an algorithm to be run on any federated learning platform.
278+
[`MonaiAlgo`](https://docs.monai.io/en/latest/fl.html#monai.fl.client.MonaiAlgo) implements the main functionalities needed
279+
to run federated learning experiments, namely `train()`, `get_weights()`, and `evaluate()`, that can be run using single- or multi-GPU training.
277280
On top, it provides implementations for life-cycle management of the component such as `initialize()`, `abort()`, and `finalize()`.
278-
281+
The MONAI FL client also allows computing summary data statistics (e.g., intensity histograms) on the datasets defined in the bundle configs
282+
using the [`MonaiAlgoStats`](https://docs.monai.io/en/latest/fl.html#monai.fl.client.MonaiAlgoStats) class.
283+
These statistics can be shared and visualized on the FL server.
279284
[NVIDIA FLARE](https://github.com/NVIDIA/NVFlare), the federated learning platform developed by NVIDIA, has already built [the integration piece](https://github.com/NVIDIA/NVFlare/tree/2.2/integration/monai)
280285
with [`ClientAlgo`](https://docs.monai.io/en/latest/fl.html#clientalgo) to allow easy experimentation with MONAI bundles within their federated environment.
281-
[[Federated learning tutorial]](https://github.com/Project-MONAI/tutorials/tree/main/federated_learning/nvflare)
286+
Our [[federated learning tutorials]](https://github.com/Project-MONAI/tutorials/tree/main/federated_learning/nvflare) shows
287+
examples of single- & multi-GPU training and federated statistics workflows.
282288

283289
## Auto3dseg
284290

docs/source/whatsnew_1_0.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,16 @@ It has been tested on large-scale 3D medical imaging datasets in different modal
3131
## Federated Learning Client
3232
![federated-learning](../images/federated.svg)
3333

34-
MONAI now includes the federated learning client algorithm APIs that are exposed as an abstract base class
34+
MONAI now includes the federated learning (FL) client algorithm APIs that are exposed as an abstract base class
3535
for defining an algorithm to be run on any federated learning platform.
3636
[NVIDIA FLARE](https://github.com/NVIDIA/NVFlare), the federated learning platform developed by [NVIDIA](https://www.nvidia.com/en-us/),
37-
has already built [the integration piece](https://github.com/NVIDIA/NVFlare/tree/2.2/integration/monai) with these new APIs.
38-
With [the new federated learning APIs](https://docs.monai.io/en/latest/fl.html), MONAI bundles can seamlessly be extended to a federated paradigm.
37+
has already built [the integration piece](https://github.com/NVIDIA/NVFlare/tree/dev/integration/monai) with these new APIs.
38+
With [the new federated learning APIs](https://docs.monai.io/en/latest/fl.html), MONAI bundles can seamlessly be extended to a federated paradigm
39+
and executed using single- or multi-GPU training.
40+
The MONAI FL client also allows computing summary data statistics (e.g., intensity histograms) on the datasets defined in the bundle configs.
41+
These can be shared and visualized on the FL server, for example, using NVIDIA FLARE's federated statistics operators,
42+
see [here](https://github.com/NVIDIA/NVFlare/tree/dev/integration/monai/examples/spleen_ct_segmentation) for an example.
43+
3944
We welcome other federated learning toolkits to integrate with MONAI FL APIs, building a common foundation for
4045
collaborative learning in medical imaging.
4146

monai/fl/client/client_algo.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ class BaseClient:
1919
Provide an abstract base class to allow the client to return summary statistics of the data.
2020
2121
To define a new stats script, subclass this class and implement the
22-
following abstract methods:
22+
following abstract methods::
2323
2424
- self.get_data_stats()
2525
26-
initialize(), abort(), and finalize() - inherited from `ClientAlgoStats` - can be optionally be implemented
26+
initialize(), abort(), and finalize() -- inherited from `ClientAlgoStats`; can be optionally be implemented
2727
to help with lifecycle management of the class object.
2828
"""
2929

@@ -66,20 +66,23 @@ def get_data_stats(self, extra: Optional[dict] = None) -> ExchangeObject:
6666
For example, requested statistics.
6767
6868
Returns:
69+
6970
ExchangeObject: summary statistics.
7071
71-
Extra dict example:
72+
Extra dict example::
73+
7274
requested_stats = {
7375
FlStatistics.STATISTICS: metrics,
7476
FlStatistics.NUM_OF_BINS: num_of_bins,
7577
FlStatistics.BIN_RANGES: bin_ranges
7678
}
7779
78-
Returned ExchangeObject example:
80+
Returned ExchangeObject example::
7981
8082
ExchangeObject(
8183
statistics = {...}
8284
)
85+
8386
"""
8487
raise NotImplementedError(f"Subclass {self.__class__.__name__} must implement this method.")
8588

0 commit comments

Comments
 (0)