Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This change adds hierarchical federated statistics support. The existing `StatisticsController` outputs global statistics in a flat hierarchy. There are usecases where global statistics are required to be generated as per the given hierarchy configuration where NVFlare clients can be specified to belong to a particular hierarchy. The new class `HierarchicalStatisticsController` is added to support hierarchical statistics. It is derived from `StatisticsController` and takes additional argument `hierarchy_config` for hierarchy specification file providing details about all the clients and their hierarchy. Example hierarchy config file contents: { "Manufacturers": [ { "Name": "Manufacturer-1", "Orgs": [ { "Name": "Org-1", "Sites": ["Site-1"] }, { "Name": "Org-2", "Sites": ["Site-2"] } ], }, { "Name": "Manufacturer-2", "Orgs": [ { "Name": "Org-3", "Sites": ["Site-3", "Site-4"] } ] }, ] } The above hierarchy config specifies three level hierarchy for four NVFlare clients named 'Site-1', 'Site-2', 'Site-3' and 'Site-4'. And the generate global statistics output will in hierarchical format like below. At each hierarchical level, global statistics are caulculated whereas local statistics are reported at the last hierarchical level. { "Global": { <Global stats> }, "Manufacturers": [ { "Name": "Manufacturer-1", "Global": { <Manufacturer level stats> }, "Orgs": [ { "Name": "Org-1", "Global": { <Org level stats> }, "Sites": [ { "Name": "Site-1", "Local": { <Local stats> }, }, { "Name": "Site-2", "Local": { <Local stats> }, } ], }, ] }, ], } The number of hierarchical levels and the hierarchical level names are automatically calculated from the given hierarchy config. Any number of hierarchical levels are supported. This change also adds unit test to test hierarchical global statistics upto four hierarchical levels.
- Loading branch information