-
Notifications
You must be signed in to change notification settings - Fork 175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add hierarchical statistics support #2608
Conversation
589591e
to
bcf4049
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! I added some comments and requested changes to be more consistent with FLARE code style.
nvflare/app_common/workflows/hierarchical_statistics_controller.py
Outdated
Show resolved
Hide resolved
nvflare/app_common/workflows/hierarchical_statistics_controller.py
Outdated
Show resolved
Hide resolved
nvflare/app_common/workflows/hierarchical_statistics_controller.py
Outdated
Show resolved
Hide resolved
0be8b16
to
a5aabae
Compare
Thanks @chesterxgchen and @yanchengnv for the review, I have incorporated all the review comments. Also removed few redundant source lines in the latest change, thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks better. There seems to be a logical gap about hierarchy_config_json handling (see my comments). Also added some minor style suggestions.
nvflare/app_common/workflows/hierarchical_statistics_controller.py
Outdated
Show resolved
Hide resolved
nvflare/app_common/workflows/hierarchical_statistics_controller.py
Outdated
Show resolved
Hide resolved
a5aabae
to
d105fb7
Compare
Thanks @yanchengnv again for the review. I have incorporated review comments, hoping I addressed comments properly, let me know otherwise, thanks. |
d105fb7
to
410aab3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Hi @yanchengnv @chesterxgchen, Looks like someone needs to also approve workflow runs to be able to pass workflow checks and merge PR once all checks passed. |
I am at conference, will take another look after that, |
I already did it. There are some format issues. |
410aab3
to
bd575cd
Compare
@yanchengnv no worries, thanks. Fixed one typo in copyright section in latest patch, it was introduced in earlier patch, thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Looks like |
bd575cd
to
fd74021
Compare
Hi @yanchengnv, please help getting the workflows triggered once and in merging the PR. Had to rebase the PR and it seems |
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.
fd74021
to
c022a6b
Compare
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.
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 fromStatisticsController
and takes additional argumenthierarchy_config
for hierarchy specification file providing details about all the clients and their hierarchy.Example hierarchy config file contents:
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.
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 up to four hierarchical levels.
Types of changes
./runtest.sh
.